Boot from SD/MMC
From Manuals
| Line 1: | Line 1: | ||
__TOC__ | __TOC__ | ||
=Boot from SD/MMC= | =Boot from SD/MMC= | ||
| - | ==Creating a | + | ==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 into the slot of a running plug. Enter the following commands: | 1) The first step is to make a bootable file system on the SD card. Insert the card into the slot of a running plug. Enter the following commands: | ||
| Line 50: | Line 50: | ||
Electrum>> printenv bootargs (if you like, just to confirm that you did it right) | Electrum>> printenv bootargs (if you like, just to confirm that you did it right) | ||
Electrum>> boot | Electrum>> boot | ||
| + | ==To boot Kernel and Rootfs from SD/MMC card (Without NAND)== | ||
| + | 1) Download u-boot-2010.03. (Its recommended that load can be built before going further) | ||
| + | |||
| + | 2) Copy board/micromint folder and /include/configs/electrum100.h from u-boot-2009.08. | ||
| + | |||
| + | 3) Add the following Configurations to enable MMC support. | ||
| + | |||
| + | #define CONFIG_CMD_EXT2 1 | ||
| + | #define CONFIG_CMD_FAT 1 | ||
| + | #define CONFIG_MMC 1 | ||
| + | #define CONFIG_GENERIC_MMC 1 | ||
| + | #define CONFIG_CMD_MMC 1 | ||
| + | #define CONFIG_GENERIC_ATMEL_MCI 1 | ||
| + | #define MMCI_BASE 0xFFFA8000 | ||
| + | 4) Then create an init routine in your platform code: | ||
| + | |||
| + | /* this is a weak define that we are overriding */ | ||
| + | #ifdef CONFIG_GENERIC_ATMEL_MCI | ||
| + | int board_mmc_init(bd_t *bd) | ||
| + | { | ||
| + | at91_mci0_hw_init((1 << 0) || (1 << 1)); | ||
| + | /* This calls the atmel_mmc_init in gen_atmel_mci.c */ | ||
| + | return atmel_mmc_init(bd); | ||
| + | } | ||
| + | #endif | ||
| + | 5) Change line 86 of uboot*/cpu/arm926ejs/at91/at91sam9260_devices.c to | ||
| + | |||
| + | #if defined(CONFIG_ATMEL_MCI) || defined(CONFIG_GENERIC_ATMEL_MCI) | ||
| + | 6) Apply the following patch: http://www.mail-archive.com/u-boot@lists.denx.de/msg31713.html | ||
| + | |||
| + | 7) Build the u-boot-2010.03 | ||
| + | |||
| + | $make bootloader | ||
| + | 8) Update the Boot strapper and Boot-loader into Electrum100 using SAM-BA application | ||
| + | |||
| + | 9) Execute the command: | ||
| + | |||
| + | Electrum>> mmc list | ||
| + | Electrum>> mmc rescan 0 | ||
| + | |||
| + | 10) Now copy the Kernel Image and rootfs into SD card (Refer the section: Creating a Bootable filesystem on SD card). | ||
| + | |||
| + | 11) Check the card using "mmc rescan 0" command | ||
| + | |||
| + | 12) change the boot args to load root file system from SD card. | ||
| + | |||
| + | bootargs console=ttyS0,115200 root=/dev/mmcblk0p1 rw ip=192.168.1.231:192.168.1.249::255.255.255.0::eth0:none | ||
| + | 13) To load the Kernel from EXT2 change the boot commands | ||
| + | |||
| + | Electrum>> setenv bootcmd mmcinfo\; ext2load mmc 0:1 0x22000000 uImage-2.6.31.9\; bootm | ||
| + | Electrum>> saveenv | ||
| + | Electrum>> reset | ||
Revision as of 13:27, 17 June 2010
Contents |
Boot from SD/MMC
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 into the slot of a running plug. Enter the following commands:
>fdisk /dev/mmcblk0 press "o" / create a new partition table press "n" / create a new partition press "p" / it's a primary partition press "1" / partition #1 press enter / default first cylinder press enter / default last cylinder press "a" / set the boot flag press "1" / ... for partition #1 press "w" / save changes >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>> boot
To boot Kernel and Rootfs from SD/MMC card (Without NAND)
1) Download u-boot-2010.03. (Its recommended that load can be built before going further)
2) Copy board/micromint folder and /include/configs/electrum100.h from u-boot-2009.08.
3) Add the following Configurations to enable MMC support.
#define CONFIG_CMD_EXT2 1 #define CONFIG_CMD_FAT 1 #define CONFIG_MMC 1 #define CONFIG_GENERIC_MMC 1 #define CONFIG_CMD_MMC 1 #define CONFIG_GENERIC_ATMEL_MCI 1 #define MMCI_BASE 0xFFFA8000
4) Then create an init routine in your platform code:
/* this is a weak define that we are overriding */
#ifdef CONFIG_GENERIC_ATMEL_MCI
int board_mmc_init(bd_t *bd)
{
at91_mci0_hw_init((1 << 0) || (1 << 1));
/* This calls the atmel_mmc_init in gen_atmel_mci.c */
return atmel_mmc_init(bd);
}
#endif
5) Change line 86 of uboot*/cpu/arm926ejs/at91/at91sam9260_devices.c to
#if defined(CONFIG_ATMEL_MCI) || defined(CONFIG_GENERIC_ATMEL_MCI)
6) Apply the following patch: http://www.mail-archive.com/u-boot@lists.denx.de/msg31713.html
7) Build the u-boot-2010.03
$make bootloader
8) Update the Boot strapper and Boot-loader into Electrum100 using SAM-BA application
9) Execute the command:
Electrum>> mmc list Electrum>> mmc rescan 0
10) Now copy the Kernel Image and rootfs into SD card (Refer the section: Creating a Bootable filesystem on SD card).
11) Check the card using "mmc rescan 0" command
12) change the boot args to load root file system from SD card.
bootargs console=ttyS0,115200 root=/dev/mmcblk0p1 rw ip=192.168.1.231:192.168.1.249::255.255.255.0::eth0:none
13) To load the Kernel from EXT2 change the boot commands
Electrum>> setenv bootcmd mmcinfo\; ext2load mmc 0:1 0x22000000 uImage-2.6.31.9\; bootm Electrum>> saveenv Electrum>> reset
