7.0 KiB
Initial Notes & Recommendations
- Due to issues to cross-compile the image from a desktop, this guide will take you step-by-step through the process of compiling EmbassyOS directly on a Raspberry Pi 4 (4GB or 8GB)
- This process will go faster if you have an SSD/NVMe USB drive available.
- This build guide does not require a large microSD card, especially if your final build wil be used on an SSD/NVMe USB drive.
- Basic know-how of linux commands and terminal use is recommended.
- Follow the guide carefully and do not skip any steps.
🛠️ Build Guide
-
Flash Raspberry Pi OS Lite to a microSD and configure your raspi to boot from SSD/NVMe USB drive
- After flashing, create an empty text file called
sshin thebootpartition of the microSD, then proceed with booting the raspi with the flashed microSD (check your router for the IP assigned to your raspi) - Do the usual initial update/config
sudo apt update sudo raspi-config - Change
Advanced Options->Boot Order - Select
USB Boot(it will try to boot from microSD first if it's available) - Select
Finish, thenYesto reboot - After reboot,
sudo shutdown nowto power off the raspi and remove the microSD
- After flashing, create an empty text file called
-
Flash the Raspi OS Lite (from step 1) to your SSD/NVMe drive
ℹ️ Don't worry about rootfs partition size (raspi will increase it for you on initial boot)
ℹ️ Every time you re-flash your SSD/NVMe you need to first boot with a microSD and set Boot Order again
- Don't forget to create the empty
sshfile - Connect the drive (remember to remove the microSD) to the raspi and start it up
- Use
sudo raspi-configto change the default password - Optional:
sudo apt upgrade -y - Optional:
sudo nano /etc/apt/sources.list.d/vscode.listcomment the last line which containspackages.microsoft.com
- Don't forget to create the empty
-
Install GHC
sudo apt update sudo apt install -y ghc #test: ghc --version #example of output: The Glorious Glasgow Haskell Compilation System, version 8.4.4 -
Compile Stack:
-
Install Stack v2.1.3
cd ~/ wget -qO- https://raw.githubusercontent.com/commercialhaskell/stack/v2.1.3/etc/scripts/get-stack.sh | sh #test with stack --version #example output: Version 2.1.3, Git revision 636e3a759d51127df2b62f90772def126cdf6d1f (7735 commits) arm hpack-0.31.2 -
Use current Stack to compile Stack v2.5.1:
git clone --depth 1 --branch v2.5.1 https://github.com/commercialhaskell/stack.git cd stack sudo apt install -y screen screenℹ️ Build (>=3.5h total... We are using
screenin case of session timeout issues)📝 If you get disconected you can reattach last sesion again by executing
screen -rstack build --stack-yaml=stack-ghc-84.yaml --system-ghc #Install stack install --stack-yaml=stack-ghc-84.yaml --system-ghc export PATH=~/.local/bin:$PATH
-
-
Clone EmbassyOS & try to make the
agent:-
First attempt
ℹ️ The first time you run make you'll get an error
sudo apt install -y llvm-9 libgmp-dev export PATH=/usr/lib/llvm-9/bin:$PATH cd ~/ git clone https://github.com/Start9Labs/embassy-os.git cd embassy-os/ make agent📝 This will install ghc-8.10.2, then attempt to build but will give errors (in next steps we deal with errors)
-
Confirm your cpu info
cat /proc/cpuinfo | grep Hardware -
If your "Hardware" is BCM2711 then:
- Change
C compiler flagsto-marm -fno-stack-protector -mcpu=cortex-a7in the GHC settings:nano ~/.stack/programs/arm-linux/ghc-8.10.4/lib/ghc-8.10.4/settings
- Change
-
To prevent gcc errors we delete the
setup-exe-srcfolderrm -rf ~/.stack/setup-exe-src/
-
-
Install requirements for step 7
- Install NVM
cd ~/ && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion nvm --version - Install Node.js & NPM
nvm install node - Install Ionic CLI
npm install -g @ionic/cli - Install Dependencies
sudo apt-get install -y build-essential openssl libssl-dev libc6-dev clang libclang-dev libavahi-client-dev upx ca-certificates - Install Rust
cd ~/ && curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs -o- | bash #Choose option 1 source $HOME/.cargo/env #Check rust & cargo versions rustc --version cargo --version
- Install NVM
-
Finally, getting to build the .img
- At this stage you hava a working development environment to build your embassy.img.
Before you do that you can choose to enable SSH login for user
piin case something will go wrong or just skip to the next step.cd ~/embassy-os sed -e '/passwd -l pi/ s/^#*/#/' -i setup.sh⚠️ Default password for user
piisraspberry, change it the next you login. - Build the
embassy.imgcd ~/embassy-os make #Depending on your hardware this can take 1-2h+ #Wait for the "DONE!" message and take note of your product_key exit
- At this stage you hava a working development environment to build your embassy.img.
Before you do that you can choose to enable SSH login for user
-
Flash the
embassy.imgto a microSD- Copy
embassy.imgfrom the raspi to your PC with scpscp pi@raspi_IP:~/embassy-os/embassy.img . - Connect to raspi again to do
sudo shutdown now, after a complete shutdown disconnect SSD/NVMe drive - Flash
embassy.imgto a microSD (do this before flashing to the SSD/NVMe, to be sure it works)
- Copy
-
Prepare for initial setup
- Boot raspi using flashed microSD
- After a few minutes, the raspi should reboot itself and make it's first sounds.
ℹ️ If needed, you can check the
agentlog with:journalctl -u agent -ef - Proceed with the initial setup process of EmbassyOS
- If all went well you can safely flash
embassy.imgto an SSD/NVMe and repeat step 9
Embassy sounds explained
| Sound 🎶 | Indicating |
|---|---|
| Bep | Device is powering on |
| Chime | Device is ready for setup |
| Mario "Coin" | EmbassyOS has started |
| Mario "Death" | Device is about to Shutdown/Reboot |
| Mario "Power Up" | EmbassyOS update sequence |
| Beethoven | Update failed :( |