Creating a uboot script that will write MLO only once to NAND

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
        I'm trying to develop a microSD card image that will allow batch programming of beagleboard NAND devices for a production environment. 

My problem is MLO. As I understand, it needs to be written to NAND from u-boot with HW ECC turned on. I tried at the kernel level, after ensuring that it is writable from the kernel, by modifying board-omap3beagle.c, but for some reason MLO written to NAND in that manner didn't work. Is this a constraint, that MLO must be written from u-boot itself.

What I proceeded to do next is to create a boot.scr to automate the process. 

mmc init
fatload mmc 0:1 80000000 MLO
nandecc hw
nand erase 0 80000
nand write 80000000 0 80000
setenv bootcmd 'if mmc init ${mmcdev}; then if run loadbootscript; then run bootscript; else if run loaduimage; then run mmcboot; else run nandboot; fi; fi; else run nandboot; fi'
setenv bootdelay '3'
setenv baudrate '115200'
setenv loadaddr '0x82000000'
setenv usbtty 'cdc_acm'
setenv console ttyS2,115200n8
setenv mpurate '500'
setenv buddy 'none'
setenv vram '12M'
setenv dvimode '480x272MR-16@60'
setenv defaultdisplay 'dvi'
setenv mmcdev '1'
setenv mmcroot '/dev/mmcblk0p2 rw'
setenv mmcrootfstype 'ext3 rootwait'
setenv nandroot '/dev/mtdblock5 rw'
setenv nandrootfstype 'yaffs2 rootwait'
setenv nandargs 'setenv bootargs androidboot.console=ttyS2 console=${console} root=${nandroot} rootfstype=${nandrootfstype} vram=${vram} omapfb.vram=0:4M omapfb.mode=${dvimode} omapdss.def_disp=${defaultdisplay} omapfb.debug=y omapdss.debug=y init=/init'
setenv loadbootscript 'fatload mmc ${mmcdev} ${loadaddr} boot.scr'
setenv bootscript 'echo Running bootscript from mmc ...; source ${loadaddr}'
setenv loaduimage 'fatload mmc ${mmcdev} ${loadaddr} uImage'
setenv mmcboot 'echo Booting from mmc ...; run mmcargs; bootm ${loadaddr}'
setenv nandboot 'echo Booting from nand ...; run nandargs; nand read ${loadaddr} 280000 400000; bootm ${loadaddr}'
setenv mmcargs 'setenv bootargs androidboot.console=ttyS2 console=${console} root=${mmcroot} rootfstype=${mmcrootfstype} vram=${vram} omapfb.vram=0:4M omapfb.mode=${dvimode} omapdss.def_disp=${defaultdisplay} omapfb.debug=y omapdss.debug=y init=/init'
saveenv
boot


However it keeps running forever in a loop.
        
Hit any key to stop autoboot:  0 
mmc1 is available
reading boot.scr

1679 bytes read
Running bootscript from mmc ...
## Executing script at 82000000
mmc1 is available
reading MLO

24296 bytes read
HW ECC selected

NAND erase: device 0 offset 0x0, size 0x80000
Erasing at 0x60000 -- 100% complete.
OK

NAND write: device 0 offset 0x0, size 0x80000
 524288 bytes written: OK
## Switch baudrate to 115200 bps and press ENTER ...
Saving Environment to NAND...
Erasing Nand...
Erasing at 0x260000 -- 100% complete.
Writing to Nand... done
mmc1 is available
reading boot.scr

1679 bytes read
Running bootscript from mmc ...
## Executing script at 82000000
mmc1 is available
reading MLO

24296 bytes read
HW ECC selected

NAND erase: device 0 offset 0x0, size 0x80000
Erasing at 0x60000 -- 100% complete.
OK


How can I create a u-boot script that will only write MLO once to NAND? and then proceed with uboot and kernel load to flash the rest of the NAND partitions?

At the moment, as soon as it writes MLO to NAND, it requests for  a restart. Since the boot.scr it in the microSD card, it keeps writing to MLO in a loop. 

One solution is to use two microSD cards, one to flash MLO. and the other to update u-boot environment variables, and then proceed with flashing the kernel and rootfile system.

However, its quite inefficient to have two microSD cards, and would prefer to do it in one shot.

Best regards,

