Teto <matta...@gmail.com> wrote:
    >> Yes, you could do this.  I use hostfs for /, and I just mount
    >> /usr/share from the host.

    > Could you please detail the procedure since I get lost in your files.

    > And the man page looks ambiguous to me.  First how do you launch your
    > uml kernel: just host$ ./uml_kernel initrd=custom_initrd or you add "
    > root=cowtempfile,/dev/sdb5" ?  I wish you could explain to me what to
    > mount and when. Your init replace the temporary (/,/dev,/etc etc..) by

High-level explanation of UNTI.
1) You point (via umlsetup.sh) at the kernel source you want, it makes an lndir
link tree (%1) for the kernel, and compiles it.

2) You also point at the UML root tree you want to use.
That's an extracted file system that lives on the host, not a COW or loopback
file.  We suggest you put your UML file systems on the same disk as
your reference root file system, as it can use hard links, which is way
faster, and saves piles of disk space.

3) an initrd is created from files in the root file system, and a linuxrc
   file is created that:
   a) populates a /dev (we used to use devfs, but it went away) into a ramfs.
   b) gropes /proc/cmdline to find out where / is on the host, and mounts it
      with hostfs.
   c) invokes /sbin/init

At some point, hostfs grew caching, which is annoying, because it means that
I have to rm /my/test/program from within the UML, each time before I can
make DESTDIR= install it again from the host, or the file does not update. I
wish I could turn that off.

(%1) since 2.6.x some other make options would let you avoid that, but
     in some cases one wants to patch the kernel before compiling, but
     not screw with the original kernel source, and anyway, we started
     in the 2.4 days.

LOW LEVEL stuff. A script is generated:

00 #!/bin/sh
01
02 if [ -z "${TEST_PURPOSE}" ] && [ -f /uml/umlbuild/.switches.sh ]; then . 
/uml/umlbuild/.switches.sh; fi
03 # get  value from baseconfig
04 . /corp/projects/pandora/unstrung/testing/baseconfigs/net.A.sh
05
06 /uml/umlbuild/plain/vmlinux initrd=/uml/umlbuild/initrd.cpio
   umlroot=/uml/umlbuild/A/root
   root=/dev/ram0 rw ssl=pty
   ssl0=port:1300 ssl1=port:1301
   umid=A $net
   $UML_DEBUG_OPT $UML_A_OPT
   rdinit=/linuxrc $*
07 if [ -n "$UML_SLEEP" ]; then eval $UML_SLEEP; fi

02 - this sucks in some variables that tells net.A.sh, if there is a
   uml_netjig  (a version of uml_switch that knows how to play back pcap
   files), running, or if one should use multicast sockets.
04 - each virtual machine has some network configuration, which looks like:

    net_eth0="eth0=mcast,12:00:00:dc:bc:ff,239.192.0.1,21200"
    net_eth1="eth1=mcast,12:00:00:64:64:23,239.192.1.2,31200";
    net="$net_eth0 $net_eth1"

06 - the kernel to run.
   - the initrd in CPIO format.
   - umlroot= path to what path on the host to mount as /
   - serial port 0 is the current pty, and some additional serial ports.
     I use serial ports with gdbattach a lot to let me debug a
     process inside the UML from outside.  If I'm debugging the kernel
     itself, I just gdb attach to the kernel.
   - $net from above.
   - rdinit=/linuxrc

07 - I tend to run the start.sh script in a fresh xterm -e, and if the kernel
   bails, the xterm closes immediately, so "export UMLSLEEP='sleep 60'" helps
   here.

https://github.com/mcr/unstrung uses this, as does:
https://github.com/xelerance/openswan

See https://github.com/mcr/unstrung/blob/master/testing/utils/linuxrc-uml.sh
for the linuxrc that I use.

--
]               Never tell me the odds!                 | ipv6 mesh networks [
]   Michael Richardson, Sandelman Software Works        | network architect  [
]     m...@sandelman.ca  http://www.sandelman.ca/        |   ruby on rails    [


------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
User-mode-linux-user mailing list
User-mode-linux-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user

Reply via email to