diff options
author | Robert Yang <liezhi.yang@windriver.com> | 2013-08-22 15:54:44 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-08-26 11:50:49 +0100 |
commit | 6a78e22aaede80cd4e0bcbc06b878574766d7b7c (patch) | |
tree | 4c83b4e6831879fd5db8d13ce73a7f2dfb5eee17 /meta/classes | |
parent | 2dfc0e1cc72491d24536792d4bc1d5f978634671 (diff) | |
download | poky-6a78e22aaede80cd4e0bcbc06b878574766d7b7c.tar.gz |
image_types.bbclass: replace genext2fs with populate-extfs.sh
* The benefits:
- Really support ext4
- Support the sparse file (we lost the sparse file in the image in the
past, the sparse file became into the common file)
- Fix the error reported by fsck: (ext2/ext3)
Inode 1025, i_size is 16384, should be 17408.
- Have a uniform code for ext2/3/4 generation
* Comments from Darren Hart:
Basically, genext2fs doesn't support creating ext4 filesystems. It
creates, as I understand it, an ext2 filesystem, then adds a journal,
and sets some bits. It can't support the newer features like extents. So
what we end up with is a bit of a hack for a filesystem.
The ext tools (e2fsprogs) unfortunately don't provide an integrated
solution for generating prepopulated filesystem images as many other
mkfs* tools do. One thing missing was symlink support in libext2fs. I
added that support and demonstrated a script which uses the e2fsprogs
debugfs tool that can populate the newly formatted filesystem from a
directory and without root privileges.
[YOCTO #3848]
(From OE-Core rev: 40c3e18f43b2f074cec97d21aeb8d21f26dd5048)
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/image_types.bbclass | 46 |
1 files changed, 18 insertions, 28 deletions
diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass index 0e5a9a8600..c168ed50e6 100644 --- a/meta/classes/image_types.bbclass +++ b/meta/classes/image_types.bbclass | |||
@@ -141,34 +141,24 @@ IMAGE_CMD_sum.jffs2 = "${IMAGE_CMD_jffs2} && sumtool -i ${DEPLOY_DIR_IMAGE}/${IM | |||
141 | 141 | ||
142 | IMAGE_CMD_cramfs = "mkcramfs ${IMAGE_ROOTFS} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cramfs ${EXTRA_IMAGECMD}" | 142 | IMAGE_CMD_cramfs = "mkcramfs ${IMAGE_ROOTFS} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cramfs ${EXTRA_IMAGECMD}" |
143 | 143 | ||
144 | IMAGE_CMD_ext2 () { | 144 | oe_mkext234fs () { |
145 | rm -rf ${DEPLOY_DIR_IMAGE}/tmp.gz-${PN} && mkdir ${DEPLOY_DIR_IMAGE}/tmp.gz-${PN} | 145 | fstype=$1 |
146 | genext2fs -b $ROOTFS_SIZE -d ${IMAGE_ROOTFS} ${EXTRA_IMAGECMD} ${DEPLOY_DIR_IMAGE}/tmp.gz-${PN}/${IMAGE_NAME}.rootfs.ext2 | 146 | extra_imagecmd="" |
147 | mv ${DEPLOY_DIR_IMAGE}/tmp.gz-${PN}/${IMAGE_NAME}.rootfs.ext2 ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext2 | ||
148 | rmdir ${DEPLOY_DIR_IMAGE}/tmp.gz-${PN} | ||
149 | } | ||
150 | 147 | ||
151 | IMAGE_CMD_ext3 () { | 148 | if [ $# -gt 1 ]; then |
152 | genext2fs -b $ROOTFS_SIZE -d ${IMAGE_ROOTFS} ${EXTRA_IMAGECMD} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext3 | 149 | shift |
153 | tune2fs -j ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext3 | 150 | extra_imagecmd=$@ |
154 | } | 151 | fi |
155 | 152 | ||
156 | oe_mkext4fs () { | 153 | # Create a sparse image block |
157 | genext2fs -b $ROOTFS_SIZE -d ${IMAGE_ROOTFS} ${EXTRA_IMAGECMD} $1 | 154 | dd if=/dev/zero of=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.$fstype seek=$ROOTFS_SIZE count=0 bs=1k |
158 | tune2fs -O extents,uninit_bg,dir_index,has_journal,filetype $1 | 155 | mkfs.$fstype -F $extra_imagecmd ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.$fstype |
159 | e2fsck -yfDC0 $1 || chk=$? | 156 | populate-extfs.sh ${IMAGE_ROOTFS} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.$fstype |
160 | case $chk in | ||
161 | 0|1|2) | ||
162 | ;; | ||
163 | *) | ||
164 | return $chk | ||
165 | ;; | ||
166 | esac | ||
167 | } | 157 | } |
168 | 158 | ||
169 | IMAGE_CMD_ext4 () { | 159 | IMAGE_CMD_ext2 = "oe_mkext234fs ext2 ${EXTRA_IMAGECMD}" |
170 | oe_mkext4fs ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext4 | 160 | IMAGE_CMD_ext3 = "oe_mkext234fs ext3 ${EXTRA_IMAGECMD}" |
171 | } | 161 | IMAGE_CMD_ext4 = "oe_mkext234fs ext4 ${EXTRA_IMAGECMD}" |
172 | 162 | ||
173 | IMAGE_CMD_btrfs () { | 163 | IMAGE_CMD_btrfs () { |
174 | mkfs.btrfs -b `expr ${ROOTFS_SIZE} \* 1024` ${EXTRA_IMAGECMD} -r ${IMAGE_ROOTFS} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.btrfs | 164 | mkfs.btrfs -b `expr ${ROOTFS_SIZE} \* 1024` ${EXTRA_IMAGECMD} -r ${IMAGE_ROOTFS} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.btrfs |
@@ -218,7 +208,7 @@ JFFS2_ENDIANNESS ?= "${@base_conditional('SITEINFO_ENDIANNESS', 'le', '--little- | |||
218 | JFFS2_ERASEBLOCK ?= "0x40000" | 208 | JFFS2_ERASEBLOCK ?= "0x40000" |
219 | EXTRA_IMAGECMD_jffs2 ?= "--pad ${JFFS2_ENDIANNESS} --eraseblock=${JFFS2_ERASEBLOCK} --no-cleanmarkers" | 209 | EXTRA_IMAGECMD_jffs2 ?= "--pad ${JFFS2_ENDIANNESS} --eraseblock=${JFFS2_ERASEBLOCK} --no-cleanmarkers" |
220 | 210 | ||
221 | # Change these if you want default genext2fs behavior (i.e. create minimal inode number) | 211 | # Change these if you want default mkfs behavior (i.e. create minimal inode number) |
222 | EXTRA_IMAGECMD_ext2 ?= "-i 8192" | 212 | EXTRA_IMAGECMD_ext2 ?= "-i 8192" |
223 | EXTRA_IMAGECMD_ext3 ?= "-i 8192" | 213 | EXTRA_IMAGECMD_ext3 ?= "-i 8192" |
224 | EXTRA_IMAGECMD_ext4 ?= "-i 8192" | 214 | EXTRA_IMAGECMD_ext4 ?= "-i 8192" |
@@ -229,9 +219,9 @@ IMAGE_DEPENDS = "" | |||
229 | IMAGE_DEPENDS_jffs2 = "mtd-utils-native" | 219 | IMAGE_DEPENDS_jffs2 = "mtd-utils-native" |
230 | IMAGE_DEPENDS_sum.jffs2 = "mtd-utils-native" | 220 | IMAGE_DEPENDS_sum.jffs2 = "mtd-utils-native" |
231 | IMAGE_DEPENDS_cramfs = "cramfs-native" | 221 | IMAGE_DEPENDS_cramfs = "cramfs-native" |
232 | IMAGE_DEPENDS_ext2 = "genext2fs-native" | 222 | IMAGE_DEPENDS_ext2 = "e2fsprogs-native" |
233 | IMAGE_DEPENDS_ext3 = "genext2fs-native e2fsprogs-native" | 223 | IMAGE_DEPENDS_ext3 = "e2fsprogs-native" |
234 | IMAGE_DEPENDS_ext4 = "genext2fs-native e2fsprogs-native" | 224 | IMAGE_DEPENDS_ext4 = "e2fsprogs-native" |
235 | IMAGE_DEPENDS_btrfs = "btrfs-tools-native" | 225 | IMAGE_DEPENDS_btrfs = "btrfs-tools-native" |
236 | IMAGE_DEPENDS_squashfs = "squashfs-tools-native" | 226 | IMAGE_DEPENDS_squashfs = "squashfs-tools-native" |
237 | IMAGE_DEPENDS_squashfs-xz = "squashfs-tools-native" | 227 | IMAGE_DEPENDS_squashfs-xz = "squashfs-tools-native" |