Ubuntu 7.04 编译内核2.6.32

  1. windows 7系统中安装virtualbox虚拟机。
  2. 在virtualbox中安装Ubuntu 7.04 feisty,因为feisty是不受支持的老版本了,可以把/etc/apt/source.list修改为中国科学技术大学提供的源:
    # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
    # newer versions of the distribution.
    
    deb http://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu/ feisty main restricted
    deb-src http://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu/ feisty main restricted
    
    ## Major bug fix updates produced after the final release of the
    ## distribution.
    deb http://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu/ feisty-updates main restricted
    deb-src http://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu/ feisty-updates main restricted
    
    ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
    ## team, and may not be under a free licence. Please satisfy yourself as to
    ## your rights to use the software. Also, please note that software in
    ## universe WILL NOT receive any review or updates from the Ubuntu security
    ## team.
    deb http://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu/ feisty universe
    deb-src http://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu/ feisty universe

    然后更新:

    sudo apt-get update
  3. Ubuntu 7.04内核版本是2.6.20。到www.kernel.org下载2.6.32版本。(我是在中国科学技术大学开源软件镜像站下载的,地址 http://mirrors.ustc.edu.cn/kernel.org/)。
  4. 解压缩到/usr/src/目录,阅读README和/Documentation/Changes。其中Changes中说明了编译环境要用到的软件最低版本: 
    
    o  Gnu C                  3.2                     # gcc --version
    o  Gnu make               3.80                    # make --version
    o  binutils               2.12                    # ld -v
    o  util-linux             2.10o                   # fdformat --version
    o  module-init-tools      0.9.10                  # depmod -V
    o  e2fsprogs              1.41.4                  # e2fsck -V
    o  jfsutils               1.1.3                   # fsck.jfs -V
    o  reiserfsprogs          3.6.3                   # reiserfsck -V 2>&1|grep reiserfsprogs
    o  xfsprogs               2.6.0                   # xfs_db -V
    o  squashfs-tools         4.0                     # mksquashfs -version
    o  btrfs-progs            0.18                    # btrfsck
    o  pcmciautils            004                     # pccardctl -V
    o  quota-tools            3.09                    # quota -V
    o  PPP                    2.4.0                   # pppd --version
    o  isdn4k-utils           3.1pre1                 # isdnctrl 2>&1|grep version
    o  nfs-utils              1.0.5                   # showmount --version
    o  procps                 3.2.0                   # ps --version
    o  oprofile               0.9                     # oprofiled --version
    o  udev                   081                     # udevinfo -V
    o  grub                   0.93                    # grub --version
    o  mcelog		          0.6
    
  5. Ubuntu是基于Debian,这里直接使用Debian的工具make-kpkg来编译安装内核,该工具包含在kernel-package中:
    sudo apt-get install kernel-package
  6. 配置sudo make config。如使用menuconfig,需要安装额外的包:
    sudo apt-get install build-essential bin86 libqt3-headers libqt3-mt-dev

    配置时间可能比较久,看个人需要,我全部使用默认配置。

  7. 上一步配置完成后,会在当前目录下生成.config文件:
    ls -la .config
    -rw-r--r-- 1 root root 93097 2022-03-18 00:59 /usr/src/linux-2.6.32/.config
  8. 使用make-kpkg编译并打包,其中--append-to-version="-你自己命名的后缀"(要以-开头):
    sudo make-kpkg --initrd --append-to-version=-costomed kernel_image kernel_headers
  9. 编译打包时间特别久,完成后返回上一级目录/usr/src/,发现多了2个.deb文件:
    jack@virtualbox:/usr/src$ ls
    linux-2.6.32
    linux-headers-2.6.20-15
    linux-headers-2.6.20-15-generic
    linux-headers-2.6.32-customed
    linux-headers-2.6.32-customed_2.6.32-customed-10.00.Custom_i386.deb
    linux-image-2.6.32-customed_2.6.32-customed-10.00.Custom_i386.deb
  10. 接下来就是像安装普通安装包一样安装这两个文件就好了:
    sudo dpkg -i linux-headers-2.6.32-customed_2.6.32-customed-10.00.Custom_i386.deb
    sudo dpkg -i linux-image-2.6.32-customed_2.6.32-customed-10.00.Custom_i386.deb 
  11. 打开/boot/grub/menu.lst,发现多了两个启动项:
    title           Ubuntu, kernel 2.6.32-customed
    root            (hd0,0)
    kernel          /boot/vmlinuz-2.6.32-customed root=UUID=d7ab8ac1-29e4-40b5-9e72-87103f9b099b ro quiet splash
    initrd          /boot/initrd.img-2.6.32-customed
    quiet
    savedefault
    
    title           Ubuntu, kernel 2.6.32-customed (recovery mode)
    root            (hd0,0)
    kernel          /boot/vmlinuz-2.6.32-customed root=UUID=d7ab8ac1-29e4-40b5-9e72-87103f9b099b ro single
    initrd          /boot/initrd.img-2.6.32-customed
    
    title           Ubuntu, kernel 2.6.20-15-generic
    root            (hd0,0)
    kernel          /boot/vmlinuz-2.6.20-15-generic root=UUID=d7ab8ac1-29e4-40b5-9e72-87103f9b099b ro quiet splash
    initrd          /boot/initrd.img-2.6.20-15-generic
    quiet
    savedefault
    
    title           Ubuntu, kernel 2.6.20-15-generic (recovery mode)
    root            (hd0,0)
    kernel          /boot/vmlinuz-2.6.20-15-generic root=UUID=d7ab8ac1-29e4-40b5-9e72-87103f9b099b ro single
    initrd          /boot/initrd.img-2.6.20-15-generic
    
    title           Ubuntu, memtest86+
    root            (hd0,0)
    kernel          /boot/memtest86+.bin
    quiet
  12. 检查一下系统使用的内核,发现已更新:
    uname -r
    2.6.32-customed

  13. 完成。(参考了: Ubuntu7.04 编译内核2.6.22.1_Linux编程_Linux公社-Linux系统门户网站 编译UBUNTU 7.04 系统的内核_shaken的博客-CSDN博客
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值