diff --git a/.gitignore b/.gitignore index a60a652..03e40ae 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /build/ -parameters.env \ No newline at end of file +parameters.env +*.img \ No newline at end of file diff --git a/README.md b/README.md index af0338c..aad335c 100644 --- a/README.md +++ b/README.md @@ -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 +``` diff --git a/img-config.sh b/img-config.sh new file mode 100755 index 0000000..8fcbfa5 --- /dev/null +++ b/img-config.sh @@ -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 \ No newline at end of file