1*702e6014SWolfgang DenkOverview 2*702e6014SWolfgang Denk-------------- 3*702e6014SWolfgang Denk 4*702e6014SWolfgang Denkmx35pdk (known als as mx35_3stack) is a development board by Freescale. 5*702e6014SWolfgang DenkIt consists of three pluggable board: 6*702e6014SWolfgang Denk - CPU module, with CPU, RAM, flash 7*702e6014SWolfgang Denk - Personality board, with most interfaces (USB, Network,..) 8*702e6014SWolfgang Denk - Debug board with JTAG header. 9*702e6014SWolfgang Denk 10*702e6014SWolfgang DenkThe board is usually delivered with redboot. This howto explains how to boot 11*702e6014SWolfgang Denka linux kernel and how to replace the original bootloader with U-Boot. 12*702e6014SWolfgang Denk 13*702e6014SWolfgang DenkThe board is delivered with Redboot on the NAND flash. It is possible to 14*702e6014SWolfgang Denkswitch the boot device with the switches SW1-SW2 on the Personality board, 15*702e6014SWolfgang Denkand with SW5-SW10 on the Debug board. 16*702e6014SWolfgang Denk 17*702e6014SWolfgang DenkDelivered Redboot script to start the kernel 18*702e6014SWolfgang Denk--------------------------------------------------- 19*702e6014SWolfgang Denk 20*702e6014SWolfgang DenkIn redboot the following script is stored: 21*702e6014SWolfgang Denk 22*702e6014SWolfgang Denkfis load kernel 23*702e6014SWolfgang Denkexec -c "noinitrd console=ttymxc0,115200 root=/dev/mtdblock8 rw rootfstype=jffs2 ip=dhcp fec_mac=00:04:9F:00:E7:76" 24*702e6014SWolfgang Denk 25*702e6014SWolfgang DenkKernel is taken from flash. The image is in zImage format. 26*702e6014SWolfgang Denk 27*702e6014SWolfgang DenkBooting from NET, rootfs on NFS: 28*702e6014SWolfgang Denk----------------------------------- 29*702e6014SWolfgang Denk 30*702e6014SWolfgang DenkTo change the script in redboot: 31*702e6014SWolfgang Denk 32*702e6014SWolfgang Denkload -r -b 0x100000 <path_to_zImage> 33*702e6014SWolfgang Denkexec -c "noinitrd console=ttymxc0,115200 root=/dev/nfsroot rootfstype=nfsroot nfsroot=192.168.1.1:/opt/eldk-4.2-arm/armVFP rw ip=dhcp" 34*702e6014SWolfgang Denk 35*702e6014SWolfgang DenkIf the ip address is not set, you can set it with : 36*702e6014SWolfgang Denk 37*702e6014SWolfgang Denkip_address -l <board_ip/netmask> -h <server_ip> 38*702e6014SWolfgang Denk 39*702e6014SWolfgang DenkLinux partitions: 40*702e6014SWolfgang Denk--------------------------- 41*702e6014SWolfgang Denk 42*702e6014SWolfgang DenkAs default, the board is shipped with these partition tables for NAND 43*702e6014SWolfgang Denkand for NOR: 44*702e6014SWolfgang Denk 45*702e6014SWolfgang DenkCreating 5 MTD partitions on "NAND 2GiB 3,3V 8-bit": 46*702e6014SWolfgang Denk0x00000000-0x00100000 : "nand.bootloader" 47*702e6014SWolfgang Denk0x00100000-0x00600000 : "nand.kernel" 48*702e6014SWolfgang Denk0x00600000-0x06600000 : "nand.rootfs" 49*702e6014SWolfgang Denk0x06600000-0x06e00000 : "nand.configure" 50*702e6014SWolfgang Denk0x06e00000-0x80000000 : "nand.userfs" 51*702e6014SWolfgang Denk 52*702e6014SWolfgang DenkCreating 6 MTD partitions on "mxc_nor_flash.0": 53*702e6014SWolfgang Denk0x00000000-0x00080000 : "Bootloader" 54*702e6014SWolfgang Denk0x00080000-0x00480000 : "nor.Kernel" 55*702e6014SWolfgang Denk0x00480000-0x02280000 : "nor.userfs" 56*702e6014SWolfgang Denk0x02280000-0x03e80000 : "nor.rootfs" 57*702e6014SWolfgang Denk0x01fe0000-0x01fe3000 : "FIS directory" 58*702e6014SWolfgang Denk0x01fff000-0x04000000 : "Redboot config" 59*702e6014SWolfgang Denk 60*702e6014SWolfgang DenkNAND partitions can be recognized enabling in kernel CONFIG_MTD_REDBOOT_PARTS. 61*702e6014SWolfgang DenkFor this board, CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK should be set to 2. 62*702e6014SWolfgang Denk 63*702e6014SWolfgang DenkHowever, the setup in redboot is not correct and does not use the whole flash. 64*702e6014SWolfgang Denk 65*702e6014SWolfgang DenkBetter solution is to use the kernel parameter mtdparts. 66*702e6014SWolfgang DenkHere the resulting script to be defined in RedBoot with fconfig: 67*702e6014SWolfgang Denk 68*702e6014SWolfgang Denkload -r -b 0x100000 sbabic/mx35pdk/zImage.2.6.37 69*702e6014SWolfgang Denkexec -c "noinitrd console=ttymxc0,115200 root=/dev/nfsroot rootfstype=nfsroot nfsroot=192.168.1.1:/opt/eldk-4.2-arm/arm rw ip=dhcp mtdparts=mxc_nand:1m(boot),5m(linux),96m(root),8m(cfg),1938m(user);physmap-flash.0:512k(b),4m(k),30m(u),28m(r)" 70*702e6014SWolfgang Denk 71*702e6014SWolfgang DenkFlashing U-Boot 72*702e6014SWolfgang Denk-------------------------------- 73*702e6014SWolfgang Denk 74*702e6014SWolfgang DenkThere are two options: the original bootloader in NAND can be replaced with 75*702e6014SWolfgang Denku-boot, or u-boot can be stored on the NOR flash without erasing 76*702e6014SWolfgang Denkthe delivered bootloader. 77*702e6014SWolfgang DenkThe boot storage can be select using the switches on the personality board 78*702e6014SWolfgang Denk(SW1-SW2) and on the DEBUG board (SW4-SW10). 79*702e6014SWolfgang Denk 80*702e6014SWolfgang DenkThe second option is to be preferred if you have not a JTAG debugger. 81*702e6014SWolfgang DenkIf something goes wrong flashing the bootloader, it is always possible to 82*702e6014SWolfgang Denkrecover the board booting from the other device. 83*702e6014SWolfgang Denk 84*702e6014SWolfgang DenkReplacing the bootloader on the NAND 85*702e6014SWolfgang Denk-------------------------------------- 86*702e6014SWolfgang DenkTo replace RedBoot with U-Boot, the easy way is to do this in linux. 87*702e6014SWolfgang DenkStart the kernel with the suggested options. Make sure to have set the 88*702e6014SWolfgang Denkmtdparts exactly as described, because this matches the layout on the 89*702e6014SWolfgang Denkmx35pdk. 90*702e6014SWolfgang Denk 91*702e6014SWolfgang DenkYou should see in your boot log the following entries for the NAND 92*702e6014SWolfgang Denkflash: 93*702e6014SWolfgang Denk 94*702e6014SWolfgang Denk5 cmdlinepart partitions found on MTD device mxc_nand 95*702e6014SWolfgang DenkCreating 5 MTD partitions on "mxc_nand": 96*702e6014SWolfgang Denk0x000000000000-0x000000100000 : "boot" 97*702e6014SWolfgang Denk0x000000100000-0x000000600000 : "linux" 98*702e6014SWolfgang Denk0x000000600000-0x000006600000 : "root" 99*702e6014SWolfgang Denk0x000006600000-0x000006e00000 : "cfg" 100*702e6014SWolfgang Denk0x000006e00000-0x000080000000 : "user" 101*702e6014SWolfgang Denk 102*702e6014SWolfgang DenkYou can use the utilities flash_eraseall and nandwrite to put 103*702e6014SWolfgang Denku-boot on the NAND. The bootloader is marked as "boot", and 1MB is 104*702e6014SWolfgang Denkreserved. If everything is correct, this partition is accessed as 105*702e6014SWolfgang Denk/dev/mtd4. However, check if it is correct with "cat /proc/mtd" and 106*702e6014SWolfgang Denkget the device node from the partition name: 107*702e6014SWolfgang Denk 108*702e6014SWolfgang Denk$ cat /proc/mtd | grep boot 109*702e6014SWolfgang Denk 110*702e6014SWolfgang DenkI suggest you try the utilities on a different partition to be sure 111*702e6014SWolfgang Denkif everything works correctly. If not, and you remove RedBoot, you have to 112*702e6014SWolfgang Denkreinstall it using the ATK tool as suggested by Freescale, or using a 113*702e6014SWolfgang DenkJTAG debugger. 114*702e6014SWolfgang Denk 115*702e6014SWolfgang DenkI report the versions of the utilities I used (they are provided with ELDK): 116*702e6014SWolfgang Denk 117*702e6014SWolfgang Denk-bash-3.2# nandwrite --version 118*702e6014SWolfgang Denknandwrite $Revision: 1.32 $ 119*702e6014SWolfgang Denk 120*702e6014SWolfgang Denkflash_eraseall --version 121*702e6014SWolfgang Denkflash_eraseall $Revision: 1.22 $ 122*702e6014SWolfgang Denk 123*702e6014SWolfgang Denknandwrite reports a warning if the file to be saved is not sector aligned. 124*702e6014SWolfgang DenkThis should have no consequences, but I preferred to pad u-boot.bin 125*702e6014SWolfgang Denkto get no problem at all. 126*702e6014SWolfgang Denk$ dd if=/dev/zero of=zeros bs=1 count=74800 127*702e6014SWolfgang Denk$ cat u-boot.bin zeros > u-boot-padded.bin 128*702e6014SWolfgang Denk 129*702e6014SWolfgang DenkTo erase the partition: 130*702e6014SWolfgang Denk$ flash_eraseall /dev/mtd4 131*702e6014SWolfgang Denk 132*702e6014SWolfgang DenkWriting u-boot: 133*702e6014SWolfgang Denk 134*702e6014SWolfgang Denk$ nandwrite /dev/mtd4 u-boot-padded.bin 135*702e6014SWolfgang Denk 136*702e6014SWolfgang DenkNow U-Boot is stored on the booting partition. 137*702e6014SWolfgang Denk 138*702e6014SWolfgang DenkTo boot from NAND, you have to select the switches as follows: 139*702e6014SWolfgang Denk 140*702e6014SWolfgang DenkPersonality board 141*702e6014SWolfgang Denk SW2 1, 4, 5 on 142*702e6014SWolfgang Denk 2, 3, 6, 7, 8 off 143*702e6014SWolfgang Denk SW1 all off 144*702e6014SWolfgang Denk 145*702e6014SWolfgang DenkDebug Board: 146*702e6014SWolfgang Denk SW5 0 147*702e6014SWolfgang Denk SW6 0 148*702e6014SWolfgang Denk SW7 0 149*702e6014SWolfgang Denk SW8 1 150*702e6014SWolfgang Denk SW9 1 151*702e6014SWolfgang Denk SW10 0 152*702e6014SWolfgang Denk 153*702e6014SWolfgang Denk 154*702e6014SWolfgang DenkSaving U-Boot in the NOR flash 155*702e6014SWolfgang Denk--------------------------------- 156*702e6014SWolfgang Denk 157*702e6014SWolfgang DenkThe procedure to save in the NOR flash is quite the same as to write into the NAND. 158*702e6014SWolfgang Denk 159*702e6014SWolfgang DenkCheck the partition for boot in the NOR flash. Setting the mtdparts as reported, 160*702e6014SWolfgang Denkthe boot partition should be /dev/mtd0. 161*702e6014SWolfgang Denk 162*702e6014SWolfgang DenkCreating 6 MTD partitions on "mxc_nor_flash.0": 163*702e6014SWolfgang Denk0x00000000-0x00080000 : "Bootloader" 164*702e6014SWolfgang Denk0x00080000-0x00480000 : "nor.Kernel" 165*702e6014SWolfgang Denk0x00480000-0x02280000 : "nor.userfs" 166*702e6014SWolfgang Denk0x02280000-0x03e80000 : "nor.rootfs" 167*702e6014SWolfgang Denk0x01fe0000-0x01fe3000 : "FIS directory" 168*702e6014SWolfgang Denk0x01fff000-0x04000000 : "Redboot config" 169*702e6014SWolfgang Denk 170*702e6014SWolfgang DenkTo erase the whole partition: 171*702e6014SWolfgang Denk$ flash_eraseall /dev/mtd0 172*702e6014SWolfgang Denk 173*702e6014SWolfgang DenkWriting u-boot: 174*702e6014SWolfgang Denkdd if=u-boot.bin of=/dev/mtd0 175*702e6014SWolfgang Denk 176*702e6014SWolfgang DenkTo boot from NOR, you have to select the switches as follows: 177*702e6014SWolfgang Denk 178*702e6014SWolfgang DenkPersonality board 179*702e6014SWolfgang Denk SW2 all off 180*702e6014SWolfgang Denk SW1 all off 181*702e6014SWolfgang Denk 182*702e6014SWolfgang DenkDebug Board: 183*702e6014SWolfgang Denk SW5 0 184*702e6014SWolfgang Denk SW6 0 185*702e6014SWolfgang Denk SW7 0 186*702e6014SWolfgang Denk SW8 1 187*702e6014SWolfgang Denk SW9 1 188*702e6014SWolfgang Denk SW10 0 189