Merge lp:~robertliu/live-build/lb-sg-2.x into lp:~ce-infrastructure/live-build/lb-sg-2.x

Proposed by Robert Liu
Status: Needs review
Proposed branch: lp:~robertliu/live-build/lb-sg-2.x
Merge into: lp:~ce-infrastructure/live-build/lb-sg-2.x
Diff against target: 94 lines (+55/-3)
3 files modified
debian/changelog (+7/-0)
debian/control (+2/-2)
scripts/build/lb_binary_disk (+46/-1)
To merge this branch: bzr merge lp:~robertliu/live-build/lb-sg-2.x
Reviewer Review Type Date Requested Status
CE Infrastructure Pending
Review via email: mp+351960@code.launchpad.net

Description of the change

Now intel-microcode and amd64-microcode are the depends of linux-*-image-*, and they will cause the initrd become a composite file, i.e. contains two archives in single initrd. So we need to detect if the initrd is a composite one and split the archives accordingly.

This proposed method is originally from lsinitramfs, and rewrite to fulfill the needs of live-build

Please note we still need to modify a hook (binary_local-hooks/85recompress-initrd) of bugsy-config to avoid problems when generating initrd.lz for the final ISO image.

To post a comment you must log in.
Revision history for this message
Tim Chen (timchen119) wrote :

LGTM, some comments below.

lp:~robertliu/live-build/lb-sg-2.x updated
1634. By Robert Liu

Move series to trusty

Revision history for this message
Bin Li (binli) wrote :

I will test it, I met issue on 4.15 and latest oem kernel.

Revision history for this message
Bin Li (binli) wrote :

@Robert,

 Do you know why 'IUCODE_TOOL_INITRAMFS=no' in /etc/default/intel-microcode can't work in latest kernel? I worked before, XD.

Revision history for this message
Robert Liu (robertliu) wrote :

@Bin,
In recent days, there is a similar updates from amd64-microcode package. You need to modify /etc/default/amd64-microcode as well.

Revision history for this message
Robert Liu (robertliu) wrote :
Revision history for this message
Bin Li (binli) wrote :

Robert,

 Got it, thanks a lot!

Revision history for this message
Bin Li (binli) wrote :

I tried in sutton project, the image could be built successfully, but when we install from U disk, we found kernel panic with the 1032-oem kernel.

Initramfs unpacking failed: junk in compressed archive.
...
VFS: unable to mount root fs on unknown-block(1,0)

I doubt it's related to the initramfs.

Revision history for this message
Robert Liu (robertliu) wrote :

@Bin,
Do you have this patch in your bugsy-config?
I'm sure that without the patch, you will meet boot issues.

https://git.launchpad.net/~oem-solutions-engineers/carson/+git/carson-sanbernardino-xenial-amd64/commit/?id=9051f058b3d91205d5949327c43e3f5f8f7807af

Revision history for this message
Bin Li (binli) wrote :

@Robert,

 No we don't use the bugsy-config one, from my understanding your patch for live-build fix this issue, and don't need use it in bugsy-config. XD

Revision history for this message
Robert Liu (robertliu) wrote :

@Bin,
If there is any task processing the initramfs, then we need to rewrite it to make it understand the new format. That's why I change the hook of bugsy-config. The hook is used to re-compress the initramfs into lzma format.

Unmerged revisions

1634. By Robert Liu

Move series to trusty

1633. By Robert Liu

