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
|
||||
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
|
||||
cat << EOF > /boot/boot.cmd
|
||||
mmc dev 0
|
||||
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 \${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"
|
||||
booti \${kernel_addr_r} \${ramdisk_addr_r} \${fdt_addr_r}
|
||||
EOF
|
||||
|
|
|
|||
|
|
@ -7,12 +7,16 @@ ABI="${1}"
|
|||
# Create U-Boot ramdisk image
|
||||
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
|
||||
cat << EOF > /boot/boot.cmd
|
||||
mmc dev 0
|
||||
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 \${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"
|
||||
bootz \${kernel_addr_r} \${ramdisk_addr_r} \${fdt_addr_r}
|
||||
EOF
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ RUN apt-get update && \
|
|||
--no-install-recommends \
|
||||
install debootstrap \
|
||||
debian-archive-keyring \
|
||||
ubuntu-archive-keyring \
|
||||
ca-certificates \
|
||||
qemu-user-static \
|
||||
device-tree-compiler \
|
||||
|
|
|
|||
26
debians.csv
26
debians.csv
|
|
@ -1,11 +1,19 @@
|
|||
# Stable
|
||||
stretch,armhf
|
||||
stretch,arm64
|
||||
# Debian Stable
|
||||
debian,stretch,armhf
|
||||
debian,stretch,arm64
|
||||
|
||||
# Testing
|
||||
buster,armhf
|
||||
buster,arm64
|
||||
# Debian Testing
|
||||
debian,buster,armhf
|
||||
debian,buster,arm64
|
||||
|
||||
# Unstable
|
||||
sid,armhf
|
||||
sid,arm64
|
||||
# Debian Unstable
|
||||
debian,sid,armhf
|
||||
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 \
|
||||
install debootstrap \
|
||||
debian-archive-keyring \
|
||||
ubuntu-archive-keyring \
|
||||
ca-certificates \
|
||||
device-tree-compiler \
|
||||
gcc \
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ RUN apt-get update && \
|
|||
--no-install-recommends \
|
||||
install debootstrap \
|
||||
debian-archive-keyring \
|
||||
ubuntu-archive-keyring \
|
||||
ca-certificates \
|
||||
device-tree-compiler \
|
||||
gcc \
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ RUN apt-get update && \
|
|||
--no-install-recommends \
|
||||
install debootstrap \
|
||||
debian-archive-keyring \
|
||||
ubuntu-archive-keyring \
|
||||
ca-certificates \
|
||||
device-tree-compiler \
|
||||
gcc \
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ RUN apt-get update && \
|
|||
--no-install-recommends \
|
||||
install debootstrap \
|
||||
debian-archive-keyring \
|
||||
ubuntu-archive-keyring \
|
||||
ca-certificates \
|
||||
device-tree-compiler \
|
||||
gcc \
|
||||
|
|
|
|||
|
|
@ -12,14 +12,14 @@ mkdir -p /tmp/debimg/log || exit
|
|||
D=$(mktemp -d -p "${LOG_DIR}" rebuild-debians-XXXXXX)
|
||||
|
||||
IFS=,
|
||||
grep -vE "^#|^\s*$" debians.csv | while read DIST ARCH _
|
||||
grep -vE "^#|^\s*$" debians.csv | while read OS DIST ARCH _
|
||||
do
|
||||
docker run --rm \
|
||||
-v "${ARTIFACTS_DIR}":/artifacts \
|
||||
--privileged \
|
||||
debimg \
|
||||
build-debian /artifacts/debian-"${DIST}"-"${ARCH}" "${ARCH}" "${DIST}" \
|
||||
>"${D}"/"log-${DIST}-${ARCH}.txt" 2>&1 &&
|
||||
rm "${D}"/"log-${DIST}-${ARCH}.txt"
|
||||
build-debian "${OS}" "${ARCH}" "${DIST}"
|
||||
>"${D}"/"log-${OS}-${DIST}-${ARCH}.txt" 2>&1 &&
|
||||
rm "${D}"/"log-${OS}-${DIST}-${ARCH}.txt"
|
||||
done
|
||||
unset IFS
|
||||
|
|
|
|||
|
|
@ -1,18 +1,27 @@
|
|||
#!/bin/sh
|
||||
# Build Debian root filesystem
|
||||
|
||||
IMAGE2="$1" # For example "/artifacts/debian-buster-armhf"
|
||||
OS="$1" # For example "debian"
|
||||
ARCH="$2" # For example "armhf"
|
||||
DIST="$3" # For example "buster"
|
||||
|
||||
set -e
|
||||
|
||||
case "${ARCH}" in
|
||||
armhf)
|
||||
case "${OS}-${ARCH}" in
|
||||
debian-armhf)
|
||||
KERNEL=linux-image-armmp
|
||||
URL=http://deb.debian.org/debian
|
||||
SCRIPT=/usr/share/debootstrap/scripts/sid
|
||||
;;
|
||||
arm64)
|
||||
debian-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}\""
|
||||
|
|
@ -41,20 +50,21 @@ initramfs-tools,\
|
|||
openssh-server \
|
||||
"${DIST}" \
|
||||
debian \
|
||||
"http://deb.debian.org/debian/"
|
||||
"${URL}" \
|
||||
"${SCRIPT}"
|
||||
|
||||
# Randomly generated root password
|
||||
PASSWORD=$(pwgen -B -A 6 1)
|
||||
|
||||
# Write apt sources config
|
||||
case "${DIST}" in
|
||||
sid)
|
||||
case "${OS}-${DIST}" in
|
||||
debian-sid)
|
||||
tee debian/tmp/sources.list <<- EOF
|
||||
deb http://deb.debian.org/debian ${DIST} main
|
||||
deb-src http://deb.debian.org/debian ${DIST} main
|
||||
EOF
|
||||
;;
|
||||
*)
|
||||
debian-*)
|
||||
tee debian/tmp/sources.list <<- EOF
|
||||
deb 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 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
|
||||
;;
|
||||
esac
|
||||
|
|
@ -91,8 +111,11 @@ rm -v debian/usr/bin/qemu-*-static || :
|
|||
|
||||
cp -rv --preserve=mode ../2nd-stage-files/post-2nd-stage-files/* debian
|
||||
|
||||
# Set hostname
|
||||
echo "${OS}" > debian/etc/hostname
|
||||
|
||||
# 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
|
||||
rm -f ext4.img
|
||||
|
|
@ -100,4 +123,4 @@ fallocate -l 900MiB ext4.img
|
|||
mkfs.ext4 -d debian 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