Skip to content

Instantly share code, notes, and snippets.

@lupyuen
Last active April 12, 2023 12:15
Show Gist options
  • Select an option

  • Save lupyuen/a08d3d478beefc5a492ed2dae39438f3 to your computer and use it in GitHub Desktop.

Select an option

Save lupyuen/a08d3d478beefc5a492ed2dae39438f3 to your computer and use it in GitHub Desktop.

Revisions

  1. lupyuen revised this gist Apr 12, 2023. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions release.sh
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,7 @@
    #!/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

  2. lupyuen revised this gist Apr 12, 2023. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions release.sh
    Original file line number Diff line number Diff line change
    @@ -36,6 +36,8 @@ 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
  3. lupyuen revised this gist Apr 12, 2023. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions release.sh
    Original file line number Diff line number Diff line change
    @@ -109,3 +109,5 @@ read

    echo '===== NSH Info and Free'
    screen /dev/tty.usbserial-1410 115200

    echo ----- TODO: Verify hash from uname
  4. lupyuen revised this gist Apr 11, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion release.sh
    Original file line number Diff line number Diff line change
    @@ -104,7 +104,7 @@ echo ----- Unmount microSD
    diskutil unmountDisk /dev/disk2

    echo ----- Run the firmware
    echo Insert microSD into PinePhone and power on. Run "uname -a" and "free". Press Enter...
    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'
  5. lupyuen revised this gist Apr 11, 2023. No changes.
  6. lupyuen revised this gist Apr 11, 2023. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion release.sh
    Original file line number Diff line number Diff line change
    @@ -35,11 +35,12 @@ 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: curl -O https://dist.apache.org/repos/dist/dev/nuttx/KEYS && gpg --import KEYS
    ## To import the keys: wget https://dist.apache.org/repos/dist/dev/nuttx/KEYS && gpg --import KEYS
    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
  7. lupyuen revised this gist Apr 11, 2023. 1 changed file with 5 additions and 112 deletions.
    117 changes: 5 additions & 112 deletions release.sh
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,6 @@
    #!/usr/bin/env bash
    ## Validate NuttX Release for PinePhone
    ## Based on https://cwiki.apache.org/confluence/display/NUTTX/Validating+a+staged+Release
    ## clear && cd /tmp && script release.log ~/PinePhone/wip-nuttx/release.sh#!/usr/bin/env bash
    ## Validate NuttX Release for PinePhone
    ## Based on https://cwiki.apache.org/confluence/display/NUTTX/Validating+a+staged+Release
    ## clear && cd /tmp && script release.log ~/PinePhone/wip-nuttx/release.sh
    echo ----- Validate NuttX Release for PinePhone

    @@ -38,118 +35,14 @@ mkdir checkrelease
    cd checkrelease
    wget -r -nH --cut-dirs=100 --no-parent https://dist.apache.org/repos/dist/dev/nuttx/$release-$candidate/

    echo '----- TODO: [RM] verify the reported signature ("gpg: Good signature from ...")'
    echo TODO: gpg --verify apache-nuttx-$release.tar.gz.asc apache-nuttx-$release.tar.gz
    echo TODO: gpg --verify apache-nuttx-apps-$release.tar.gz.asc apache-nuttx-apps-$release.tar.gz

    echo '----- TODO: [RM] verify the reported hashes:'
    echo TODO: sha512sum -c apache-nuttx-$release.tar.gz.sha512
    echo TODO: sha512sum -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 and power on. Run "uname -a" and "free". Press Enter...
    read

    echo '===== NSH Info and Free'
    screen /dev/tty.usbserial-1410 115200
    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/

    echo '----- TODO: [RM] verify the reported signature ("gpg: Good signature from ...")'
    ## To import the keys: curl -O https://dist.apache.org/repos/dist/dev/nuttx/KEYS && gpg --import KEYS
    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

    echo '----- TODO: [RM] verify the reported hashes:'
    sha512sum -c apache-nuttx-$release.tar.gz.sha512
    sha512sum -c apache-nuttx-apps-$release.tar.gz.sha512
    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
  8. lupyuen revised this gist Apr 11, 2023. 1 changed file with 108 additions and 0 deletions.
    108 changes: 108 additions & 0 deletions release.sh
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,9 @@
    #!/usr/bin/env bash
    ## Validate NuttX Release for PinePhone
    ## Based on https://cwiki.apache.org/confluence/display/NUTTX/Validating+a+staged+Release
    ## clear && cd /tmp && script release.log ~/PinePhone/wip-nuttx/release.sh#!/usr/bin/env bash
    ## Validate NuttX Release for PinePhone
    ## Based on https://cwiki.apache.org/confluence/display/NUTTX/Validating+a+staged+Release
    ## clear && cd /tmp && script release.log ~/PinePhone/wip-nuttx/release.sh
    echo ----- Validate NuttX Release for PinePhone

    @@ -35,6 +38,111 @@ mkdir checkrelease
    cd checkrelease
    wget -r -nH --cut-dirs=100 --no-parent https://dist.apache.org/repos/dist/dev/nuttx/$release-$candidate/

    echo '----- TODO: [RM] verify the reported signature ("gpg: Good signature from ...")'
    echo TODO: gpg --verify apache-nuttx-$release.tar.gz.asc apache-nuttx-$release.tar.gz
    echo TODO: gpg --verify apache-nuttx-apps-$release.tar.gz.asc apache-nuttx-apps-$release.tar.gz

    echo '----- TODO: [RM] verify the reported hashes:'
    echo TODO: sha512sum -c apache-nuttx-$release.tar.gz.sha512
    echo TODO: sha512sum -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 and power on. Run "uname -a" and "free". Press Enter...
    read

    echo '===== NSH Info and Free'
    screen /dev/tty.usbserial-1410 115200
    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/

    echo '----- TODO: [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
  9. lupyuen revised this gist Apr 11, 2023. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions release.sh
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    #!/usr/bin/env bash
    ## Validate NuttX Release for PinePhone
    ## Based on https://cwiki.apache.org/confluence/display/NUTTX/Validating+a+staged+Release
    ## clear && script release.log ~/PinePhone/wip-nuttx/release.sh
    ## clear && cd /tmp && script release.log ~/PinePhone/wip-nuttx/release.sh
    echo ----- Validate NuttX Release for PinePhone

    ## TODO: Update PATH
    @@ -35,11 +35,11 @@ mkdir checkrelease
    cd checkrelease
    wget -r -nH --cut-dirs=100 --no-parent https://dist.apache.org/repos/dist/dev/nuttx/$release-$candidate/

    echo ----- TODO: [RM] verify the reported signature ("gpg: Good signature from ...")
    echo '----- TODO: [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

    echo ----- TODO: [RM] verify the reported hashes:
    echo '----- TODO: [RM] verify the reported hashes:'
    sha512sum -c apache-nuttx-$release.tar.gz.sha512
    sha512sum -c apache-nuttx-apps-$release.tar.gz.sha512

  10. lupyuen created this gist Apr 11, 2023.
    109 changes: 109 additions & 0 deletions release.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,109 @@
    #!/usr/bin/env bash
    ## Validate NuttX Release for PinePhone
    ## Based on https://cwiki.apache.org/confluence/display/NUTTX/Validating+a+staged+Release
    ## clear && 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/

    echo ----- TODO: [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

    echo ----- TODO: [RM] verify the reported hashes:
    sha512sum -c apache-nuttx-$release.tar.gz.sha512
    sha512sum -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 and power on. Run "uname -a" and "free". Press Enter...
    read

    echo '===== NSH Info and Free'
    screen /dev/tty.usbserial-1410 115200