[meta-ti] [PATCH v3 1/3] sdcard_image: rewrote to avoid using loopback and mount/unmount

Koen Kooi koen at dominion.thruhere.net
Thu Dec 15 23:39:05 PST 2011


Op 15 dec. 2011, om 16:05 heeft Otavio Salvador het volgende geschreven:

> Allow generation by regular users without fancy setup requirements and
> use of loopback and mount/unmount. Besides, this also includes
> following improvements:
> 
> * use of megabytes when specifying SDIMG_SIZE
> * remove restriction of filesystem to rootfs
> 
> Images that use this class needs to generate the rootfs filesystem and
> set ROOTFS variable according.
> 
> Signed-off-by: Otavio Salvador <otavio at ossystems.com.br>
> ---
> classes/sdcard_image.bbclass |  180 +++++++++++++++---------------------------
> 1 files changed, 63 insertions(+), 117 deletions(-)
> 
> diff --git a/classes/sdcard_image.bbclass b/classes/sdcard_image.bbclass
> 
> +	dd if=/dev/zero of=${SDIMG} bs=$(expr 1000 \* 1000) count=${SDIMG_SIZE}
> +
> +	# Create the boot filesystem
> +	BOOT_OFFSET=32256
> +	BOOT_BLOCKS=$(du -bks $TMP/boot | cut -f 1)
> +	BOOT_SIZE=$(expr $BOOT_BLOCKS + ${BOOTDD_EXTRA_SPACE})
> +	mkfs.vfat -n ${BOOTDD_VOLUME_ID} -d $TMP/boot -C $TMP/boot.img $BOOT_SIZE

This should probably switch to  using mcopy + dosfsck like the OE core patches Darren posted

> +	# Create partition table
> +	END1=$(expr $BOOT_SIZE \* 1024)
> +	END2=$(expr $END1 + 512)
> +	parted -s ${SDIMG} mklabel msdos
> +	parted -s ${SDIMG} mkpart primary fat16 ${BOOT_OFFSET}B ${END1}B
> +	parted -s ${SDIMG} mkpart primary ext3 ${END2}B 100%
> +	parted -s ${SDIMG} set 1 boot on
> +	parted ${SDIMG} print
> +
> +	OFFSET1=$(expr $BOOT_OFFSET / 512)
> +	OFFSET2=$(expr $END2 / 512)
> +	dd if=$TMP/boot.img of=${SDIMG} conv=notrunc seek=$OFFSET1 bs=512
> +	dd if=${ROOTFS} of=${SDIMG} conv=notrunc seek=$OFFSET2 bs=512

Do you know if fsck will work on the loop devices properly? At least ext4 needs an fsck pass to add dirhashes.

regards,

Koen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 163 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.yoctoproject.org/pipermail/meta-ti/attachments/20111216/5fe9b661/attachment.pgp>


More information about the meta-ti mailing list