First attempt on backporting all raspi3 changes to bionic.

sil2100/backport-datasource-raspi3
Łukasz 'sil2100' Zemczak 6 years ago
parent 465d4f8db7
commit 1a39926dd0

17
debian/changelog vendored

@ -1,3 +1,20 @@
livecd-rootfs (2.525.11) UNRELEASED; urgency=medium
* Backport all the required changes to enable Raspberry Pi 3 armhf and arm64
preinstalled image builds. (LP: #1805668)
- Add support for raspi3 rootfs builds (based on Ryan Finnie's changes).
- For ubuntu-image consumption, export the kernel and initrd to
image/boot/uboot for raspi*.
- Avoid issues of hard-linking to a symbolic vmlinuz as this can lead to a
dangling symlink.
- Add raspi3 arm64 rootfs build support.
- Add git to the build dependencies for the gadget tree pull.
- Minor fixes to raspi3 builds: add arm64+raspi3 to the supported model
list, pass SUITE on to the build stage and use the git:// url for the
gadget tree.
-- Łukasz 'sil2100' Zemczak <lukasz.zemczak@ubuntu.com> Thu, 29 Nov 2018 16:24:23 +0100
livecd-rootfs (2.525.10) bionic; urgency=medium livecd-rootfs (2.525.10) bionic; urgency=medium
[ Cody Shepherd ] [ Cody Shepherd ]

3
debian/control vendored

@ -17,12 +17,14 @@ Depends: ${misc:Depends},
gdisk, gdisk,
genisoimage, genisoimage,
germinate (>= 1.25.1), germinate (>= 1.25.1),
git,
gnupg, gnupg,
grep-dctrl, grep-dctrl,
kpartx, kpartx,
live-build (>= 3.0~a57-1ubuntu31~), live-build (>= 3.0~a57-1ubuntu31~),
lsb-release, lsb-release,
lzma, lzma,
make,
parted, parted,
procps, procps,
python-minimal | python, python-minimal | python,
@ -32,6 +34,7 @@ Depends: ${misc:Depends},
snapd, snapd,
squashfs-tools (>= 1:3.3-1), squashfs-tools (>= 1:3.3-1),
sudo, sudo,
u-boot-tools [armhf arm64],
ubuntu-image, ubuntu-image,
vmdk-stream-converter [amd64 i386], vmdk-stream-converter [amd64 i386],
xz-utils, xz-utils,

@ -23,12 +23,31 @@ PREFIX="livecd.$PROJECT${SUBARCH:+-$SUBARCH}"
if [ "${IMAGEFORMAT:-}" = "ubuntu-image" ]; then if [ "${IMAGEFORMAT:-}" = "ubuntu-image" ]; then
# Use ubuntu-image instead of live-build # Use ubuntu-image instead of live-build
CHANNEL="${CHANNEL:-edge}" if [ "$PROJECT" = "ubuntu-core"]; then
env SNAPPY_STORE_NO_CDN=1 \ CHANNEL="${CHANNEL:-edge}"
ubuntu-image -c "$CHANNEL" $UBUNTU_IMAGE_ARGS \ env SNAPPY_STORE_NO_CDN=1 \
-o "$PREFIX".img "$PREFIX".model-assertion ubuntu-image snap -c "$CHANNEL" $UBUNTU_IMAGE_ARGS \
xz -0 -T4 "$PREFIX".img -O output "$PREFIX".model-assertion
mv seed.manifest "$PREFIX".manifest # XXX: currently we only have one image generated, but really
# we should be supporting more than one for models that
# define those.
mv output/*.img "$PREFIX".img
xz -0 -T4 "$PREFIX".img
mv output/seed.manifest "$PREFIX".manifest
else
# First we need to build the gadget tree
make -C "config/$PREFIX-gadget" ARCH=$ARCH SERIES=$SUITE
ubuntu-image classic $UBUNTU_IMAGE_ARGS \
-s $SUITE -p $PROJECT -a $ARCH --subarch $SUBARCH \
-O output config/$PREFIX-gadget/install
# XXX: currently we only have one image generated, but really
# we should be supporting more than one for models that
# define those.
mv output/*.img "$PREFIX".img
xz -0 -T4 "$PREFIX".img
mv output/filesystem.manifest "$PREFIX".manifest
fi
exit 0 exit 0
fi fi
@ -800,13 +819,13 @@ done
NUMFLAVOURS="$(set -- $LB_LINUX_FLAVOURS; echo $#)" NUMFLAVOURS="$(set -- $LB_LINUX_FLAVOURS; echo $#)"
if [ "$NUMFLAVOURS" = 1 ] && [ "$LB_LINUX_FLAVOURS" != "none" ]; then if [ "$NUMFLAVOURS" = 1 ] && [ "$LB_LINUX_FLAVOURS" != "none" ]; then
# only one kernel flavour # only one kernel flavour
if [ -e "binary/$INITFS/vmlinuz" ]; then if [ -f "binary/$INITFS/vmlinuz" ] && ! [ -h "binary/$INITFS/vmlinuz" ]; then
ln "binary/$INITFS/vmlinuz" "$PREFIX.kernel" ln "binary/$INITFS/vmlinuz" "$PREFIX.kernel"
chmod 644 "$PREFIX.kernel" chmod 644 "$PREFIX.kernel"
else else
ln -sf "$PREFIX.kernel-$LB_LINUX_FLAVOURS" "$PREFIX.kernel" ln -sf "$PREFIX.kernel-$LB_LINUX_FLAVOURS" "$PREFIX.kernel"
fi fi
if [ -e "binary/$INITFS/initrd.lz" ]; then if [ -f "binary/$INITFS/initrd.lz" ] && ! [ -h "binary/$INITFS/initrd.lz" ]; then
ln "binary/$INITFS/initrd.lz" "$PREFIX.initrd" ln "binary/$INITFS/initrd.lz" "$PREFIX.initrd"
chmod 644 "$PREFIX.initrd" chmod 644 "$PREFIX.initrd"
else else
@ -814,36 +833,52 @@ if [ "$NUMFLAVOURS" = 1 ] && [ "$LB_LINUX_FLAVOURS" != "none" ]; then
fi fi
fi fi
if [ "$SUBARCH" = "ac100" ]; then case $SUBARCH in
# create the md5sum and size files for which we are actually doing all this ac100)
md5sum $PREFIX.rootfs.tar.gz >chroot/installer.md5 # create the md5sum and size files for which we are actually doing all this
wc -c $PREFIX.rootfs.tar.gz >chroot/installer.size md5sum $PREFIX.rootfs.tar.gz >chroot/installer.md5
wc -c $PREFIX.rootfs.tar.gz >chroot/installer.size
INFO_DESC="$(lsb_release -d -s)" INFO_DESC="$(lsb_release -d -s)"
INFO_STAMP=$(date +20%y%m%d-%H:%M) INFO_STAMP=$(date +20%y%m%d-%H:%M)
echo "$INFO_DESC - $ARCH ($INFO_STAMP)" >chroot/media-info echo "$INFO_DESC - $ARCH ($INFO_STAMP)" >chroot/media-info
# make sure update-initramfs feels cosy and warm in the environment # make sure update-initramfs feels cosy and warm in the environment
lb chroot_proc install "$@" lb chroot_proc install "$@"
lb chroot_sysfs install "$@" lb chroot_sysfs install "$@"
lb chroot_devpts install "$@" lb chroot_devpts install "$@"
# re-create initrd to contain the installer.md5 file # re-create initrd to contain the installer.md5 file
Chroot chroot "env FLASH_KERNEL_SKIP=1 update-initramfs -k all -t -u -v" Chroot chroot "env FLASH_KERNEL_SKIP=1 update-initramfs -k all -t -u -v"
# create boot.img # create boot.img
Chroot chroot "abootimg --create /boot/installer-${KVERS}.img -f /boot/bootimg.cfg-$SUBARCH -r /boot/initrd.img-${KVERS} -k /boot/vmlinuz-${KVERS}" Chroot chroot "abootimg --create /boot/installer-${KVERS}.img -f /boot/bootimg.cfg-$SUBARCH -r /boot/initrd.img-${KVERS} -k /boot/vmlinuz-${KVERS}"
# clean up # clean up
lb chroot_devpts remove "$@" lb chroot_devpts remove "$@"
lb chroot_sysfs remove "$@" lb chroot_sysfs remove "$@"
lb chroot_proc remove "$@" lb chroot_proc remove "$@"
cp "chroot/boot/installer-${KVERS}.img" "$PREFIX.bootimg-$FLAVOUR"
ln -sf "$PREFIX.bootimg-$FLAVOUR" "$PREFIX.bootimg"
;;
cp "chroot/boot/installer-${KVERS}.img" "$PREFIX.bootimg-$FLAVOUR" raspi2|raspi3)
ln -sf "$PREFIX.bootimg-$FLAVOUR" "$PREFIX.bootimg" # copy the kernel and initrd to a predictable directory for
# ubuntu-image consumption. In some cases, like in pi2/3
# u-boot, the bootloader needs to contain the kernel and initrd,
# so during rootfs build we copy it over to a directory that
# ubuntu-image looks for and shoves into the bootloader
# partition.
UBOOT_BOOT="image/boot/uboot"
fi mkdir -p $UBOOT_BOOT
cp $PREFIX.initrd $UBOOT_BOOT/initrd.img || true
cp $PREFIX.kernel $UBOOT_BOOT/vmlinuz || true
;;
esac
if [ "$PROJECT" = "ubuntu-touch" ] || [ "$PROJECT" = "ubuntu-touch-custom" ]; then if [ "$PROJECT" = "ubuntu-touch" ] || [ "$PROJECT" = "ubuntu-touch-custom" ]; then
sourceslist="chroot/etc/apt/sources.list" sourceslist="chroot/etc/apt/sources.list"

@ -175,7 +175,7 @@ case $IMAGEFORMAT in
MODEL=dragonboard ;; MODEL=dragonboard ;;
armhf+raspi2) armhf+raspi2)
MODEL=pi2 ;; MODEL=pi2 ;;
armhf+raspi3) armhf+raspi3|arm64+raspi3)
MODEL=pi3 ;; MODEL=pi3 ;;
armhf+cm3) armhf+cm3)
MODEL=cm3 ;; MODEL=cm3 ;;
@ -184,20 +184,39 @@ case $IMAGEFORMAT in
exit 1 exit 1
;; ;;
esac esac
case $MODEL in
pc-amd64|pc-i386)
UBUNTU_IMAGE_ARGS="--image-size 3700M" ;;
*)
UBUNTU_IMAGE_ARGS="" ;;
esac
echo "IMAGEFORMAT=$IMAGEFORMAT" >> config/common if [ $PROJECT = "ubuntu-core" ]; then
echo "UBUNTU_IMAGE_ARGS=\"$UBUNTU_IMAGE_ARGS\"" >> config/common # snap-based core images
# Store model assertion in top dir to get it picked up later as a build artifact
env SNAPPY_STORE_NO_CDN=1 snap known --remote model series=16 model="$MODEL" brand-id=canonical > "$PREFIX".model-assertion case $MODEL in
echo "Configured ubuntu-image for the following model assertion:" pc-amd64|pc-i386)
cat "$PREFIX".model-assertion UBUNTU_IMAGE_ARGS="--image-size 3700M" ;;
echo "----------------------------------------------------------" *)
UBUNTU_IMAGE_ARGS="" ;;
esac
echo "IMAGEFORMAT=$IMAGEFORMAT" >> config/common
echo "UBUNTU_IMAGE_ARGS=\"$UBUNTU_IMAGE_ARGS\"" >> config/common
# Store model assertion in top dir to get it picked up later as a build artifact
env SNAPPY_STORE_NO_CDN=1 snap known --remote model series=16 model="$MODEL" brand-id=canonical > "$PREFIX".model-assertion
echo "Configured ubuntu-image for the following model assertion:"
cat "$PREFIX".model-assertion
echo "----------------------------------------------------------"
else
# classic images
UBUNTU_IMAGE_ARGS=""
UBUNTU_IMAGE_ARGS="$UBUNTU_IMAGE_ARGS${PROPOSED:+ --with-proposed}"
UBUNTU_IMAGE_ARGS="$UBUNTU_IMAGE_ARGS${EXTRA_PPAS:+ --extra-ppas \"$EXTRA_PPAS\"}"
git clone git://git.launchpad.net/~canonical-foundations/snap-$MODEL/+git/github-mirror -b classic config/$PREFIX-gadget
echo "IMAGEFORMAT=$IMAGEFORMAT" >> config/common
echo "SUITE=$SUITE" >> config/common
echo "UBUNTU_IMAGE_ARGS=\"$UBUNTU_IMAGE_ARGS\"" >> config/common
echo "Configured ubuntu-image for the following gadget model: $MODEL"
fi
# Fake finished configuration for lb build # Fake finished configuration for lb build
mkdir -p .build mkdir -p .build
touch .build/config touch .build/config
@ -751,7 +770,7 @@ case $PROJECT in
esac esac
case $ARCH in case $ARCH in
armel|armhf) armel|armhf|arm64)
KERNEL_FLAVOURS="${SUBARCH:-$KERNEL_FLAVOURS}" KERNEL_FLAVOURS="${SUBARCH:-$KERNEL_FLAVOURS}"
case $SUBARCH in case $SUBARCH in
dove) dove)
@ -789,6 +808,13 @@ case $ARCH in
add_package install linux-firmware-raspi2 u-boot-rpi flash-kernel u-boot-tools add_package install linux-firmware-raspi2 u-boot-rpi flash-kernel u-boot-tools
BINARY_REMOVE_LINUX=false BINARY_REMOVE_LINUX=false
;; ;;
raspi3)
COMPONENTS='main restricted universe multiverse'
KERNEL_FLAVOURS=raspi2
add_package install raspi3-firmware u-boot-rpi flash-kernel u-boot-tools
BINARY_REMOVE_LINUX=false
;;
esac esac
;; ;;
esac esac
@ -854,7 +880,7 @@ echo "SUBPROJECT=\"${SUBPROJECT:-}\"" >> config/binary
echo "LB_DISTRIBUTION=\"$SUITE\"" >> config/binary echo "LB_DISTRIBUTION=\"$SUITE\"" >> config/binary
case $ARCH+$SUBARCH in case $ARCH+$SUBARCH in
armhf+raspi2) armhf+raspi2|armhf+raspi3|arm64+raspi3)
cat > config/hooks/01-firmware-directory.chroot_early <<EOF cat > config/hooks/01-firmware-directory.chroot_early <<EOF
#!/bin/sh -ex #!/bin/sh -ex
mkdir -p /boot/firmware mkdir -p /boot/firmware

Loading…
Cancel
Save