Compile OpenWrt 19.07.1 with Kernel 4.19

I would like to compile OpenWrt with Kernel 4.19 (or even 5.4) for x86. I have copied the config and patchfiles from Master on /target/linux/x86 to the current buildroot and have updated the file with the additional checksums.

Unfortunately I get an error when I start make kernel_menuconfig

make kernel_menuconfig
Collecting target info: done
 make[1] tools/quilt/compile
 make[2] -C tools/flock clean-build
 make[2] -C tools/flock compile
 make[2] -C tools/xz clean-build
 make[2] -C tools/xz compile
 make[2] -C tools/sed clean-build
 make[2] -C tools/sed compile
 make[2] -C tools/patch clean-build
 make[2] -C tools/patch compile
 make[2] -C tools/tar clean-build
 make[2] -C tools/tar compile
 make[2] -C tools/m4 clean-build
 make[2] -C tools/m4 compile
 make[2] -C tools/autoconf clean-build
 make[2] -C tools/autoconf compile
 make[2] -C tools/pkg-config clean-build
 make[2] -C tools/pkg-config compile
 make[2] -C tools/automake clean-build
 make[2] -C tools/automake compile
 make[2] -C tools/missing-macros clean-build
 make[2] -C tools/missing-macros compile
 make[2] -C tools/libtool clean-build
 make[2] -C tools/libtool compile
 make[2] -C tools/flex clean-build
 make[2] -C tools/flex compile
 make[2] -C tools/bison clean-build
 make[2] -C tools/bison compile
 make[2] -C tools/findutils clean-build
 make[2] -C tools/findutils compile
 make[2] -C tools/quilt clean-build
 make[2] -C tools/quilt compile
make[1]: Entering directory '/mnt/data/share/internal/software/openwrt/target/linux'
make[2]: Entering directory '/mnt/data/share/internal/software/openwrt/target/linux/x86'
mkdir -p /mnt/data/share/internal/software/openwrt/dl
SHELL= flock /mnt/data/share/internal/software/openwrt/tmp/.linux-4.19.106.tar.xz.flock -c '    /mnt/data/share/internal/software/openwrt/scripts/ "/mnt/data/share/internal/software/openwrt/dl" "linux-4.19.106.tar.xz" "63c8bd76a9b282e18112f8ff9e3fd41e3d1df9f9b7248ea1a370b05a827e9cda" "" "@KERNEL/linux/kernel/v4.x"    '
+ curl -f --connect-timeout 20 --retry 5 --location --insecure
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 98.6M  100 98.6M    0     0  5104k      0  0:00:19  0:00:19 --:--:-- 5237k
rm -rf /mnt/data/share/internal/software/openwrt/build_dir/target-x86_64_musl/linux-x86_64
mkdir -p /mnt/data/share/internal/software/openwrt/build_dir/target-x86_64_musl/linux-x86_64
xzcat /mnt/data/share/internal/software/openwrt/dl/linux-4.19.106.tar.xz | tar -C /mnt/data/share/internal/software/openwrt/build_dir/target-x86_64_musl/linux-x86_64 -xf -
cp -fpR "/mnt/data/share/internal/software/openwrt/target/linux/generic/files"/. /mnt/data/share/internal/software/openwrt/build_dir/target-x86_64_musl/linux-x86_64/linux-4.19.106/
find /mnt/data/share/internal/software/openwrt/build_dir/target-x86_64_musl/linux-x86_64/linux-4.19.106/ -name \*.rej -or -name \*.orig | xargs -r rm -f
if [ -d /mnt/data/share/internal/software/openwrt/target/linux/generic/patches ]; then echo "generic patches directory is present. please move your patches to the pending directory" ; exit 1; fi

Applying /mnt/data/share/internal/software/openwrt/target/linux/x86/patches-4.19/011-tune_lzma_options.patch using plaintext:
patching file scripts/Makefile.lib
Hunk #1 FAILED at 325.
1 out of 1 hunk FAILED -- saving rejects to file scripts/Makefile.lib.rej
patching file arch/x86/include/asm/boot.h
Patch failed!  Please fix /mnt/data/share/internal/software/openwrt/target/linux/x86/patches-4.19/011-tune_lzma_options.patch!
Makefile:25: recipe for target '/mnt/data/share/internal/software/openwrt/build_dir/target-x86_64_musl/linux-x86_64/linux-4.19.106/.prepared_291e75c2405b936c1be093e6a62025f9' failed
make[2]: *** [/mnt/data/share/internal/software/openwrt/build_dir/target-x86_64_musl/linux-x86_64/linux-4.19.106/.prepared_291e75c2405b936c1be093e6a62025f9] Error 1
make[2]: Leaving directory '/mnt/data/share/internal/software/openwrt/target/linux/x86'
Makefile:13: recipe for target 'menuconfig' failed
make[1]: *** [menuconfig] Error 2
make[1]: Leaving directory '/mnt/data/share/internal/software/openwrt/target/linux'
/mnt/data/share/internal/software/openwrt/include/ recipe for target 'kernel_menuconfig' failed
make: *** [kernel_menuconfig] Error 2

How is this done correctly? Which files from Master do i need to include in the buildroot from 19.07.1 to use kernel 4.19?

In addition to the target specific patches, you would need the "generic" linux 4.19 patches, too. And "generic" linux config, too. Plus you might need to evaluate all kernel package in package/kernel that is there are some compatibility changes in master that you need to backport.

OpenWrt has pretty complex hardware-oriented patch collection that is needed for getting everything to work, so trying to jump int 4.19 in a branch that only supports 4.14 is pretty impossible.

Initial 4.19 support was removed from 19.07 branch in June 2019 by this commit. You should likely start by reverting it:;a=commit;h=000d400baa0af2e42c9a462e42df7dc9abde1ec7

In general, if you need to ask what you need to do, you will likely fail, as the task will be so complex.

1 Like