Merge lp:~sil2100/livecd-rootfs/bionic-raspi3-backport into lp:~ubuntu-core-dev/livecd-rootfs/bionic-proposed

Proposed by Łukasz Zemczak
Status: Merged
Merged at revision: 1690
Proposed branch: lp:~sil2100/livecd-rootfs/bionic-raspi3-backport
Merge into: lp:~ubuntu-core-dev/livecd-rootfs/bionic-proposed
Diff against target: 291 lines (+136/-55)
4 files modified
debian/changelog (+17/-0)
debian/control (+3/-0)
live-build/auto/build (+73/-38)
live-build/auto/config (+43/-17)
To merge this branch: bzr merge lp:~sil2100/livecd-rootfs/bionic-raspi3-backport
Reviewer Review Type Date Requested Status
Łukasz Zemczak Approve
Review via email: mp+359858@code.launchpad.net

Commit message

Backport all the necessary livecd-rootfs changes for raspi3 armhf/arm64 support.

Description of the change

Backport all the necessary livecd-rootfs changes for raspi3 armhf/arm64 support.

To post a comment you must log in.
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

I tested it in a PPA and performed a livefs build of raspi3+arm64 - resulting image works as expected. Apologies for the self-approval but we're short on time..!

review: Approve
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2018-11-26 20:55:29 +0000
3+++ debian/changelog 2018-11-29 16:44:19 +0000
4@@ -1,3 +1,20 @@
5+livecd-rootfs (2.525.11) UNRELEASED; urgency=medium
6+
7+ * Backport all the required changes to enable Raspberry Pi 3 armhf and arm64
8+ preinstalled image builds. (LP: #1805668)
9+ - Add support for raspi3 rootfs builds (based on Ryan Finnie's changes).
10+ - For ubuntu-image consumption, export the kernel and initrd to
11+ image/boot/uboot for raspi*.
12+ - Avoid issues of hard-linking to a symbolic vmlinuz as this can lead to a
13+ dangling symlink.
14+ - Add raspi3 arm64 rootfs build support.
15+ - Add git to the build dependencies for the gadget tree pull.
16+ - Minor fixes to raspi3 builds: add arm64+raspi3 to the supported model
17+ list, pass SUITE on to the build stage and use the git:// url for the
18+ gadget tree.
19+
20+ -- Łukasz 'sil2100' Zemczak <lukasz.zemczak@ubuntu.com> Thu, 29 Nov 2018 16:24:23 +0100
21+
22 livecd-rootfs (2.525.10) bionic; urgency=medium
23
24 [ Cody Shepherd ]
25
26=== modified file 'debian/control'
27--- debian/control 2018-10-26 21:01:17 +0000
28+++ debian/control 2018-11-29 16:44:19 +0000
29@@ -17,12 +17,14 @@
30 gdisk,
31 genisoimage,
32 germinate (>= 1.25.1),
33+ git,
34 gnupg,
35 grep-dctrl,
36 kpartx,
37 live-build (>= 3.0~a57-1ubuntu31~),
38 lsb-release,
39 lzma,
40+ make,
41 parted,
42 procps,
43 python-minimal | python,
44@@ -32,6 +34,7 @@
45 snapd,
46 squashfs-tools (>= 1:3.3-1),
47 sudo,
48+ u-boot-tools [armhf arm64],
49 ubuntu-image,
50 vmdk-stream-converter [amd64 i386],
51 xz-utils,
52
53=== modified file 'live-build/auto/build'
54--- live-build/auto/build 2018-08-27 22:32:07 +0000
55+++ live-build/auto/build 2018-11-29 16:44:19 +0000
56@@ -23,12 +23,31 @@
57 if [ "${IMAGEFORMAT:-}" = "ubuntu-image" ]; then
58 # Use ubuntu-image instead of live-build
59
60- CHANNEL="${CHANNEL:-edge}"
61- env SNAPPY_STORE_NO_CDN=1 \
62- ubuntu-image -c "$CHANNEL" $UBUNTU_IMAGE_ARGS \
63- -o "$PREFIX".img "$PREFIX".model-assertion
64- xz -0 -T4 "$PREFIX".img
65- mv seed.manifest "$PREFIX".manifest
66+ if [ "$PROJECT" = "ubuntu-core"]; then
67+ CHANNEL="${CHANNEL:-edge}"
68+ env SNAPPY_STORE_NO_CDN=1 \
69+ ubuntu-image snap -c "$CHANNEL" $UBUNTU_IMAGE_ARGS \
70+ -O output "$PREFIX".model-assertion
71+ # XXX: currently we only have one image generated, but really
72+ # we should be supporting more than one for models that
73+ # define those.
74+ mv output/*.img "$PREFIX".img
75+ xz -0 -T4 "$PREFIX".img
76+ mv output/seed.manifest "$PREFIX".manifest
77+ else
78+ # First we need to build the gadget tree
79+ make -C "config/$PREFIX-gadget" ARCH=$ARCH SERIES=$SUITE
80+ ubuntu-image classic $UBUNTU_IMAGE_ARGS \
81+ -s $SUITE -p $PROJECT -a $ARCH --subarch $SUBARCH \
82+ -O output config/$PREFIX-gadget/install
83+ # XXX: currently we only have one image generated, but really
84+ # we should be supporting more than one for models that
85+ # define those.
86+ mv output/*.img "$PREFIX".img
87+ xz -0 -T4 "$PREFIX".img
88+ mv output/filesystem.manifest "$PREFIX".manifest
89+ fi
90+
91 exit 0
92 fi
93
94@@ -800,13 +819,13 @@
95 NUMFLAVOURS="$(set -- $LB_LINUX_FLAVOURS; echo $#)"
96 if [ "$NUMFLAVOURS" = 1 ] && [ "$LB_LINUX_FLAVOURS" != "none" ]; then
97 # only one kernel flavour
98- if [ -e "binary/$INITFS/vmlinuz" ]; then
99+ if [ -f "binary/$INITFS/vmlinuz" ] && ! [ -h "binary/$INITFS/vmlinuz" ]; then
100 ln "binary/$INITFS/vmlinuz" "$PREFIX.kernel"
101 chmod 644 "$PREFIX.kernel"
102 else
103 ln -sf "$PREFIX.kernel-$LB_LINUX_FLAVOURS" "$PREFIX.kernel"
104 fi
105- if [ -e "binary/$INITFS/initrd.lz" ]; then
106+ if [ -f "binary/$INITFS/initrd.lz" ] && ! [ -h "binary/$INITFS/initrd.lz" ]; then
107 ln "binary/$INITFS/initrd.lz" "$PREFIX.initrd"
108 chmod 644 "$PREFIX.initrd"
109 else
110@@ -814,36 +833,52 @@
111 fi
112 fi
113
114-if [ "$SUBARCH" = "ac100" ]; then
115- # create the md5sum and size files for which we are actually doing all this
116- md5sum $PREFIX.rootfs.tar.gz >chroot/installer.md5
117- wc -c $PREFIX.rootfs.tar.gz >chroot/installer.size
118-
119- INFO_DESC="$(lsb_release -d -s)"
120- INFO_STAMP=$(date +20%y%m%d-%H:%M)
121-
122- echo "$INFO_DESC - $ARCH ($INFO_STAMP)" >chroot/media-info
123-
124- # make sure update-initramfs feels cosy and warm in the environment
125- lb chroot_proc install "$@"
126- lb chroot_sysfs install "$@"
127- lb chroot_devpts install "$@"
128-
129- # re-create initrd to contain the installer.md5 file
130- Chroot chroot "env FLASH_KERNEL_SKIP=1 update-initramfs -k all -t -u -v"
131-
132- # create boot.img
133- Chroot chroot "abootimg --create /boot/installer-${KVERS}.img -f /boot/bootimg.cfg-$SUBARCH -r /boot/initrd.img-${KVERS} -k /boot/vmlinuz-${KVERS}"
134-
135- # clean up
136- lb chroot_devpts remove "$@"
137- lb chroot_sysfs remove "$@"
138- lb chroot_proc remove "$@"
139-
140- cp "chroot/boot/installer-${KVERS}.img" "$PREFIX.bootimg-$FLAVOUR"
141- ln -sf "$PREFIX.bootimg-$FLAVOUR" "$PREFIX.bootimg"
142-
143-fi
144+case $SUBARCH in
145+ ac100)
146+ # create the md5sum and size files for which we are actually doing all this
147+ md5sum $PREFIX.rootfs.tar.gz >chroot/installer.md5
148+ wc -c $PREFIX.rootfs.tar.gz >chroot/installer.size
149+
150+ INFO_DESC="$(lsb_release -d -s)"
151+ INFO_STAMP=$(date +20%y%m%d-%H:%M)
152+
153+ echo "$INFO_DESC - $ARCH ($INFO_STAMP)" >chroot/media-info
154+
155+ # make sure update-initramfs feels cosy and warm in the environment
156+ lb chroot_proc install "$@"
157+ lb chroot_sysfs install "$@"
158+ lb chroot_devpts install "$@"
159+
160+ # re-create initrd to contain the installer.md5 file
161+ Chroot chroot "env FLASH_KERNEL_SKIP=1 update-initramfs -k all -t -u -v"
162+
163+ # create boot.img
164+ Chroot chroot "abootimg --create /boot/installer-${KVERS}.img -f /boot/bootimg.cfg-$SUBARCH -r /boot/initrd.img-${KVERS} -k /boot/vmlinuz-${KVERS}"
165+
166+ # clean up
167+ lb chroot_devpts remove "$@"
168+ lb chroot_sysfs remove "$@"
169+ lb chroot_proc remove "$@"
170+
171+ cp "chroot/boot/installer-${KVERS}.img" "$PREFIX.bootimg-$FLAVOUR"
172+ ln -sf "$PREFIX.bootimg-$FLAVOUR" "$PREFIX.bootimg"
173+ ;;
174+
175+ raspi2|raspi3)
176+ # copy the kernel and initrd to a predictable directory for
177+ # ubuntu-image consumption. In some cases, like in pi2/3
178+ # u-boot, the bootloader needs to contain the kernel and initrd,
179+ # so during rootfs build we copy it over to a directory that
180+ # ubuntu-image looks for and shoves into the bootloader
181+ # partition.
182+ UBOOT_BOOT="image/boot/uboot"
183+
184+ mkdir -p $UBOOT_BOOT
185+
186+ cp $PREFIX.initrd $UBOOT_BOOT/initrd.img || true
187+ cp $PREFIX.kernel $UBOOT_BOOT/vmlinuz || true
188+ ;;
189+esac
190
191 if [ "$PROJECT" = "ubuntu-touch" ] || [ "$PROJECT" = "ubuntu-touch-custom" ]; then
192 sourceslist="chroot/etc/apt/sources.list"
193
194=== modified file 'live-build/auto/config'
195--- live-build/auto/config 2018-10-24 19:18:36 +0000
196+++ live-build/auto/config 2018-11-29 16:44:19 +0000
197@@ -175,7 +175,7 @@
198 MODEL=dragonboard ;;
199 armhf+raspi2)
200 MODEL=pi2 ;;
201- armhf+raspi3)
202+ armhf+raspi3|arm64+raspi3)
203 MODEL=pi3 ;;
204 armhf+cm3)
205 MODEL=cm3 ;;
206@@ -184,20 +184,39 @@
207 exit 1
208 ;;
209 esac
210- case $MODEL in
211- pc-amd64|pc-i386)
212- UBUNTU_IMAGE_ARGS="--image-size 3700M" ;;
213- *)
214- UBUNTU_IMAGE_ARGS="" ;;
215- esac
216-
217- echo "IMAGEFORMAT=$IMAGEFORMAT" >> config/common
218- echo "UBUNTU_IMAGE_ARGS=\"$UBUNTU_IMAGE_ARGS\"" >> config/common
219- # Store model assertion in top dir to get it picked up later as a build artifact
220- env SNAPPY_STORE_NO_CDN=1 snap known --remote model series=16 model="$MODEL" brand-id=canonical > "$PREFIX".model-assertion
221- echo "Configured ubuntu-image for the following model assertion:"
222- cat "$PREFIX".model-assertion
223- echo "----------------------------------------------------------"
224+
225+ if [ $PROJECT = "ubuntu-core" ]; then
226+ # snap-based core images
227+
228+ case $MODEL in
229+ pc-amd64|pc-i386)
230+ UBUNTU_IMAGE_ARGS="--image-size 3700M" ;;
231+ *)
232+ UBUNTU_IMAGE_ARGS="" ;;
233+ esac
234+
235+ echo "IMAGEFORMAT=$IMAGEFORMAT" >> config/common
236+ echo "UBUNTU_IMAGE_ARGS=\"$UBUNTU_IMAGE_ARGS\"" >> config/common
237+ # Store model assertion in top dir to get it picked up later as a build artifact
238+ env SNAPPY_STORE_NO_CDN=1 snap known --remote model series=16 model="$MODEL" brand-id=canonical > "$PREFIX".model-assertion
239+ echo "Configured ubuntu-image for the following model assertion:"
240+ cat "$PREFIX".model-assertion
241+ echo "----------------------------------------------------------"
242+ else
243+ # classic images
244+
245+ UBUNTU_IMAGE_ARGS=""
246+ UBUNTU_IMAGE_ARGS="$UBUNTU_IMAGE_ARGS${PROPOSED:+ --with-proposed}"
247+ UBUNTU_IMAGE_ARGS="$UBUNTU_IMAGE_ARGS${EXTRA_PPAS:+ --extra-ppas \"$EXTRA_PPAS\"}"
248+
249+ git clone git://git.launchpad.net/~canonical-foundations/snap-$MODEL/+git/github-mirror -b classic config/$PREFIX-gadget
250+
251+ echo "IMAGEFORMAT=$IMAGEFORMAT" >> config/common
252+ echo "SUITE=$SUITE" >> config/common
253+ echo "UBUNTU_IMAGE_ARGS=\"$UBUNTU_IMAGE_ARGS\"" >> config/common
254+
255+ echo "Configured ubuntu-image for the following gadget model: $MODEL"
256+ fi
257 # Fake finished configuration for lb build
258 mkdir -p .build
259 touch .build/config
260@@ -751,7 +770,7 @@
261 esac
262
263 case $ARCH in
264- armel|armhf)
265+ armel|armhf|arm64)
266 KERNEL_FLAVOURS="${SUBARCH:-$KERNEL_FLAVOURS}"
267 case $SUBARCH in
268 dove)
269@@ -789,6 +808,13 @@
270 add_package install linux-firmware-raspi2 u-boot-rpi flash-kernel u-boot-tools
271 BINARY_REMOVE_LINUX=false
272 ;;
273+ raspi3)
274+ COMPONENTS='main restricted universe multiverse'
275+ KERNEL_FLAVOURS=raspi2
276+ add_package install raspi3-firmware u-boot-rpi flash-kernel u-boot-tools
277+ BINARY_REMOVE_LINUX=false
278+ ;;
279+
280 esac
281 ;;
282 esac
283@@ -854,7 +880,7 @@
284 echo "LB_DISTRIBUTION=\"$SUITE\"" >> config/binary
285
286 case $ARCH+$SUBARCH in
287- armhf+raspi2)
288+ armhf+raspi2|armhf+raspi3|arm64+raspi3)
289 cat > config/hooks/01-firmware-directory.chroot_early <<EOF
290 #!/bin/sh -ex
291 mkdir -p /boot/firmware

Subscribers

People subscribed via source and target branches