[Reserved] UML can be debugged from the source code construction under Debian

xiaoxiao2021-03-06  15

Sender: Judicious (unable day), the letter area: kerneltech

Title: UML can be debugged from the source code constructed under Debian

Sending station: BBS Shuimu Tsinghua Station (SAT Feb 26 15:01:05 2005), transfer

Since User-Mode-Linux constructed from .DEB cannot be used as a built core (without exporting kernel symbols), I need to create User-mode -Linux from source code. I used the kernel 2.4.24, use UML's Patch is 2.4.24-3. When using a 2.4.18 core, there is a problem. (2005-01- 16 added the method of using the GDB debug kernel)

1 Compile USER-MODE-Linux from source code, basically according to UML's HOWTO (http://user-mode-linux.sourceforge.net/Usermodelinux-howto.html)

SHELL under:

A download the kernel source code to PATH, I use 2.4.24 (I used 2.4.18 to compile N, I can't go)

Apt-Get Install kernel-Source-2.4.24

B decompression kernel source:

Debian: path # tar-xvjf kernel-source-2.4.24.tar.bz2

b Download the UML's Patch to Kernel-Source, I use 2.4.24-3 (I have compiled it with 2.4.24-3, I have never passed)

http://prdownloads.sourceforge.net/User-mode-linux/uml-patch-2.4.24-3.bz2

D debian: path / kernel-source-2.4.24 # bzcat UML-PATCH-2.4.24-3.bz2

e Make Menconfig Arch = UM

Do not use any modifications, or you can customize the kernel according to your own needs.

f Make Linux Arch = UM (No Make DEP)

The kernel compilation is complete, generate Linux at the top of the source tree, this is UML, it is an application

2 download root file system (root file system) to / mnt

http://puzzle.dl.sourceforge.net/sourceForge/User-mode-linux/debian-3.0r0.ext2.bz2

3 shell:

#: CD / MNT

4 #: bunzip2 Debian-3.0r0.ext2.bz2

5 #: dd if = / dev / zero of = debian-3.0r0.ext2 bs = 1 count = 0 Seek = 536870912

6 #: / sbin / e2fsck -f debian-3.0r0.ext2

7 #: / sbin / resize2fs -p debian-3.0r0.ext2

8 Linux UBD0 = Debian-3.0R0.ext2 devfs = mount

The system should be able to get up.

9 About debugging

Provide three ways:

Debug method one (this is the method of fiasco @ smth prawns, I tried but no success):

A Start GDB Linux to get the PID of this process

B Linux ubd0 = debian-3.0r0.ext2 devfs = mount debug gdb-pid = PID

Then the process of GDB can debug kernel as the normal program is debugged.

Debug method 2:

A GDB Linux

B GDB> SET ARGS UBD0 = Debian-3.0r0.ext2 devfs = mount // Settings the parameters running

Now you can debug the kernel as a normal application (Oh, this Linux itself is a normal program :-))

Debug method three

a Linux ubd0 = debian-3.0r0.ext2 devfs = mount debug GDB-PID = PIDB Using PS -A to get the PID running last Linux

SHELL under:

GDB

ATT PID

OK, now you can debug it as debugging ordinary programs, but this method has no way to work, because when you perform an ATT PID, you can't control the location of the program.

Good luck

By Judicious

Attach two useful links:

http://deb.riseup.net/miscellaneous/uml/

http://now.ohah.net/en/user_mode_linux

-

※ Source: · BBS Shuimu Tsinghua Station SMTH.ORG · [From: 202.118.70. *]

转载请注明原文地址:https://www.9cbs.com/read-47402.html

New Post(0)