am335x_evm: Misc environment enhancements
cover am335x_evm: Misc environment enhancements
Hey all,
The bulk of this series adds environemnt variables to better support working with NAND, SPI or ethernet. In the case of SPI we also add a spiboot target which will change environment to be looked for on SPI rather than NAND. This also documents how to use the network SPL options.
Signature · 1 line
Tom
PATCH 1/5 am335x_evm: Add NAND environment variables
From: Chase Maupin <[email protected]>
* Added support to the default environment variables for NAND boot.
* Add nandboot to the default bootcmd.
--- include/configs/am335x_evm.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
include/configs/am335x_evm.h +14 -0
@@ -60,12 +60,20 @@"mmcdev=0\0" \"mmcroot=/dev/mmcblk0p2 ro\0" \"mmcrootfstype=ext4 rootwait\0" \ +"nandroot=ubi0:rootfs rw ubi.mtd=7,2048\0" \ +"nandrootfstype=ubifs rootwait=1\0" \ +"nandsrcaddr=0x280000\0" \ +"nandimgsize=0x500000\0" \"ramroot=/dev/ram0 rw ramdisk_size=65536 initrd=${rdaddr},64M\0" \"ramrootfstype=ext2\0" \"mmcargs=setenv bootargs console=${console} " \"${optargs} " \"root=${mmcroot} " \"rootfstype=${mmcrootfstype}\0" \ +"nandargs=setenv bootargs console=${console} " \ +"${optargs} " \ +"root=${nandroot} " \ +"rootfstype=${nandrootfstype}\0" \"bootenv=uEnv.txt\0" \"loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenv}\0" \"importbootenv=echo Importing environment from mmc ...; " \
@@ -80,6 +88,10 @@"mmcboot=echo Booting from mmc ...; " \"run mmcargs; " \"bootm ${loadaddr}\0" \ +"nandboot=echo Booting from nand ...; " \ +"run nandargs; " \ +"nand read ${loadaddr} ${nandsrcaddr} ${nandimgsize}; " \ +"bootm ${loadaddr}\0" \"ramboot=echo Booting from ramdisk ...; " \"run ramargs; " \"bootm ${loadaddr}\0" \
@@ -105,6 +117,8 @@"if run loaduimage; then " \"run mmcboot;" \"fi;" \ +"else " \ +"run nandboot;" \"fi;" \/* Clock Defines */
Signature · 1 line
1.7.9.5
PATCH 2/5 am335x_evm: Add SPI environment variables
In reply to Tom RiniFrom: Chase Maupin <[email protected]>
* Added variables to support SPI booting
* Note that the first 512KiB are reserved for 4 copies of SPL.
--- include/configs/am335x_evm.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
include/configs/am335x_evm.h +14 -0
@@ -74,6 +74,15 @@"${optargs} " \"root=${nandroot} " \"rootfstype=${nandrootfstype}\0" \ +"spiroot=/dev/mtdblock4 rw\0" \ +"spirootfstype=jffs2\0" \ +"spisrcaddr=0xe0000\0" \ +"spiimgsize=0x362000\0" \ +"spibusno=0\0" \ +"spiargs=setenv bootargs console=${console} " \ +"${optargs} " \ +"root=${spiroot} " \ +"rootfstype=${spirootfstype}\0" \"bootenv=uEnv.txt\0" \"loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenv}\0" \"importbootenv=echo Importing environment from mmc ...; " \
@@ -92,6 +101,11 @@"run nandargs; " \"nand read ${loadaddr} ${nandsrcaddr} ${nandimgsize}; " \"bootm ${loadaddr}\0" \ +"spiboot=echo Booting from spi ...; " \ +"run spiargs; " \ +"sf probe ${spibusno}:0; " \ +"sf read ${loadaddr} ${spisrcaddr} ${spiimgsize}; " \ +"bootm ${loadaddr}\0" \"ramboot=echo Booting from ramdisk ...; " \"run ramargs; " \"bootm ${loadaddr}\0" \
Signature · 1 line
1.7.9.5
PATCH 3/5 am335x_evm: Add NET environment variables
In reply to Tom RiniFrom: Chase Maupin <[email protected]>
* Add environment variables to support network booting
--- include/configs/am335x_evm.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
include/configs/am335x_evm.h +15 -0
@@ -64,6 +64,10 @@"nandrootfstype=ubifs rootwait=1\0" \"nandsrcaddr=0x280000\0" \"nandimgsize=0x500000\0" \ +"rootpath=/export/rootfs\0" \ +"nfsopts=nolock\0" \ +"static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}" \ +"::off\0" \"ramroot=/dev/ram0 rw ramdisk_size=65536 initrd=${rdaddr},64M\0" \"ramrootfstype=ext2\0" \"mmcargs=setenv bootargs console=${console} " \
@@ -83,6 +87,11 @@"${optargs} " \"root=${spiroot} " \"rootfstype=${spirootfstype}\0" \ +"netargs=setenv bootargs console=${console} " \ +"${optargs} " \ +"root=/dev/nfs " \ +"nfsroot=${serverip}:${rootpath},${nfsopts} rw " \ +"ip=dhcp\0" \"bootenv=uEnv.txt\0" \"loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenv}\0" \"importbootenv=echo Importing environment from mmc ...; " \
@@ -106,6 +115,12 @@"sf probe ${spibusno}:0; " \"sf read ${loadaddr} ${spisrcaddr} ${spiimgsize}; " \"bootm ${loadaddr}\0" \ +"netboot=echo Booting from network ...; " \ +"setenv autoload no; " \ +"dhcp; " \ +"tftp ${loadaddr} ${bootfile}; " \ +"run netargs; " \ +"bootm ${loadaddr}\0" \"ramboot=echo Booting from ramdisk ...; " \"run ramargs; " \"bootm ${loadaddr}\0" \
Signature · 1 line
1.7.9.5
PATCH 4/5 doc/SPL/README.am335x-network: Document using ethernet (and USB) SPL
In reply to Tom RiniFrom: Ilya Yanok <[email protected]>
Added README file with the description of required options and host configuration to use network SPL with am335x targets. Briefly discuss how to use this configuration to program empty boards.
--- doc/SPL/README.am335x-network | 93 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 doc/SPL/README.am335x-network
doc/SPL/README.am335x-network new file +93 -0
@@ -0,0 +1,93 @@ +USING AM335x NETBOOT FEATURE + + Some boards (like TI AM335x based ones) have quite big on-chip RAM and +have support for booting via network in ROM. The following describes +how to setup network booting and then optionally use this support to flash +NAND and bricked (empty) board with only a network cable. + + I. Building the required images + 1. You have to enable generic SPL configuration options (see +docs/README.SPL) as well as CONFIG_SPL_NET_SUPPORT, +CONFIG_ETH_SUPPORT, CONFIG_SPL_LIBGENERIC_SUPPORT and +CONFIG_SPL_LIBCOMMON_SUPPORT in your board configuration file to build +SPL with support for booting over the network. Also you have to enable +the driver for the NIC used and CONFIG_SPL_BOARD_INIT option if your +board needs some board-specific initialization (TI AM335x EVM does). +If you want SPL to use some Vendor Class Identifier (VCI) you can set +one with CONFIG_SPL_NET_VCI_STRING option. am335x_evm configuration +comes with support for network booting preconfigured. + 2. Define CONFIG_BOOTCOMMAND for your board to load and run debrick +script after boot: +#define CONFIG_BOOTCOMMAND \ + "setenv autoload no; " \ + "bootp; " \ + "if tftp 80000000 debrick.scr; then " \ + "source 80000000; " \ + "fi" +(Or create additional board configuration with such option). + 3. Build U-Boot as usual + $ make <your_board_name> + You will need u-boot.img and spl/u-boot.bin images to perform +network boot. Copy them to u-boot-restore.img and +u-boot-spl-restore.bin respectively to distinguish this version +(with automatic restore running) from the main one. + + II. Host configuration. + 1. Setup DHCP server (recommended server is ISC DHCPd). + - Install DHCP server and setup it to listen on the interface you +chose to connect to the board (usually configured in +/etc/default/dhcpd or /etc/default/isc-dhcp-server). Make sure there +are no other active DHCP servers in the same network segment. + - Edit your dhcpd.conf and subnet declaration matching the address +on the interface. Specify the range of assigned addresses and bootfile +to use. IMPORTANT! Both RBL and SPL use the image filename provided +in the BOOTP reply but obviously they need different images (RBL needs +raw SPL image -- u-boot-spl-restore.bin while SPL needs main U-Boot +image -- u-boot-restore.img). So you have to configure DHCP server to +provide different image filenames to RBL and SPL (and possibly another +one to main U-Boot). This can be done by checking Vendor Class +Identifier (VCI) set by BOOTP client (RBL sets VCI to "DM814x ROM v1.0" +and you can set VCI used by SPL with CONFIG_SPL_NET_VCI_STRING option, +see above). + - If you plan to use TFTP server on another machine you have to set +server-name option to point to it. + - Here is sample configuration for ISC DHCPd, assuming the interface +used to connect to the board is eth0, and it has address 192.168.8.1: + +subnet 192.168.8.0 netmask 255.255.255.0 { + range dynamic-bootp 192.168.8.100 192.168.8.199; + + if substring (option vendor-class-identifier, 0, 10) = "DM814x ROM" { + filename "u-boot-spl-restore.bin"; + } elsif substring (option vendor-class-identifier, 0, 17) = "AM335x U-Boot SPL" { + filename "u-boot-restore.img"; + } else { + filename "uImage"; + } +} + + 2. Setup TFTP server. + Install TFTP server and put image files to it's root directory +(likely /tftpboot or /var/lib/tftpboot or /srv/tftp). You will need +u-boot.img and spl/u-boot-spl-bin files from U-Boot build directory. + + III. Reflashing (debricking) the board. + 1. Write debrick script. You will need to write a script that will +be executed after network boot to perform actual rescue actions. You +can use usual U-Boot commands from this script: tftp to load additional +files, nand erase/nand write to erase/write the NAND flash. + + 2. Create script image from your script. From U-Boot build directory: + +$ ./tools/mkimage -A arm -O U-Boot -C none -T script -d <your script> debrick.scr + +This will create debrick.scr file with your script inside. + + 3. Copy debrick.scr to TFTP root directory. You also need to copy +there all the files your script tries to load via TFTP. Example script +loads u-boot.img and MLO. You have to create these files doing regular +(not restore_flash) build and copy them to tftpboot directory. + + 4. Boot the board from the network, U-Boot will load debrick script +and run it after boot. +
Signature · 1 line
1.7.9.5
PATCH 5/5 am335x evm: Add am335x_evm_spiboot target
In reply to Tom RiniThis target will move the environment into SPI flash and documents the expected layout. We correct the SPL define for where U-Boot is and remove an unused define.
--- boards.cfg | 1 + include/configs/am335x_evm.h | 25 +++++++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-)
boards.cfg +1 -0
@@ -231,6 +231,7 @@ integratorap_cm946es arm arm946es integrator armltd integratorcp_cm946es arm arm946es integrator armltd - integratorcp:CM946ES ca9x4_ct_vxp arm armv7 vexpress armltd am335x_evm arm armv7 am335x ti am33xx am335x_evm:SERIAL1,CONS_INDEX=1 +am335x_evm_spiboot arm armv7 am335x ti am33xx am335x_evm:SERIAL1,CONS_INDEX=1,SPI_BOOT am335x_evm_uart1 arm armv7 am335x ti am33xx am335x_evm:SERIAL2,CONS_INDEX=2 am335x_evm_uart2 arm armv7 am335x ti am33xx am335x_evm:SERIAL3,CONS_INDEX=3 am335x_evm_uart3 arm armv7 am335x ti am33xx am335x_evm:SERIAL4,CONS_INDEX=4
include/configs/am335x_evm.h +23 -2
@@ -279,8 +279,7 @@#define CONFIG_SPL_SPI_LOAD #define CONFIG_SPL_SPI_BUS 0#define CONFIG_SPL_SPI_CS 0 -#define CONFIG_SYS_SPI_U_BOOT_OFFS 0x20000 -#define CONFIG_SYS_SPI_U_BOOT_SIZE 0x40000 +#define CONFIG_SYS_SPI_U_BOOT_OFFS 0x80000#define CONFIG_SPL_LDSCRIPT "$(CPUDIR)/omap-common/u-boot-spl.lds"#define CONFIG_SPL_BOARD_INIT
@@ -356,6 +355,26 @@#define CONFIG_USB_ETH_RNDIS #endif /* CONFIG_MUSB_GADGET */ +/* +* Default to using SPI for environment, etc. We have multiple copies +* of SPL as the ROM will check these locations. +* 0x0 - 0x20000 : First copy of SPL +* 0x20000 - 0x40000 : Second copy of SPL +* 0x40000 - 0x60000 : Third copy of SPL +* 0x60000 - 0x80000 : Fourth copy of SPL +* 0x80000 - 0xDF000 : U-Boot +* 0xDF000 - 0xE0000 : U-Boot Environment +* 0xE0000 - 0x442000 : Linux Kernel +* 0x442000 - 0x800000 : Userland +*/ +#if defined(CONFIG_SPI_BOOT ) +# undef CONFIG_ENV_IS_NOWHERE +# define CONFIG_ENV_IS_IN_SPI_FLASH +# define CONFIG_ENV_SPI_MAX_HZ CONFIG_SF_DEFAULT_SPEED +# define CONFIG_ENV_OFFSET (892 << 10)/* 892 KiB in */ +# define CONFIG_ENV_SECT_SIZE (4 << 10)/* 4 KB sectors */ +#endif /* SPI support */ +/* Unsupported features */ #undef CONFIG_USE_IRQ
@@ -388,10 +407,12 @@/* CS0 */ #define CONFIG_SYS_MAX_NAND_DEVICE 1/* Max number of NAND devices */ +#if !defined(CONFIG_SPI_BOOT )#undef CONFIG_ENV_IS_NOWHERE#define CONFIG_ENV_IS_IN_NAND #define CONFIG_ENV_OFFSET 0x260000/* environment starts here */ #define CONFIG_SYS_ENV_SECT_SIZE (128 << 10)/* 128 KiB */ #endif +#endif #endif /* ! __CONFIG_AM335X_EVM_H */
Signature · 1 line
1.7.9.5
cover am335x_evm: Misc environment enhancements
In reply to Tom RiniQuoted 7 lines · Tom Rini
Hey all,
The bulk of this series adds environemnt variables to better support working with NAND, SPI or ethernet. In the case of SPI we also add a spiboot target which will change environment to be looked for on SPI rather than NAND. This also documents how to use the network SPL options.
Applied to u-boot-ti/master.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130219/847a00d1/attachment.pgp>