From f6fea2e7d617b2381738780b0f157a3ee77bec11 Mon Sep 17 00:00:00 2001 From: Robert Nelson Date: Tue, 4 Dec 2012 10:49:30 -0600 Subject: [PATCH] Cleanup/Rewrite: boot partition setups Signed-off-by: Robert Nelson --- mk_mmc.sh | 68 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 45 insertions(+), 23 deletions(-) diff --git a/mk_mmc.sh b/mk_mmc.sh index 0efcc20..d8f889f 100755 --- a/mk_mmc.sh +++ b/mk_mmc.sh @@ -1164,12 +1164,13 @@ function unmount_all_drive_partitions { LC_ALL=C parted --script ${MMC} mklabel msdos || drive_error_ro } -function omap_fatfs_boot_part_error { +function fatfs_boot_error { echo "Failure: [parted --script ${MMC} set 1 boot on]" exit } -function omap_fatfs_boot_part { +function fatfs_boot { + #For: TI: Omap/Sitara Devices echo "" echo "Using fdisk to create an omap compatible fatfs BOOT partition" echo "-----------------------------" @@ -1190,14 +1191,25 @@ function omap_fatfs_boot_part { echo "Setting Boot Partition's Boot Flag" echo "-----------------------------" - LC_ALL=C parted --script ${MMC} set 1 boot on || omap_fatfs_boot_part_error + LC_ALL=C parted --script ${MMC} set 1 boot on || fatfs_boot_error } -function dd_to_drive { +function dd_uboot_boot { + #For: Freescale: i.mx5/6 Devices echo "" echo "Using dd to place bootloader on drive" echo "-----------------------------" - dd if=${TEMPDIR}/dl/${UBOOT} of=${MMC} seek=${dd_seek} bs=${dd_bs} + dd if=${TEMPDIR}/dl/${UBOOT} of=${MMC} seek=${dd_uboot_seek} bs=${dd_uboot_bs} + bootloader_installed=1 +} + +function dd_spl_uboot_boot { + #For: Samsung: Exynos 4 Devices + echo "" + echo "Using dd to place bootloader on drive" + echo "-----------------------------" + dd if=${TEMPDIR}/dl/${UBOOT} of=${MMC} seek=${dd_spl_uboot_seek} bs=${dd_spl_uboot_bs} + dd if=${TEMPDIR}/dl/${UBOOT} of=${MMC} seek=${dd_uboot_seek} bs=${dd_uboot_bs} bootloader_installed=1 } @@ -1233,11 +1245,15 @@ function create_partitions { fi case "${bootloader_location}" in - omap_fatfs_boot_part) - omap_fatfs_boot_part + fatfs_boot) + fatfs_boot + ;; + dd_uboot_boot) + dd_uboot_boot + LC_ALL=C parted --script ${PARTED_ALIGN} ${MMC} mkpart primary ${parted_format} ${boot_startmb} ${boot_endmb} ;; - dd_to_drive) - dd_to_drive + dd_spl_uboot_boot) + dd_spl_uboot_boot LC_ALL=C parted --script ${PARTED_ALIGN} ${MMC} mkpart primary ${parted_format} ${boot_startmb} ${boot_endmb} ;; *) @@ -1352,9 +1368,12 @@ function populate_boot { #!/bin/sh format=1.0 board=${BOOTLOADER} + bootloader_location=${bootloader_location} - dd_seek=${dd_seek} - dd_bs=${dd_bs} + dd_spl_uboot_seek=${dd_spl_uboot_seek} + dd_spl_uboot_bs=${dd_spl_uboot_bs} + dd_uboot_seek=${dd_uboot_seek} + dd_uboot_bs=${dd_uboot_bs} boot_image=${boot} boot_script=${boot_script} @@ -1442,7 +1461,7 @@ function check_mmc { function is_omap { IS_OMAP=1 - bootloader_location="omap_fatfs_boot_part" + bootloader_location="fatfs_boot" spl_name="MLO" boot_name="u-boot.img" @@ -1479,11 +1498,11 @@ function is_omap { function is_imx { IS_IMX=1 - bootloader_location="dd_to_drive" + bootloader_location="dd_uboot_boot" unset spl_name boot_name="u-boot.imx" - dd_seek="1" - dd_bs="1024" + dd_uboot_seek="1" + dd_uboot_bs="1024" boot_startmb="2" SUBARCH="imx" @@ -1506,17 +1525,20 @@ function check_uboot_type { unset USE_UIMAGE unset USE_KMS unset dtb_file - - unset bootloader_location - unset spl_name - unset boot_name unset need_dtbs KERNEL_SEL="STABLE" + boot="bootz" + unset spl_name + unset boot_name + unset bootloader_location + unset dd_spl_uboot_seek + unset dd_spl_uboot_bs + unset dd_uboot_seek + unset dd_uboot_bs + unset boot_scr_wrapper unset usbnet_mem - unset dd_seek - unset dd_bs boot_partition_size="50" case "${UBOOT_TYPE}" in @@ -1720,8 +1742,8 @@ function check_uboot_type { SERIAL_CONSOLE="${SERIAL},115200" boot="bootm" USE_UIMAGE=1 - dd_seek="2" - dd_bs="512" + dd_uboot_seek="2" + dd_uboot_bs="512" kernel_addr="0x10000000" initrd_addr="0x12000000" load_addr="0x10008000"