Boot from SD/MMC
From Manuals
(→Boot from SD/MMC) |
(→Creating a Bootable Filesystem on SD card) |
||
| Line 54: | Line 54: | ||
Using default value 1 | Using default value 1 | ||
Last cylinder, +cylinders or +size{K,M,G} (1-1203, default 1203): | Last cylinder, +cylinders or +size{K,M,G} (1-1203, default 1203): | ||
| - | + | # select last cylinder (default) | |
Using default value 1203 | Using default value 1203 | ||
Command (m for help): a # set boot blag | Command (m for help): a # set boot blag | ||
| - | Partition number (1-4): 1 | + | Partition number (1-4): 1 # for first partition |
Command (m for help): w # write changes | Command (m for help): w # write changes | ||
Revision as of 16:24, 10 February 2011
Contents |
Boot from SD/MMC
The Following Procedure explains how to boot a Kernel Image and Root File system from a SD/MMC card. Thus a NAND flash is no more a mandatory component to have on our Electrum100 boards. Boot from SD/MMC card gives a wide range of options for the user including portability, larger memory etc,. In our test bed, we didn't see a considerable change in the speed of the board, thus speed is not a big concern when booting from SD/MMC given the advantages it provides.
Note: As EXT2 File system is used, there is no Journalism. So its recommended to use standard commands every time you Reboot or Shutdown.
shutdown -h now to Shutdown shutdown -r now to Restart
To boot Kernel and Rootfs from SD/MMC card (Without NAND)
1) Download u-boot-2010.03 from http://wiki.micromint.com/index.php/Electrum_Documentation
2) Build u-boot-2010.03 source or download the binary.
$make bootloader
3) Update the Boot strapper and Boot-loader into Electrum100 using SAM-BA application
4) Execute the command:
Electrum> mmc list Electrum> mmc rescan 0
5) Now copy the Kernel Image and rootfs into SD card (Refer the section: Creating a Bootable filesystem on SD card).
6) Check the card using "mmc rescan 0" command
7) change the boot args to load root file system from SD card.
setenv bootargs console=ttyS0,115200 root=/dev/mmcblk0p1 rw ip=192.168.1.231:192.168.1.249::255.255.255.0::eth0:none
8) To load the Kernel from EXT2 change the boot commands
Electrum> setenv bootcmd mmcinfo\; ext2load mmc 0:1 0x22000000 uImage-2.6.33.5\; bootm Electrum> saveenv Electrum> reset
Creating a Bootable Filesystem on SD card
1) The first step is to make a bootable file system on the SD card. Insert the card and enter the following commands:
$ fdisk /dev/mmcblk0
Command (m for help): o # create a new partition table
Building a new DOS disklabel with disk identifier 0xc57e78f0.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Command (m for help): n # create a new partition
Command action
e extended
p primary partition (1-4)
p # select primary partition
Partition number (1-4): 1 # select first partition (default)
First cylinder (1-1203, default 1): # select first cylinder (default)
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1203, default 1203):
# select last cylinder (default)
Using default value 1203
Command (m for help): a # set boot blag
Partition number (1-4): 1 # for first partition
Command (m for help): w # write changes
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
$ mkfs -t ext2 /dev/mmcblk0p1
$ mkdir /mnt/sdcard
$ mount /dev/mmcblk0p1 /mnt/sdcard
$ df
2) Now copy your existing nand file system onto the sd card. This may take 5-10 minutes.
root#: cp -r /rootfs/* /mnt/sdcard
3) The SD card should now mirror your internal nand flash, which you can confirm with df -h, etc.
Filesystem 1K-blocks Used Available Use% Mounted on rootfs 519168 185612 333556 36% / tmpfs 257816 0 257816 0% /lib/init/rw varrun 257816 260 257556 1% /var/run varlock 257816 0 257816 0% /var/lock udev 257816 12 257804 1% /dev tmpfs 257816 0 257816 0% /dev/shm tmpfs 257816 21824 235992 9% /var/cache/apt /dev/mmcblk0p1 7707056 516216 6799340 8% /mnt/sdcard
your SD card now has a bootable system. The next step is to boot it.
Booting from the SD Card
You need to interact with u-boot now. You must do this from a program talking to the usb-serial port, not from an ssh shell (duh).
>shutdown -r now
When u-boot appears, stop it by typing ENTER a few times, to stop it from booting automatically.
Electrum>> printenv bootargs bootargs console=ttyS0,115200 root=/dev/nfs rw ip=192.168.1.231:192.168.1.249::255.255.255.0:: eth0: nfsroot=192.168.1.249:/media/disk/rootfs
This is the line that you'll need to change. Change it to
Electrum>> setenv bootargs console=ttyS0,115200 root=/dev/mmcblk0p1 rw ip=192.168.1.231:192.168.1.249::255.255.255.0:: eth0:none Electrum>> printenv bootargs (if you like, just to confirm that you did it right) Electrum>> saveenv Electrum>> boot
