Add Raspberry Pi support

This commit is contained in:
Johan Gunnarsson 2019-03-26 21:20:09 +01:00
parent 83936e66a3
commit 8902128249
4 changed files with 49 additions and 0 deletions

View File

@ -14,6 +14,8 @@ RUN apt-get -y install debootstrap \
swig \
parted \
e2fsprogs \
dosfstools \
mtools \
pwgen
ENV PATH="/debimg:${PATH}"
COPY . /debimg

44
build-boot-rpi Executable file
View File

@ -0,0 +1,44 @@
#!/bin/sh
# Build SD card image
IMAGE="${1}" # For example "boot-bananapi.bin"
DEFCONFIG="${2}" # For example "Bananapi_defconfig"
TUPLE="${3}" # For example "arm-linux-gnueabihf"
set -e
# Create fresh empty directory
TMP=$(mktemp -d tmp.XXXXXX)
cd "${TMP}"
build-image tmp.img
build-u_boot u-boot "${DEFCONFIG}" "${TUPLE}"
# Write Raspberry Pi boot config
cat << EOF > config.txt
kernel=u-boot.bin
boot_delay=0
boot_delay_ms=100
gpu_mem=16
EOF
# Download Raspberry Pi boot files
FIRMWARE="https://github.com/raspberrypi/firmware/blob/stable"
wget "${FIRMWARE}/boot/fixup.dat" \
"${FIRMWARE}/boot/start.elf" \
"${FIRMWARE}/boot/bootcode.bin"
# Create empty FAT partition
rm -f vfat.img
fallocate -l 31MiB vfat.img
mkfs.vfat vfat.img
# Copy boot files to FAT partition
mcopy -v -i vfat.img u-boot/u-boot.bin config.txt fixup.dat start.elf bootcode.bin ::
# Copy FAT partition to image
dd if=vfat.img of=tmp.img bs=1K seek=1K
truncate -s 32M tmp.img
gzip tmp.img
cp tmp.img.gz "${IMAGE}.bin.gz"

View File

@ -14,6 +14,8 @@ RUN apt-get -y install debootstrap \
swig \
parted \
e2fsprogs \
dosfstools \
mtools \
pwgen
ENV PATH="/debimg:${PATH}"
COPY . /debimg

View File

@ -11,6 +11,7 @@ docker build -t debimg .
# Build bootloaders
docker run $DOCKEROPTS1 debimg build-boot-allwinner "/artifacts/boot-bananapi" "Bananapi_defconfig" "arm-linux-gnueabihf"
docker run $DOCKEROPTS1 debimg build-boot-rpi "/artifacts/boot-rpi2" "rpi_2_defconfig" "arm-linux-gnueabihf"
# Build root filesystems
docker run $DOCKEROPTS2 debimg build-debian "/artifacts/debian-stretch-armhf" "armhf" "stretch"