Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Ubuntu 12.10.The operation process of installing Bochs 2.6and debugging linux-0.11 kernel

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

Today, I will talk to you about the operation process of Ubuntu 12.10 installing Bochs 2.6 and debugging the linux-0.11 kernel. Many people may not know much about it. In order to make you understand better, the editor has summarized the following contents for you. I hope you can get something from this article.

Http://blog.csdn.net/sinzou1/article/details/5903968

Linux (ubuntu) install bochs

Http://wenku.baidu.com/view/f968e23b0912a21614792914.html

Install bochs under ubuntu

Http://www.linuxidc.com/Linux/2011-07/38371.html

Notes on Ubuntu 10.04 installation Bochs 2.4.5

Http://blog.csdn.net/traceless/article/details/3200169

Installation and use of bochs

Http://hi.baidu.com/_0x55aa/item/38e3ac01d72f0e1bcc34eae6

Startup of linux bochs

This article introduces how to use bochs to debug kernel linux-0.11 version under SUSE Linux Enterprise Desktop system.

Foreword:

Although linux-0.11 is the early kernel code, with no more than 20, 000 lines of code, it is basically a stripped-down version of today's kernel code.

Read and understand the complete code, you can have a deep understanding of the operation process of the whole system.

one。 Preparations (performed by root users):

Download the debugging tool bochs:

Download the installation package of .tar.gz in http://sourceforge.net/projects/bochs/. Be careful not to download the rpm package, because you need to add the gdb-stub function when you install it. The rpm package does not have this function. Execute after download:

Tar zxvf bochs-2.3.5.tar.gz

Cd bochs-2.3.5

. / configure-- enable-gdb-stub

If a X windows libraries were not found error occurs, you can use SUSE YaST software management to search for xorg and install the basic installation package of xorg, as shown below:

If error: X11/extensions/Xrandr.h: No such file or directory appears, then

Sudo apt-get install xorg-dev

In addition, you may want to install gcc installation, just search for gcc installation with the software management of gcc

Continue to install bochs

Make

Make install

All right, download the linux-0.11 kernel source code package and put the source code package in / root/kernel/:

Mkdir / root/kernel

Cd / root/kernel

Wget http://www.kernel.org/pub/linux/kernel/Historic/old-versions/linux-0.11.tar.gz

Tar zxvf linux-0.11.tar.gz

This source package will eventually be compiled in a bochs emulated system, because the debug loop mirror is Intel x86 software emulated by bochs, so do not compile this kernel on the SUSE system.

And compiling the kernel in the bochs simulation system requires some configuration files to be changed, as follows:

Cd linux-0.11

Vi Makefile

Change RAMDISK= #-DRAMDISK=512 to RAMDISK=-DRAMDISK=2048

Change ROOT_DEV=/dev/hd6 to ROOT_DEV=FLOPPY

In all the Makefile under the source directory

LDFLAGS =-M-x / / remove the-s flag

CFLAGS = Wall-O-g-fstrength-reduce-fomit-frame-pointer-fcombine-regs / / add-g flag, remove-mstring-insns

Change the value of SYSSIZE in boot/bootsect.s and tools/build.c to 0x8000

Because of the large number of Makefile files, I wrote a script program adjust_make_for_gdb to do the above work directly.

#! / bin/sh

Sed-I'5s Universe Greater Greater Makefile

Sed-I '5sUniverse 512Universe 2048Universe 'Makefile

Sed-I'23 s /\ / dev\ / hd6/FLOPPY/' Makefile

Sed-I'6s Universe 3gamma 8max 'boot/bootsect.s

Sed-I'35 sUnip 2 Universe 8 Universe 'tools/build.c

Find. -name 'Makefile' | while read filename;do

All_lines=$ (grep LDFLAGS $filename-nH | awk-F:'{print $2}')

First_line=$ (echo $all_lines | awk'{print $1}')

Echo $first_line

Sed-I "$first_line s/-s//g" $filename

All_lines=$ (grep CFLAGS $filename-nH | awk-F:'{print $2}')

First_line=$ (echo $all_lines | awk'{print $1}')

Echo $first_line

Sed-I "$first_line Smokey O-fs/-O-g-fs/g" $filename

Sed-I'1, mstringin _ sns _ filename

Done

Put this script in the linux-0.11 directory and execute it once.

Cd linux-0.11

. / adjust_make_for_gdb

After execution, package this source code.

Cd..

Tar cvf gdb-linux-0.11.tar linux-0.11

My gdb-linux-0.11.tar file is attached here.

two。 Use bochs

Here you need to download two packages from http://oldlinux.org/Linux.old/bochs/.

Wget http://oldlinux.org/Linux.old/bochs/linux-0.11-devel-050518.zip

Wget http://oldlinux.org/Linux.old/bochs/linux-0.11-gdb-rh9-050619.tar.gz

Put these two packages on / root/kernel/, and extract them.

Tar zxvf linux-0.11-050518-rh9.tar.gz (originally linux-0.11-040923-rh9.tar.gz, I can't find the bochsrc-hdboot.bxrc file in the extracted file, just change it to linux-0.11-050518-rh9.tar.gz)

Unzip linux-0.11-devel-050518.zip-d. /

Cd linux-0.11-devel-050518/

Here we only use the bochsrc-hdboot.bxrc file.

Vim bochsrc-hdboot.bxrc

Make two changes inside:

1. Vgaromimage: $BXSHARE\ VGABIOS-lgpl-latest backslash change to get

Vgaromimage: $BXSHARE/VGABIOS-lgpl-latest

2. Romimage: file=$BXSHARE\ BIOS-bochs-latest, which can be obtained by changing address=0xf0000

Romimage: file=$BXSHARE/BIOS-bochs-latest

At this point, you can run bochs.

# bochs-Q-f bochsrc-hdboot.bxrc

-errors and solutions-

If it works properly, you will get the following figure:

(1) > > PANIC > PANIC

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report