Page 1 of 1
Test setup for bootloader.
Posted: Thu May 19, 2011 1:15 pm
by mindentropy
Hi,
I want to write a simple bootloader for a development board that I am having. I have previous experience with writing a bootloader for x86.
I would want to know what's the best development setup? I already have uboot on it. Is it a good idea to write a second stage bootloader by booting from uboot? There is network,usb and sd card interface on it. Coding on my desktop and transferring via sd card everytime there is a small change is cumbersome.
Thanks.
Re: Test setup for bootloader.
Posted: Thu May 19, 2011 1:25 pm
by rdos
The best setup for ease of development is a FTP-server. However, that requires a functional network driver, a functional filesystem and a functional TCP/IP stack, which is not something that beginners have. If the BIOS supports remote boot over networks (for instance bootp), this could be a useful alternative.
I did my first stages under MSDOS, which might be attractive because it could host the required tools, and it reboots pretty fast. Windows is less attractive because it takes ages to boot.
Re: Test setup for bootloader.
Posted: Thu May 19, 2011 1:30 pm
by mindentropy
Well uboot supports tftpboot. I was thinking that would be the way to go i.e. make uboot boot my bootloader. Since I am writing everything from scratch my first priority should be writing a serial driver and making the LED's blink I guess.
Also in case of driver writing for an existing OS say linux is nfs the only way to go to make things comfortable? I am a little concerned about security. How are you guys managing it?
Also how do corporations write their bootloaders? Do they write for their emulators first or do they directly write for the hardware? Do they get the hardware upfront?
Re: Test setup for bootloader.
Posted: Thu May 19, 2011 7:58 pm
by schilds
Since you mentioned a serial driver, and assuming that means it has a serial port: I just wrote something that boots, relocates itself and loads code over a serial port (that I intend to play around with myself). It should be possible to chain load your own boot loader using it. However I'm new to this whole business so can't tell you if it's suitable or not.
https://github.com/schilds/Serial-BootLoader
Re: Test setup for bootloader.
Posted: Fri May 20, 2011 12:55 am
by mindentropy
Hope your board had facilities for loading boot loader off of mmc card when you start testing and inevitably bricking the loader.
No it doesn't. I have to use the bootloader provided in the NOR flash to write to the NAND flash. Then toggle a switch and boot from NAND flash. The bootloader in the NOR flash will upload the code via USB. For development these are quite a lot of steps I think.
Copying u-boot functionality is also not the best way to spend your time, but if you wish so - write an u-boot replacement, not chainloaded stage2.
Its just learning experience and will have minimal functionality. Serial and mmc.
Schilds,
That's exactly what I had in mind and planning on writing.