Port OpenWrt for x64 kernel to ubuntu 22.04 rootfs

Hi,

I’m playing around with openwrt for couple of year's.

Does anyone know is it possible and what steps needs to be taken to compile/run openwrt x64 kernel with modules to ubuntu 22.04 , just like installingone more kernel on ubuntu?

I already copy wmlinuz and modules from latest openwrt release, have created initramfs. Afjust grub.cfg , openwrt kernel starts, mount rootfs, say it start /sbin/init and there stops….not run further systemd scripts.

What i need to change in openwrt x64 build to make it run on ubuntu?

Whose rootfs, Ubuntu?

Yes.
Like installing normal ubunutu server on x86 machine and then just swap ubuntu’s kernel to openwrt’s x86 kernel with openwrt modules.

What's the point as you can install openwrt on its own?

1 Like

the point is that openwrt has a lot patches to the kernel which speeds up overall wifi performance, which i need to maintain on my custom ubuntu kernel...
vanilla ubuntu kernel (the same version as openwrt 5.10.161) has so much slower upload an download through my wifi compex 5GH wireless card..

this way i have rootfs with all my installations and configuration/ management of software untouched, and i could have fast and furious openwrt kernel up and running...

is it that simple to just switch kernel from openwrt to ubuntu? or i need to do something during the build of openwrt kernel in menuconfig?

Update: it seems that
devtmps
Is missing!

What is your kernel command line? You’re going to need to explicitly state that init is systemd as openwrt does not support systemd by default. Kernel is setup to use the openwrt init system.

Once you get past that there will be many more ‘missing’ components I expect, like kms etc as wrt doesn’t need any desktop supporting services

hi, this one is my command line...

           linux   /boot/vmlinuznodevtmpfs rootwait root=PARTUUID=9532ba09-e689-479f-adeb-42976ba7cc66 ro noinitrd devtmpfs.mount=0 debug

"Kernel is setup to use the openwrt init system." hm..,

EDIT: devtmps is fixed by compiling openwrt x64 kernel with CONFIG_DEVTMPFS ON.

now fixing rootfs kmods....

You can find all the systemd kernel reqs in the README - you'll need to enable these for systemd support; https://github.com/systemd/systemd/blob/main/README

And depending on how ubuntu starts systemd you may want to specify it explicitly in the kernel command line (init=XXXXX)

1 Like

Hi, some of the config parameter for systemd support from above link is not available in openwrt menuconfig...

how i can add them?
Kernel Config Options:
CONFIG_DEVTMPFS
CONFIG_CGROUPS (it is OK to disable all controllers)
CONFIG_INOTIFY_USER
CONFIG_SIGNALFD
CONFIG_TIMERFD
CONFIG_EPOLL
CONFIG_UNIX (it requires CONFIG_NET, but every other flag in it is not necessary)
CONFIG_SYSFS
CONFIG_PROC_FS
CONFIG_FHANDLE (libudev, mount and bind mount handling)

EDIT: i had wrong modules directory name, after i fix that, ubuntu was up & running:-)

thnx for all your help..

the most important default change is:

CONFIG_DEVTMPFS = y and automount of it

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.