Merge lp:~oem-solutions-releng/live-build/lb-sg-2.x-add-ext4-support into lp:~ce-infrastructure/live-build/lb-sg-2.x

Proposed by Timothy R. Chavez
Status: Merged
Merge reported by: Timothy R. Chavez
Merged at revision: not available
Proposed branch: lp:~oem-solutions-releng/live-build/lb-sg-2.x-add-ext4-support
Merge into: lp:~ce-infrastructure/live-build/lb-sg-2.x
Diff against target: 117 lines (+54/-7)
3 files modified
debian/changelog (+8/-1)
scripts/build/lb_binary_rootfs (+45/-5)
scripts/build/lb_config (+1/-1)
To merge this branch: bzr merge lp:~oem-solutions-releng/live-build/lb-sg-2.x-add-ext4-support
Reviewer Review Type Date Requested Status
Nicola Heald (community) Approve
Review via email: mp+150727@code.launchpad.net

Description of the change

Gives projects the ability to use ext4 (and implicitly ext3) filesystems via the LB_CHROOT_FILESYSTEM config setting.

To post a comment you must log in.
Revision history for this message
Nicola Heald (notnownikki) wrote :

Looks good to me, generated an ext4 fs when I tried it, so +1

review: Approve

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 2013-02-26 17:39:22 +0000
3+++ debian/changelog 2013-02-27 06:33:20 +0000
4@@ -1,10 +1,17 @@
5 live-build (2.0.12-2cesg14) lucid; urgency=low
6
7+ [ Mike Heald ]
8 * scripts/build/lb_binary_zsync
9 - Backported from live-build 3.x and added support for virtual-hdd, net, and tar
10 binary images
11
12- -- Mike Heald <mike.heald@canonical.com> Tue, 26 Feb 2013 16:46:46 -0000
13+ [ Timothy Chavez ]
14+ * scripts/build/lb_binary_rootfs:
15+ - Added ext4 support by backporting it from 3.0.1-1
16+ * scripts/build/lb_config:
17+ - Added ext4 to --chroot-filesystem options list
18+
19+ -- Timothy Chavez <timothy.chavez@canonical.com> Wed, 27 Feb 2013 06:14:30 +0000
20
21 live-build (2.0.12-2cesg13) lucid; urgency=low
22
23
24=== modified file 'scripts/build/lb_binary_rootfs'
25--- scripts/build/lb_binary_rootfs 2011-05-30 18:27:29 +0000
26+++ scripts/build/lb_binary_rootfs 2013-02-27 06:33:20 +0000
27@@ -79,9 +79,9 @@
28 done
29
30 case "${LB_CHROOT_FILESYSTEM}" in
31- ext2|ext3)
32+ ext2|ext3|ext4)
33 # Checking depends
34- Check_package chroot/usr/bin/genext2fs genext2fs
35+ Check_package chroot/sbin/mkfs.${LB_CHROOT_FILESYSTEM} e2fsprogs
36
37 # Restoring cache
38 Restore_cache cache/packages_binary
39@@ -95,14 +95,46 @@
40 rm -f binary/${INITFS}/filesystem.${LB_CHROOT_FILESYSTEM}
41 fi
42
43- DU_DIM="$(du -ks chroot/chroot | cut -f1)"
44+ case "${LB_BUILD_WITH_CHROOT}" in
45+ true)
46+ DU_DIM="$(du -ms chroot/chroot | cut -f1)"
47+ INODES="$(find chroot/chroot | wc -l)"
48+ ;;
49+
50+ false)
51+ DU_DIM="$(du -ms chroot | cut -f1)"
52+ INODES="$(find chroot | wc -l)"
53+ ;;
54+ esac
55+
56 REAL_DIM="$(Calculate_partition_size ${DU_DIM} ${LB_CHROOT_FILESYSTEM})"
57+ REAL_INODES="$(Calculate_partition_size ${INODES} ${LB_CHROOT_FILESYSTEM})"
58
59 RESERVED_PERCENTAGE="--reserved-percentage"
60
61 case "${LB_BUILD_WITH_CHROOT}" in
62 true)
63- Chroot chroot "genext2fs --size-in-blocks=${REAL_DIM} ${RESERVED_PERCENTAGE}=0 --root=chroot filesystem.${LB_CHROOT_FILESYSTEM}"
64+ dd if=/dev/zero of=chroot/filesystem.${LB_CHROOT_FILESYSTEM} bs=1024k count=0 seek=${REAL_DIM}
65+
66+ if ! Chroot chroot "test -s /etc/mtab"
67+ then
68+ Chroot chroot "ln -s /proc/mounts/mtab /etc/mtab"
69+ FAKE_MTAB="true"
70+ fi
71+
72+ Chroot chroot "mkfs.${LB_CHROOT_FILESYSTEM} -F -b 1024 -N ${REAL_INODES} -m 0 filesystem.${LB_CHROOT_FILESYSTEM}"
73+
74+ mkdir -p filesystem.tmp
75+ ${LB_ROOT_COMMAND} mount -o loop chroot/filesystem.${LB_CHROOT_FILESYSTEM} filesystem.tmp
76+ cp -a chroot/chroot/* filesystem.tmp
77+
78+ if [ "${FAKE_MTAB}" = "true" ]
79+ then
80+ Chroot chroot "rm -f /etc/mtab"
81+ fi
82+
83+ ${LB_ROOT_COMMAND} umount filesystem.tmp
84+ rmdir filesystem.tmp
85
86 # Move image
87 mv chroot/filesystem.${LB_CHROOT_FILESYSTEM} binary/${INITFS}
88@@ -161,7 +193,15 @@
89 ;;
90
91 false)
92- genext2fs --size-in-blocks=${REAL_DIM} ${RESERVED_PERCENTAGE}=0 --root=chroot binary/${INITFS}/filesystem.${LB_CHROOT_FILESYSTEM}
93+ dd if=/dev/zero of=binary/${INITFS}/filesystem.${LB_CHROOT_FILESYSTEM} bs=1024k count=0 seek=${REAL_DIM}
94+ mkfs.${LB_CHROOT_FILESYSTEM} -F -b 1024 -N ${REAL_INODES} -m 0 binary/${INITFS}/filesystem.${LB_CHROOT_FILESYSTEM}
95+
96+ mkdir -p filesystem.tmp
97+ ${LB_ROOT_COMMAND} mount -o loop binary/${INITFS}/filesystem.${LB_CHROOT_FILESYSTEM} filesystem.tmp
98+ cp -a chroot/* filesystem.tmp
99+
100+ ${LB_ROOT_COMMAND} umount filesystem.tmp
101+ rmdir filesystem.tmp
102 ;;
103 esac
104
105
106=== modified file 'scripts/build/lb_config'
107--- scripts/build/lb_config 2013-02-22 17:38:29 +0000
108+++ scripts/build/lb_config 2013-02-27 06:33:20 +0000
109@@ -57,7 +57,7 @@
110 \t [--compression bzip2|gzip|xz|none]\n\
111 \t [--zsync true|false]\n\
112 \t [--build-with-chroot true|false]\n\
113-\t [--chroot-filesystem ext2|ext3|squashfs|plain|jffs2]\n\
114+\t [--chroot-filesystem ext2|ext3|ext4|squashfs|plain|jffs2]\n\
115 \t [--clean]\n\
116 \t [-c|--conffile FILE]\n\
117 \t [--debconf-frontend dialog|editor|noninteractive|readline]\n\

Subscribers

People subscribed via source and target branches