Can dope an .img file directly

master
B.J. Dweck 2020-10-12 00:58:19 +02:00
parent 14aa70dd77
commit d615f0b0aa
3 changed files with 28 additions and 1 deletions

3
.gitignore vendored
View File

@ -1,2 +1,3 @@
/build/
parameters.env
parameters.env
*.img

View File

@ -4,6 +4,8 @@ This project aims to create an easy way to burn a RPi SD card with an [Ubuntu Se
## Quick Start
### Configure Torch and SSH Parameters
Place your settings in `parameters.env`
```bash
@ -22,6 +24,9 @@ EOF
* SSH_PUBKEY - Pubkey to copy to the ~/.ssh directory for SSH access
* TORCH_CONFIG_DIR - Directory containing Torch [configuration](/bj/torch-agent) files
### Manual Image Configuration
Run `build.sh`
```bash
@ -33,3 +38,12 @@ Find the built configuration bundle in the `build` directory and extract it to t
```bash
tar -xzvf build/rpi-cloud-init.tgz /mnt/rpi-boot/
```
### Automatic Image Configuration
Place a decompressed Ubuntu Server `*.img` file in the project directory and
use `img-config.sh` to build and dope the boot partition of `*.img` file directly
```bash
sudo ./img-config.sh ubuntu-20.04.1-preinstalled-server-arm64+raspi.img
```

12
img-config.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
SECTOR_BYTES=512
SECTOR_START=2048
OFFSET=$(($SECTOR_BYTES*$SECTOR_START))
./build.sh
mkdir -p boot-part
mount -o rw,loop,offset=$OFFSET $1 ./boot-part
tar -xzvf build/rpi-cloud-init.tgz -C boot-part
umount ./boot-part
rmdir ./boot-part