Add support for building Ubuntu images
This commit is contained in:
parent
80ffdd57e0
commit
c8a7292461
|
|
@ -1 +0,0 @@
|
||||||
debian
|
|
||||||
|
|
@ -7,12 +7,16 @@ ABI="${1}"
|
||||||
# Create U-Boot ramdisk image
|
# Create U-Boot ramdisk image
|
||||||
mkimage -A arm64 -T ramdisk -C none -d "/boot/initrd.img-${ABI}" "/boot/initrd.uimg-${ABI}"
|
mkimage -A arm64 -T ramdisk -C none -d "/boot/initrd.img-${ABI}" "/boot/initrd.uimg-${ABI}"
|
||||||
|
|
||||||
|
FDT=/usr/lib/linux
|
||||||
|
[ -d "/lib/firmware/${ABI}/device-tree" ] && FDT="/lib/firmware/${ABI}/device-tree"
|
||||||
|
[ -d "/usr/lib/linux-image-${ABI}" ] && FDT="/usr/lib/linux-image-${ABI}"
|
||||||
|
|
||||||
# Create U-Boot boot script
|
# Create U-Boot boot script
|
||||||
cat << EOF > /boot/boot.cmd
|
cat << EOF > /boot/boot.cmd
|
||||||
mmc dev 0
|
mmc dev 0
|
||||||
ext4load mmc 0:2 \${kernel_addr_r} /boot/vmlinuz-${ABI}
|
ext4load mmc 0:2 \${kernel_addr_r} /boot/vmlinuz-${ABI}
|
||||||
ext4load mmc 0:2 \${ramdisk_addr_r} /boot/initrd.uimg-${ABI}
|
ext4load mmc 0:2 \${ramdisk_addr_r} /boot/initrd.uimg-${ABI}
|
||||||
ext4load mmc 0:2 \${fdt_addr_r} /usr/lib/linux-image-${ABI}/\${fdtfile}
|
ext4load mmc 0:2 \${fdt_addr_r} ${FDT}/\${fdtfile}
|
||||||
setenv bootargs "root=/dev/mmcblk0p2 rw rootwait"
|
setenv bootargs "root=/dev/mmcblk0p2 rw rootwait"
|
||||||
booti \${kernel_addr_r} \${ramdisk_addr_r} \${fdt_addr_r}
|
booti \${kernel_addr_r} \${ramdisk_addr_r} \${fdt_addr_r}
|
||||||
EOF
|
EOF
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,16 @@ ABI="${1}"
|
||||||
# Create U-Boot ramdisk image
|
# Create U-Boot ramdisk image
|
||||||
mkimage -A arm -T ramdisk -C none -d "/boot/initrd.img-${ABI}" "/boot/initrd.uimg-${ABI}"
|
mkimage -A arm -T ramdisk -C none -d "/boot/initrd.img-${ABI}" "/boot/initrd.uimg-${ABI}"
|
||||||
|
|
||||||
|
FDT=/usr/lib/linux
|
||||||
|
[ -d "/lib/firmware/${ABI}/device-tree" ] && FDT="/lib/firmware/${ABI}/device-tree"
|
||||||
|
[ -d "/usr/lib/linux-image-${ABI}" ] && FDT="/usr/lib/linux-image-${ABI}"
|
||||||
|
|
||||||
# Create U-Boot boot script
|
# Create U-Boot boot script
|
||||||
cat << EOF > /boot/boot.cmd
|
cat << EOF > /boot/boot.cmd
|
||||||
mmc dev 0
|
mmc dev 0
|
||||||
ext4load mmc 0:2 \${kernel_addr_r} /boot/vmlinuz-${ABI}
|
ext4load mmc 0:2 \${kernel_addr_r} /boot/vmlinuz-${ABI}
|
||||||
ext4load mmc 0:2 \${ramdisk_addr_r} /boot/initrd.uimg-${ABI}
|
ext4load mmc 0:2 \${ramdisk_addr_r} /boot/initrd.uimg-${ABI}
|
||||||
ext4load mmc 0:2 \${fdt_addr_r} /usr/lib/linux-image-${ABI}/\${fdtfile}
|
ext4load mmc 0:2 \${fdt_addr_r} ${FDT}/\${fdtfile}
|
||||||
setenv bootargs "root=/dev/mmcblk0p2 rw rootwait"
|
setenv bootargs "root=/dev/mmcblk0p2 rw rootwait"
|
||||||
bootz \${kernel_addr_r} \${ramdisk_addr_r} \${fdt_addr_r}
|
bootz \${kernel_addr_r} \${ramdisk_addr_r} \${fdt_addr_r}
|
||||||
EOF
|
EOF
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ RUN apt-get update && \
|
||||||
--no-install-recommends \
|
--no-install-recommends \
|
||||||
install debootstrap \
|
install debootstrap \
|
||||||
debian-archive-keyring \
|
debian-archive-keyring \
|
||||||
|
ubuntu-archive-keyring \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
qemu-user-static \
|
qemu-user-static \
|
||||||
device-tree-compiler \
|
device-tree-compiler \
|
||||||
|
|
|
||||||
26
debians.csv
26
debians.csv
|
|
@ -1,11 +1,19 @@
|
||||||
# Stable
|
# Debian Stable
|
||||||
stretch,armhf
|
debian,stretch,armhf
|
||||||
stretch,arm64
|
debian,stretch,arm64
|
||||||
|
|
||||||
# Testing
|
# Debian Testing
|
||||||
buster,armhf
|
debian,buster,armhf
|
||||||
buster,arm64
|
debian,buster,arm64
|
||||||
|
|
||||||
# Unstable
|
# Debian Unstable
|
||||||
sid,armhf
|
debian,sid,armhf
|
||||||
sid,arm64
|
debian,sid,arm64
|
||||||
|
|
||||||
|
# Ubuntu 18.04 (LTS)
|
||||||
|
ubuntu,bionic,armhf
|
||||||
|
ubuntu,bionic,arm64
|
||||||
|
|
||||||
|
# Ubuntu 19.04
|
||||||
|
ubuntu,disco,armhf
|
||||||
|
ubuntu,disco,arm64
|
||||||
|
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ RUN apt-get update && \
|
||||||
--no-install-recommends \
|
--no-install-recommends \
|
||||||
install debootstrap \
|
install debootstrap \
|
||||||
debian-archive-keyring \
|
debian-archive-keyring \
|
||||||
|
ubuntu-archive-keyring \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
device-tree-compiler \
|
device-tree-compiler \
|
||||||
gcc \
|
gcc \
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ RUN apt-get update && \
|
||||||
--no-install-recommends \
|
--no-install-recommends \
|
||||||
install debootstrap \
|
install debootstrap \
|
||||||
debian-archive-keyring \
|
debian-archive-keyring \
|
||||||
|
ubuntu-archive-keyring \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
device-tree-compiler \
|
device-tree-compiler \
|
||||||
gcc \
|
gcc \
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ RUN apt-get update && \
|
||||||
--no-install-recommends \
|
--no-install-recommends \
|
||||||
install debootstrap \
|
install debootstrap \
|
||||||
debian-archive-keyring \
|
debian-archive-keyring \
|
||||||
|
ubuntu-archive-keyring \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
device-tree-compiler \
|
device-tree-compiler \
|
||||||
gcc \
|
gcc \
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ RUN apt-get update && \
|
||||||
--no-install-recommends \
|
--no-install-recommends \
|
||||||
install debootstrap \
|
install debootstrap \
|
||||||
debian-archive-keyring \
|
debian-archive-keyring \
|
||||||
|
ubuntu-archive-keyring \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
device-tree-compiler \
|
device-tree-compiler \
|
||||||
gcc \
|
gcc \
|
||||||
|
|
|
||||||
|
|
@ -12,14 +12,14 @@ mkdir -p /tmp/debimg/log || exit
|
||||||
D=$(mktemp -d -p "${LOG_DIR}" rebuild-debians-XXXXXX)
|
D=$(mktemp -d -p "${LOG_DIR}" rebuild-debians-XXXXXX)
|
||||||
|
|
||||||
IFS=,
|
IFS=,
|
||||||
grep -vE "^#|^\s*$" debians.csv | while read DIST ARCH _
|
grep -vE "^#|^\s*$" debians.csv | while read OS DIST ARCH _
|
||||||
do
|
do
|
||||||
docker run --rm \
|
docker run --rm \
|
||||||
-v "${ARTIFACTS_DIR}":/artifacts \
|
-v "${ARTIFACTS_DIR}":/artifacts \
|
||||||
--privileged \
|
--privileged \
|
||||||
debimg \
|
debimg \
|
||||||
build-debian /artifacts/debian-"${DIST}"-"${ARCH}" "${ARCH}" "${DIST}" \
|
build-debian "${OS}" "${ARCH}" "${DIST}"
|
||||||
>"${D}"/"log-${DIST}-${ARCH}.txt" 2>&1 &&
|
>"${D}"/"log-${OS}-${DIST}-${ARCH}.txt" 2>&1 &&
|
||||||
rm "${D}"/"log-${DIST}-${ARCH}.txt"
|
rm "${D}"/"log-${OS}-${DIST}-${ARCH}.txt"
|
||||||
done
|
done
|
||||||
unset IFS
|
unset IFS
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,27 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Build Debian root filesystem
|
# Build Debian root filesystem
|
||||||
|
|
||||||
IMAGE2="$1" # For example "/artifacts/debian-buster-armhf"
|
OS="$1" # For example "debian"
|
||||||
ARCH="$2" # For example "armhf"
|
ARCH="$2" # For example "armhf"
|
||||||
DIST="$3" # For example "buster"
|
DIST="$3" # For example "buster"
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
case "${ARCH}" in
|
case "${OS}-${ARCH}" in
|
||||||
armhf)
|
debian-armhf)
|
||||||
KERNEL=linux-image-armmp
|
KERNEL=linux-image-armmp
|
||||||
|
URL=http://deb.debian.org/debian
|
||||||
|
SCRIPT=/usr/share/debootstrap/scripts/sid
|
||||||
;;
|
;;
|
||||||
arm64)
|
debian-arm64)
|
||||||
KERNEL=linux-image-arm64
|
KERNEL=linux-image-arm64
|
||||||
|
URL=http://deb.debian.org/debian
|
||||||
|
SCRIPT=/usr/share/debootstrap/scripts/sid
|
||||||
|
;;
|
||||||
|
ubuntu-armhf|ubuntu-arm64)
|
||||||
|
KERNEL=linux-image-generic
|
||||||
|
URL=http://ports.ubuntu.com/ubuntu-ports
|
||||||
|
SCRIPT=/usr/share/debootstrap/scripts/gutsy
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Can't decide kernel package for \"${ARCH}\""
|
echo "Can't decide kernel package for \"${ARCH}\""
|
||||||
|
|
@ -41,20 +50,21 @@ initramfs-tools,\
|
||||||
openssh-server \
|
openssh-server \
|
||||||
"${DIST}" \
|
"${DIST}" \
|
||||||
debian \
|
debian \
|
||||||
"http://deb.debian.org/debian/"
|
"${URL}" \
|
||||||
|
"${SCRIPT}"
|
||||||
|
|
||||||
# Randomly generated root password
|
# Randomly generated root password
|
||||||
PASSWORD=$(pwgen -B -A 6 1)
|
PASSWORD=$(pwgen -B -A 6 1)
|
||||||
|
|
||||||
# Write apt sources config
|
# Write apt sources config
|
||||||
case "${DIST}" in
|
case "${OS}-${DIST}" in
|
||||||
sid)
|
debian-sid)
|
||||||
tee debian/tmp/sources.list <<- EOF
|
tee debian/tmp/sources.list <<- EOF
|
||||||
deb http://deb.debian.org/debian ${DIST} main
|
deb http://deb.debian.org/debian ${DIST} main
|
||||||
deb-src http://deb.debian.org/debian ${DIST} main
|
deb-src http://deb.debian.org/debian ${DIST} main
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
*)
|
debian-*)
|
||||||
tee debian/tmp/sources.list <<- EOF
|
tee debian/tmp/sources.list <<- EOF
|
||||||
deb http://deb.debian.org/debian ${DIST} main
|
deb http://deb.debian.org/debian ${DIST} main
|
||||||
deb-src http://deb.debian.org/debian ${DIST} main
|
deb-src http://deb.debian.org/debian ${DIST} main
|
||||||
|
|
@ -62,6 +72,16 @@ deb http://deb.debian.org/debian ${DIST}-updates main
|
||||||
deb-src http://deb.debian.org/debian ${DIST}-updates main
|
deb-src http://deb.debian.org/debian ${DIST}-updates main
|
||||||
deb http://security.debian.org/debian-security ${DIST}/updates main
|
deb http://security.debian.org/debian-security ${DIST}/updates main
|
||||||
deb-src http://security.debian.org/debian-security ${DIST}/updates main
|
deb-src http://security.debian.org/debian-security ${DIST}/updates main
|
||||||
|
EOF
|
||||||
|
;;
|
||||||
|
ubuntu-*)
|
||||||
|
tee debian/tmp/sources.list <<- EOF
|
||||||
|
deb http://ports.ubuntu.com/ubuntu-ports ${DIST} main universe
|
||||||
|
deb-src http://ports.ubuntu.com/ubuntu-ports ${DIST} main universe
|
||||||
|
deb http://ports.ubuntu.com/ubuntu-ports ${DIST}-updates main universe
|
||||||
|
deb-src http://ports.ubuntu.com/ubuntu-ports ${DIST}-updates main universe
|
||||||
|
deb http://ports.ubuntu.com/ubuntu-ports ${DIST}-security main universe
|
||||||
|
deb-src http://ports.ubuntu.com/ubuntu-ports ${DIST}-security main universe
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
@ -91,8 +111,11 @@ rm -v debian/usr/bin/qemu-*-static || :
|
||||||
|
|
||||||
cp -rv --preserve=mode ../2nd-stage-files/post-2nd-stage-files/* debian
|
cp -rv --preserve=mode ../2nd-stage-files/post-2nd-stage-files/* debian
|
||||||
|
|
||||||
|
# Set hostname
|
||||||
|
echo "${OS}" > debian/etc/hostname
|
||||||
|
|
||||||
# List all files
|
# List all files
|
||||||
find debian ! -type d -printf "/%P\n" | sort > "/artifacts/debian-${DIST}-${ARCH}.files.txt"
|
find debian ! -type d -printf "/%P\n" | sort > "/artifacts/${OS}-${DIST}-${ARCH}.files.txt"
|
||||||
|
|
||||||
# Make a ext4 filesystem of this and put it into the image
|
# Make a ext4 filesystem of this and put it into the image
|
||||||
rm -f ext4.img
|
rm -f ext4.img
|
||||||
|
|
@ -100,4 +123,4 @@ fallocate -l 900MiB ext4.img
|
||||||
mkfs.ext4 -d debian ext4.img
|
mkfs.ext4 -d debian ext4.img
|
||||||
gzip ext4.img
|
gzip ext4.img
|
||||||
|
|
||||||
cp -v ext4.img.gz "${IMAGE2}-${PASSWORD}.bin.gz"
|
cp -v ext4.img.gz "/artifacts/${OS}-${DIST}-${ARCH}-${PASSWORD}.bin.gz"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue