第2个任务描述如下:
This is Task 02 of the Eudyptula Challenge------------------------------------------Now that you have written your first kernel module, it's time to takeoff the training wheels and move on to building a custom kernel. Nomore distro kernels for you. For this task you must run your ownkernel. And use git! Exciting, isn't it? No? Oh, ok...The tasks for this round are:- Download Linus's latest git tree from git.kernel.org (you have tofigure out which one is his. It's not that hard, just remember whathis last name is and you should be fine.)- Build it, install it, and boot it. You can use whatever kernelconfiguration options you wish to use, but you must enableCONFIG_LOCALVERSION_AUTO=y.- Show proof of booting this kernel. Bonus points if you do it on a"real" machine, and not a virtual machine (virtual machines areacceptable, but come on, real kernel developers don't mess aroundwith virtual machines, they are too slow. Oh yeah, we aren't realkernel developers just yet. Well, I'm not anyway, I'm just ascript...) Again, proof of running this kernel is up to you, I'msure you can do well.Hint, you should look into the 'make localmodconfig' option, and baseyour kernel configuration on a working distro kernel configuration.Don't sit there and answer all 1625 different kernel configurationoptions by hand, even I, a foolish script, know better than to do that!After doing this, don't throw away that kernel, git tree, andconfiguration file. You'll be using it for later tasks. A workingkernel configuration file is a precious thing, all kernel developershave one they have grown and tended to over the years. This is thestart of a long journey with yours. Don't discard it like was a brokenumbrella, it deserves better than that.
I get the linux kernel source code use set of commands:
[root@bogon ~]# uname -a Linux bogon 2.6.32-279.el6.x86_64 #1 SMP Fri Jun 22 12:19:21 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux [root@bogon /]# mkdir /kernel/Task2 [root@bogon /]# cd /kernel/Task2/ [root@bogon Task2]# pwd /kernel/Task2 [root@bogon Task2]# git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git [root@bogon Task2]# cd linux/ [root@bogon Task2]# make localmodconfig
Then modify the configure file '.config',set CONFIG_LOCALVERSION_AUTO=y
...
#
# General setup
#
CONFIG_INIT_ENV_ARG_LIMIT=32
CONFIG_CROSS_COMPILE=""
# CONFIG_COMPILE_TEST is not set
CONFIG_LOCALVERSION=""
#CONFIG_LOCALVERSION_AUTO is not set
CONFIG_LOCALVERSION_AUTO=y
CONFIG_HAVE_KERNEL_GZIP=y
CONFIG_HAVE_KERNEL_BZIP2=y
CONFIG_HAVE_KERNEL_LZMA=y
...
Next run,some compile information is ignored:
[root@bogon linux]# make -j8 all [root@bogon linux]# make modules_install [root@bogon linux]# make install sh /kernel/Task2/linux/arch/x86/boot/install.sh 3.15.0-rc4-00298-g9f1eb57 arch/x86/boot/bzImage \ System.map "/boot"
Luckly,it all works well!
I found the file '/etc/grub.conf' be modified!
[root@bogon linux]# cat /etc/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/sda2
# initrd /initrd-[generic-]version.img
#boot=/dev/sda
default=1
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (3.15.0-rc4-00298-g9f1eb57)
root (hd0,0)
kernel /vmlinuz-3.15.0-rc4-00298-g9f1eb57 ro root=UUID=b4d19447-4c9d-4eb8-be5d-33e7ab8c5fd9 rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet
initrd /initramfs-3.15.0-rc4-00298-g9f1eb57.img
title CentOS (2.6.32-279.el6.x86_64)
root (hd0,0)
kernel /vmlinuz-2.6.32-279.el6.x86_64 ro root=UUID=b4d19447-4c9d-4eb8-be5d-33e7ab8c5fd9 rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet
initrd /initramfs-2.6.32-279.el6.x86_64.img
Next,set the default=0 and reboot my machine.About 2 mins later,the machine launched successfully.
[root@bogon linux]# uname -a Linux bogon 3.15.0-rc4-00298-g9f1eb57 #1 SMP Wed May 7 21:30:42 PDT 2014 x86_64 x86_64 x86_64 GNU/Linux
All of the above operations are completed in my virtual machine.
- 微信扫码赞助
-
- 支付宝赞助
-
2015/02/09 00:25:47
vmware workstation 10
2015/01/14 09:16:00
Linux是CentOS 6.5最小化安装的。
2015/01/13 13:50:28
虚拟机用的什么?有些虚拟机好像不行
2015/01/13 13:50:28
Linux是CentOS 6.5最小化安装的。
2015/01/13 10:30:56
hi,你好请问你用的Linux是什么版本,虚拟机是什么版本?我按照你的步骤做,重启总是不成功