1解壓縮文件
tar -jxf linux-3.0.tar.bz2
cd linux-3.0
2修改makefile,配置CPU類型和交叉編譯器(195,196行)
ARCH ?= arm
CROSS_COMPILE ?= /opt/buildroot-2012.08/arm920t/usr/bin/arm-linux-
注意:在配置交叉編譯器路徑的時候,不要多加多餘的空格,否則編譯器不會被找到,我剛剛修改的cross_compile的時候,就是因爲在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
linuxrom-s3c2440.bin
rm -f zImage
該段是在linux編譯的內核的前面,加上一個64字節的頭,讓u-boot能夠引導內核啓動
3拷貝 arch/arm/configs/s3c2410_defconfig作爲.config的模板,
make menuconfig
System Type --->
[*] SMDK2440
[*] SMDK2440 with S3C2440 CPU module
Kernel Features --->
[*]UsetheARMEABItocompilethekernel
[*] Allow old ABI binaries to run with this kernel (EXPERIMENTAL)
4修改時鐘和串口
將arch/arm/mach-s3c2440/mach-smdk2440.c中的__init smdk2440_map_io()函數中對時鐘的初始化修改爲12MHz:
s3c24xx_init_clocks(12000000);
將drivers/tty/serial/samsung.c中設置如下:
#define S3C24XX_SERIAL_NAME "ttyS"
將uart_driver s3c24xx_uart_drv結構體中的.driver_name設置爲如下
.driver_name = "ttyS",
5修改arch/arm/tools/mach-types,將machine_ID配置爲如下
s3c2440 ARCH_S3C2440 S3C2440 1999
mini2440 MACH_MINI2440 MINI2440 362
6 開始編譯:make
編譯好了之後,把linxurom-s3c2440.bin 下載到開發板的30008000地址下,啓動,這時候我們發現,我們的開發板已經跑起來了,可以進入內核了。
7配置內核
make menuconfig
General setup --->
[*] Prompt for development and/or incomplete code/drivers
[*] System V IPC
<*> Kernel .config support
[*] Enable access to .config through /proc/config.gz
[*] Optimize for size
-*- Configure standard kernel features (expert users) --->
[*] Embedded system
[*] Enable VM event counters for /proc/vmstat
[*] Disable heap randomization
[*] Enable loadable module support --->
[*] Module unloading
[*] MMU-based Paged Memory Management Support
ARM system type (Samsung S3C2410, S3C2412, S3C2413, S3C2416, S3C2440, S3C2442, S3C2443, S3C2
[*] Force UART FIFO on during boot process
S3C2440 and S3C2442 Machines --->
[*] SMDK2440
[*] SMDK2440 with S3C2440 CPU module
[*] Use the ARM EABI to compile the kernel
[*] Allow old ABI binaries to run with this kernel (EXPERIMENTAL)
Boot options --->
(console=ttyS0,115200 mem=64M rw loglevel=7 init=/init) Default kernel command string
Floating point emulation --->
[*] NWFPE math emulation
Userspace binary formats --->
[*] Kernel support for ELF binaries
Power management options --->
[*] Suspend to RAM and standby
[*] Networking support --->
Networking options --->
<*> Packet socket
<*> Unix domain sockets
[*] TCP/IP networking
[*] IP: multicasting
[*] IP: kernel level autoconfiguration
[*] IP: DHCP support
[*] IP: BOOTP support
[*] IP: RARP support
[*] IP: multicast routing
<*> INET: socket monitoring interface
[*] Network packet filtering framework (Netfilter) --->
-*- DNS Resolver support
Device Drivers --->
[*] Network device support --->
[*] Ethernet (10 or 100Mbit) --->
<*> DM9000 support