]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/meta-ti-glsdk.git/blobdiff - classes/sdcard_image.bbclass
sdcard_image: Copy user.txt/uEnv.txt if it exists in /boot
[glsdk/meta-ti-glsdk.git] / classes / sdcard_image.bbclass
index 9aed4f846b40391772206f373d9881961c0faf47..2bbf4c47cf61fa6e9f8ae3ccb524fa8080f8dda8 100644 (file)
@@ -7,10 +7,17 @@ IMAGE_FSTYPES_append = " tar.bz2 sdimg"
 LOSETUP ?= "/sbin/losetup"
 
 # Since these need to go in /etc/fstab we can hardcode them
 LOSETUP ?= "/sbin/losetup"
 
 # Since these need to go in /etc/fstab we can hardcode them
+# Since the vars are weakly assigned, you can override them from your local.conf
 LOOPDEV ?= "/dev/loop1"
 LOOPDEV_BOOT ?= "/dev/loop2"
 LOOPDEV_FS ?= "/dev/loop3"
 
 LOOPDEV ?= "/dev/loop1"
 LOOPDEV_BOOT ?= "/dev/loop2"
 LOOPDEV_FS ?= "/dev/loop3"
 
+# Default to 4GiB images, but use 2GiB images for beaglebone
+SDIMG_SIZE ?= "444" 
+SDIMG_SIZE_beaglebone = "222"
+
+BOOTPARTNAME ?= "${MACHINE}"
+
 IMAGE_CMD_sdimg () {
        SDIMG=${WORKDIR}/sd.img
 
 IMAGE_CMD_sdimg () {
        SDIMG=${WORKDIR}/sd.img
 
@@ -28,7 +35,7 @@ IMAGE_CMD_sdimg () {
 
        # If an SD image is already present, reuse and reformat it
        if [ ! -e ${SDIMG} ] ; then
 
        # If an SD image is already present, reuse and reformat it
        if [ ! -e ${SDIMG} ] ; then
-               dd if=/dev/zero of=${SDIMG} bs=$(echo '255 * 63 * 512' | bc) count=444
+               dd if=/dev/zero of=${SDIMG} bs=$(echo '255 * 63 * 512' | bc) count=${SDIMG_SIZE}
        fi
 
        ${LOSETUP} ${LOOPDEV} ${SDIMG}
        fi
 
        ${LOSETUP} ${LOOPDEV} ${SDIMG}
@@ -56,7 +63,7 @@ IMAGE_CMD_sdimg () {
 
        ${LOSETUP} ${LOOPDEV_BOOT} ${SDIMG} -o ${BOOT_OFFSET} 
 
 
        ${LOSETUP} ${LOOPDEV_BOOT} ${SDIMG} -o ${BOOT_OFFSET} 
 
-       /sbin/mkfs.msdos ${LOOPDEV_BOOT} -n boot $LOOPDEV_BLOCKS
+       /sbin/mkfs.msdos ${LOOPDEV_BOOT} -n ${BOOTPARTNAME} $LOOPDEV_BLOCKS
 
        # Prepare filesystem partition
        # Copy ubi used by flashing scripts
 
        # Prepare filesystem partition
        # Copy ubi used by flashing scripts
@@ -85,8 +92,10 @@ IMAGE_CMD_sdimg () {
                suffix=bin
        fi
 
                suffix=bin
        fi
 
+       cp -v ${IMAGE_ROOTFS}/boot/{user.txt,uEnv.txt} ${WORKDIR}/tmp-mnt-boot || true
+
        if [ -e ${IMAGE_ROOTFS}/boot/u-boot.$suffix ] ; then
        if [ -e ${IMAGE_ROOTFS}/boot/u-boot.$suffix ] ; then
-               cp -v ${IMAGE_ROOTFS}/boot/{u-boot.$suffix,user.txt,uEnv.txt} ${WORKDIR}/tmp-mnt-boot || true
+               cp -v ${IMAGE_ROOTFS}/boot/{u-boot.$suffix} ${WORKDIR}/tmp-mnt-boot || true
        else
                cp -v ${DEPLOY_DIR_IMAGE}/u-boot-${MACHINE}.$suffix ${WORKDIR}/tmp-mnt-boot/u-boot.$suffix 
        fi
        else
                cp -v ${DEPLOY_DIR_IMAGE}/u-boot-${MACHINE}.$suffix ${WORKDIR}/tmp-mnt-boot/u-boot.$suffix 
        fi