diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f8cd43b..0e57388 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,7 @@ name: build on: - push: { branches: [main] } + push: + branches: [main] release: types: [published] jobs: @@ -10,6 +11,7 @@ jobs: - uses: actions/checkout@v2 - run: sudo apt-get update - run: sudo apt-get install -y qemu-user-static + - run: sudo bin/overlay-gen - run: bin/build - run: sudo bin/img-gen - uses: actions/upload-artifact@v2 diff --git a/.gitignore b/.gitignore index 96bf745..2d69006 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ /apkovl/ /cache/ /dist/ +/overlay.img.gz /yama-armhf.tar.gz /yama-armhf.img.gz diff --git a/README.md b/README.md index c6d4467..cfee0f3 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ Raspberry Pi Zero 向け OS のビルドするためのツール群 ## ビルド ```sh +bin/overlay-gen bin/build bin/img-gen ``` @@ -20,7 +21,7 @@ bin/img-gen - Docker - Docker Compose - qemu-user-static -- awk, bash, curl, fallocate, grep, gzip, losetup, mkfs.fat, parted, python3, ssh-keygen, tar, xargs +- awk, bash, curl, fallocate, grep, gzip, losetup, mkfs.ext4, mkfs.fat, parted, python3, ssh-keygen, tar, xargs ### WiFi の設定 diff --git a/bin/overlay-gen b/bin/overlay-gen new file mode 100755 index 0000000..6ea1854 --- /dev/null +++ b/bin/overlay-gen @@ -0,0 +1,20 @@ +#!/bin/sh +# オーバーレイイメージファイルの生成 +# Usage: bin/overlay-gen +# Required: fallocate losetup mkfs.ext4 gzip +cd -- "$(dirname -- "$0")/.." +set -eux +size=512m +fallocate -l "${size}" overlay.img +mkfs.ext4 overlay.img +dev="$(losetup -f)" +finally="losetup -d '${dev}'" +trap 'sh -c "${finally}"' EXIT +losetup "${dev}" overlay.img +tmp="$(mktemp -d)" +finally="rmdir '${tmp}'; ${finally}" +mount "${dev}" "${tmp}" +finally="umount '${tmp}'; ${finally}" +mkdir -p "${tmp}/work/usr" +mkdir -p "${tmp}/upper/usr" +finally="${finally}; gzip -f overlay.img" diff --git a/overlay.img.gz b/overlay.img.gz deleted file mode 100644 index 84846ef..0000000 Binary files a/overlay.img.gz and /dev/null differ