您的位置:首页 > 运维架构 > Linux

在fedora7上构建UML(User mode linux)(二)

2012-05-13 12:37 246 查看
上集讲到,运行

[hid@hid-server ~]$ ./linux ubda=romfs

时重复出现以下错误提示信息:

xterm_open: $DISPLAY not set.

Failed to open console 5, err = -19

init: can't log to /dev/tty5

首先,不能初始化出console,此时的inittab文件为

[hid@hid-server etc]$ cat inittab

::sysinit:/etc/init.d/rcS

::respawn:-/bin/sh

tty2::askfirst:-/bin/sh

::ctrlaltdel:/bin/umount -a -r

修改为

console::sysinit:/etc/init.d/rcS

tty0::respawn:/bin/sh

运行,发现可以启动shell了,而且可以输入命令,但是在未启动shell之前和halt之后,仍然有重复的错误提示,经查找资料和分析,某些信息以及日志的输出设备未指定,在http://user-mode-linux.sourceforge.net/configure.html网站发现,有如下一段话即UML启动时候的参数设置,故根据第一项,为UML添加启动参数:

Consoles

UML has both consoles and serial lines, which are practically identical. They can be attached to a variety of different host devices, including already-open file descriptors, pseudo-terminals, and ports. Here are some common uses: con0=fd:0,fd:1
con=pts The main console is attached to stdin and stdout and all other consoles are attached to pts devices. Unless you know what you're doing, you should always specifically configure con0 this way when configuring all the other consoles. con0=fd:0,fd:1 con1=null
con=pts This is the same as above, except con1 is made to not exist. This is helpful with some distributions which run /sbin/hwclock during boot. The boot may hang at that point because hwclock tries to read from this console. Removing the device from the
UML will cause the read to fail, and the boot to continue. ssl=xterm All of the serial lines are attached to xterms, which will pop up when they are opened from inside UML. ssl=port:9000 All of the serial lines are attached to the host's port 9000. They can
be accessed with "telnet localhost 9000" There is more flexibility in configuring consoles and serial lines than shown above. A complete description is given
here
[root@hid-server uml]# ./linux ubda=romfs con=pts con0=fd:0,fd:1

Locating the bottom of the address space ... 0x0

Locating the top of the address space ... 0xc0000000

Core dump limits :

soft - 0

hard - NONE

Checking that ptrace can change system call numbers...OK

Checking syscall emulation patch for ptrace...check_sysemu got system call number -1, expected 20...check_ptrace : child exited with status 2.

Disabling SYSEMU support.

check_ptrace : child exited with exitcode 2, while expecting 1; status 0x200

missing

Checking for tmpfs mount on /dev/shm...OK

Checking PROT_EXEC mmap in /dev/shm/...OK

Checking for the skas3 patch in the host:

- /proc/mm...not found: No such file or directory

- PTRACE_FAULTINFO...not found

- PTRACE_LDT...not found

UML running in SKAS0 mode

Adding 31875072 bytes to physical memory to account for exec-shield gap

Linux version 2.6.26.2 () (gcc version 4.1.2 20070502 (Red Hat 4.1.2-12)) #8 Fri May 1 00:39:43 CST 2009

Built 1 zonelists in Zone order, mobility grouping on. Total pages: 15849

Kernel command line: ubda=romfs con=pts con0=fd:0,fd:1 root=98:0

PID hash table entries: 256 (order: 8, 1024 bytes)

Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)

Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)

Memory: 29748k available

Mount-cache hash table entries: 512

Checking for host processor cmov support...Yes

Checking that host ptys support output SIGIO...Yes

Checking that host ptys support SIGIO on close...No, enabling workaround

net_namespace: 192 bytes

Using 2.6 host AIO

NET: Registered protocol family 16

NET: Registered protocol family 2

IP route cache hash table entries: 1024 (order: 0, 4096 bytes)

TCP established hash table entries: 2048 (order: 2, 16384 bytes)

TCP bind hash table entries: 2048 (order: 1, 8192 bytes)

TCP: Hash tables configured (established 2048 bind 2048)

TCP reno registered

NET: Registered protocol family 1

mconsole (version 2) initialized on /root/.uml/gCMUuy/mconsole

Checking host MADV_REMOVE support...OK

Host TLS support detected

Detected host type: i386 (GDT indexes 6 to 9)

VFS: Disk quotas dquot_6.5.1

Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)

msgmni has been set to 58

io scheduler noop registered

io scheduler anticipatory registered (default)

io scheduler deadline registered

io scheduler cfq registered

TCP cubic registered

NET: Registered protocol family 17

Initialized stdio console driver

Console initialized on /dev/tty0

console [tty0] enabled

Initializing software serial port version 1

console [mc-1] enabled

ubda: unknown partition table

VFS: Mounted root (ext2 filesystem) readonly.

line_ioctl: tty0: unknown ioctl: 0x541e

Virtual console 5 assigned device '/dev/pts/1'

*********************************************************

* *

* Hello,linux! *

*********************************************************

# halt

The system is going down NOW!

Sending SIGTERM to all processes

Sending SIGKILL to all processes

Requesting system halt

System halted.

至此,自己构建的UML可以运行起来了,庆祝!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: