Sharing one ethernet network device between two L4Linux instances
Martin Schröder
martin.schroeder at openlimit.com
Mon Oct 26 14:35:02 CET 2015
Am 23.10.2015 um 10:48 schrieb Mahdi Aichouch:
> Regarding the use of the "cons multiplexer", if I understood correctly I should use it instead of "l4shmns" service, right?
> If yes, do I have to disable the support of "l4shmns" option in L4Linux and remove all configuration from my Lua configuration file?
>
> Could you please share a document or some instructions that explain how to use the "cons multiplexer".
l4shmns and cons are two different things, and you can use them both together:
cons allows a serial console to either L4Linux while l4shmns allows to connect from one L4Linux to another L4Linux via a virtual
network interface. But for l4shmns you need to configure the virtual network interface for the "hidden"-L4Linux. This is a little
bit tricky if you don't have a console.
For cons & l4shmns I use this configuration:
modules.lst:
============
add "module cons" to "entry L4Linux ARM"
l4lx.cfg:
=========
-- vim:set ft=lua:
local lxname = "vmlinuz";
if L4.Info.arch() == "arm" then
lxname = "vmlinuz.arm";
end
local shmns = L4.default_loader:create_namespace({shm = "something"});
local cons = L4.default_loader:new_channel();
L4.default_loader:start({ caps = { cons = cons:svr() },
log = L4.Env.log, },
"rom/cons -k -a");
L4.default_loader.log_fab = cons;
L4.default_loader:start(
{ caps = {
-- log = L4.Env.log:m("rws"),
shmns = shmns:mode("rw"),
},
l4re_dbg = L4.Dbg.Warn,
log = { "l4linux1", "yellow", "key=1" },
},
"rom/" .. lxname .. " mem=64M console=ttyLv0 l4x_rd=rom/ramdisk-" .. L4.Info.arch() .. ".rd root=1:0 ramdisk_size=4000
l4shmnet.add=shmns,macpart=1");
L4.default_loader:start(
{ caps = {
-- log = L4.Env.log:m("rws"),
shmns = shmns:mode("rw"),
},
l4re_dbg = L4.Dbg.Warn,
log = { "l4linux2", "magenta", "key=2" },
},
"rom/" .. lxname .. " mem=64M console=ttyLv0 l4x_rd=rom/ramdisk-" .. L4.Info.arch() .. ".rd root=1:0 ramdisk_size=4000
l4shmnet.add=shmns,macpart=2");
make qemu E="L4Linux ARM"
Then you'll see both l4linux booting:
> ...
> l4linux1|
> l4linux1| Please press Enter to activate this console.
> l4linux2|
> l4linux2| Please press Enter to activate this console.
Now press either <Enter> and type "help" to see cons. Or press "[Ctrl-E] 1" or "[CTRL-E] 2" to switch between both L4Linux instances:
[Ctrl-E] 1
> ------------- Connecting to 'l4linux1' -------------
> Key type dns_resolver registered
> RAMDISK: ext2 filesystem found at block 0
> RAMDISK: Loading 3072KiB [1 disk] into ram disk... done.
> EXT4-fs (ram0): couldn't mount as ext3 due to feature incompatibilities
> EXT4-fs (ram0): mounting ext2 file system using the ext4 subsystem
> EXT4-fs (ram0): mounted filesystem without journal. Opts: (null)
> VFS: Mounted root (ext2 filesystem) readonly on device 1:0.
> Freeing unused kernel memory: 168K (023ae000 - 023d8000)
>
> Please press Enter to activate this console.
> / # ip addr add 10.10.10.1/24 broadcast 10.10.10.255 dev eth0
> / # ifconfig eth0 up
> net eth0: L4ShmNet established, with 52:54:00:b0:cf:01, IRQ 312
> / #
[Ctrl-E] 2
> ------------- Connecting to 'l4linux2' -------------
> Key type dns_resolver registered
> RAMDISK: ext2 filesystem found at block 0
> RAMDISK: Loading 3072KiB [1 disk] into ram disk... done.
> EXT4-fs (ram0): couldn't mount as ext3 due to feature incompatibilities
> EXT4-fs (ram0): mounting ext2 file system using the ext4 subsystem
> EXT4-fs (ram0): mounted filesystem without journal. Opts: (null)
> VFS: Mounted root (ext2 filesystem) readonly on device 1:0.
> Freeing unused kernel memory: 168K (023ae000 - 023d8000)
>
> Please press Enter to activate this console.
> / # ip addr add 10.10.10.2/24 broadcast 10.10.10.255 dev eth0
> / # ifconfig eth0 up
> / # ping -c3 10.10.10.1
> PING 10.10.10.1 (10.10.10.1): 56 data bytes
> 64 bytes from 10.10.10.1: seq=0 ttl=64 time=50.000 ms
> 64 bytes from 10.10.10.1: seq=1 ttl=64 time=6.000 ms
> 64 bytes from 10.10.10.1: seq=2 ttl=64 time=6.000 ms
>
> --- 10.10.10.1 ping statistics ---
> 3 packets transmitted, 3 packets received, 0% packet loss
> round-trip min/avg/max = 6.000/20.666/50.000 ms
> / #
Martin
More information about the l4-hackers
mailing list