From 8888c9e15c6fe3670c03b8c8851efbf039d81636 Mon Sep 17 00:00:00 2001 From: cyteen Date: Mon, 6 Oct 2025 12:11:54 +0100 Subject: [PATCH] Initial commit. --- .gitignore | 7 ++++ README.concatenateable_images | 26 ++++++++++++ README.md | 76 +++++++++++++++++++++++++++++++++++ debian-image-builder.sh | 26 ++++++++++++ 4 files changed, 135 insertions(+) create mode 100644 .gitignore create mode 100644 README.concatenateable_images create mode 100644 README.md create mode 100644 debian-image-builder.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2f5186f --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +# Previous component images +partition.img.gz +firmware.*.img.gz +*_combined-image.img + +# Previous combined images +old_images/ diff --git a/README.concatenateable_images b/README.concatenateable_images new file mode 100644 index 0000000..96533f7 --- /dev/null +++ b/README.concatenateable_images @@ -0,0 +1,26 @@ +This directory provides installer images in the form of a device-specific +part (containing the partition table and the system firmware) and a +device-independent part (containing the actual installer), which can be +unpacked and concatenated together to build a complete installer image. + +The device-specific part is named firmware..img.gz +and the device-independent part is named partition.img.gz. + +In addition to providing several firmware..img.gz files for +a number of devices with device-specific system firmware, we also +provide a firmware.none.img.gz file (containing the partition table but +without any system firmware) to provide generic installer images for +devices for which no firmware..img.gz file is provided. + +To create a complete image from the two parts on Linux systems, you can +use zcat as follows: + + zcat firmware..img.gz partition.img.gz > complete_image.img + +On Windows systems, you have to first decompress the two parts separately, +which can be done e.g. by using 7-Zip, and then concatenate the decompressed +parts together by running the command + + copy /b firmware..img + partition.img complete_image.img + +in a Windows CMD.exe window. diff --git a/README.md b/README.md new file mode 100644 index 0000000..cea6176 --- /dev/null +++ b/README.md @@ -0,0 +1,76 @@ +# Debian Installer Image Builder for RockPro64 RK3399 + +A shell script that automates downloading and combining Debian installer images for arm64 boards, supporting both release and daily builds. + +## Table of Contents + +- [Features](#features) +- [Requirements](#requirements) +- [Usage](#usage) +- [Configuration](#configuration) +- [Output Files](#output-files) +- [License](#license) + +## Features + +- Downloads firmware and partition images from official Debian repositories +- Supports both release and daily build versions +- Automatically combines downloaded images +- Timestamp-based naming for daily builds +- Cleans up old image files + +## Requirements + +- Bash shell +- wget utility +- zcat utility (part of gzip package) + +## Usage + +Save the script as `debian-image-builder.sh`, make it executable, and run: + +```bash +chmod +x debian-image-builder.sh +./debian-image-builder.sh +``` + +## Configuration + +The script uses the following variables: + +```bash +BOARD=rockpro64-rk3399 # Hardware board identifier +RELEASE=forky # Debian release (bookworm/trixie/forky) +IMAGE_TYPE=daily # Type of image (daily/release) +TIMESTAMP=$(date "+%Y%m%d%H%M%S") +``` + +``` +Where BOARD can be: +* a64-olinuxino +* firefly-rk3399 +* nanopi_neo2 +* none +* orangepi_one_plus +* orangepi_zero_plus2 +* pine64_plus +* pinebook-pro-rk3399 +* pinebook +* puma-rk3399 +* rock-pi-4-rk3399 +* rock64-rk3328 +* rockpro64-rk3399 +* teres_i + +## Output Files +Based on the +: +- Release builds: `${BOARD}-${RELEASE}_combined-image.img` +- Daily builds: `${BOARD}-${TIMESTAMP}-${RELEASE}_combined-image.img` + +Old combined images are moved to the + directory. + +## License +[MIT License](LICENSE) +``` diff --git a/debian-image-builder.sh b/debian-image-builder.sh new file mode 100644 index 0000000..27c5555 --- /dev/null +++ b/debian-image-builder.sh @@ -0,0 +1,26 @@ +BOARD=rockpro64-rk3399 +# RELEASE=bookworm +# RELEASE=trixie +RELEASE=forky +IMAGE_TYPE=daily # or release +TIMESTAMP=$(date "+%Y%m%d%H%M%S") + +# remove the old image +rm partition.img.gz +rm firmware."${BOARD}".img.gz +mv *_combined-image.img old_images + +# if statement to set urls based on IMAGE_TYPE +if [ "${IMAGE_TYPE}" = "release" ]; then + BOARD_URL=http://ftp.debian.org/debian/dists/"${RELEASE}"/main/installer-arm64/current/images/netboot/SD-card-images/firmware."${BOARD}".img.gz + PARTITION_URL=http://ftp.debian.org/debian/dists/"${RELEASE}"/main/installer-arm64/current/images/netboot/SD-card-images/partition.img.gz + wget "${BOARD_URL}" + wget "${PARTITION_URL}" + zcat firmware."${BOARD}".img.gz partition.img.gz >"${BOARD}-${RELEASE}"_combined-image.img +else + PARTITION_URL=https://d-i.debian.org/daily-images/arm64/daily/netboot/SD-card-images/partition.img.gz + BOARD_URL=https://d-i.debian.org/daily-images/arm64/daily/netboot/SD-card-images/firmware.${BOARD}.img.gz + wget "${PARTITION_URL}" + wget "${BOARD_URL}" + zcat firmware."${BOARD}".img.gz partition.img.gz >"${BOARD}-${TIMESTAMP}-${RELEASE}"_combined-image.img +fi