summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Ziswiler <marcel.ziswiler@toradex.com>2013-05-01 18:04:03 +0200
committerMarcel Ziswiler <marcel.ziswiler@toradex.com>2013-05-01 18:04:03 +0200
commit823edcee3ff3c6a21eb57a2d9ee2cecfda5ef857 (patch)
tree8b38f9e4e7d3e673bb4971bfc837643c459e256b
parent9f8b30fcd1b9c36d180eb5a2fa208c0222154db5 (diff)
colibri_t20: sdboot: change offset handling
Rather than relying on hard-coded offsets actually make use of partition table parsing implementation.
-rw-r--r--include/configs/colibri_t20.h30
-rw-r--r--include/configs/colibri_t20_sdboot.h20
2 files changed, 33 insertions, 17 deletions
diff --git a/include/configs/colibri_t20.h b/include/configs/colibri_t20.h
index 9635c8b2a1..17b7a5c5ae 100644
--- a/include/configs/colibri_t20.h
+++ b/include/configs/colibri_t20.h
@@ -138,13 +138,28 @@
"fatload usb 0:1 ${loadaddr} uImage;" \
"run ramboot"
-#define SD_BOOTCMD \
+#ifndef __CONFIG_SDBOOT_H
+#define SD_BOOT_ARGS \
+ ""
+#define SD_BOOT_SETUP \
+ ""
+#else /* !__CONFIG_SDBOOT_H */
+#define SD_BOOTCMD \
"run setup; " \
"setenv bootargs ${defargs} ${sdargs} ${mtdparts} ${setupargs}; " \
- "echo Booting from MMC/SD card...; " \
- "mmc read 0 ${loadaddr} 0x2a00 0x4000; " \
+ "echo Booting from MMC/SD card...; " \
+ "mmc read 0 ${loadaddr} ${lnxoffset} ${sd_kernel_size}; " \
"bootm"
+#define SD_BOOT_ARGS \
+ "sdargs=root=/dev/mmcblk0p1 ip=off rw,noatime rootfstype=ext3 rootwait gpt\0" \
+ "sd_kernel_size=0x4000\0" \
+ "sdboot=" SD_BOOTCMD "\0"
+
+#define SD_BOOT_SETUP \
+ "gpt_sector=${gptoffset} "
+#endif /* !__CONFIG_SDBOOT_H */
+
#undef CONFIG_BOOTARGS
#undef CONFIG_BOOTCOMMAND
#undef CONFIG_DIRECT_BOOTARGS
@@ -154,7 +169,7 @@
//moved from disk/part_efi.h to here, give the block where the GP1 partition starts
//compare with sdargs below
#ifdef __CONFIG_SDBOOT_H
-#define GPT_PRIMARY_PARTITION_TABLE_LBA 18945ULL
+#define GPT_PRIMARY_PARTITION_TABLE_LBA (gd->gpt_offset)
#else
#define GPT_PRIMARY_PARTITION_TABLE_LBA 1ULL
#endif
@@ -167,9 +182,10 @@
"mmcboot=" MMC_BOOTCMD "\0" \
"nfsargs=ip=:::::eth0:on root=/dev/nfs rw netdevwait\0" \
"ramargs=initrd=0xA1800000,32M ramdisk_size=32768 root=/dev/ram0 rw\0" \
- "sdargs=root=/dev/mmcblk0p1 ip=:::::eth0:off rw,noatime rootfstype=ext3 rootwait gpt gpt_sector=18945\0" \
- "sdboot=" SD_BOOTCMD "\0" \
- "setup=setenv setupargs asix_mac=${ethaddr} no_console_suspend=1 console=tty1 console=ttyS0,${baudrate}n8 debug_uartport=lsport,0 ${memargs}\0" \
+ SD_BOOT_ARGS \
+ "setup=setenv setupargs " \
+ SD_BOOT_SETUP \
+ "asix_mac=${ethaddr} no_console_suspend=1 console=tty1 console=ttyS0,${baudrate}n8 debug_uartport=lsport,0 ${memargs}\0" \
"ubiargs=ubi.mtd=0 root=ubi0:rootfs rootfstype=ubifs\0" \
"ubiboot=" UBI_BOOTCMD "\0" \
"usbboot=" USB_BOOTCMD "\0" \
diff --git a/include/configs/colibri_t20_sdboot.h b/include/configs/colibri_t20_sdboot.h
index a23d1a6823..588419a5f9 100644
--- a/include/configs/colibri_t20_sdboot.h
+++ b/include/configs/colibri_t20_sdboot.h
@@ -34,17 +34,16 @@ SD-BOOT
The sd sector numbers are used as follows:
u-boot needs to find ENV and LNX to get to the environment and the kernel, the kernel needs to find the APP partition for the rootfs.
ENV: colibri_t20_sdboot.h
-Set CONFIG_ENV_MMC_OFFSET to the byte start address of ENV, take the sector address of Partid 6 (which is in 2024 byte sectors)
+Set CONFIG_ENV_MMC_OFFSET to the byte start address of ENV, take the sector address of Partid 6 (which is in 2048 byte sectors)
LNX: colibri_t20.h
-Set the u-boot environment SDBOOTCMD below, mmc read RAMloadaddr, 512byte sector start, 512byte copy length
-take the sector address of Partid 7 (which is in 2024 byte sectors)
+Set the u-boot environment SDBOOTCMD below, mmc read RAMloadaddr, 512byte sector start, 512byte copy length.
+Take the sector address of Partid 7 (which is in 2048 byte sectors).
APP: colibri_t20.h
Set the u-boot environment sdargs and the variable GPT_PRIMARY_PARTITION_TABLE_LBA below.
The kernel finds the partition with the help of the GP1/GPT partitions. The kernel commandline must include "gpt gpt_sector=xxx"
to force it to use GUID Partition Table (GPT) and to give the 512byte sector start address of the primary GUID.
-Set this in
Take the start address of Partid 8 (which is in 2048 byte sectors). add 1 to the resulting 512byte block. (at pos. 0 is the MBR)
E.g. Output during nvflash procedure on serial console:
@@ -53,12 +52,12 @@ SD Alloc Partid=3, start sector=1536,num=64
SD Alloc Partid=4, start sector=1600,num=960
SD Alloc Partid=5, start sector=2560,num=64
SD Alloc Partid=6, start sector=2624,num=64
-SD Alloc Partid=7, start sector=2688,num=2048
-SD Alloc Partid=8, start sector=4736,num=512
-SD Alloc Partid=9, start sector=5248,num=500032
-SD Alloc Partid=10, start sector=505280,num=460352
+SD Alloc Partid=7, start sector=2688,num=4096
+SD Alloc Partid=8, start sector=6784,num=512
+SD Alloc Partid=9, start sector=7296,num=3879808
+SD Alloc Partid=11, start sector=3887104,num=0
-sector start address 4736 * 2048 -> 18944 * 512 -> GPT start sector is 18945.
+sector start address 6784 * 2048 -> 27137 * 512 -> GPT start sector is 27137.
*/
@@ -87,7 +86,8 @@ sector start address 4736 * 2048 -> 18944 * 512 -> GPT start sector is 18945.
#if defined(CONFIG_ENV_IS_IN_MMC)
#define CONFIG_SYS_MMC_ENV_DEV 0 /* use MMC0, slot on eval board and Iris */
-#define CONFIG_ENV_MMC_OFFSET (10496 * 512) /* Byteaddress of the beginning of the ENV partition */
+/* once the eMMC is detected the corresponding setting is taken */
+#define CONFIG_ENV_MMC_OFFSET (gd->env_offset * 512)
#endif
#endif /* __CONFIG_H */