2017-08-21 177 views
1

我正在爲飛思卡爾Variscite VAR-SOM-MX6生成我自己的IMAGE_FSTYPES=sdcard圖像。我已經複製meta-fsl-arm/classes/image_types_fsl.bbclass類並略微修改它,以便有三個分區而不是兩個。我正在尋找包含格式化爲FAT(vfat)的第三個分區,以便可以將文件添加到SD卡上,以便它們不會與引導分區或根文件系統中的文件並排放置。如何爲Variscite爲Yocto sdcard圖像格式化分區iMX6

我已增加的generate_imx_sdcard()功能,我創建新的分區:

generate_imx_sdcard() { 
# Create partition table 
parted -s ${SDCARD} mklabel msdos 
parted -s ${SDCARD} unit KiB mkpart primary fat32 ${IMAGE_ROOTFS_ALIGNMENT} $(expr ${IMAGE_ROOTFS_ALIGNMENT} \+ ${BOOT_SPACE_ALIGNED}) 
parted -s ${SDCARD} unit KiB mkpart primary $(expr ${IMAGE_ROOTFS_ALIGNMENT} \+ ${BOOT_SPACE_ALIGNED}) $(expr ${IMAGE_ROOTFS_ALIGNMENT} \+ ${BOOT_SPACE_ALIGNED} \+ $ROOTFS_SIZE) 
# Line below is the new partition I have added 
parted -s ${SDCARD} unit KiB mkpart primary fat32 $(expr ${IMAGE_ROOTFS_ALIGNMENT} \+ ${BOOT_SPACE_ALIGNED} \+ $ROOTFS_SIZE) $(expr ${IMAGE_ROOTFS_ALIGNMENT} \+ ${BOOT_SPACE_ALIGNED} \+ $ROOTFS_SIZE \+ ${THIRD_PARTITION}) 
parted ${SDCARD} print 

我已經確保了總SD卡側通過包括這一點,在我新的分區大小${THIRD_PARTITION}添加到適應這個總SD卡(設備)的尺寸:

IMAGE_CMD_sdcard() { 
if [ -z "${SDCARD_ROOTFS}" ]; then 
    bberror "SDCARD_ROOTFS is undefined. To use sdcard image from Freescale's BSP it needs to be defined." 
exit 1 
fi 
# Align boot partition and calculate total SD card image size 
BOOT_SPACE_ALIGNED=$(expr ${BOOT_SPACE} + ${IMAGE_ROOTFS_ALIGNMENT} - 1) 
BOOT_SPACE_ALIGNED=$(expr ${BOOT_SPACE_ALIGNED} - ${BOOT_SPACE_ALIGNED} % ${IMAGE_ROOTFS_ALIGNMENT}) 
SDCARD_SIZE=$(expr ${IMAGE_ROOTFS_ALIGNMENT} + ${BOOT_SPACE_ALIGNED} + $ROOTFS_SIZE + ${IMAGE_ROOTFS_ALIGNMENT} + ${THIRD_PARTITION}) 

當我BitBake的我的層和輸出SD卡鏡像刻錄到SD卡中,分區是適當尺寸和可用然而問題/問題,我已是,H我該如何格式化這個新創建的分區?

據我所知,這樣做的常規方法將沿mkfs.vfat -n "Partition Name" /dev/sdd,在那裏我提供一個設備的東西,但我不確定如何去Yocto做這件事,因爲沒有設備標識符,只有${SDCARD}變量。我知道,如果分區被格式化爲ext4文件系統,那麼可以提供偏移量來進行格式化,但是如果我想將其格式化爲vfat,則似乎沒有辦法做到這一點。

任何幫助將不勝感激。

回答

0

從我的角度來看,image_types_fsl.bbclass用於生成SD卡圖像的方式並不複雜,如果要編輯它,則容易出錯。

我建議你使用wic來創建你的圖像。