核心板:micro2440
交叉编译工具:arm-linux-gcc-3.4.2.tar.bz2
内核: linux-2.6.18.tar.bz2
# tar –jxvf arm-linux-gcc-3.4.2.tar.bz2 –C /
# tar –jxvf linux-2.6.18.tar.bz2
# cd linux-2.6.18
# vi Makefile //修改架构,交叉编译
ARCH = arm
CROSS_COMPILE = /armtools/bin/arm-linux-
# vi arch/arm/mach-s3c2410/common-smdk.c
107 static struct mtd_partition smdk_default_nand_part[] = {
108 [0] = {
109 .name = "bootloader", //bootloader位置
110 .size = 0x80000,
111 .offset = 0,
112 },
113 [1] = { //内核所存位置
114 .name = "kernel",
115 .offset = 0x80000,
116 .size = 0x3c0000,
117 },
118 [2] = { //文件系统所存位置
119 .name = "rootfs",
120 .offset = 0x440000,
121 .size = 0x3f00000,
122 },
123 [3] = {
124 .name = "other",
125 .offset = 0x4340000,
126 .size = 0xbcc0000,
127 }/*,
128 ……..
# vi drivers/mtd/nand/s3c2410.c //修改ECC
574 } else {
575 //chip->ecc.mode = NAND_ECC_SOFT;
576 chip->ecc.mode = NAND_ECC_NONE;
577 }
578 }
# cd ../
# tar –zxvf yaffs2.tar.gz
# cd yaffs2
# ./patch-ker.sh c ../linux-2.6.18
# cd ../linux-2.6.18
# vi fs/Kconfig
787
788 config DEVFS_FS
789 bool "/dev file system support"
790 depends on EXPERIMENTAL
791 default y
792 help
793 sa;dkfsafdsafsa
794
795 config DEVFS_MOUNT
796 bool "Automatically mount at boot"
797 depends on DEVFS_FS
798 default y
799 help
800 asdfasfdkjkl
801
802 config DEVFS_DEBUG
803 bool "debug devfs"
804 depends on DEVFS_FS
805 help
806 sasaad
# vi arch/arm/kernel/head.S
73 /*add by gary*/
74 mov r0, #0
75 ldr r1, =0x16a
76 ldr r2, =0x30000100
77 /*end add*/
# vi arch/arm/mach-s3c2410/mach-smdk2440.c
194 //s3c24xx_init_clocks(16934400);
195 s3c24xx_init_clocks(12000000);
内核配置:
# make s3c2410_defconfig
# make menuconfig
System Type
S3C24XX Implementations --->
[*] SMDK2440
[*] SMDK2440 with S3C2440 CPU module
[*] SMDM2440 with S3C2442 CPU module
Floating point emulation --->
[*] NWFPE math emulation
Device Drivers
Memory Technology Devices (MTD) --->
<*> Memory Technology Device (MTD) support
<*> MTD concatenating support
[*] Command line partition table parsing
NAND Flash Device Drivers
<*> NAND Device Support
<*> NAND Flash support for S3C2410/S3C2440 SoC
Block devices
<*> Loopback device support
<*> RAM disk support
(16) Default number of RAM disks
(4096) Default RAM disk size (kbytes)
(1024) Default RAM disk block size (bytes)
[*] Initial RAM filesystem and RAM disk (initramfs/initrd) support
File systems
Pseudo filesystems --->
[*] Virtual memory file system support (former shm fs)
Miscellaneous filesystems
<*> YAFFS2 file system support
<*> Journalling Flash File System (JFFS) support
<*> Compressed ROM file system support (cramfs)
# make
# make uImage
ramdisk根文件系统:
mkdir rootfs
创建目录:
cd rootfs/
mkdir bin boot dev etc home lib mnt opt proc root sbin tmp uar var
chmod 1777 tmp
chmod 700 root
添加设备文件:
cd dev/
mknod -m 600 console c 5 1
mknod -m 666 null c 1 3
添加etc下的配置文件:
cd ../etc/
vi inittab (系统初始化)
::sysinit:/etc/init.d/rcS
::askfirst:/bin/sh
mkdir init.d
cd init.d
vi rcS
#!/bin/sh
echo "mount all"
/bin/mount -a
echo "*************************"
echo "My Embedded"
echo "*************************"
chmod 755 rcS
cd ..
vi fstab (文件挂载)
none /proc proc defaults 0 0
none /tmp tmpfs defaults 0 0
vi profile (配置环境变量)
#set path
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
chmod 755 fstab inittab profile
cd busybox-1.00 (配置、编译和安装BusyBox-1.0)
Build Options --->
[*] Build BusyBox as a static binary (no shared libs)
[*] Do you want to build BusyBox with a Cross Compiler?
(/armtools/bin/arm-linux-) Cross Compiler prefix
make
make install
cp –r _install/* rootfs/
ramdisk 制作:
mkdir tmp/initrd
dd if=/dev/ram0 of=tmp/ramdisk.img bs=1024 count=4096 (4096与内核相关选相以对应)
mkfs.ext2 -F -m 0 -b 1024 tmp/ramdisk.img 4096 (ext2在内核中以选上)
mount -t ext2 tmp/ramdisk.img /mnt/ -o loop
cp -av rootfs/* /mnt/
umount /mnt/
bzip2 -9 tmp/ramdisk.img
mkimage -A arm -O linux -T ramdisk -C bzip2 -n testfs -a 0x440000 -e 0x440000 -d tmp/ramdisk.img.bz2 initrd.img
uImage:
tftp 0x33000000 uImage
nand erase 0x80000 0x3c0000
nand write 0x33000000 0x80000 0x3c0000
ramdisk:
tftp 0x30008000 uImage
nand erase 0x440000 0x300000
nand write 0x30008000 0x440000 0x300000
setenv bootargs root=/dev/ram0 console=ttySAC0 init=/linuxrc rootfstype=ext2
save
reset
错误信息:
s3c2440-i2c s3c2440-i2c: i2c-0: S3C I2C adapter
TCP bic registered
NET: Registered protocol family 1
No filesystem could mount root, tried: ext2
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(1,0)
高手解答下,这个是什么问题!好困惑!!