【记录】kernel打补丁,编译

  1. 解压

准备好内核文件后,执行解压命令

book@book-desktop:~$ cd /work/system/
book@book-desktop:/work/system$ ls
busybox-1.7.0.tar.bz2        u-boot-1.1.6_jz2440.patch
linux-2.6.22.6_jz2440.patch  u-boot-1.1.6.tar.bz2
linux-2.6.22.6.tar.bz2       yaffs_source.tar.gz
s3c_mci_patch.tar.bz2        yaffs_source_util_larger_small_page_nand.tar.bz2
u-boot-1.1.6                 yaffs_util_mkyaffsimage.patch
book@book-desktop:/work/system$ 
book@book-desktop:/work/system$ 
book@book-desktop:/work/system$ tar xjf linux-2.6.22.6.tar.bz2 
  1. 打补丁

直接执行命令

book@book-desktop:~$ cd /work/system/
book@book-desktop:/work/system$ ls
busybox-1.7.0.tar.bz2        u-boot-1.1.6_jz2440.patch
linux-2.6.22.6_jz2440.patch  u-boot-1.1.6.tar.bz2
linux-2.6.22.6.tar.bz2       yaffs_source.tar.gz
s3c_mci_patch.tar.bz2        yaffs_source_util_larger_small_page_nand.tar.bz2
u-boot-1.1.6                 yaffs_util_mkyaffsimage.patch
book@book-desktop:/work/system$ 
book@book-desktop:/work/system$ 
book@book-desktop:/work/system$ tar xjf linux-2.6.22.6.tar.bz2 
  1. 配置

三种方法

3.1. make menuconfig

3.2.使用默认配置,在上面修改

查找默认配置

book@book-desktop:/work/system/linux-2.6.22.6$ find -name "*defconfig*"

2410相关默认配置

book@book-desktop:/work/system/linux-2.6.22.6$ make s3c2410_defconfig

结果保存到.config中

然后,从.config中读出信息,出现菜单

make menuconfig

 .config - Linux Kernel v2.6.22.6 Configuration
 --------------------------------------------------------------------------------
  +----------------------- Linux Kernel Configuration ------------------------+
  |  Arrow keys navigate the menu.  <Enter> selects submenus --->.            |
  |  Highlighted letters are hotkeys.  Pressing <Y> includes, <N> excludes,   |
  |  <M> modularizes features.  Press <Esc><Esc> to exit, <?> for Help, </>   |
  |  for Search.  Legend: [*] built-in  [ ] excluded  <M> module  < > module  |
  | +-----------------------------------------------------------------------+ |
  | |        Code maturity level options  --->                              | |
  | |        General setup  --->                                            | |
  | |        Loadable module support  --->                                  | |
  | |        Block layer  --->                                              | |
  | |        System Type  --->                                              | |
  | |        Bus support  --->                                              | |
  | |        Kernel Features  --->                                          | |
  | |        Boot options  --->                                             | |
  | |        Floating point emulation  --->                                 | |
  | |        Userspace binary formats  --->                                 | |
  | |        Power management options  --->                                 | |
  | |        Networking  --->                                               | |
  | |        Device Drivers  --->                                           | |
  | |        File systems  --->                                             | |
  | |        Profiling support  --->                                        | |
  | |        Kernel hacking  --->                                           | |
  | +----v(+)---------------------------------------------------------------+ |
  +---------------------------------------------------------------------------+
  |                     <Select>    < Exit >    < Help >        

3.3.使用厂家提供的配置文件,进行修改

将厂家提供的.config文件复制到.config中
然后make menuconfig

book@book-desktop:/work/system/linux-2.6.22.6$ ls config_ok
config_ok
book@book-desktop:/work/system/linux-2.6.22.6$ cp config_ok .config
book@book-desktop:/work/system/linux-2.6.22.6$ make menuconfig

结果为

scripts/kconfig/mconf arch/arm/Kconfig
drivers/serial/Kconfig:235:warning: multi-line strings not supported
 .config - Linux Kernel v2.6.22.6 Configuration
 --------------------------------------------------------------------------------
  +----------------------- Linux Kernel Configuration ------------------------+
  |  Arrow keys navigate the menu.  <Enter> selects submenus --->.            |
  |  Highlighted letters are hotkeys.  Pressing <Y> includes, <N> excludes,   |
  |  <M> modularizes features.  Press <Esc><Esc> to exit, <?> for Help, </>   |
  |  for Search.  Legend: [*] built-in  [ ] excluded  <M> module  < > module  |
  | +-----------------------------------------------------------------------+ |
  | |        Code maturity level options  --->                              | |
  | |        General setup  --->                                            | |
  | |        Loadable module support  --->                                  | |
  | |        Block layer  --->                                              | |
  | |        System Type  --->                                              | |
  | |        Bus support  --->                                              | |
  | |        Kernel Features  --->                                          | |
  | |        Boot options  --->                                             | |
  | |        Floating point emulation  --->                                 | |
  | |        Userspace binary formats  --->                                 | |
  | |        Power management options  --->                                 | |
  | |        Networking  --->                                               | |
  | |        Device Drivers  --->                                           | |
  | |        File systems  --->                                             | |
  | |        Profiling support  --->                                        | |
  | |        Kernel hacking  --->                                           | |
  | +----v(+)---------------------------------------------------------------+ |
  +---------------------------------------------------------------------------+
  |                     <Select>    < Exit >    < Help >                      |
  +---------------------------------------------------------------------------+
  1. 编译

生成uImage

make uImage

编译好的内核在目录中
arch/arm/boot/uImage

5.下载内核

使用u-boot和dnw.exe下载。

5.1. 插上USB线,准备发送

5.2.重启,载menu菜单下输入k

+---------------------------------------------+
| S3C2440A USB Downloader ver R0.03 2004 Jan  |
+---------------------------------------------+
USB: IN_ENDPOINT:1 OUT_ENDPOINT:3
FORMAT: <ADDR(DATA):4>+<SIZE(n+10):4>+<DATA:n>+<CS:2>
NOTE: Power off/on or press the reset button for 1 sec
      in order to get a valid USB device address.

Hit any key to stop autoboot:  0 

##### 100ask Bootloader for OpenJTAG #####
[n] Download u-boot to Nand Flash
[k] Download Linux kernel uImage
[j] Download root_jffs2 image
[y] Download root_yaffs image
[d] Download to SDRAM & Run
[z] Download zImage into RAM
[g] Boot linux from RAM
[f] Format the Nand Flash
[s] Set the boot parameters
[b] Boot the system
[r] Reboot u-boot
[q] Quit from menu
Enter your selection: k
USB host is connected. Waiting a download.

5.3. 打开dnw.exe

这里写图片描述

5.4. 发送uImage文件

这里写图片描述

发送完成后,串口会输出信息

Enter your selection: k
USB host is connected. Waiting a download.

Now, Downloading [ADDRESS:30000000h,TOTAL:1848730]
RECEIVED FILE SIZE: 1848730 (902KB/S, 2S)

NAND erase: device 0 offset 0x60000, size 0x200000
Erasing at 0x240000 -- 100% complete.
OK

NAND write: device 0 offset 0x60000, size 0x1c3590

Writing data at 0x223000 -- 100% complete.
 1848720 bytes written: OK

5.5. u-boot菜单下输入b,启动内核

starting pid 772, tty '/dev/s3c2410_serial0': '/bin/sh'
# 
# ls
bin         lib         mnt         root        tmp
dev         linuxrc     opt         sbin        usr
etc         lost+found  proc        sys
# 
# 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值