Merge lp:~mwhudson/livecd-rootfs/live-server-kernel-futzing into lp:livecd-rootfs
- live-server-kernel-futzing
- Merge into trunk
Status: | Merged |
---|---|
Merge reported by: | Steve Langasek |
Merged at revision: | not available |
Proposed branch: | lp:~mwhudson/livecd-rootfs/live-server-kernel-futzing |
Merge into: | lp:livecd-rootfs |
Diff against target: |
300 lines (+121/-66) (has conflicts) 5 files modified
debian/changelog (+13/-0) live-build/auto/config (+1/-17) live-build/functions (+0/-31) live-build/ubuntu-server/hooks/032-installer-squashfs.binary (+13/-18) live-build/ubuntu-server/hooks/033-kernel-bits.binary (+94/-0) Text conflict in debian/changelog |
To merge this branch: | bzr merge lp:~mwhudson/livecd-rootfs/live-server-kernel-futzing |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Steve Langasek | Approve | ||
Review via email: mp+359880@code.launchpad.net |
Commit message
* Changes to kernel handling for live-server: do not include kernel/initrd
in filesystem.squashfs but rather install it in a throwaway layer on top
of installer.squashfs and fish kernel, initrd and modules out of that with
an initrd hook that records kernel metapackage name in /run and mounts
/lib/modules.
Description of the change
- 1737. By Michael Hudson-Doyle
-
changelog
- 1738. By Michael Hudson-Doyle
-
fix syntax error
Steve Langasek (vorlon) : | # |
- 1739. By Michael Hudson-Doyle
-
rationalize suffix handling
- 1740. By Michael Hudson-Doyle
-
we cannot put the modules squashfses directly in /casper
Michael Hudson-Doyle (mwhudson) wrote : | # |
Michael Hudson-Doyle (mwhudson) wrote : | # |
- 1741. By Michael Hudson-Doyle
-
i was sure you could pass squashfses directly as lowerdir, apparently not
- 1742. By Michael Hudson-Doyle
-
testing vs reality
- 1743. By Michael Hudson-Doyle
-
remove cloud-initramfs
-copymods and add comments - 1744. By Michael Hudson-Doyle
-
remove cloud-initramfs
-copymods harder - 1745. By Michael Hudson-Doyle
-
ffs
- 1746. By Michael Hudson-Doyle
-
debugging by guesswork: no squashfuse
- 1747. By Michael Hudson-Doyle
-
ffs
- 1748. By Michael Hudson-Doyle
-
ffs^2
- 1749. By Michael Hudson-Doyle
-
stop trying to be cute
- 1750. By Michael Hudson-Doyle
-
i h8te shell
Michael Hudson-Doyle (mwhudson) wrote : | # |
This works now. New related merge proposals that must be merged first:
https:/
https:/
- 1751. By Michael Hudson-Doyle
-
consistently use tabs for indentation
- 1752. By Michael Hudson-Doyle
-
remove a comment that no longer makes sense
Balint Reczey (rbalint) wrote : | # |
The target Bazaar branch is not active anymore.
Please resubmit the merge proposal against https:/
Steve Langasek (vorlon) wrote : | # |
this all landed in git.
Preview Diff
1 | === modified file 'debian/changelog' |
2 | --- debian/changelog 2018-12-06 11:38:12 +0000 |
3 | +++ debian/changelog 2018-12-09 23:08:48 +0000 |
4 | @@ -1,3 +1,4 @@ |
5 | +<<<<<<< TREE |
6 | livecd-rootfs (2.548) disco; urgency=medium |
7 | |
8 | * Key netplan delegation to NetworkManager on presence of |
9 | @@ -6,6 +7,18 @@ |
10 | |
11 | -- Steve Langasek <steve.langasek@ubuntu.com> Thu, 06 Dec 2018 13:38:09 +0200 |
12 | |
13 | +======= |
14 | +livecd-rootfs (2.548~ppa13) disco; urgency=medium |
15 | + |
16 | + * Changes to kernel handling for live-server: do not include kernel/initrd |
17 | + in filesystem.squashfs but rather install it in a throwaway layer on top |
18 | + of installer.squashfs and fish kernel, initrd and modules out of that with |
19 | + an initrd hook that records kernel metapackage name in /run and mounts |
20 | + /lib/modules from a squashfs on the ISO. |
21 | + |
22 | + -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Fri, 30 Nov 2018 14:13:20 +1300 |
23 | + |
24 | +>>>>>>> MERGE-SOURCE |
25 | livecd-rootfs (2.547) disco; urgency=medium |
26 | |
27 | [ Ćukasz Zemczak ] |
28 | |
29 | === modified file 'live-build/auto/config' |
30 | --- live-build/auto/config 2018-11-28 15:05:24 +0000 |
31 | +++ live-build/auto/config 2018-12-09 23:08:48 +0000 |
32 | @@ -117,12 +117,6 @@ |
33 | esac |
34 | fi |
35 | |
36 | -skip_lb_stage() { |
37 | - STAGE="$1" |
38 | - mkdir -p .build |
39 | - touch ".build/$STAGE" |
40 | -} |
41 | - |
42 | case $IMAGEFORMAT in |
43 | ext2|ext3|ext4) |
44 | OPTS="${OPTS:+$OPTS }--initramfs none --chroot-filesystem $IMAGEFORMAT" |
45 | @@ -145,20 +139,15 @@ |
46 | ;; |
47 | |
48 | plain) |
49 | - INITRAMFS_TYPE=none |
50 | case $PROJECT:${SUBPROJECT:-} in |
51 | ubuntu-server:live) |
52 | - # Stop lb installing casper into filesystem.squashfs |
53 | - # by skipping lb_chroot_live-packages. |
54 | - skip_lb_stage chroot_live-packages |
55 | - INITRAMFS_TYPE=auto |
56 | touch config/universe-enabled |
57 | ;; |
58 | *) |
59 | PREINSTALLED=true |
60 | ;; |
61 | esac |
62 | - OPTS="${OPTS:+$OPTS }--initramfs $INITRAMFS_TYPE --chroot-filesystem $IMAGEFORMAT" |
63 | + OPTS="${OPTS:+$OPTS }--initramfs none --chroot-filesystem $IMAGEFORMAT" |
64 | ;; |
65 | |
66 | ubuntu-image) |
67 | @@ -519,9 +508,6 @@ |
68 | add_task install standard |
69 | add_task install server |
70 | LIVE_TASK='cloud-image' |
71 | - case $ARCH in |
72 | - amd64) add_package live linux-signed-generic ;; |
73 | - esac |
74 | ;; |
75 | esac |
76 | COMPONENTS='main' |
77 | @@ -837,8 +823,6 @@ |
78 | esac |
79 | |
80 | case $PROJECT:${SUBPROJECT:-} in |
81 | - ubuntu-server:live) |
82 | - ;; |
83 | ubuntu-server:*|ubuntu-base:*|ubuntu-touch:*|ubuntu-touch-custom:*) |
84 | OPTS="${OPTS:+$OPTS }--linux-packages=none --initramfs=none" |
85 | KERNEL_FLAVOURS=none |
86 | |
87 | === modified file 'live-build/functions' |
88 | --- live-build/functions 2018-11-13 19:21:19 +0000 |
89 | +++ live-build/functions 2018-12-09 23:08:48 +0000 |
90 | @@ -337,37 +337,6 @@ |
91 | --rename /usr/bin/systemd-detect-virt |
92 | } |
93 | |
94 | -recreate_initramfs() { |
95 | - # Regenerate the initramfs by running update-initramfs in the |
96 | - # chroot at $1 and copying the generated initramfs |
97 | - # around. Beware that this was written for a single use case |
98 | - # (live-server) and may not work in all cases without |
99 | - # tweaking... |
100 | - # config/common must be sourced before calling this function. |
101 | - CHROOT="$1" |
102 | - # Start by cargo culting bits of lb_chroot_hacks: |
103 | - if [ -n "$LB_INITRAMFS_COMPRESSION" ]; then |
104 | - echo "COMPRESS=$LB_INITRAMFS_COMPRESSION" > "$CHROOT"/etc/initramfs-tools/conf.d/livecd-rootfs.conf |
105 | - fi |
106 | - chroot "$CHROOT" sh -c "${UPDATE_INITRAMFS_OPTIONS:-} update-initramfs -k all -t -u" |
107 | - rm -rf "$CHROOT"/etc/initramfs-tools/conf.d/livecd-rootfs.conf |
108 | - # Then bits of lb_binary_linux-image: |
109 | - case "${LB_INITRAMFS}" in |
110 | - casper) |
111 | - DESTDIR="binary/casper" |
112 | - ;; |
113 | - |
114 | - live-boot) |
115 | - DESTDIR="binary/live" |
116 | - ;; |
117 | - |
118 | - *) |
119 | - DESTDIR="binary/boot" |
120 | - ;; |
121 | - esac |
122 | - mv "$CHROOT"/boot/initrd.img-* $DESTDIR |
123 | -} |
124 | - |
125 | release_ver() { |
126 | # Return the release version number |
127 | distro-info --series="$LB_DISTRIBUTION" -r | awk '{ print $1 }' |
128 | |
129 | === modified file 'live-build/ubuntu-server/hooks/032-installer-squashfs.binary' |
130 | --- live-build/ubuntu-server/hooks/032-installer-squashfs.binary 2018-11-12 20:39:25 +0000 |
131 | +++ live-build/ubuntu-server/hooks/032-installer-squashfs.binary 2018-12-09 23:08:48 +0000 |
132 | @@ -24,13 +24,14 @@ |
133 | . config/functions |
134 | . config/common |
135 | |
136 | -SQUASH_ROOT=binary/boot/squashfs.dir |
137 | +FILESYSTEM_ROOT=binary/boot/squashfs.dir |
138 | +INSTALLER_ROOT=binary/boot/installer.squashfs.dir |
139 | OVERLAY_ROOT=binary/overlay |
140 | |
141 | -mkdir -p "$OVERLAY_ROOT" |
142 | +mkdir -p "$INSTALLER_ROOT" "$OVERLAY_ROOT" |
143 | |
144 | # Create an installer squashfs layer |
145 | -mount_overlay "$SQUASH_ROOT/" "$OVERLAY_ROOT/" "$SQUASH_ROOT/" |
146 | +mount_overlay "$FILESYSTEM_ROOT/" "$OVERLAY_ROOT/" "$INSTALLER_ROOT/" |
147 | |
148 | setup_mountpoint binary/boot/squashfs.dir |
149 | |
150 | @@ -40,8 +41,8 @@ |
151 | # It would be better to have this in ../includes.binary/overlay but |
152 | # you can't have backslashes in filenames in bzr branches! |
153 | DEVICE_UNIT_NAME='dev-disk-by\x2duuid-00c629d6\x2d06ab\x2d4dfd\x2db21e\x2dc3186f34105d.device' |
154 | -mkdir -p "$SQUASH_ROOT/etc/systemd/system/$DEVICE_UNIT_NAME.d" |
155 | -cat > "$SQUASH_ROOT/etc/systemd/system/$DEVICE_UNIT_NAME.d/override.conf" <<EOF |
156 | +mkdir -p "$INSTALLER_ROOT/etc/systemd/system/$DEVICE_UNIT_NAME.d" |
157 | +cat > "$INSTALLER_ROOT/etc/systemd/system/$DEVICE_UNIT_NAME.d/override.conf" <<EOF |
158 | [Unit] |
159 | JobRunningTimeoutSec=0s |
160 | EOF |
161 | @@ -50,22 +51,19 @@ |
162 | |
163 | # Install any requirements for the installer, for things we don't want |
164 | # to see on the installed system |
165 | -chroot $SQUASH_ROOT apt-get update |
166 | -chroot $SQUASH_ROOT apt-get -y install user-setup curtin lupin-casper |
167 | +chroot $INSTALLER_ROOT apt-get update |
168 | +chroot $INSTALLER_ROOT apt-get -y install user-setup curtin lupin-casper |
169 | |
170 | # For bug #1743643 "Install to dirty disk with swap fails" remove the |
171 | # "helpful" casper script that mounts any swap partitions it finds. |
172 | -rm -f $SQUASH_ROOT/usr/share/initramfs-tools/scripts/casper-bottom/*swap |
173 | - |
174 | -# Installing casper means we need a new initramfs |
175 | -UPDATE_INITRAMFS_OPTIONS=CASPER_GENERATE_UUID=1 recreate_initramfs $SQUASH_ROOT |
176 | +rm -f $INSTALLER_ROOT/usr/share/initramfs-tools/scripts/casper-bottom/*swap |
177 | |
178 | # Don't let cloud-init run in the live session. |
179 | -touch $SQUASH_ROOT/etc/cloud/cloud-init.disabled |
180 | +touch $INSTALLER_ROOT/etc/cloud/cloud-init.disabled |
181 | |
182 | # Do the snap seeding dance. |
183 | -chroot $SQUASH_ROOT mkdir -p /var/lib/snapd/seed/snaps /var/lib/snapd/seed/assertions |
184 | -chroot $SQUASH_ROOT sh -c ' |
185 | +chroot $INSTALLER_ROOT mkdir -p /var/lib/snapd/seed/snaps /var/lib/snapd/seed/assertions |
186 | +chroot $INSTALLER_ROOT sh -c ' |
187 | set -x; |
188 | cd /var/lib/snapd/seed; |
189 | sudo SNAPPY_STORE_NO_CDN=1 snap download core; |
190 | @@ -89,10 +87,7 @@ |
191 | EOF |
192 | ' |
193 | |
194 | -teardown_mountpoint "$SQUASH_ROOT" |
195 | - |
196 | -# Then unmount the overlay |
197 | -umount "$SQUASH_ROOT" |
198 | +teardown_mountpoint "$INSTALLER_ROOT" |
199 | |
200 | squashfs_f="${PWD}/livecd.${PROJECT}.installer.squashfs" |
201 | |
202 | |
203 | === added file 'live-build/ubuntu-server/hooks/033-kernel-bits.binary' |
204 | --- live-build/ubuntu-server/hooks/033-kernel-bits.binary 1970-01-01 00:00:00 +0000 |
205 | +++ live-build/ubuntu-server/hooks/033-kernel-bits.binary 2018-12-09 23:08:48 +0000 |
206 | @@ -0,0 +1,94 @@ |
207 | +#!/bin/bash -eux |
208 | +# vi: ts=4 noexpandtab |
209 | +# |
210 | +# Generate a squashfs root and manifest |
211 | + |
212 | +echo "033-kernel-bits.binary" |
213 | + |
214 | +case ${IMAGE_TARGETS-} in |
215 | + ""|*squashfs*) |
216 | + ;; |
217 | + *) |
218 | + echo "Skipping squashfs build" |
219 | + exit 0 |
220 | + ;; |
221 | +esac |
222 | + |
223 | +if [ -n "${SUBARCH-}" ]; then |
224 | + echo "Skipping rootfs build for subarch flavor build" |
225 | + exit 0 |
226 | +fi |
227 | + |
228 | +. config/functions |
229 | +. config/common |
230 | + |
231 | +INSTALLER_ROOT=binary/boot/installer.squashfs.dir |
232 | + |
233 | +KERNEL_BITS_ROOT=binary/boot/kernel-bits.dir |
234 | +KERNEL_BITS_OVERLAY=binary/boot/overlay-kernel-bits |
235 | + |
236 | +#variants='ga hwe' |
237 | +variants='ga' |
238 | + |
239 | +for variant in $variants; do |
240 | + if [ "$variant" = "ga" ]; then |
241 | + kernel_metapkg=linux-generic |
242 | + modules_squashfs_f=modules.squashfs |
243 | + initrd_f=initrd-generic |
244 | + kernel_f=kernel-generic |
245 | + elif [ "$variant" = "hwe" ]; then |
246 | + kernel_metapkg=linux-generic-hwe-$(lsb_release -sc) |
247 | + modules_squashfs_f=modules-hwe.squashfs |
248 | + initrd_f=initrd-generic-hwe |
249 | + kernel_f=kernel-generic-hwe |
250 | + else |
251 | + echo "bogus variant: $variant" |
252 | + exit 1 |
253 | + fi |
254 | + |
255 | + # Make preparations |
256 | + mkdir -p $KERNEL_BITS_ROOT $KERNEL_BITS_OVERLAY |
257 | + mount_overlay "$INSTALLER_ROOT/" "$KERNEL_BITS_OVERLAY/" "$KERNEL_BITS_ROOT/" |
258 | + setup_mountpoint $KERNEL_BITS_ROOT |
259 | + |
260 | + # Our initramfs hook implements a kind of extreme version of |
261 | + # cloud-initramfs-copymods, so remove that and prevent duelling hooks |
262 | + env DEBIAN_FRONTEND=noninteractive chroot $KERNEL_BITS_ROOT apt-get -y remove cloud-initramfs-copymods ubuntu-server || true |
263 | + |
264 | + # Configure initramfs creation |
265 | + if [ -n "$LB_INITRAMFS_COMPRESSION" ]; then |
266 | + echo "COMPRESS=$LB_INITRAMFS_COMPRESSION" > "$KERNEL_BITS_ROOT"/etc/initramfs-tools/conf.d/livecd-rootfs.conf |
267 | + fi |
268 | + echo "CASPER_GENERATE_UUID=1" > "$KERNEL_BITS_ROOT"/etc/initramfs-tools/conf.d/casper.conf |
269 | + |
270 | + # Add a hook to record which kernel was booted and mount the |
271 | + # modules.squashfs created below. |
272 | + cat <<EOF > "$KERNEL_BITS_ROOT"/etc/initramfs-tools/scripts/init-bottom/live-server |
273 | +#!/bin/sh |
274 | +case \$1 in |
275 | +prereqs) exit 0;; |
276 | +esac |
277 | + |
278 | +echo ${kernel_metapkg} > /run/kernel-meta-package |
279 | +mkdir -p \$rootmnt/lib/modules |
280 | +mount \$rootmnt/cdrom/casper/extras/$modules_squashfs_f \$rootmnt/lib/modules |
281 | +EOF |
282 | + chmod +x "$KERNEL_BITS_ROOT"/etc/initramfs-tools/scripts/init-bottom/live-server |
283 | + |
284 | + # Install the kernel! |
285 | + env DEBIAN_FRONTEND=noninteractive chroot $KERNEL_BITS_ROOT apt-get -y install ${kernel_metapkg} |
286 | + |
287 | + # Fish out generated kernel image and initrd |
288 | + mv "$KERNEL_BITS_ROOT"/boot/initrd.img-* ${PWD}/livecd.${PROJECT}.$initrd_f |
289 | + mv "$KERNEL_BITS_ROOT"/boot/vmlinu?-* ${PWD}/livecd.${PROJECT}.$kernel_f |
290 | + |
291 | + # Create squashfs containing all the modules |
292 | + modules_squashfs_path="${PWD}/livecd.${PROJECT}.$modules_squashfs_f" |
293 | + (cd "$KERNEL_BITS_ROOT/lib/modules" && |
294 | + mksquashfs . $modules_squashfs_path -no-progress -xattrs -comp xz) |
295 | + |
296 | + # And clean up |
297 | + teardown_mountpoint $KERNEL_BITS_ROOT |
298 | + umount $KERNEL_BITS_ROOT |
299 | + rm -rf $KERNEL_BITS_ROOT $KERNEL_BITS_OVERLAY |
300 | +done |
Pushed some small tweaks.