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