Build kernel modules

116 views
Skip to first unread message

enexis

unread,
Jan 16, 2018, 7:56:10 AM1/16/18
to CoreOS Dev
Hi all,

I was trying to build new kernel module (what is missing in the current releases) following this guide: https://coreos.com/os/docs/latest/kernel-modules.html 

All good except the fact when I start the container with nspawn there is only a limited 2.9GB root disk space available which fills up quickly :

coreos_developer_container ~ # df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/loop5p9    2.9G  2.9G     0 100% /
tmpfs           2.0G     0  2.0G   0% /tmp
tmpfs           2.0G     0  2.0G   0% /dev
tmpfs           2.0G     0  2.0G   0% /dev/shm
tmpfs           2.0G  4.0K  2.0G   1% /run
tmpfs           2.0G  428K  2.0G   1% /run/systemd/nspawn/incoming
overlay          47G  6.4G   38G  15% /usr/lib64/modules
tmpfs           2.0G     0  2.0G   0% /sys/fs/cgroup

Been tried a few nspawn options none works, so I'm struggling there.

Any advise ?

Thanks,

Best regards,

 

David Michael

unread,
Jan 16, 2018, 10:06:27 AM1/16/18
to coreo...@googlegroups.com
You can bind a local directory over /usr/src or wherever you are
running the compilation with something like --bind="$PWD/src:/us/src".
Make sure to emerge coreos-sources again if you're reusing the same
container.

Thanks.

David

enexis

unread,
Jan 16, 2018, 11:56:59 AM1/16/18
to CoreOS Dev
Hi David,
Many thanks it worked! 
I was able to build the required module, now just need to load it on pxe boot ...
Any idea how to add module via PXE boot or shall I open a new topic regarding this ?

Thanks!

Best regards,

David Michael

unread,
Jan 16, 2018, 1:06:47 PM1/16/18
to coreo...@googlegroups.com
>> Thanks.
>>
>> David
>
>
>
> Hi David,
> Many thanks it worked!
> I was able to build the required module, now just need to load it on pxe
> boot ...
> Any idea how to add module via PXE boot or shall I open a new topic
> regarding this ?

Well, the official recommendation would be to modify the kernel config
and build a PXE image with the SDK as in:
https://coreos.com/os/docs/latest/sdk-modifying-coreos.html

If you have the module built and installed in the developer container,
you could tack it onto an existing PXE initrd with something like this
and PXE boot with the new initrd:

> alias cpio='docker run --rm --volume="$PWD:/wd" --workdir=/wd -i busybox cpio'
> cp --parents /lib/modules/*-coreos/kernel/drivers/.../module.ko .
> mkdir -p etc/systemd/system/systemd-udevd.service.requires
> echo -e '[Unit]\nDefaultDependencies=no\nBefore=systemd-udevd.service\n[Service]\nType=oneshot\nExecStart=/usr/sbin/depmod' > etc/systemd/system/depmod.service
> ln -fs ../depmod.service etc/systemd/system/systemd-udevd.service.requires/
> find etc lib/modules/*-coreos/kernel/drivers/... | cpio -oHnewc | gzip | cat coreos_production_pxe_image.cpio.gz - > new.cpio.gz

If you've confirmed that the module works for you and want it enabled
by default, you can request it here: https://issues.coreos.com/

Or, if you'd like, you can add it yourself. Here is an example:
https://github.com/coreos/coreos-overlay/pull/3009

Thanks.

David
Reply all
Reply to author
Forward
0 new messages