Skip to content

Commit

Permalink
GHA: Generate burn image
Browse files Browse the repository at this point in the history
  • Loading branch information
hzyitc committed Jul 26, 2022
1 parent 04cb1b3 commit bf3e96f
Showing 1 changed file with 61 additions and 1 deletion.
62 changes: 61 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ jobs:
with:
repository: armbian/build

- name: "Apply patch #3981"
run: |
curl -L -O https://github.com/armbian/build/pull/3981.patch
git apply 3981.patch
- name: Build
run: |
sudo ./compile.sh \
Expand All @@ -60,7 +65,62 @@ jobs:
EXPERT=yes \
USE_CCACHE=no \
NO_APT_CACHER=yes \
COMPRESS_OUTPUTIMAGE=xz,sha,gpg
COMPRESS_OUTPUTIMAGE=img,xz,sha,gpg
sudo chown $(id -u):$(id -g) -R output/
- name: Download AmlImg
run: |
ver="v0.3.0"
curl -L -o ./AmlImg https://github.com/hzyitc/AmlImg/releases/download/$ver/AmlImg_${ver}_linux_amd64
chmod +x ./AmlImg
- name: Download and unpack the latest u-boot
run: |
echo "::group::Download"
tag=$(curl https://api.github.com/repos/hzyitc/u-boot-onecloud/releases/latest | jq -r .tag_name)
curl -L -o ./uboot.img https://github.com/hzyitc/u-boot-onecloud/releases/download/$tag/eMMC.burn.img
echo "::endgroup::"
echo "::group::Unpack"
./AmlImg unpack ./uboot.img burn/
echo "::endgroup::"
- name: Extract boot and rootfs partitions
run: |
diskimg=$(ls output/images/*.img)
loop=$(sudo losetup --find --show --partscan $diskimg)
sudo dd if=${loop}p1 of=burn/boot.img
sudo dd if=${loop}p2 of=burn/rootfs.img
sudo losetup -d $loop
sudo chown $(id -u):$(id -g) -R burn/
- name: Generate burn image
run: |
echo -n "sha1sum $(sha1sum burn/boot.img | awk '{print $1}')" >burn/boot.VERIFY
echo -n "sha1sum $(sha1sum burn/rootfs.img | awk '{print $1}')" >burn/rootfs.VERIFY
cat <<EOF >>burn/commands.txt
PARTITION:boot:normal:boot.img
VERIFY:boot:normal:boot.VERIFY
PARTITION:rootfs:normal:rootfs.img
VERIFY:rootfs:normal:rootfs.VERIFY
EOF
prefix=$(ls output/images/*.img | sed 's/\.img$//')
burnimg=${prefix}.burn.img
./AmlImg pack $burnimg burn/
- name: Hash and compress burn image
run: |
cd output/images/
burnimg=$(ls *.burn.img)
sha256sum $burnimg | tee ${burnimg}.sha
pixz -9 <$burnimg >${burnimg}.xz
- name: Clean original files
run: |
rm -rf output/images/*.img
- name: Upload artifacts
uses: actions/upload-artifact@v2
Expand Down

0 comments on commit bf3e96f

Please sign in to comment.