* Add handling for composite initrd.
* Update Vcs-Browser and Vcs-Bzr

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 2017-12-22 03:42:55 +0000
3+++ debian/changelog 2018-08-01 08:37:24 +0000
4@@ -1,3 +1,10 @@
5+live-build (2.0.12-2cesg35) trusty; urgency=medium
6+
7+ * Add handling for composite initrd.
8+ * Update Vcs-Browser and Vcs-Bzr
9+
10+ -- Robert Liu <robert.liu@canonical.com> Tue, 31 Jul 2018 17:04:10 +0800
11+
12 live-build (2.0.12-2cesg34) precise; urgency=medium
13
14 * Support kernel mount option in precise, trusty, artful build machine.
15
16=== modified file 'debian/control'
17--- debian/control 2011-05-30 18:47:54 +0000
18+++ debian/control 2018-08-01 08:37:24 +0000
19@@ -7,8 +7,8 @@
20 Build-Depends: debhelper (>= 7.0.50~)
21 Standards-Version: 3.9.1
22 Homepage: http://live.debian.net/devel/live-build/
23-Vcs-Browser: http://bazaar.launchpad.net/~oem-solutions-releng/live-build/lb-sg-2.x/files
24-Vcs-Bzr: lp:~oem-solutions-releng/live-build/lb-sg-2.x
25+Vcs-Browser: https://launchpad.net/~ce-infrastructure/live-build/lb-sg-2.x
26+Vcs-Bzr: lp:~ce-infrastructure/live-build/lb-sg-2.x
27
28 Package: live-build
29 Architecture: all
30
31=== modified file 'scripts/build/lb_binary_disk'
32--- scripts/build/lb_binary_disk 2011-06-15 21:13:12 +0000
33+++ scripts/build/lb_binary_disk 2018-08-01 08:37:24 +0000
34@@ -83,6 +83,20 @@
35 > binary/.disk/archive_trace
36 fi
37
38+# Read bytes out of a file, checking that they are valid hex digits
39+readhex()
40+{
41+ dd < "$1" bs=1 skip="$2" count="$3" 2> /dev/null | \
42+ LANG=C grep -E "^[0-9A-Fa-f]{$3}\$"
43+}
44+
45+# Check for a zero byte in a file
46+checkzero()
47+{
48+ dd < "$1" bs=1 skip="$2" count=1 2> /dev/null | \
49+ LANG=C grep -q -z '^$'
50+}
51+
52 if [ "${LB_LINUX_PACKAGES}" != "none" ]
53 then
54 case "${LB_INITRAMFS}" in
55@@ -92,7 +106,38 @@
56 mkdir -p uuid
57 cd uuid
58
59- zcat "../${INITRD}" | cpio --quiet -id conf/uuid.conf
60+ # the following codes is from lsinitramfs originally
61+ # copy here to identify if the initrd is a composite
62+ #
63+ # There may be a prepended uncompressed archive. cpio
64+ # won't tell us the true size of this so we have to
65+ # parse the headers and padding ourselves. This is
66+ # very roughly based on linux/lib/earlycpio.c
67+ offset=0
68+ while true; do
69+ if checkzero "../${INITRD}" $offset; then
70+ offset=$((offset + 4))
71+ continue
72+ fi
73+ magic="$(readhex "../${INITRD}" $offset 6)" || break
74+ test $magic = 070701 || test $magic = 070702 || break
75+ namesize=0x$(readhex "../${INITRD}" $((offset + 94)) 8)
76+ filesize=0x$(readhex "../${INITRD}" $((offset + 54)) 8)
77+ offset=$(((offset + 110)))
78+ offset=$(((offset + $namesize + 3) & ~3))
79+ offset=$(((offset + $filesize + 3) & ~3))
80+ done
81+
82+ if [ $offset -ne 0 ]; then
83+ # Extract main archive
84+ subarchive=$(mktemp ${TMPDIR:-/var/tmp}/initrd_XXXXXX)
85+ dd < "../${INITRD}" bs="$offset" skip=1 2> /dev/null \
86+ > $subarchive
87+ zcat $subarchive | cpio --quiet -id conf/uuid.conf
88+ rm -f $subarchive
89+ else
90+ zcat "../${INITRD}" | cpio --quiet -id conf/uuid.conf
91+ fi
92
93 if [ -e conf/uuid.conf ]
94 then

Subscribers

People subscribed via source and target branches