1Summary 2======= 3The README is for the boot procedure on the ipam390 board 4 5In the context of U-Boot, the board is booted in three stages. The initial 6bootloader which executes upon reset is the ROM Boot Loader (RBL) and sits 7in the internal ROM. The RBL initializes the internal memory and then 8depending on the exact board and pin configurations will initialize another 9controller (such as NAND) to continue the boot process by loading 10the secondary program loader (SPL). The SPL will initialize the system 11further (some clocks, SDRAM). As on this board is used the falcon boot 12mode, now 2 ways are possible depending on the GPIO 7_14 input pin, 13connected with the "soft reset switch" 14 15If this pin is logical 1 (high level): 16spl code starts the kernel image without delay 17 18If this pin is logical 0 (low level): 19spl code starts the u-boot image 20 21AIS is an image format defined by TI for the images that are to be loaded 22to memory by the RBL. The image is divided into a series of sections and 23the image's entry point is specified. Each section comes with meta data 24like the target address the section is to be copied to and the size of the 25section, which is used by the RBL to load the image. At the end of the 26image the RBL jumps to the image entry point. The AIS format allows for 27other things such as programming the clocks and SDRAM if the header is 28programmed for it. We do not take advantage of this and instead use SPL as 29it allows for additional flexibility (run-time detect of board revision, 30loading the next image from a different media, etc). 31 32Compilation 33=========== 34run "./MAKEALL ipam390" in the u-boot source tree. 35Once this build completes you will have a u-boot.ais file that needs to 36be written to the nand flash. 37 38Flashing the images to NAND 39========================== 40The AIS image can be written to NAND flash using the following commands. 41Assuming that the network is configured and enabled and the u-boot.ais file 42is tftp'able. 43 44U-Boot > print upd_uboot 45upd_uboot=tftp c0000000 ${u-boot};nand erase.part u-boot;nand write c0000000 20000 ${filesize} 46U-Boot > 47U-Boot > run upd_uboot 48Using DaVinci-EMAC device 49TFTP from server 192.168.1.1; our IP address is 192.168.20.71 50Filename '/tftpboot/ipam390/u-boot.ais'. 51Load address: 0xc0000000 52Loading: ################################## 53 1.5 MiB/s 54done 55Bytes transferred = 493716 (78894 hex) 56 57NAND erase.part: device 0 offset 0x20000, size 0x160000 58Erasing at 0x160000 -- 100% complete. 59OK 60 61NAND write: device 0 offset 0x20000, size 0x78894 62 493716 bytes written: OK 63U-Boot > 64 65Recovery 66======== 67 68In the case of a "bricked" board, you need to use the TI tools found 69here[1] to create an uboot-uart-ais.bin file 70 71- cd to the u-boot source tree 72 73- compile the u-boot for the ipam390 board: 74$ ./MAKEALL ipam390 75 76 -> Now we shall have u-boot.bin 77 78- Create u-boot-uart-ais.bin 79$ mono HexAIS_OMAP-L138.exe -entrypoint 0xC1080000 -ini 80ipam390-ais-uart.cfg -o ./uboot-uart-ais.bin ./u-boot.bin@0xC1080000; 81 82Note: The ipam390-ais-uart.cfg is found in the board directory 83for the ipam390 board, u-boot:/board/Barix/ipam390/ipam390-ais-uart.cfg 84 85- We can now run bootloader on IPAM390 via UART using the command below: 86 87$ mono ./slh_OMAP-L138.exe -waitForDevice -v -p /dev/tty.UC-232AC uboot-uart-ais.bin 88NOTE: Do not cancel the command execution! The command takes 20+ seconds 89to upload u-boot over serial and run it! 90Outcome: 91Waiting for the OMAP-L138... 92(AIS Parse): Read magic word 0x41504954. 93(AIS Parse): Waiting for BOOTME... (power on or reset target now) 94(AIS Parse): BOOTME received! 95(AIS Parse): Performing Start-Word Sync... 96(AIS Parse): Performing Ping Opcode Sync... 97(AIS Parse): Processing command 0: 0x5853590D. 98(AIS Parse): Performing Opcode Sync... 99(AIS Parse): Executing function... 100(AIS Parse): Processing command 1: 0x5853590D. 101(AIS Parse): Performing Opcode Sync... 102(AIS Parse): Executing function... 103(AIS Parse): Processing command 2: 0x5853590D. 104(AIS Parse): Performing Opcode Sync... 105(AIS Parse): Executing function... 106(AIS Parse): Processing command 3: 0x5853590D. 107(AIS Parse): Performing Opcode Sync... 108(AIS Parse): Executing function... 109(AIS Parse): Processing command 4: 0x5853590D. 110(AIS Parse): Performing Opcode Sync... 111(AIS Parse): Executing function... 112(AIS Parse): Processing command 5: 0x58535901. 113(AIS Parse): Performing Opcode Sync... 114(AIS Parse): Loading section... 115(AIS Parse): Loaded 326516-Byte section to address 0xC1080000. 116(AIS Parse): Processing command 6: 0x58535906. 117(AIS Parse): Performing Opcode Sync... 118(AIS Parse): Performing jump and close... 119(AIS Parse): AIS complete. Jump to address 0xC1080000. 120(AIS Parse): Waiting for DONE... 121(AIS Parse): Boot completed successfully. 122 123Operation completed successfully. 124 125Falcon Bootmode (boot linux without booting U-Boot) 126=================================================== 127 128The Falcon Mode extends this way allowing to start the Linux kernel directly 129from SPL. A new command is added to U-Boot to prepare the parameters that SPL 130must pass to the kernel, using ATAGS or Device Tree. 131 132In normal mode, these parameters are generated each time before 133loading the kernel, passing to Linux the address in memory where 134the parameters can be read. 135With Falcon Mode, this snapshot can be saved into persistent storage and SPL is 136informed to load it before running the kernel. 137 138To boot the kernel, these steps under a Falcon-aware U-Boot are required: 139 1401. Boot the board into U-Boot. 141Use the "spl export" command to generate the kernel parameters area or the DT. 142U-Boot runs as when it boots the kernel, but stops before passing the control 143to the kernel. 144 145Here the command sequence for the ipam390 board: 146- load the linux kernel image into ram: 147 148U-Boot > nand read c0100000 2 200000 400000 149 150NAND read: device 0 offset 0x200000, size 0x400000 151 4194304 bytes read: OK 152 153- generate the bootparms image: 154 155U-Boot > spl export atags c0100000 156## Booting kernel from Legacy Image at c0100000 ... 157 Image Name: Linux-3.5.1 158 Image Type: ARM Linux Kernel Image (uncompressed) 159 Data Size: 2504280 Bytes = 2.4 MiB 160 Load Address: c0008000 161 Entry Point: c0008000 162 Verifying Checksum ... OK 163 Loading Kernel Image ... OK 164subcommand not supported 165subcommand not supported 166Argument image is now in RAM at: 0xc0000100 167 168- copy the bootparms image into nand: 169 170U-Boot > mtdparts 171 172device nand0 <davinci_nand.0>, # parts = 6 173 #: name size offset mask_flags 174 0: u-boot-env 0x00020000 0x00000000 0 175 1: u-boot 0x00160000 0x00020000 0 176 2: bootparms 0x00020000 0x00180000 0 177 3: factory-info 0x00060000 0x001a0000 0 178 4: kernel 0x00400000 0x00200000 0 179 5: rootfs 0x07a00000 0x00600000 0 180 181active partition: nand0,0 - (u-boot-env) 0x00020000 @ 0x00000000 182 183defaults: 184mtdids : nand0=davinci_nand.0 185mtdparts: mtdparts=davinci_nand.0:128k(u-boot-env),1408k(u-boot),128k(bootparms),384k(factory-info),4M(kernel),-(rootfs) 186U-Boot > nand erase.part bootparms 187 188NAND erase.part: device 0 offset 0x180000, size 0x20000 189Erasing at 0x180000 -- 100% complete. 190OK 191U-Boot > nand write c0000100 180000 20000 192 193NAND write: device 0 offset 0x180000, size 0x20000 194 131072 bytes written: OK 195U-Boot > 196 197You can use also the predefined U-Boot Environment variable "setbootparms", 198which will do all the above steps in one command: 199 200U-Boot > print setbootparms 201setbootparms=nand read c0100000 200000 400000;spl export atags c0100000;nand erase.part bootparms;nand write c0000100 180000 20000 202U-Boot > run setbootparms 203 204NAND read: device 0 offset 0x200000, size 0x400000 205 4194304 bytes read: OK 206## Booting kernel from Legacy Image at c0100000 ... 207 Image Name: Linux-3.5.1 208 Image Type: ARM Linux Kernel Image (uncompressed) 209 Data Size: 2504280 Bytes = 2.4 MiB 210 Load Address: c0008000 211 Entry Point: c0008000 212 Verifying Checksum ... OK 213 Loading Kernel Image ... OK 214subcommand not supported 215subcommand not supported 216Argument image is now in RAM at: 0xc0000100 217 218NAND erase.part: device 0 offset 0x180000, size 0x20000 219Erasing at 0x180000 -- 100% complete. 220OK 221 222NAND write: device 0 offset 0x180000, size 0x20000 223 131072 bytes written: OK 224U-Boot > 225 226Links 227===== 228[1] 229 http://sourceforge.net/projects/dvflashutils/files/OMAP-L138/ 230