diff options
author | Koen Kooi <koen@dominion.thruhere.net> | 2011-11-07 18:07:55 +0100 |
---|---|---|
committer | Koen Kooi <koen@dominion.thruhere.net> | 2011-11-07 18:07:55 +0100 |
commit | d51ebcf4b4a368fa7cc9b35518a2480fd60fd448 (patch) | |
tree | ff405573d7566808938ec0cf456b8e1a0f9043cc | |
parent | bea48dbf4fa253dd360bcab975a90de009465f27 (diff) | |
download | meta-ti-d51ebcf4b4a368fa7cc9b35518a2480fd60fd448.tar.gz |
sdcard_image bbclass: add proper ext4 support, fix inode calculations, etc, etc
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
-rw-r--r-- | classes/sdcard_image.bbclass | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/classes/sdcard_image.bbclass b/classes/sdcard_image.bbclass index 96288ba2..1737ed9f 100644 --- a/classes/sdcard_image.bbclass +++ b/classes/sdcard_image.bbclass | |||
@@ -15,6 +15,9 @@ LOOPDEV_FS ?= "/dev/loop3" | |||
15 | # Default to 4GiB images | 15 | # Default to 4GiB images |
16 | SDIMG_SIZE ?= "444" | 16 | SDIMG_SIZE ?= "444" |
17 | 17 | ||
18 | # FS type for rootfs | ||
19 | ROOTFSTYPE ?= "ext3" | ||
20 | |||
18 | BOOTPARTNAME_beaglebone = "BEAGLE_BONE" | 21 | BOOTPARTNAME_beaglebone = "BEAGLE_BONE" |
19 | BOOTPARTNAME ?= "${MACHINE}" | 22 | BOOTPARTNAME ?= "${MACHINE}" |
20 | 23 | ||
@@ -119,22 +122,32 @@ IMAGE_CMD_sdimg () { | |||
119 | umount ${WORKDIR}/tmp-mnt-boot | 122 | umount ${WORKDIR}/tmp-mnt-boot |
120 | ${LOSETUP} -d ${LOOPDEV_BOOT} || true | 123 | ${LOSETUP} -d ${LOOPDEV_BOOT} || true |
121 | 124 | ||
122 | # Prepare ext3 parition | 125 | # Prepare rootfs parition |
123 | echo "Creating ext3 loopback" | 126 | echo "Creating rootfs loopback" |
124 | ${LOSETUP} ${LOOPDEV_FS} ${SDIMG} -o ${FS_OFFSET} | 127 | ${LOSETUP} ${LOOPDEV_FS} ${SDIMG} -o ${FS_OFFSET} |
125 | 128 | ||
126 | # should use fdisk info | 129 | # should use fdisk info |
127 | echo "Creating ext3 image" | 130 | echo "Creating rootfs image" |
128 | touch ${WORKDIR}/${IMAGE_NAME}.rootfs.ext3 | 131 | touch ${WORKDIR}/${IMAGE_NAME}.rootfs.img |
129 | # lots of small files, so use 8k per inode, not 64k | 132 | |
130 | genext2fs -i 4096 -b $FS_SIZE_BLOCKS -d ${IMAGE_ROOTFS} ${WORKDIR}/${IMAGE_NAME}.rootfs.ext3 | 133 | FS_NUM_INODES=$(echo $FS_SIZE_BLOCKS / 4 | bc) |
131 | tune2fs -L ${IMAGE_NAME} -j ${WORKDIR}/${IMAGE_NAME}.rootfs.ext3 | 134 | |
132 | 135 | case "${ROOTFSTYPE}" in | |
133 | #ext4 support | 136 | ext3) |
134 | #cp ${WORKDIR}/${IMAGE_NAME}.rootfs.ext3 ${WORKDIR}/${IMAGE_NAME}.rootfs.ext4 | 137 | genext2fs -z -N $FS_NUM_INODES -b $FS_SIZE_BLOCKS -d ${IMAGE_ROOTFS} ${WORKDIR}/${IMAGE_NAME}.rootfs.img |
135 | #tune2fs -O extents,uninit_bg,dir_index ${WORKDIR}/${IMAGE_NAME}.rootfs.ext4 | 138 | tune2fs -L ${IMAGE_NAME} -j ${WORKDIR}/${IMAGE_NAME}.rootfs.img |
136 | 139 | ;; | |
137 | dd if=${WORKDIR}/${IMAGE_NAME}.rootfs.ext3 of=${LOOPDEV_FS} | 140 | ext4) |
141 | genext2fs -z -N $FS_NUM_INODES -b $FS_SIZE_BLOCKS -d ${IMAGE_ROOTFS} ${WORKDIR}/${IMAGE_NAME}.rootfs.img | ||
142 | tune2fs -L ${IMAGE_NAME} -j -O extents,uninit_bg,dir_index ${WORKDIR}/${IMAGE_NAME}.rootfs.img | ||
143 | ;; | ||
144 | *) | ||
145 | echo "Please set ROOTFSTYPE to something supported" | ||
146 | exit 1 | ||
147 | ;; | ||
148 | esac | ||
149 | |||
150 | dd if=${WORKDIR}/${IMAGE_NAME}.rootfs.img of=${LOOPDEV_FS} | ||
138 | 151 | ||
139 | ${LOSETUP} -d ${LOOPDEV_FS} || true | 152 | ${LOSETUP} -d ${LOOPDEV_FS} || true |
140 | 153 | ||