From 107e8021f888ec4c3763538707941879fdbbf47a Mon Sep 17 00:00:00 2001 From: cyteen Date: Sun, 5 May 2024 10:27:01 +0100 Subject: [PATCH] Seems to work. Separate README Separate Dockerfile Added case statement entries to allow devuan releases Using the exist Dockerfile leads to missing keys for the container and the debootstrap chroot. To use the existing image you could: * Add a devuan sources.list and pull in the keys package and the devuan debootstrap * Add gnugp2 and apt-key to the debootstrap --include and add the key via --keyring then after the debootstrap second stage use apt-key add --- Dockerfile | 110 ++++++++++++++++++++++--------------------- Dockerfile.devuan | 62 ++++++++++++++++++++++++ README.md | 67 ++++---------------------- README_devuan.md | 74 +++++++++++++++++++++++++++++ scripts/build-debian | 10 ++-- 5 files changed, 207 insertions(+), 116 deletions(-) create mode 100644 Dockerfile.devuan create mode 100644 README_devuan.md diff --git a/Dockerfile b/Dockerfile index da268cc..77b66f3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,60 +1,62 @@ -# FROM public.ecr.aws/ubuntu/ubuntu:24.04 -FROM devuan/devuan:daedalus +FROM public.ecr.aws/ubuntu/ubuntu:24.04 ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && \ - apt-get --assume-yes \ - --no-install-recommends \ - install debootstrap \ - debian-archive-keyring \ - ca-certificates \ - qemu-user \ - qemu-user-static \ - qemu-system-arm \ - qemu-system-x86 \ - device-tree-compiler \ - gcc \ - gcc-arm-none-eabi \ - make \ - git \ - bc \ - bzip2 \ - pigz \ - bison \ - flex \ - python3-dev \ - python3-pkg-resources \ - python3-pyelftools \ - python3-setuptools \ - swig \ - parted \ - e2fsprogs \ - dosfstools \ - mtools \ - pwgen \ - libssl-dev \ - libgnutls28-dev \ - uuid-dev \ - parallel \ - ssh \ - sshpass \ - unzip && \ - ([ "$(uname -m)" = "aarch64" ] && \ - apt-get --assume-yes \ - install gcc-arm-linux-gnueabihf \ - gcc-i686-linux-gnu \ - gcc-x86-64-linux-gnu || :) && \ - ([ "$(uname -m)" = "x86_64" ] && \ - apt-get --assume-yes \ - install gcc-arm-linux-gnueabihf \ - gcc-aarch64-linux-gnu \ - gcc-i686-linux-gnu || :) && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* && \ - rm -f /var/log/*.log + apt-get --assume-yes \ + --no-install-recommends \ + install debootstrap \ + debian-archive-keyring \ + gpg \ + dirmngr \ + gpg-agent \ + ca-certificates \ + qemu-user \ + qemu-user-static \ + qemu-system-arm \ + qemu-system-x86 \ + device-tree-compiler \ + gcc \ + gcc-arm-none-eabi \ + make \ + git \ + bc \ + bzip2 \ + pigz \ + bison \ + flex \ + python3-dev \ + python3-pkg-resources \ + python3-pyelftools \ + python3-setuptools \ + swig \ + parted \ + e2fsprogs \ + dosfstools \ + mtools \ + pwgen \ + libssl-dev \ + libgnutls28-dev \ + uuid-dev \ + parallel \ + ssh \ + sshpass \ + unzip && \ + ([ "$(uname -m)" = "aarch64" ] && \ + apt-get --assume-yes \ + install gcc-arm-linux-gnueabihf \ + gcc-i686-linux-gnu \ + gcc-x86-64-linux-gnu || :) && \ + ([ "$(uname -m)" = "x86_64" ] && \ + apt-get --assume-yes \ + install gcc-arm-linux-gnueabihf \ + gcc-aarch64-linux-gnu \ + gcc-i686-linux-gnu || :) && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* && \ + rm -f /var/log/*.log RUN wget -q "https://awscli.amazonaws.com/awscli-exe-linux-$(uname -m).zip" -O "awscliv2.zip" && \ - unzip -q awscliv2.zip && \ - ./aws/install && \ - rm -rf aws + unzip -q awscliv2.zip && \ + ./aws/install && \ + rm -rf aws ENV PATH="/debimg/scripts:${PATH}" COPY . /debimg WORKDIR /debimg diff --git a/Dockerfile.devuan b/Dockerfile.devuan new file mode 100644 index 0000000..749701d --- /dev/null +++ b/Dockerfile.devuan @@ -0,0 +1,62 @@ +FROM devuan/devuan:daedalus +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update && \ + apt-get --assume-yes \ + --no-install-recommends \ + install debootstrap \ + debian-archive-keyring \ + gpg \ + dirmngr \ + gpg-agent \ + ca-certificates \ + qemu-user \ + qemu-user-static \ + qemu-system-arm \ + qemu-system-x86 \ + device-tree-compiler \ + gcc \ + gcc-arm-none-eabi \ + make \ + git \ + bc \ + bzip2 \ + pigz \ + bison \ + flex \ + python3-dev \ + python3-pkg-resources \ + python3-pyelftools \ + python3-setuptools \ + swig \ + parted \ + e2fsprogs \ + dosfstools \ + mtools \ + pwgen \ + libssl-dev \ + libgnutls28-dev \ + uuid-dev \ + parallel \ + ssh \ + sshpass \ + unzip && \ + ([ "$(uname -m)" = "aarch64" ] && \ + apt-get --assume-yes \ + install gcc-arm-linux-gnueabihf \ + gcc-i686-linux-gnu \ + gcc-x86-64-linux-gnu || :) && \ + ([ "$(uname -m)" = "x86_64" ] && \ + apt-get --assume-yes \ + install gcc-arm-linux-gnueabihf \ + gcc-aarch64-linux-gnu \ + gcc-i686-linux-gnu || :) && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* && \ + rm -f /var/log/*.log +RUN wget -q "https://awscli.amazonaws.com/awscli-exe-linux-$(uname -m).zip" -O "awscliv2.zip" && \ + unzip -q awscliv2.zip && \ + ./aws/install && \ + rm -rf aws +ENV PATH="/debimg/scripts:${PATH}" +COPY . /debimg +WORKDIR /debimg diff --git a/README.md b/README.md index 0b2b97e..a91ab53 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,8 @@ Pre-built images ready for download are availble at [sd-card-images.johang.se](h The generated SD card images are made up of two separate images: -- **boot-BOARD.bin**: Boot image that contains partition table, U-Boot and chip-specific code. The boot image will only work on the board it's built for. The filename indicates which board it's built for. -- **debian-ARCH-VERSION-PASSWORD.bin**: Debian ext4 root filesystem image that contains a complete Debian installation, including kernel, initrd and device tree. This Debian image is generic and will work on all chips and boards with the CPU architecture it's built for. The filename indicates Debian version, CPU architecture and default root password. +* **boot-BOARD.bin**: Boot image that contains partition table, U-Boot and chip-specific code. The boot image will only work on the board it's built for. The filename indicates which board it's built for. +* **debian-ARCH-VERSION-PASSWORD.bin**: Debian ext4 root filesystem image that contains a complete Debian installation, including kernel, initrd and device tree. This Debian image is generic and will work on all chips and boards with the CPU architecture it's built for. The filename indicates Debian version, CPU architecture and default root password. These two images are the concatenated to a single image, which is then written to SD card, for example like this: @@ -20,67 +20,20 @@ These two images are the concatenated to a single image, which is then written t ### Build your own boot image -#### To build a boot image for Raspberry Pi 3 B: +To build a boot image for Raspberry Pi 3 B: -```bash -docker build -t sd-images https://github.com/johang/sd-card-images.git -mkdir -p /tmp/sd-images -docker run --rm -v /tmp/sd-images:/artifacts sd-images build-boot raspberrypi_3b bcm2837 rpi_3_defconfig aarch64-linux-gnu -``` - -The image will end up in /tmp/sd-images on the host. - -#### To build a boot image for Pine64 Rockpro64: - -```bash -docker build -t sd-images https://github.com/johang/sd-card-images.git -mkdir -p /tmp/sd-images -docker run --rm \ - -v /tmp/sd-images:/artifacts \ - devuan/sd-images \ - build-boot ROCKPro64 rk3399 rockpro64-rk3399_defconfig aarch64-linux-gnu -``` - -The image will end up in /tmp/sd-images on the host. - -#### To build a boot image for Sinovoip Banana Pi M2+: - -```bash -docker build -t sd-images https://github.com/johang/sd-card-images.git -mkdir -p /tmp/sd-images -docker run --rm \ - -v /tmp/sd-images:/artifacts \ - -v /usr/share/debootstrap/scripts:/usr/share/debootstrap/scripts \ - devuan/sd-images \ - build-boot banana_pi_m2_plus allwinner-h5 bananapi_m2_plus_h5_defconfig aarch64-linux-gnu -``` + docker build -t sd-images https://github.com/johang/sd-card-images.git + mkdir -p /tmp/sd-images + docker run --rm -v /tmp/sd-images:/artifacts sd-images build-boot raspberrypi_3b bcm2837 rpi_3_defconfig aarch64-linux-gnu The image will end up in /tmp/sd-images on the host. ### Build your own Debian ext4 root filesystem image -#### To build a Debian ext4 root filesystem image for arm64: +To build a Debian ext4 root filesystem image for arm64: -```bash -docker build -t sd-images https://github.com/johang/sd-card-images.git -mkdir -p /tmp/sd-images -docker run --rm -v /tmp/sd-images:/artifacts sd-images build-debian debian arm64 buster -``` - -The image will end up in /tmp/sd-images on the host. - -#### To build a Devuan ext4 root filesystem image for arm64: - -```bash -docker build -t devuan/sd-images . -mkdir -p /tmp/sd-images -docker run --rm \ - -v /tmp/sd-images:/artifacts \ - -v /usr/share/debootstrap/scripts:/usr/share/debootstrap/scripts \ - -v /etc/apt/trusted.gpg.d:/etc/apt/trusted.gpg.d \ - --privileged \ - devuan/sd-images \ - build-debian devuan arm64 daedalus -``` + docker build -t sd-images https://github.com/johang/sd-card-images.git + mkdir -p /tmp/sd-images + docker run --rm -v /tmp/sd-images:/artifacts sd-images build-debian debian arm64 buster The image will end up in /tmp/sd-images on the host. diff --git a/README_devuan.md b/README_devuan.md new file mode 100644 index 0000000..b4847d6 --- /dev/null +++ b/README_devuan.md @@ -0,0 +1,74 @@ +# Debian SD card images + +This repository is a bunch of scripts to build SD card images that various [single-board computers](https://en.wikipedia.org/wiki/Single-board_computer) (SBC) can boot. Emphasis is on pureness; pure Debian and pure mainline U-boot. + +## Pre-built images + +Pre-built images ready for download are availble at [sd-card-images.johang.se](https://sd-card-images.johang.se). + +## Usage + +The generated SD card images are made up of two separate images: + +- **boot-BOARD.bin**: Boot image that contains partition table, U-Boot and chip-specific code. The boot image will only work on the board it's built for. The filename indicates which board it's built for. +- **debian-ARCH-VERSION-PASSWORD.bin**: Debian ext4 root filesystem image that contains a complete Debian installation, including kernel, initrd and device tree. This Debian image is generic and will work on all chips and boards with the CPU architecture it's built for. The filename indicates Debian version, CPU architecture and default root password. + +These two images are the concatenated to a single image, which is then written to SD card, for example like this: + + $ zcat boot-raspberrypi_3b.bin.gz debian-buster-arm64-XXXXXX.bin.gz > sd-card.img + # dd if=sd-card.img of=/dev/sdXXX + +### Build your own boot image + +#### To build a boot image for Raspberry Pi 3 B: + +```bash +docker build -t devuan/sd-images -f .Dockerfile.devuan . +mkdir -p /tmp/sd-images +docker run --rm -v /tmp/sd-images:/artifacts sd-images build-boot raspberrypi_3b bcm2837 rpi_3_defconfig aarch64-linux-gnu +``` + +The image will end up in /tmp/sd-images on the host. + +#### To build a boot image for Pine64 Rockpro64: + +```bash +docker build -t devuan/sd-images -f ./Dockerfile.devuan . +mkdir -p /tmp/sd-images +docker run --rm \ + -v /tmp/sd-images:/artifacts \ + devuan/sd-images \ + build-boot ROCKPro64 rk3399 rockpro64-rk3399_defconfig aarch64-linux-gnu +``` + +The image will end up in /tmp/sd-images on the host. + +#### To build a boot image for Sinovoip Banana Pi M2+: + +```bash +docker build -t devuan/sd-images -f ./Dockerfile.devuan . +mkdir -p /tmp/sd-images +docker run --rm \ + -v /tmp/sd-images:/artifacts \ + devuan/sd-images \ + build-boot banana_pi_m2_plus allwinner-h5 bananapi_m2_plus_h5_defconfig aarch64-linux-gnu +``` + +The image will end up in /tmp/sd-images on the host. + +### Build your own Debian ext4 root filesystem image + +#### To build a Devuan ext4 root filesystem image for arm64: + +```bash +docker build -t devuan/sd-images -f ./Dockerfile.devuan . +mkdir -p /tmp/sd-images +docker run --rm \ + -v /tmp/sd-images:/artifacts \ + -v `pwd`:/debimg \ + --privileged \ + devuan/sd-images \ + build-debian devuan arm64 daedalus +``` + +The image will end up in /tmp/sd-images on the host. diff --git a/scripts/build-debian b/scripts/build-debian index ac024b3..9ff63a8 100755 --- a/scripts/build-debian +++ b/scripts/build-debian @@ -11,25 +11,25 @@ case "${OS}-${ARCH}" in devuan-armhf) KERNEL=linux-image-armmp URL=http://deb.devuan.org/merged - KERNEL_URL=http://packages.debian.org/"${DIST}"/"${KERNEL}" + # KERNEL_URL=http://packages.debian.org/"${DIST}"/"${KERNEL}" SCRIPT=/usr/share/debootstrap/scripts/ceres ;; devuan-arm64) KERNEL=linux-image-arm64 URL=http://deb.devuan.org/merged - KERNEL_URL=http://packages.debian.org/"${DIST}"/"${KERNEL}" + # KERNEL_URL=http://packages.debian.org/"${DIST}"/"${KERNEL}" SCRIPT=/usr/share/debootstrap/scripts/ceres ;; devuan-i386) KERNEL=linux-image-686 URL=http://deb.devuan.org/merged - KERNEL_URL=http://packages.debian.org/"${DIST}"/"${KERNEL}" + # KERNEL_URL=http://packages.debian.org/"${DIST}"/"${KERNEL}" SCRIPT=/usr/share/debootstrap/scripts/ceres ;; devuan-amd64) KERNEL=linux-image-amd64 URL=http://deb.devuan.org/merged - KERNEL_URL=http://packages.debian.org/"${DIST}"/"${KERNEL}" + # KERNEL_URL=http://packages.debian.org/"${DIST}"/"${KERNEL}" SCRIPT=/usr/share/debootstrap/scripts/ceres ;; debian-armhf) @@ -209,7 +209,7 @@ devuan) chroot debian /bin/sh -ex <<-EOF /debootstrap/debootstrap --second-stage /bin/mv /tmp/sources.list /etc/apt/sources.list - /bin/mv /tmp/priority-experimental /etc/apt/preferences.d/priority-experimental || : + # /usr/bin/apt-key add /etc/apt/trusted.gpg.d/devuan_key.gpg /usr/bin/apt-get update /usr/bin/apt-get -y upgrade /usr/bin/apt-get -y --no-install-recommends ${KERNELSUITE} install ${KERNEL}