1.新建kernel文件夹,用于存放内核文件
[weishusheng@localhost ~]$ mkdir kernel
2.进入kernel,上传压并解压压缩文件
[weishusheng@localhost ~]$cd kernel
[weishusheng@localhost kernel]$ tar -xjf linux-3.0.tar.bz2
3.进入linux-3.0
cd linux-3.0
4.修改makefile,配置CPU类型和交叉编译器(195,196行)
ARCH ?=arm
CROSS_COMPILE ?=/opt/buildroot-2012.08/arm926t/usr/bin/arm-linux-
交叉编译器路径每个人不太一样,大家把路径都换成自己的,另外在配置交叉编译器路径的时候,不要多加多余的空格,否则编译器不会被找到。
在同一文件下添加zImage头制作(559行后面)
cp arch/arm/boot/zImage . -f
../u-boot-2010.09.bak/tools/mkimage -A arm -O linux -T kernel -C none -a 30008000
-e 30008040 -n "Linux Kernel" -d zImage linux-s3c2440-kernel.bin
rm -f zImage
以上三行都以Tab空格键开头
(-A 指定CPU的体系结构
-O 指定操作系统类型,可以取以下值:
openbsd、netbsd、freebsd、4_4bsd、linux、svr4、esix、solaris、irix、sco、dell、ncr、lynxos、vxworks、psos、qnx、u-boot、rtems、artos
-T 指定映象类型,可以取以下值:
standalone、kernel、ramdisk、multi、firmware、script、filesystem
-C 指定映象压缩方式
-a 指定映象在内存中的加载地址,映象下载到内存中时,要按照用mkimage制作映象时,这个参数所指定的地址值来下载
-e 指定映象运行的入口点地址,这个地址就是-a参数指定的值加上0x40(因为前面有个mkimage添加的0x40个字节的头)
-n 指定映象名
-d 指定制作映象的源文件
该段是在linux编译的内核的前面,加上一个64字节的头,让u-boot能够引导内核启动
5.我们以s3c2410为模板制作s3c2440的内核。
拷贝 arch/arm/configs/s3c2410_defconfig作为.config的模板
[weishusheng@localhost linux-3.0]$ sudo cp arch/arm/configs/s3c2410_defconfig ./.config
注意"."是拷贝到当前目录下
6.make menuconfig
(如果make menuconfig后乱码或者不能删除路径以进行修改,那么是你在执行make menuconfig前没有执行export TERM=vt100)
Linux/arm 3.0.0 Kernel Configuration
所有的 M-> n (*代表编译进内核,M表示编译成模块,n表示不选)
General setup --->
[*] Enable loadable module support --->
-*- Enable the block layer --->
[ ] Support for large (2TB+) block devices and files
System Type --->
[*] MMU-based Paged Memory Management Support
ARM system type (Samsung S3C2410, S3C2412, S3C2413, S3C2416, S3C2440, S3C
(X) Samsung S3C2410, S3C2412, S3C2413, S3C2416, S3C2440, S3C2442
S3C2440 and S3C2442 Machines --->
[*] SMDK2440
[*] SMDK2440 with S3C2440 CPU module (NEW)
Kernel Features --->
[*] Use the ARM EABI to compile the kernel
Boot options --->
() Default kernel command string
consel=ttySAC0,115200,init=/init
Userspace binary formats --->
[*] Kernel support for ELF binaries
-*- Networking support --->
M -> n
Device Drivers --->
< > Parallel port support --->
[*] Block devices --->
Network block device support
(1024) Default number of RAM disks
(204800) Default RAM disk size (kbytes)
其他的,M->n
SCSI device support --->
M->n
[*] Network device support --->
[*] Ethernet (10 or 100Mbit) --->
DM9000 support
[]wireless LAN无线网卡 先不选
Input device support --->
input device support](包括鼠标键盘触摸屏(event interface)) *-->n(先都不支持只留下串口)
Character devices --->
[*] Stallion multiport serial support
Serial drivers --->
< > 8250/16550 and compatible serial support
Samsung SoC serial support
[*] Support for console on Samsung SoC serial port
Samsung S3C2440/S3C2442/S3C2416 Serial port support (NEW)
< > Hardware Random Number Generator Core support
*-*TPM Hardware Support---->
< > National Semiconductor TPM Interface
< > Atmel TPM Interface
< > Hardware Monitoring support --->
Sound card support --->
< > Advanced Linux Sound Architecture --->
[ ] Multifunction device drivers --->
[ ] HID Devices --->
[*] USB support --->
USB Mass Storage support
USB Serial Converter support --->
USB FTDI Single Port Serial Driver USB转串口驱动程序
USB Prolific 2303 Single Port Serial Driver PL2303驱动
USB Winchiphead CH341 Single Port Serial Driver
MMC/SD/SDIO card support --->
Secure Digital Host Controller Interface support
File systems --->
前4种系统一般都不会用到n
CD-ROM/DVD Filesystems --->
< > ISO 9660 CDROM file system support
M-->n
DOS/FAT/NT Filesystems --->
Pseudo filesystems --->伪文件系统 [*][Tmpfs POSIX Access Control Lists]将内存的一段拿出来做文件系统(掉电丢失),必须要 [*] Miscellaneous filesystems ---> Journalling Flash File System v2 (JFFS2) support [*] Network File Systems ---> NFS client support [kernel hacking] 都不选 n [cryptographic API]加密相关不选 n [library routines] 动态库不选 7.修改时钟和串口 将arch/arm/mach-s3c2440/mach-smdk2440.c中的__init smdk2440_map_io()函数中对时钟的初始化修改为12MHz: s3c24xx_init_clocks(12000000); 8.将drivers/tty/serial/samsung.c中设置如下: #define S3C24XX_SERIAL_NAME "ttyS" 将uart_driver s3c24xx_uart_drv结构体中的.driver_name设置为如下 .driver_name = "ttyS", 8.修改arch/arm/tools/mach-types,将machine_ID配置为如下 s3c2440 ARCH_S3C2440 S3C2440 1999 mini2440 MACH_MINI2440 MINI2440 362 9.开始编译:make 编译好了之后,把linxurom-s3c2440.bin 下载到开发板的30008000地址下,bootm30008000 启动内核,因为我们的根文件系统还没加,所以在内核启动到挂载根文件系统时会卡住,那接下来的事就是根文件系统的制作了,但到了这步,我们的内核算是跑起来了。
VFAT (Windows-95) fs support
(437) Default codepage for FAT
(ascii) Default iocharset for FAT
NTFS file system support
[ ] NTFS debugging support (NEW)
[*] NTFS write support