2023年操作系统Linux内核编译实验报告_第1页
2023年操作系统Linux内核编译实验报告_第2页
2023年操作系统Linux内核编译实验报告_第3页
2023年操作系统Linux内核编译实验报告_第4页
2023年操作系统Linux内核编译实验报告_第5页
已阅读5页,还剩6页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

操作系统课程设计实验报告实验名称:linux的内核编译姓名/学号:一、实验目的熟悉linux的使用,编译内核二、实验内容.编译linux的新内核.将学号添加到新内核启动菜单中三、团实验环境.软件环境:Windows7旗舰版VMwareWorkstation8UbuntuKyiin13.04(内核版本UbunduwithLinux3.8.0-19).团硬件环境Intelcorei5—2450M四、团程序设计与实现1.团下载并安装VMwareWorkstation以及Ubuntuky1ini3.04x-nroot@)ubuntu:/home/wcsbfangouroot@ubuntu:/home/wcsbfangou#update-grupNocommand'update-grup'found,didyoumean:Command'update-grub'frompackage'grub'(main)Command'update-grub'frompackage'grub2-common'(main)update-grup:commandnotfoundroot@ubuntu:/home/wcsbfangou#update-grubGeneratinggrub.cfg...Foundmemtest86+image:/boot/memtest86+.bindoneroot@ubuntu:/home/wcsbfangou#gedit/boot/grub/grub.cfgLj*grub.cfgxelsesearch--no-floppy--fs-uuid--set=root74a43acf-97f0-4b70-Jc61-c889399edac8ftlinux/boot/vmlinuz-3.13.6root=UUID=74a43acf-97f0-4b7O-ac61-:889399edac8roftnd_preseed=/preseed.cfgautonoprompt)riortty=crittcallocale=en_USquietIsubmenu'AdvancedoptionsforUbuntu'$menuentry_id_optton•gnultnux-Jdvanced-74a43acf-97f0-4b70-ac61-c889399edac8,{menuentry'Ubuntu,withLinux120111933'--classjbuntu--classgnu-linux--classgnu--|classos$menuentry_td_option1gnulinux-3.13.6-advanced-74a43acf-97f0-4b70-ac61-c889399edac8'{recordfailload_videogfxmode$ltnux_gfx_modeinsmodgzioinsmodpart_msdosinsmodext2setroot='hd0,nsdosl'if[x$feature_platform_search_hint=xy];then0,•|•・i••(3)重启电脑,可以实现选择内核,学号添加到新内核启动菜单中了GNUGRUBversion2.00-13ubuntu3lllbuntuAdvancedoptionsforUbuntuMemorytest(memtest86+)Memorytest(memtest86+,serialconsole115200)Usethe*and+keystoselectwhichentryishighlighted.PressentertoboottheselectedOS,'e'toeditthecommandsbeforebootingor'c'foracommand-line.GNUGRUBversion2.00-13ubuntu3Ubuntu,withLinux3.13.6(recoverymode)Ubuntu,withLinuxUbuntu,withLinux(recoverymode)Usethe个and,keystoselectwhichentryishighlighted.PressentertoboottheselectedOS,'e'toeditthecommandsbeforebootingorforacommand-line.ESCtoreturn五、团实验收获与体会开始安装ubuntu后,开机进入的界面是类似于终端的界面,没有图形界面,后来查了一下,才知道输入startx才是打开桌面程序。尚有就是更新源的问题,系统默认是美国的源,更新一些东西的时候总是失败,后来查了一下才知道问题所在,然后把更新源改成了北交,再加上学校的IPV6网,下载更新简直神速。其实尚有碰到好多问题,比如无法上网、无法从主系统拷贝文献到虚拟机什么的,都是通过百度搜索解决的,就不一一列举了。由于之前基本没有用过Ubuntu,对Ubuntu一无所知,通过这次实验,大体了解了一下Ubuntu的基本操作和原理。每次操作都非常的大胆,做错了大不了从新安装Ubuntu,反正是虚拟机,不是太在乎。没怎么用到书,由于感觉书上的东西还要自己慢慢找,然后就一直通过搜索引擎查找想要的知识,但是网上的资源良莠不齐,还得慢慢辨别是否实用。▼DevicesPresentAutodetectPresent▼DevicesPresentAutodetectPresentAutodetectPassword:(在此输入你上面设立的密码)HomeI(IjjUbuntux|匕Ubuntu\►Poweronthisvirtualmachine国EditvirtualmachinesettingsMiMemory2GB□Processors4aHardDisk(SCSD20GBfCD/DVD(IDE)UsingfileD:\v...位NetworkAd叩…NATQUSBControllerOSoundCardVPrinter/DisplayDescriptionTypeheretoenteradescriptionofthisvirtualmachine.▼VirtualMachineDetailsState:PoweredoffConfigurationfile:D:\Ubuntu\Ubuntu.vmxHardwarecompatibility:Workstation8.0virtualmachine开机先获取root权限sudopasswdrootEnternewUNIXpassword:(在这输入你的密码)RetypenewUNIXpassword:(拟定你输入的密码)passwd:passwordupdatedsuccessfully以后,假如在想获得root权限,只需进行如下的操作:suroot**!|O4O1;***VMwareEasyInstallPLEASEHAIT!VMwareToolsiscurrentlybeinginstalledonyoursystem.DependingontheversionofUbuntuyouareinstalling,youmayloginbelowandusethesystemduringtheinstallation.Otherwise,pleasewaitforthegraphicalenvironmenttolaunch.Thankyou.*****田***:40^*******叱*******叱***叱叱**毋ubuntulogin:ucsbfangouPassword:Lastlogin:TueMar1821:40:23CST2014onttylWelcometoUbuntu13.04(GNU/Linux3.8.0-19-generic1686)*Documentation:YourUbuntureleaseisnotsupportedanymore.Forupgradeinformation,pleasevisit:/releaseendoflifeNewrelease'13.10'available.Run'do-release-upgrade'toupgradetoit.tucsbfangou@ubuntu:surootPassword:rootOubuntu:/home/uicsb-fangou#接下来的实验都是在获得root权限下操作的。打开系统查看系统信息AllSettingsDetailsAllSettingsDetailsAllSettingsDetailsDevicenameMemoryProcessorGraphicsOStypeDiskubuntu13.04x-DetailsubuntuAllSettingsDetailsDevicenameMemoryProcessorGraphicsOStypeDiskubuntu13.042.0CiBIntel®cjare"*i5-2450MCPU@2.50GHz*4Gallium0.4onllvmpipe(LLVM3.2,256bits)32-bit19.9GB按住Ctrl+aIt+t打开终端,并输入uname-a以查看内核版本信息rx-nroot@ubuntu:/home/wcsbfangouroot@ubuntu:/home/wcsbfangou#uname-aLinuxubuntu3.8.0-19-genertc#29-UbuntuSMPWedApr1718:19:42UTC20131686t6861686GNU/Linuxroot@ubuntu:/home/wcsbfangou#,可见此版本是的内核2.下载内核并编译(1)我下载好的内核存放在Download文献夹里,为了方便直观,我又新建了一个名为kerneI的文献夹(mkdirkernel),并将下载好的内核存放在kernel文献夹里(cp-/root/Down1oads/Linux-3.13.6.tar.xz/home/wcsbfangou/kernel)ox-nroot(^)ubuntu:/home/wcsbFangou/kernelroot@ubuntu:/home/wcsbfangou#mkdirkernelroot@ubuntu:/home/wcsbfangou#IsDesktopDownloadsMusicPublicVideosDocumentskernelPicturesTemplates桌面root@ubuntu:/home/wcsbfangou#cp-r/root/Downloads/ltnux-3.13.6.tar.xz/home/icsbfangou/kernelroot@ubuntu:/home/wcsbfangou#cdkernelroot@ubuntu:/home/wcsbfangou/kernel#Isroot@ubuntu:/home/wcsbfangou/kernel.#|(2)解压下载好的内核文献,输入xz-dIinux-3.13.6.tar.xz后按回车,再输入后按回车,然后会发现kerne1下的文献变成1inux—3.13.6和Iinux-3.13.6.tar=root(^)ubuntu:/home/wcsbfangou/kernel八nit「amfs_data.S八Irt/.linux-3.13.6/virt/kvn/vfio.croot@ubuntu:/home/wcsbfangou/kernel#Islinux-3.13.6(3)进入kernel文献夹(cdlinux-3.15.5),然后执行makemenuconfig提醒缺少ncurses的库渣了一下百度,需要输入apt-getinsta1Ilibncurses5—dev来安装缺失的库。Imake:***[menuconfig]Error2root@ubuntu:/home/wcsbfangou/kernel/linux-3.13.6#cd..cd..:commandnotfoundroot@ubuntu:/home/wcsbfangou/kernel/linux-3.13.6#cd..root@ubuntu:/home/wcsbfangou/kernel#cd..「ootOubuntu:/home/wcsbfanaou#installlibncu「ses5・de/(4)安装好之后再执行makemenuconfig即可设立,我是参考错误!未定义书签。这个网址进行设立的x-=.config-Ltnux/x863.13.6KernelConfigurationArrowkeysnavigatethemenu.<Enter>selectssubmenus—>(oremptysubmenus--).Highlightedlettersarehotkeys.Pressing<Y>includes,<N>excludes,<M>modularizesfeatures.Press<Esc><Esc>toexit,<?>forHelp,</>forSearch.Legend:[*]butlt-tn[]64-bttkernelGeneralsetup—>-**providesysten-wtderingoftrustedkeys[*]nableloadablemodulesupport—>[*]nabletheblocklayer--->Processortypeandfeatures—>owermanagementandACPIoptions—>Busoptions(PCIetc.)—>xecutablefileformats/Emulations---*-N-tworktngsupport—><Select><Exit><Help><Save><Load><Select>设立之后选择Save一下便退出,然后执行makex-r=root$)CCCCarch/x86/kernel/cpu/scattered.oCCarch/x86/kernel/cpu/topology.oCCarch/x86/kernel/cpu/proc.oMKCAParch/x86/kernel/cpu/capflags.cCCCCCCarch/x86/kernel/cpu/comnon.oCCarch/x86/kernel/cpu/rdrand.oCCarch/x86/kernel/cpu/natch.oCCarch/x86/kernel/cpu/bugs.oCCarch/x86/kernel/cpu八ntel.oCCarch/x86/kernel/cpu/amd.oCCarch/x86/kernel/cpu/cyrtx.oCCarch/x86/kernel/cpu/centaur.oCCarch/x86/kernel/cpu八ransneta.oCCarch/x86/kernel/cpu/umc.oCCarch/x86/kernel/cpu/perf_event.oCCarch/x86/kernel/cpu/perf_event_amd.oCCarch/x86/kernel/cpu/perf_event_amd_uncore.oCCarch/x86/kernel/cpu/perf_event_p6.oCCarch/x86/kernel/cpu/perf_event_knc.oCCarch/x86/kernel/cpu/perf_event_p4.o这一步花费时间最长,我是晚上十一点多执行的,知道凌晨1:30才执行完,一直守候在电脑前不离不弃,太坑了,早知道要这么长时间就第二天在弄了。。。。(5)按照顺序执行makemodulesjnstal1和makeinstallIHEX2FWftrnware/emt62/spdtf.fwIHEX2FWfirmware/emt62/nidi.fwIHEXftrnware/kaweth/new_code.btnIHEXfirnware/kaweth/trigger_code.binIHEXftrmware/kaweth/new_code_ftx.binIHEXftrmware/kaweth/trtgger_code_ftx.binIHEXfirmware八t_3416.fw'IHEXftrnware/tt_5eS2.fwIHEXftrmware/mts_cdma.fwIHEXftrnware/nts_gsn.fwIHEXftrnware/mts_edge.fwH16T0FWftrnware/edgeport/boot.fwH16TOFWfirmware/edgeport/boot2.fwH16T0FWftrmware/edgeport/down.fwH16TOFWfirmware/edgeport/down2.fwIHEXftrnware/edgeport/down3.binIHEX2FWftrmware/whtteheat_loader.fwIHEX2FWfirmware/whiteheat.fwIHEX2FWftrmware/keyspan_pda/keyspan_pda.fwIHEX2FWfirmware/keyspan_pda/xircom_pgs.fwIHEXftrmware/cpla2/stv0672_vp4.btnIHEXftrmware/yam/1266.binIHEXfirnware/yam/96ee.binrootfflubuntu:/home/wcsbfanqou/kernel/ltnux-3.13.6#makemodulesInstall!INSTALL/ltb/ftrnware/emt62/ntdt.fwINSTALL/lib/firnware/kaweth/new_code.binINSTALL八tb/ftrmware/kaweth八rtgger_code.binINSTALL/lib/firmware/kaweth/new_code_fix.binINSTALL八tb/fIrmware/kaweth八rtgger_code_flx.binINSTALL/ltb/ftrnware/tt_34ie.fw"INSTALL/Xib/firmware/ti_5652.fwINSTALL/Itb/ftrnware/nts_cdma.fwINSTALL/lib/firmware/nts_gsm.fwINSTALL/ltb/ftrmware/nts_edge.fwINSTALL/llb/ftrmware/edgeport/boot.fwINSTALL/lib/firmware/edgeport/boot2.fwINSTALL/lib/ftrnware/edgeport/down.fwINSTALL/ltb/firmware/edgeport/down2.fwINSTALL/ltb/flrmware/edgeport/down3.btnINSTALL/ltb/ftrnware/whtteheat_loader.fwINSTALL/lib/firmware/whiteheat.fwINSTALL/ltb/ftrnware/keyspan_pda/keyspan_pda.fwINSTALL/ltb/firn»ware/keyspan_pda/xtrcom_pgs.fwINSTALL/ltb/ftrmware/cpta2/stv0672_vp4.binINSTALL/ltb/ftrnware/yaA/1260.btnINSTALL/lib/firmware/yam/96e0.binrootdubuntu:/home/wcsbfanaou/kernel/ltnux-3.13.6#makeinstall!(6)执行之后然后重启,打开终端输入uname-a查看内核版本信息,会发现变成了linux-3.13.6x-arootf9ubuntu:/home/wcsbfangouroot@ubuntu:/home/wcsbfangou#unane-aLinuxubuntu3.13.6#1SMPMonMar1701:02:14CST2014168616861686GNU/Ltnuxroot^ubuntu:/hone/wcsbfangou#|]证明编译内核成功。但是为什么默认内核变成了新编译的内核,我却无法选择,然后又搜了一些资料,找到解决的方法,会在接下来环节提到。3.实现开机选择内核与菜单显示学号(1)查阅相关资料后,得到开机选择内核的方法。打开终端输入gedit/etc/defauIt/grub,编辑grub,注释掉GRUB_HIDDEN_TIME0UT=0然后还要update-grub一下就可以再开机时候选择内核*1匕理在线首员个人主员^乐学服务*grub(/etc/lkltbc-eoI93zdkH8Gxdxfvsu-08sYNq70.solltbcryptsetup.so.4■open,公第器篮;aelj*grubxIfyouchange/boot/grub/grubJForfulldocume/info-fgrub«GRUB_DEFAULT=0##CRUB_HIDDEN_TIM^GRUB_HIDDEN_TIME0iGRUB_TIMEOUT=10CRUB_DISTRIBUTOR=CRUB_CMDLINE_LINU>CRUB_CMDLINE_LINU>prtortty=crtttcals,ltbnss_mdns4_ntntfnal..so.2root§ubuntu:/llbffcdmodules*grub(/etc/lkltbc-eoI93zdkH8Gxdxfvsu-08sYNq70.solltbcryptsetup.so.4■open,公第器篮;aelj*grubxIfyouchange/boot/grub/grubJForfulldocume/info-fgrub«GRUB_DEFAULT=0##CRUB_HIDDEN_TIM^GRUB_HIDDEN_TIME0iGRUB_TIMEOUT=10CRUB_DISTRIBUTOR=CRUB_CMDLINE_LINU>CRUB_CMDLINE_LINU>prtortty=crtttcals,ltbnss_mdns4_ntntfnal..so.2root§ubuntu:/llbffcdmodulesroot0ubuntu:/lib/modul.es#Isroot@ubuntu:/ltb/nodules/3.13.6#Isbuildkernelnodules.alias»UncommenttoenIsbmodprobe.dnodulesPlymouthrecovery-moderesolvconfsecuritysystendterntnfoudevufwxtablesmodules.builtinmodules.builtin.binmodules.depnodules.alias.binmodules.dep.binroot^ubuntu:/lib/modules/3.13.6#geditnodules.ordersourcenodules.softdepnodules.symbols/etc/default/grub»Thisworkswith"VmU.WTTobtainsuthenenorymapInformationfromGRUB(CNUMach,kernelofjlesjnstallII♦Und

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论