1. u-boot
重建u-boot比較重要的一點在mkimage的產生,因mkimage要將kernel包給u-boot去作init與換手的動作,必須要給些重要檔頭資訊給u-boot認得。這時mkimage執行檔就相當重要,要產生此執行檔有兩個辦法:
A: u can isolate the mkimage.c for building execution file, this C file is under the tools folder u-boot/tools
B: rebuild u-boot, it is an easy way to develop mkimage execution file
under your u-boot folder
$make davinci_dm368_ipnc_config
$make ARCH=arm CROSS_COMPILE=arm_v5t_le-
you can find 'mkimage' in u-boot/tools
如果是移动了uboot的路径,则可以这样:
(1) make unconfig
(2) make clean
(3) make clobber (important, 它将删除 原来生成的旧tools,参考makefile)
(4) make smdk2410_config
(5) make
OK...
2. kernel
rebuild kernel
defconfig first
make ARCH=arm CROSS_COMPILE=arm_v5t_le- davinci_dm365_defconfig
(davinci_dm365_ipnc_defconfig/davinci_dm368_ipnc_defconfig)
config file can refer this path: /arch/arm/configs/
verifying the montavista default kernel options
make ARCH=arm CROSS_COMPILE=arm_v5t_le- checksetconfig
manual mkimage (only for dm368 ipnc)
./mkimage -A arm -O linux -T kernel -C none -a 80008000 -e 80008000 -n Linux-2.6.18_pro500-davinci_IPNC -d zImage uImage
modify MTD partition with dm368_ipnc in below C file
ti-davinci/arch/arm/mach-davinci/board-dm368-ipnc.c
mkimage always not find, because u must re-build your u-boot and set the absolute path in scripts/mkuboot.sh that is in your kernel root folder, for example:
1 #!/bin/bash
2
3 #
4 # Build U-Boot image when `mkimage' tool is available.
5 #
6 MKIMAGE_PATH="/home/joe/dm368/ipnc/Utils/src/u-boot/tools/"
7 MKIMAGE=$(type -path "${MKIMAGE_PATH}mkimage")
8
9
10 if [ -z "${MKIMAGE}" ]; then
11 # Doesn't exist
12 echo '"mkimage" command not found - U-Boot images will not be built' >&2
13 exit 0;
14 fi
15
16 # Call "mkimage" to create U-Boot image
17 ${MKIMAGE} "$@"
if u finished above steps, i think the uImage is ready in this path arch/arm/boot/uImage
3. ramdisk (root file system + busybox + udev + init setting)
Develop root file system (ext2, cramfs)
first, build a simple file system by hand
$dd if=/dev/zero of=rootfs.ext bs=32768K count=1
bs=32768K is depend on your kernel config, device driver-> block setting-> ramdisk size
$/sbin/mke2fs rootfs.ext
...proceed anyway?[Y/N]Y
or another way
$mke2fs -F -m0 rootfs.ext2
then mount this file system to your folder
$mkdir initrd
$sudo mount -t ext2 -o loop rootfs.ext2 initrd
next we can copy any folder to initrd, or create the core file system in this folder
$mkdir bin dev etc lib proc sbin sys tmp usr var
$chmod 1777 tmp
$mkdir usr/bin usr/lib usr/sbin
$mkdir var/lib var/lock var/log var/run var/tmp
$chmod 1777 var/tmp
copy all required library (*.so) to /lib
next, install busybox
download busybox
close the task set from micellaneous... utility in "make menuconfig"
rebuild busybox
$make ARCH=arm CROSS_COMPILE=arm_linux
install busybox to your folder
$make install ARCH=arm CROSS_COMPILE=arm_linux
install UDEV
after kernel 2.6.14 , the device node can detect all device nodes automatily, here have two ways
1.UDEV
2.mdev from busybox
UDEV is more popular than mdev, and UDEV is able to add the device you need.
mdev -s just only scan the device which is in your system.
UDEV is the best way to detect your system device node.
download UDEV from internet http://www.kernel.org/pub/linux/utils/kernel/hotplug/
The udev-100 is i used
$make ARCH=arm CROSS_COMPILE=arm_linux
copy udev, udevd, udevsettle, udevtrigger,udevstart to /sbin/ and create udev folder in /etc
links.conf, rules.d, udev.conf these three files are under /etc/udev
init setting
etc/init.d/rcS, etc/fstab, etc/inittab are requirements
vi fstab -->
proc /proc proc defaults 0 0
sysfs /sys sysfs defaults 0 0
tmpfs /dev tmpfs defaults 0 0
vi rcS --> remember to start our udev
udevd --daemon
udevstart
.....it is configurable on init code
if udev, init, busybox are ready.
ext2->
$sudo umount -t ext2 initrd
$gzip -9 rootfs.ext2
$cp rootfs.ext2.gz /tftpboot
and u-boot config is
bootargs mem=50m console.... root=/dev/ram0 rw initrd=0x82000000, 8M... -->8M is according to rootfs.ext2.gz size.
cramfs->
downlod cramfs http://sourceforge.net/projects/cramfs/
rebuild your cramfs
don't unmount your initrd
$cramfs/mkcramfs initrd rootfs.cram
透過上面兩種檔案系統格式都可以正常啟動,這邊比較匪夷所思的是以往都是由u-boot 帶起kernel跟ramdisk,在此u-boot帶起kernel是毫無疑問的,但是否為kernel帶起ramdisk還是?因為如果透過mkimage的方式去包ramdisk,會有開啟後認不出檔案系統的現象,kernel panic...VFS,但如果不透過mkimage直接透過gzip壓縮,透過u-boot來帶initrd是可以正常運作的,其中的差異就是是否有被u-boot 的mkimage所包過。而cramfs的方式就都不會有這樣的問題。
in ramdisk
$[root@hostname /]# /bin/hostname joe-host
$[root@joe-host /]#
沒有留言:
張貼留言