bootloader环境搭建
1.解压bootloader
tar zxvf uboot_mini2440.tar.gz
2.清除bootloader
cd uboot_mini2440
make distclean
3.配置bootloader
make mini2440_config
4.设置启动环境变量
4.1.设置flash下载并启动内核
配置bootloader/include/configs/mini2440.h中的CONFIG_BOOTCOMMAND
nand read 31000000 60000 500000;bootm 31000000
4.2.设置yaffs挂载根文件系统
配置bootloader/include/configs/mini2440.h中的CONFIG_BOOTARGS
noinitrd console=ttySAC0,115200 init=/linuxrc root=/dev/mtdblock2
5.编译bootloader
make ARCH=arm CROSS_COMPILE=arm-linux-
rootfs环境搭建
1.创建系统目录
mkdir rootfs
cd rootfs
mkdir bin dev etc lib mnt proc sbin sys tmp usr var
mkdir usr/bin usr/lib usr/sbin lib/modules
2.创建设备文件
cd dev
mknod -m 666 console c 5 1
mknod -m 666 null c 1 3
3.添加配置文件
tar zxvf etc.tar.gz
cp -rf etc/* rootfs/etc/
4.添加系统工具
4.1.解压busybox
tar zxvf busybox-1.13.3.tar.gz
4.2.清除busybox
cd busybox-1.13.3
make distclean
4.3.配置busybox
make menuconfig
busybox settings->build options->[*]build busybox as a static binary
busybox settings->build options->(arm-linux-)cross compiler prefix
busybox settings->installation options->[*]don’t use /usr
busybox settings->installation options->(.../rootfs)busybox installation prefix
4.4.编译busybox
make
4.5.安装busybox
make install
kernel环境搭建
1.解压kernel
tar zxvf linux-mini2440.tar.gz
2.清除kernel
cd linux-mini2440
make distclean
3.配置kernel
3.1.加载配置文件
make menuconfig ARCH=arm
load an alternate configuration file->.config->exit->save
3.2.配置文件系统
make menuconfig ARCH=arm
device drivers-><*>memory techology device(MTD) support
->[*]MTD partitioning support
3.3.配置内核分区
配置kernel/arch/arm/mach-s3c2440/mach-mini2440.c中的mtd_partition
static struct mtd_partition friendly_arm_default_nand_part[] = {
[0] = {
.name = "u-boot",
.offset = 0x00000000,
.size = 0x00040000,
},
[1] = {
.name = "kernel",
.offset = 0x00060000,
.size = 0x00500000,
},
[2] = {
.name = "rootfs",
.offset = 0x00560000,
.size = MTDPART_SIZ_FULL,
}
};
4.编译kernel
4.1.复制mkimage工具
cp .../uboot_mini2440/tools/mkimage /bin
4.2.编译kernel
make uImage ARCH=arm CROSS_COMPILE=arm-linux-
5.编译kernel模块
make modules ARCH=arm CROSS_COMPILE=arm-linux-
6.安装kernel模块
make modules_install ARCH=arm INSTALL_MOD_PATH=.../rootfs
7.压缩文件系统
./mkyaffs2image .../rootfs rootfs.img
8.下载bootloader
8.1.PC安装USB驱动
insmod usb.ko
8.2.开发板等待下载
usbsalve 1 31000000
8.3.PC开始USB上传
./dnw u-boot.bin 30100000
8.4.开发板擦除nand
nand erase 0 40000
8.5.开发板烧写nand
nand write 31000000 0 40000
9.下载kernel
9.1.开发板等待下载
usbsalve 1 31000000
9.2.PC开始USB上传
./dnw uImage 31000000
9.3.开发板擦除nand
nand erase 60000 500000
9.4.开发板烧写nand
nand write 31000000 60000 500000
10.下载rootfs
10.1.开发板等待下载
usbsalve 1 31000000
10.2.PC开始USB上传
./dnw rootfs.img 31000000
10.3.开发板擦除nand
nand erase 560000
10.4.开发板烧写nand
nand write.yaffs 31000000 560000 [flie size]