bootloader: redboot
kernel: 2.6.31 ltib for imx51
rootfs: emdebian or ubuntu rootstock
board: freescale imx51
1. 先編kernel。這裡是用freescale 對於這塊板子提供的其中一個工貝,叫ltib。可以想像它就像是LFS寫成一個shell script,幫你從頭到尾建立kernel及roorfs,省去cross compiler的時間。比較重要的是這個ltib是由freescale 所提供的,所以裡面有板子的BSP,及kernel的patch,不然ltib其實是個open project。
***這包ltib在freescale的文件中說,要在Ubuntu 9.04下執行,才能正常work!!!!***
1. Download package L2.6.31_09.12.00_SDK_source.tar.gz
2. tar xvf L2.6.31_09.12.00_SDK_source.tar.gz
3. cd L2.6.31_09.12.00_SDK_source
4. ./install
5. cd ltib
6. ./ltib -m config
7. 等一段時間......
8. 會出現一個要你選rootfs的畫面,選min profile就好(因為它很小,省時間,重點是最後根本不需要..)
9. 再東選選西選選,重點要選目前用的板子,imx51_babbage
10. ./ltib
11.等一段時間......
12.中間會出現kernel的menuconfig,選你要的drivers吧
13.選完後,再等一下,就會在目前的資料夾產生一堆東西
14.重要的兩個,分別是roofs 資料夾(rootfs/boot/zImage<--kernel),及rpm 資料夾(rpm/BUILD/linux-2.6.31<--kernel source tree and some modules)
2. 燒寫bootloader 及kernel
1. bootloader。在這裡是用redboot,你也可以用uboot,但在freescale 的教學文件中都是用redboot。
1. Download package L2.6.31_09.12.00_SDK_images_MX51.tar.bz2
2. tar xvf L2.6.31_09.12.00_SDK_images_MX51.tar.bz2
3. cd L2.6.31_09.12.00_SDK_images_MX51
4. tar xvf redboot_200952.tar.bz2
5. cd redboot_200952/bin
6. dd if=mx51_babbage_redboot.bin of=/dev/sdb && sync && sync (假設SD卡為 /dev/sdb)
7. cd $ur_ltib_location/ltib/rootfs/boot/
8. dd if=zImage of=/dev/sdb bs=512 seek=2048 && sync && sync
2. 分割SD磁區。這裡是要將kernel跟rootfs分開。
1. fdisk /dev/sdb
The number of cylinders for this disk is set to 8491.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): u
Changing display/entry units to sectors
Command (m for help): d
Selected partition 1
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First sector (48-7744511, default 48): 8192
Last sector or +size or +sizeM or +sizeK (8192-7744511, default 7744511):
Using default value 7744511
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or
resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
2. umount /dev/sdb1
3. mkfs.ext3 /dev/sdb1
所以,/dev/sdb1巳經被格式化為ext3,等著後面要做的rootfs,做好的rootfs,就可以放到這裡來。
且SD卡前面的4M,存放著bootload及kernel。
理論上來說,這張SD卡巳經可以開機,只需要設定一下redboot的參數,
開機時,趕按 ctrl+C,進⼊bootloader
RedBoot> fis init
RedBoot> fis create -n -b 0x100000 -f 0x100000 -l 0x300000 kernel
RedBoot> fconfig
Run script at boot: true
Boot script:
Enter script, terminate with empty line
>> fis load kernel
>> exec –c “noinitrd console=tty1 console=ttymxc0, 115200 root=/dev/mmcblk0p1 rw video=mxcfb:800x600-16@60”
>>
Boot script timeout (1000ms resolution): 1
Use BOOTP for network configuration: true
Default server IP address: 192.168.0.1
Board specifics: 0
Console baud rate: 115200
Set eth0 network hardware address [MAC]: false
GDB connection port: 9000
Force console for special debug messages: false
Network debug at boot time: false
Update RedBoot non-volatile configuration - continue (y/n)? y
... Read from 0x07ee0000-0x07eff000 at 0xeff80000: .
... Erase from 0xeff80000-0xeffa0000: .
... Program from 0x07ee0000-0x07f00000 at 0xeff80000: .
RedBoot>
重啟電腦,但一定會出現kernel panic,因為這時還沒有rootfs啊。
沒有留言:
張貼留言