summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board/lego/ev3/README36
-rw-r--r--include/configs/legoev3.h48
2 files changed, 65 insertions, 19 deletions
diff --git a/board/lego/ev3/README b/board/lego/ev3/README
index a3563732499..da62a649bad 100644
--- a/board/lego/ev3/README
+++ b/board/lego/ev3/README
@@ -9,14 +9,34 @@ Booting
=======
The EV3 contains a bootloader in EEPROM that loads u-boot.bin from address 0x0
-of the spi flash memory. Using the default configuration, u-boot will check to
-see if there is a boot.scr file on the first FAT partition of the mmc. If there
-is, it will run the script and boot the kernel from the uImage file also in
-the FAT partition. Otherwise, it will load a kernel and rootfs from the flash.
-The kernel must be stored at address 0x50000 on the flash and have a maximum
-size of 4MiB. The rootfs must be a squasfs image and stored at 0x450000 in the
-flash and have a maximum size of 10MiB. The flash starting at 0xE50000 is
-reserved for user data.
+of the SPI flash memory (with a size of 256KiB!). Because the EEPROM is read-
+only and it takes care of low level configuration (PLL and DDR), we don't use
+U-Boot to produce an SPL image.
+
+Using the default configuration, U-Boot had a boot scrips that works as follows:
+
+* Check to see if microSD card is present
+* If it is, try to load boot.scr from the first FAT partition
+* If loading boot.scr was successful, run it
+* Otherwise, try loading uEnv.txt
+* If loading uEnv.txt was successful, import it
+* If there is a uenvcmd variable (from uEnv.txt), run it
+* Try to load uImage from the first FAT partition
+* If it was successful, try to load da850-lego-ev3.dtb
+* If loading uImage was successful, boot it (DT is optional)
+* If none of the above was successful, try booting from flash
+
+Suggested Flash Memory Layout
+=============================
+
+The following is based on the default U-Boot configuration:
+
+| Image (file) | Start Addr. | Max. Size |
++--------------------+-------------+-------------------+
+| u-boot.bin | 0x0 | 0x40000 (256KiB) |
+| da850-lego-ev3.dtb | 0x40000 | 0x10000 (64KiB) |
+| uImage | 0x50000 | 0x400000 (4MiB) |
+| rootfs (squashfs) | 0x450000 | 0xa00000 (10MiB) |
Writing image to flash
======================
diff --git a/include/configs/legoev3.h b/include/configs/legoev3.h
index 9eb95bc030f..7a0511f88e6 100644
--- a/include/configs/legoev3.h
+++ b/include/configs/legoev3.h
@@ -84,34 +84,60 @@
"if run loadbootscr; then " \
"run bootscript; " \
"else " \
+ "if run loadbootenv; then " \
+ "echo Loaded env from ${bootenvfile};" \
+ "run importbootenv;" \
+ "fi;" \
+ "if test -n $uenvcmd; then " \
+ "echo Running uenvcmd...;" \
+ "run uenvcmd;" \
+ "fi;" \
"if run loadimage; then " \
"run mmcargs; " \
+ "if run loadfdt; then " \
+ "echo Using ${fdtfile}...;" \
+ "run fdtfixup; " \
+ "run fdtboot; "\
+ "fi; " \
"run mmcboot; " \
- "else " \
- "run flashargs; " \
- "run flashboot; " \
"fi; " \
"fi; " \
- "else " \
- "run flashargs; " \
- "run flashboot; " \
- "fi"
+ "fi; "\
+ "run flashargs; " \
+ "run flashboot"
#define CONFIG_EXTRA_ENV_SETTINGS \
+ "bootenvfile=uEnv.txt\0" \
+ "fdtfile=da850-lego-ev3.dtb\0" \
"memsize=64M\0" \
"filesyssize=10M\0" \
"verify=n\0" \
"console=ttyS1,115200n8\0" \
"bootscraddr=0xC0600000\0" \
+ "fdtaddr=0xC0600000\0" \
"loadaddr=0xC0007FC0\0" \
"filesysaddr=0xC1180000\0" \
"fwupdateboot=mw 0xFFFF1FFC 0x5555AAAA; reset\0" \
- "mmcargs=setenv bootargs mem=${memsize} console=${console} root=/dev/mmcblk0p2 rw rootwait lpj=747520\0" \
+ "importbootenv=echo Importing environment...; " \
+ "env import -t ${loadaddr} ${filesize}\0" \
+ "loadbootenv=fatload mmc 0 ${loadaddr} ${bootenvfile}\0" \
+ "mmcargs=setenv bootargs console=${console} root=/dev/mmcblk0p2 rw " \
+ "rootwait ${optargs}\0" \
"mmcboot=bootm ${loadaddr}\0" \
- "flashargs=setenv bootargs mem=${memsize} initrd=${filesysaddr},${filesyssize} root=/dev/ram0 rw rootfstype=squashfs console=${console} lpj=747520\0" \
- "flashboot=sf probe 0; sf read ${loadaddr} 0x50000 0x400000; sf read ${filesysaddr} 0x450000 0xA00000; bootm ${loadaddr}\0" \
+ "flashargs=setenv bootargs initrd=${filesysaddr},${filesyssize} " \
+ "root=/dev/ram0 rw rootfstype=squashfs console=${console} " \
+ "${optargs}\0" \
+ "flashboot=sf probe 0; " \
+ "sf read ${fdtaddr} 0x40000 0x10000; " \
+ "sf read ${loadaddr} 0x50000 0x400000; " \
+ "sf read ${filesysaddr} 0x450000 0xA00000; " \
+ "run fdtfixup; " \
+ "run fdtboot\0" \
"loadimage=fatload mmc 0 ${loadaddr} uImage\0" \
+ "loadfdt=fatload mmc 0 ${fdtaddr} ${fdtfile}\0" \
+ "fdtfixup=fdt addr ${fdtaddr}; fdt resize; fdt chosen\0" \
+ "fdtboot=bootm ${loadaddr} - ${fdtaddr}\0" \
"loadbootscr=fatload mmc 0 ${bootscraddr} boot.scr\0" \
- "bootscript=source ${bootscraddr}\0" \
+ "bootscript=source ${bootscraddr}\0"
#ifdef CONFIG_CMD_BDI
#define CONFIG_CLOCKS