[How-To] Compile OpenWrt x86 and Keep Full Compatibility With Official Kernel Packages
I recently rebuilt my OpenWrt x86 image and needed to keep compatibility with all official repository packages, including kernel modules (kmods).
This method preserves the exact kernel ABI, so LuCI and opkg can install every package without “kernel version mismatch” errors.
This is the cleanest and safest way to build a custom image while still using the official OpenWrt repo.
Steps
1. Clone the exact release
git clone https://git.openwrt.org/openwrt/openwrt.git
cd openwrt
git checkout v24.10.4
2. Update and install feeds
./scripts/feeds update -a
./scripts/feeds install -a
3. Use the official build config
Download the official config directly:
wget -O .config \
https://downloads.openwrt.org/releases/24.10.4/targets/x86/64/config.buildinfo
If you open config.buildinfo, you will see the kernel used for this target:
kernel - 6.6.110~484466e2719a743506c36b4bb2103582-r1
The important part is the vermagic hash:
484466e2719a743506c36b4bb2103582
4. Load defaults and adjust configuration
make defconfig
make menuconfig
Do not change any <M> entries to < >, as that removes modules and changes the kernel ABI.
If you want a driver included in your image, use <*> instead — this does not break compatibility. You can add packages, but its simpler to do it from gui after first boot.
5. Confirm kernel ABI matches official repo
make target/linux/{clean,compile}
find build_dir/ -name .vermagic -exec cat {} \;
If it prints:
484466e2719a743506c36b4bb2103582
…then your custom image is fully compatible with all official packages and kernel modules from the OpenWrt repository.
6. Build your image
make download && make -j5
Result
-
Full LuCI/opkg access to all packages
-
Kernel modules install without errors
-
ABI/signature checks pass
-
Completely custom x86 image with zero repo compatibility issues
Full credit to the original write-up:
https://hamy.io/post/0015/how-to-compile-openwrt-and-still-use-the-official-repository/