Last active
April 12, 2023 12:15
-
-
Save lupyuen/a08d3d478beefc5a492ed2dae39438f3 to your computer and use it in GitHub Desktop.
Validate NuttX Release for PinePhone
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
## Validate NuttX Release for PinePhone | |
## Based on https://cwiki.apache.org/confluence/display/NUTTX/Validating+a+staged+Release | |
## Sample Output: https://gist.github.com/lupyuen/5760e0375d44a06b3c730a10614e4d24 | |
## clear && cd /tmp && script release.log ~/PinePhone/wip-nuttx/release.sh | |
echo ----- Validate NuttX Release for PinePhone | |
## TODO: Update PATH | |
export PATH="$PATH:/Applications/ArmGNUToolchain/11.3.rel1/aarch64-none-elf/bin" | |
echo ----- Remove checkrelease folder | |
rm -r checkrelease | |
set -e ## Exit when any command fails | |
set -x ## Echo commands | |
## TODO: Update release and candidate | |
release=12.1.0 | |
candidate=RC0 | |
## Build NuttX | |
function build_nuttx { | |
## Go to NuttX Folder | |
pushd ../nuttx | |
## Build NuttX | |
make -j | |
## Return to previous folder | |
popd | |
} | |
echo ----- download staged artifacts. Check their signature and hashes. | |
mkdir checkrelease | |
cd checkrelease | |
wget -r -nH --cut-dirs=100 --no-parent https://dist.apache.org/repos/dist/dev/nuttx/$release-$candidate/ | |
## To import the keys: wget https://dist.apache.org/repos/dist/dev/nuttx/KEYS && gpg --import KEYS | |
## To trust the keys: gpg --edit-key 9208D2E4B800D66F749AD4E94137A71698C5E4DB | |
## Then enter "trust" and "5" | |
echo '----- [RM] verify the reported signature ("gpg: Good signature from ...")' | |
gpg --verify apache-nuttx-$release.tar.gz.asc apache-nuttx-$release.tar.gz | |
gpg --verify apache-nuttx-apps-$release.tar.gz.asc apache-nuttx-apps-$release.tar.gz | |
## For Linux: Use "sha512sum" instead of "shasum -a 512" | |
echo '----- [RM] verify the reported hashes:' | |
shasum -a 512 -c apache-nuttx-$release.tar.gz.sha512 | |
shasum -a 512 -c apache-nuttx-apps-$release.tar.gz.sha512 | |
echo ----- extract src bundle | |
tar -xf apache-nuttx-$release.tar.gz | |
tar -xf apache-nuttx-apps-$release.tar.gz | |
echo ----- verify the existence of LICENSE, NOTICE, README.md files in the extracted source bundle in BOTH apps and nuttx | |
ls -l nuttx/LICENSE | |
ls -l nuttx/NOTICE | |
ls -l nuttx/README.md | |
ls -l apps/LICENSE | |
ls -l apps/NOTICE | |
ls -l apps/README.md | |
echo ----- Build Targets | |
cd nuttx | |
echo '===== Compiler' | |
aarch64-none-elf-gcc -v | |
echo '===== Configuration' | |
./tools/configure.sh pinephone:nsh | |
echo ----- Build NuttX | |
build_nuttx | |
echo '===== Size' | |
aarch64-none-elf-size nuttx | |
echo ----- Dump the disassembly to nuttx.S | |
aarch64-none-elf-objdump \ | |
-t -S --demangle --line-numbers --wide \ | |
nuttx \ | |
>nuttx.S \ | |
2>&1 \ | |
& | |
## Quit if microSD card not present | |
if [ ! -d "/Volumes/NO NAME" ] | |
then | |
echo ----- microSD Card not found | |
exit | |
fi | |
echo ----- Copy the config | |
cp .config nuttx.config | |
echo ----- Compress the NuttX Image | |
cp nuttx.bin Image | |
rm -f Image.gz | |
gzip Image | |
echo ----- Copy to microSD | |
cp Image.gz "/Volumes/NO NAME" | |
ls -l "/Volumes/NO NAME/Image.gz" | |
## TODO: Verify that /dev/disk2 is microSD | |
echo ----- Unmount microSD | |
diskutil unmountDisk /dev/disk2 | |
echo ----- Run the firmware | |
echo Insert microSD into PinePhone, connect PinePhone to USB and press Enter. Power on, run "uname -a" and "free"... | |
read | |
echo '===== NSH Info and Free' | |
screen /dev/tty.usbserial-1410 115200 | |
echo ----- TODO: Verify hash from uname |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment