How to choose 4.9 kernel version instead of 4.14 for ar71xx

Hello to all.
I am building a firmware for my router Mikrotik RB450G.
After I install the image on my router I see the kernel version is 4.14.
How to build a firmware for the router and get kernel veresion 4.9?

Thanks!

1 Like

Checkout an ancient commit, when ar71xx still used 4.9.

In general, you have not freedom to select a kernel version. There are hundreds of hardware-oriented OpenWrt patches that need to match the kernel version. There is pretty much just one kernel version available.

You need to checkout the sources of last commit before the kernel switch to 4.14 in ar71xx:
https://git.openwrt.org/?p=openwrt/openwrt.git;a=shortlog;h=77d004de6d09edc6d8a5cf77471d52d4865ae577

That would mean October 2018 code.

Alternative would be to use the mid-2018 code in 18.06 branch, which has newer security fixes, but still uses 4.9 for ar71xx. But that is then ancient code otherwise.
https://git.openwrt.org/?p=openwrt/openwrt.git;a=history;f=target/linux/ar71xx;hb=refs/heads/openwrt-18.06

3 Likes

How much time do you want to invest for having the kernel on 4.9?

You can revert the commit that dropped kernel 4.9 support, increase the kernel version 4.9 to the latest patch version and update / fix the patches.
Ask if you need further assistance...

2 Likes

The reason I want to use 4.9 is because I can't install and run openvpn on 4.14. I got errors...
But openvpn works well with 4.9.

Can you explain why you need kernel version 4.9?
Probably there is a better solution for your problem...

Are you sure that this is related to the kernel and not another combination of software versions?

1 Like

Hmm, I will build a fresh 4.14 version and try to install openvpn. I need to catch the error and post it here.
This is better to do.

1 Like

I have build a fresh firmware for my router.
I get the next error once I try to install OpenVPN:

Details for package openvpn-openssl

  • Version: 2.4.7-2
  • Size: ~158.3 KB installed
  • Dependencies:
    • kmod-tun (15.9 KB) NOT INSTALLED
      • kernel VERSION INCOMPATIBLE
    • liblzo2 (32.7 KB) NOT INSTALLED
    • libopenssl1.1 INSTALLED
Description

Open source VPN solution using OpenSSL

  • The installed version of package kernel is not compatible, Require version = 4.14.125-1-a97bc8b33be51b9770ae41a525e3975e, once the next version is installed: 4.14.156-1-23ab19d181b6d2e1b339410fcd13638f

I have tried also to install kmod-tun and get the same error: version not compatible...

Any idea how to solve this?
Thanks

kernel-modules > network support > kmod-tun [*/m]

1 Like

If you build your kernel you also have to build all the kmods you need rather than download them prebuilt from the repository. The kernel is hashed to enforce an exact match of the same build. In theory it could work to force it if the major and minor versions match exactly but you risk bricking.

2 Likes

You can try using opkg install --force-depends

Why you need to build the kernel and image yourself?

If you only need some custom packages, you can also use the SDK and the official built images.

If you need to build it yourself because of patching the kernel, then it would be the best to select all needed packages, especially kmod packages, in menuconfig.

I need a firmware with some packages inside and the ability to reset the device to this firmware.

Building from source may not be necessary in this case. Try the Image Builder instead.

1 Like

Well, the thread opener is building from source for some reason or another. Once they do build from source, it doesn't make sense to do it half-way and not to build everything they need. As laid out before, this isn't at all an issue with kernel 4.14 vs 4.9, the very same issues would arise if kernel 4.9 were still available - it's simply inherent in the way they do a custom build, but then expect to install further kernel modules matching their self-built kernel.

There are three ways to avoid/ fix this:

  • using an official firmware build and then installing packages at runtime via opkg.
  • using the imagebuilder, which takes the binary packages from OpenWrt's official package repositories to assemble a new firmware image containing all packages needed.
  • building from source as before, but making sure to select (=y) all features and packages for the build, making sure that opkg is never needed in the first place (as the self-built image already contains everything desired).

Which route to take depends on the kind of the desired changes relative to official default builds (are source level modifications necessary) and personal preference, the results -if done correctly- are mostly equivalent.

5 Likes

I have fixed it in this way:
I have build a firmware and included kmod-tun. I am able to install openvpn and run it.
Thank you guys for ideas and help!

1 Like

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