Build official release with minimal kernel fix (kernel vermagic mismatch)

Hi,

I'm trying to use my Routerboard RB951G-2HnD with latest version 18.06.0, but it still needs a 2 line patch for making the switch work (at least on this hw rev).

Anyway, I'm trying to compile from source, using the same config.seed as in https://downloads.openwrt.org/releases/18.06.0/targets/ar71xx/mikrotik/

My intent is to be able to use the official repositories, and i got it working except for packages that depend on kernel modules (qos-scripts in this example). When using the resulting ImageBuilder, i get this:

Collected errors:
 * satisfy_dependencies_for: Cannot satisfy the following dependencies for qos-scripts:
 * 	kernel (= 4.9.111-1-1be0120c02e6cc24c38bf656ea23010f) 
 * 
 * opkg_install_cmd: Cannot install package qos-scripts.

The problem is a mismatch in the LINUX_VERMAGIC constant. According to include/kernel-defaults.mk, this constant is generated like this:

grep '=[ym]' $(LINUX_DIR)/.config.set | LC_ALL=C sort | mkhash md5 > $(LINUX_DIR)/.vermagic

The resulting hash on my build is not 1be0120c02e6cc24c38bf656ea23010f, and that's why i'm getting the dependency problem.

Steps to reproduce what I'm doing:

$ git clone git clone https://git.openwrt.org/openwrt/openwrt.git
$ git checkout v18.06.0
$ wget -O .config https://downloads.openwrt.org/releases/18.06.0/targets/ar71xx/mikrotik/config.seed
$ make menuconfig
[ patch target/linux/ar71xx/files/arch/mips/ath79/mach-rb95x.c ]
$ make

Any clue on what's happening or how to get an exact match on the vermagic const?

Thanks
Julian

Run make defconfig after wget and before make menuconfig. Probably drop the make menuconfig if you don't add any package (no kmod) with it.

The all kmod config symbol get only expanded if you do a make defconfig and therefore you have a different kernel config hash.

1 Like

I repeated the steps with make defconfig, without menuconfig. The hash doesn't match, but it's the same as in my previous try: 0c67855836f58a9adf997ce6e67d81ba.

Still different that the release one 1be0120c02e6cc24c38bf656ea23010f

All steps?

You need the original minimal config that you download with wget!

If you have used the .config from you build before it will not work!

Do at least with you cloned source and checked out tag:
./scripts/feeds update -a && ./scripts/feeds install -a
make clean
wget ...
make defconfig
make download
make -j4

I didn't reuse the old .config.

I'm trying again with your instructions (was lacking make download and the feeds command.

You could check with make menuconfig if all kmod packages are selected after make defconfig...

1 Like

All 731 kmod packages are either set to m or y, except these:

$ grep -i kmod .config | grep -v m$ | grep -v y$
# CONFIG_PACKAGE_kmod-cryptodev is not set
# CONFIG_PACKAGE_kmod-fs-afs is not set
# CONFIG_KMOD_BATMAN_ADV_DEBUG_LOG is not set
# CONFIG_KMOD_BATMAN_ADV_NC is not set
# CONFIG_PACKAGE_kmod-rtc-ds1307 is not set
# CONFIG_PACKAGE_kmod-rtc-ds1374 is not set
# CONFIG_PACKAGE_kmod-rtc-ds1672 is not set
# CONFIG_PACKAGE_kmod-rtc-isl1208 is not set
# CONFIG_PACKAGE_kmod-rtc-pcf2123 is not set
# CONFIG_PACKAGE_kmod-rtc-pcf8563 is not set
# CONFIG_PACKAGE_kmod-rtc-pt7c4338 is not set
# CONFIG_PACKAGE_kmod-rtc-rs5c372a is not set
# CONFIG_PACKAGE_libkmod is not set
# CONFIG_PACKAGE_kmod is not set

Confirmed with menuconfig:
Selecci%C3%B3n_411

I'll let you know after it compiles...

1 Like

Well, it hasn't finished the build yet, but I can see the hash matches the official release.

$ grep '=[ym]' ./build_dir/target-mips_24kc_musl/linux-ar71xx_mikrotik/linux-4.9.111/.config.set | LC_ALL=C sort | ./staging_dir/host/bin/mkhash md5
1be0120c02e6cc24c38bf656ea23010f

Thanks man!!

Thank you very much!