mirror of
https://github.com/kou029w/megabit-os.git
synced 2025-01-18 16:07:58 +00:00
add build job for disk image file
This commit is contained in:
parent
31a58e6f90
commit
8f4dc4b208
4 changed files with 29 additions and 19 deletions
1
.github/workflows/build.yml
vendored
1
.github/workflows/build.yml
vendored
|
@ -9,3 +9,4 @@ jobs:
|
|||
- run: sudo apt-get update
|
||||
- run: sudo apt-get install -y qemu-user-static
|
||||
- run: bin/build
|
||||
- run: sudo bin/img-gen
|
||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,3 +2,4 @@
|
|||
/cache/
|
||||
/dist/
|
||||
/megabit-armhf.tar.gz
|
||||
/megabit-armhf.img.gz
|
||||
|
|
21
README.md
21
README.md
|
@ -39,18 +39,7 @@ blink();
|
|||
|
||||
```sh
|
||||
bin/build
|
||||
```
|
||||
|
||||
### SD カードのフォーマット
|
||||
|
||||
- FAT32 (LBA)
|
||||
- boot フラグ付ける
|
||||
- ボリュームラベル付けない
|
||||
|
||||
### SD カードに書き込み
|
||||
|
||||
```sh
|
||||
tar xf megabit-armhf.tar.gz -C /path/to/sd/
|
||||
bin/img-gen
|
||||
```
|
||||
|
||||
### 前提条件
|
||||
|
@ -59,14 +48,8 @@ tar xf megabit-armhf.tar.gz -C /path/to/sd/
|
|||
- binfmt-support 2.1.7+
|
||||
- Docker
|
||||
- Docker Compose
|
||||
- curl
|
||||
- grep
|
||||
- gzip
|
||||
- jq
|
||||
- ruby
|
||||
- ssh-keygen
|
||||
- bash
|
||||
- qemu-user-static
|
||||
- awk, bash, curl, fallocate, grep, gzip, gzip, jq, losetup, mkfs.fat, parted, ruby, ssh-keygen, tar, xargs
|
||||
|
||||
### WiFi の設定
|
||||
|
||||
|
|
25
bin/img-gen
Executable file
25
bin/img-gen
Executable file
|
@ -0,0 +1,25 @@
|
|||
#!/bin/sh
|
||||
# デバイスイメージファイルの生成
|
||||
# Usage: bin/img-gen
|
||||
# Required: gzip awk fallocate parted xargs losetup mkfs.fat tar
|
||||
cd -- "$(dirname -- "$0")/.."
|
||||
set -eux
|
||||
size="$(gzip -l megabit-armhf.tar.gz | awk 'END{printf"%.f",$2*1.02}')"
|
||||
fallocate -l "${size}" megabit-armhf.img
|
||||
xargs -l parted -s megabit-armhf.img <<EOF
|
||||
mklabel msdos
|
||||
mkpart primary fat32 0 100%
|
||||
set 1 boot on
|
||||
EOF
|
||||
dev="$(losetup -f)"
|
||||
finally="losetup -d '${dev}'"
|
||||
trap 'sh -c "${finally}"' EXIT
|
||||
losetup -P "${dev}" megabit-armhf.img
|
||||
part="${dev}p1"
|
||||
mkfs.fat "${part}"
|
||||
tmp="$(mktemp -d)"
|
||||
finally="rmdir '${tmp}'; ${finally}"
|
||||
mount "${part}" "${tmp}"
|
||||
finally="umount '${tmp}'; ${finally}"
|
||||
tar xf megabit-armhf.tar.gz -C "${tmp}"
|
||||
finally="${finally}; gzip -f megabit-armhf.img"
|
Loading…
Add table
Reference in a new issue