[elbe-users] add binary files to target image

Olivier Dion dion at linutronix.de
Tue May 5 19:34:22 CEST 2020


On Tue, 05 May 2020, Christian Baur <christian.baur at steinbeis-tzs.de> wrote:
> Hi elbe-users,
>
> what is the best way to get files from the host pc into the final image?
>
> Long version:
> I need to integrate several binary files, configs etc. into my x86-64 
> image build by elbe.
> The files are already in a directory with the layout of the final rfs.
> Can i mount a directory from my host pc inside the initvm and 'cp -r' 
> everything to the target image?


You can share your filesystem with the guest using plan 9 network
filesystem.

Here are the steps:

1. Stop your initvm

2. virsh --connect qemu:///system

3. virsh # edit initvm

4. Add the following in the <devices> node.
----------------------------------------------------------------------
 <filesystem type='mount' accessmode='passthrough'>
    <driver type='path' wrpolicy='immediate'/>
    <source dir='/home/olivier/linutronix/elbe'/>
    <target dir='mydata'/>
    <readonly/>
</filesystem>
----------------------------------------------------------------------
Here source directory point to my clone of Elbe.  It should point to
your directory.  The target directory is _not_ a directory.  It's just a
label that we're going to reuse later.  Name it however you like.

5. Start your initvm and attach to it (or ssh)

6. Make sure that you have the following kernel modules loaded:
----------------------------------------------------------------------
loop
virtio
9p
9pnet
9pnet_virtio
----------------------------------------------------------------------

7. # mount -t 9p mydata /mnt

In step 7, we reuse the label 'mydata' from step 4.


Hope that helped.

-- 
Olivier Dion
Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen



More information about the elbe-users mailing list