Elvis
Hi,
        I'm trying to develop a microSD card image that will allow batch programming of beagleboard NAND devices for a production environment. 

My problem is MLO. As I understand, it needs to be written to NAND from u-boot with HW ECC turned on. I tried at the kernel level, after ensuring that it is writable from the kernel, by modifying board-omap3beagle.c, but for some reason MLO written to NAND in that manner didn't work. Is this a constraint, that MLO must be written from u-boot itself.

What I proceeded to do next is to create a boot.scr to automate the process. 

mmc init
fatload mmc 0:1 80000000 MLO
nandecc hw
nand erase 0 80000
nand write 80000000 0 80000
setenv bootcmd 'if mmc init ${mmcdev}; then if run loadbootscript; then run bootscript; else if run loaduimage; then run mmcboot; else run nandboot; fi; fi; else run nandboot; fi'
setenv bootdelay '3'
setenv baudrate '115200'
setenv loadaddr '0x82000000'
setenv usbtty 'cdc_acm'
setenv console ttyS2,115200n8
setenv mpurate '500'
setenv buddy 'none'
setenv vram '12M'
setenv dvimode '480x272MR-16@60'
setenv defaultdisplay 'dvi'
setenv mmcdev '1'
setenv mmcroot '/dev/mmcblk0p2 rw'
setenv mmcrootfstype 'ext3 rootwait'
setenv nandroot '/dev/mtdblock5 rw'
setenv nandrootfstype 'yaffs2 rootwait'
setenv nandargs 'setenv bootargs androidboot.console=ttyS2 console=${console} root=${nandroot} rootfstype=${nandrootfstype} vram=${vram} omapfb.vram=0:4M omapfb.mode=${dvimode} omapdss.def_disp=${defaultdisplay} omapfb.debug=y omapdss.debug=y init=/init'
setenv loadbootscript 'fatload mmc ${mmcdev} ${loadaddr} boot.scr'
setenv bootscript 'echo Running bootscript from mmc ...; source ${loadaddr}'
setenv loaduimage 'fatload mmc ${mmcdev} ${loadaddr} uImage'
setenv mmcboot 'echo Booting from mmc ...; run mmcargs; bootm ${loadaddr}'
setenv nandboot 'echo Booting from nand ...; run nandargs; nand read ${loadaddr} 280000 400000; bootm ${loadaddr}'
setenv mmcargs 'setenv bootargs androidboot.console=ttyS2 console=${console} root=${mmcroot} rootfstype=${mmcrootfstype} vram=${vram} omapfb.vram=0:4M omapfb.mode=${dvimode} omapdss.def_disp=${defaultdisplay} omapfb.debug=y omapdss.debug=y init=/init'
saveenv
boot


However it keeps running forever in a loop.
        
Hit any key to stop autoboot:  0 
mmc1 is available
reading boot.scr

1679 bytes read
Running bootscript from mmc ...
## Executing script at 82000000
mmc1 is available
reading MLO

24296 bytes read
HW ECC selected

NAND erase: device 0 offset 0x0, size 0x80000
Erasing at 0x60000 -- 100% complete.
OK

NAND write: device 0 offset 0x0, size 0x80000
 524288 bytes written: OK
## Switch baudrate to 115200 bps and press ENTER ...
Saving Environment to NAND...
Erasing Nand...
Erasing at 0x260000 -- 100% complete.
Writing to Nand... done
mmc1 is available
reading boot.scr

1679 bytes read
Running bootscript from mmc ...
## Executing script at 82000000
mmc1 is available
reading MLO

24296 bytes read
HW ECC selected

NAND erase: device 0 offset 0x0, size 0x80000
Erasing at 0x60000 -- 100% complete.
OK


How can I create a u-boot script that will only write MLO once to NAND? and then proceed with uboot and kernel load to flash the rest of the NAND partitions?

At the moment, as soon as it writes MLO to NAND, it requests for  a restart. Since the boot.scr it in the microSD card, it keeps writing to MLO in a loop. 

One solution is to use two microSD cards, one to flash MLO. and the other to update u-boot environment variables, and then proceed with flashing the kernel and rootfile system.

However, its quite inefficient to have two microSD cards, and would prefer to do it in one shot.

Best regards,

Elvis




--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux