From 8ae93f233c3080949abd629a9db0750a124c50dc Mon Sep 17 00:00:00 2001 From: Thomas Butler <58192340+trbutler4@users.noreply.github.com> Date: Wed, 31 Jul 2024 20:52:10 -0500 Subject: [PATCH] Getting started (#16) * adding docs for building and running on an emulator * updating summary * adding to docs * tweaks * getting started docs * mdl tweaks * cleared m009s * more tweaks * auto format with mdformat * disagree with rule * conforming to style guide --- docs/src/SUMMARY.md | 3 + docs/src/getting-started/README.md | 40 +++++++++++ docs/src/getting-started/building-the-os.md | 78 +++++++++++++++++++++ docs/src/resources/README.md | 10 +-- 4 files changed, 124 insertions(+), 7 deletions(-) create mode 100644 docs/src/getting-started/building-the-os.md diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md index 2bb11a07..ea752794 100644 --- a/docs/src/SUMMARY.md +++ b/docs/src/SUMMARY.md @@ -3,4 +3,7 @@ - [Introduction](./README.md) - [Overview](./overview/README.md) + - [Getting Started](./getting-started/README.md) + +- [Building the OS](./getting-started/building-the-os.md) diff --git a/docs/src/getting-started/README.md b/docs/src/getting-started/README.md index bad55622..8fb5755b 100644 --- a/docs/src/getting-started/README.md +++ b/docs/src/getting-started/README.md @@ -1 +1,41 @@ # Getting Started + +## Install Android Studio + +Most development, at least starting out, will be on the 3 +android applications that form the core of the starknet +phone: light client, wallet, and browser. + +Installing the build: + +1. Install [Android Studio](https://developer.android.com/studio/install). +1. Create a new pixel device with the latest android SDK. Follow the + +instructions [here](https://developer.android.com/studio/run/managing-avds) + +1. Create a fork of this repository, and open the application in Android Studio. +1. Refer to the [contribution guide](<>) for any contributions. + +## Installing on an emulator + +NOTE: We are still working to provide an image for download. For now, +development on any of the applications can be done on a generic android OS. + +Steps to install on an emulator: + +1. Download a zip file of the image. +1. Make sure [Android Studio](https://developer.android.com/studio/install) is installed. +1. Navigate to the Android SDK install location. On mac this default to `Library/Android/sdk` + +```bash +cd Library/Android/sdk +``` + +Create a new directory called "android-32", and inside that directory create +a new directory called "default" + +```bash +mkdir android-32/default +``` + +Extract the zip file of the OS image to the newly created "default" directory diff --git a/docs/src/getting-started/building-the-os.md b/docs/src/getting-started/building-the-os.md new file mode 100644 index 00000000..a85c1830 --- /dev/null +++ b/docs/src/getting-started/building-the-os.md @@ -0,0 +1,78 @@ +# Building the OS + +## Build Dependencies + +Baseline build dependencies: + +- x86_64 Linux build environment. +- 32GiB of memory or more. Link-Time Optimization (LTO) creates huge peaks + during linking and is mandatory for Control Flow Integrity (CFI). Linking + Vanadium (Chromium) and the Linux kernel with LTO + CFI are the most memory + demanding tasks. +- 100GiB+ of additional free storage space for a typical build of the entire + OS for a multiarch device. + +More detailed dependiencies and build guide can be found +[here](https://grapheneos.org/build) + +## Downloading the source code + +### Development Branch + +Starknet Phone forks the '14' branch of grapheneOS, which is the main +development branch of GrapheneOS. + +```bash +mkdir starknet-phone-os +cd starknet-phone-os +repo init -u \ +https://github.com/suffix-labs/snphone_platform_manifest/tree/14 -b 14 +repo sync -j8 +``` + +### Emulator builds + +NOTE: must be done from bash or zsh + +set up build environment + +```bash +source build/envsetup.sh +``` + +set the build target + +```bash +lunch sdk_phone64_x86_64-cur-eng +``` + +start the build. This can take multiple hours to run. + +```bash +m +``` + +### Adding prebuilt binaries + +#### Emulator + +sync repo + +```bash +mkdir -p android/kernel/6.1 +cd android/kernel/6.1 +repo init -u https://github.com/GrapheneOS/kernel_manifest-6.1.git -b 14 +repo sync -j8 +``` + +build the kernel image and modules for the emulator + +```bash +ARCH=x86_64 common/build_virt.sh +``` + +replace the prebuilts in the OS source tree + +```bash +ANDROID_BUILD_TOP=~/starknet-phone-os ARCH=x86_64 common/update_virt_prebuilts.sh +``` diff --git a/docs/src/resources/README.md b/docs/src/resources/README.md index fc99768c..540950fb 100644 --- a/docs/src/resources/README.md +++ b/docs/src/resources/README.md @@ -1,16 +1,12 @@ +# Resources -## Resources - -### Ethereum Phone +## Ethereum Phone [Ethereum Phone platform manifest](https://github.com/EthereumPhone/platform_manifest) - [wallet sdk](https://github.com/EthereumPhone/WalletSDK) - [light node app](https://github.com/EthereumPhone/lightnodeapp) -### GrapheneOS +## GrapheneOS [GrapheneOS Docs](https://grapheneos.org/build#build-dependencies) - [building graphene os](https://grapheneos.org/build)