4.6.6-op24 source/vermagic

Hello.

I believe, it is impossible to get GL.iNET's op24 sources, right? :frowning:
How can I build a custom module with same vermagic then?
For example, current version 4.6.6 (mt-3000) made on OpenWRT's commit ebe7c5f1a3 of 24.10 branch, but even if I checkout and build default image, vermagic will differ from image I may download from gl.inet (5f888a243508bd63116c3c6987914d47-r1)

* pkg_hash_check_unresolved: cannot find dependency kernel (= 6.6.47~619a58e5e502dc9d8c11231596e812c6-r1) for kmod-helloworld
* pkg_hash_fetch_best_installation_candidate: Packages for kmod-helloworld found, but incompatible with the architectures configured

I need at least config.seed (config.buildinfo) file then, I think. Or any other way to build a module with same vermagic, maybe?

Also, is it possible to made custom GL.iNET UI module (not luci) for op24 firmware?

1 Like

The GL SDK and UI not be made public, the firmware cannot be customized compiled with GL GUI. Can only be compiled based on OpenWRT open source with Luci.
Currently GL OP24 firmware is based on OP24.0.

What plugins do you need to install? HelloWorld?
This plugin is quite special, GL cannot provide technical support. Sorry.
But you can compile them yourself or Google can find the MT7981 compiled ipk packages.

What plugins do you need to install? HelloWorld?

Of cause not :slight_smile:
This was just a sample of opkg error that indicates that module I built is not compatible with kernel from firmware you released.

This plugin is quite special, GL cannot provide technical support.

I do not ask for support of custom module, I can build OpenWRT kernel and module locally, all I need is only a config file that was used by you (on op24 firmware) to build a kernel to be able make kernel with the same VERMAGIC
OpenWRT releases provide this file with each public release, for example, I can install OpenWRT 23.05 on MT-3000 an build custom module using their published config file: https://downloads.openwrt.org/releases/23.05.5/targets/mediatek/filogic/config.buildinfo

1 Like

I thought I'm smart, and I faked VERMAGIC to pass opkg check :slight_smile:

But looks like this is not enough, and as a result I'm getting error when I'm trying to load my module:
.gnu.linkonce.this_module section size must match the kernel's built struct module size at run time

Here is output of readelf -a of

my module:

Section Headers:
  [Nr] Name              Type             Address           Offset
       Size              EntSize          Flags  Link  Info  Align
  [23] .gnu.linkonc[...] PROGBITS         0000000000000000  0000b640
       0000000000000280 0000000000000000  WA       0     0     64
  [24] .rela.gnu.li[...] RELA             0000000000000000  00087698
       0000000000000030  0000000000000018   I      48    23     8

Relocation section '.rela.gnu.linkonce.this_module' at offset 0x8a8f0 contains 2 entries:
  Offset          Info           Type           Sym. Value    Sym. Name + Addend
000000000138  011800000101 R_AARCH64_ABS64   0000000000000000 init_module + 0
000000000258  00f800000101 R_AARCH64_ABS64   0000000000000000 cleanup_module + 0

any module from your firmware:

Section Headers:
  [Nr] Name              Type             Address           Offset
       Size              EntSize          Flags  Link  Info  Align
  [28] .gnu.linkonc[...] PROGBITS         0000000000000000  0000db80
       00000000000004c0  0000000000000000  WA       0     0     64
  [29] .rela.gnu.li[...] RELA             0000000000000000  00020060
       0000000000000030  0000000000000018   I      39    28     8

Relocation section '.rela.gnu.linkonce.this_module' at offset 0x20060 contains 2 entries:
  Offset          Info           Type           Sym. Value    Sym. Name + Addend
000000000138  012500000101 R_AARCH64_ABS64   0000000000000008 init_module + 0
000000000488  011300000101 R_AARCH64_ABS64   0000000000000000 cleanup_module + 0

Could you please share kernel configuration you used?

2 Likes

Can you pull /proc/config.gz for the kernel configuration?

No. Kernel was compiled without any option to get configuration.

GL.iNET, Kernel is GPLv2, which basically means ‘if you distribute binaries, then you have to distribute sources to let anyone build a kernel by themself’.

Please, share kernel configuration file.

1 Like

I was examining all the feeds earlier, all the repositories involved are GL and keyed.

Opkg list installed gives a 6.6.47 R1 version for most packages.

I don't need their code (even if they have to open it by GPL rules). I need only configuration file that was used to build kernel, without configuration it is unable to compile any other module.

1 Like

Maybe you could try modifying the include/kernel-defaults.mk file to populate your hash directly into .vermagic, like so:

...
# copy CONFIG_KERNEL_* settings over to .config.target
        awk '/^(#[[:space:]]+)?CONFIG_KERNEL/{sub("CONFIG_KERNEL_","CONFIG_");print}' $(TOPDIR)/.config >> $(LINUX_DIR)/.config.target
        echo "# CONFIG_KALLSYMS_EXTRA_PASS is not set" >> $(LINUX_DIR)/.config.target
        echo "# CONFIG_KALLSYMS_ALL is not set" >> $(LINUX_DIR)/.config.target
        echo "CONFIG_KALLSYMS_UNCOMPRESSED=y" >> $(LINUX_DIR)/.config.target
        $(SCRIPT_DIR)/package-metadata.pl kconfig $(TMP_DIR)/.packageinfo $(TOPDIR)/.config $(KERNEL_PATCHVER) > $(LINUX_DIR)/.config.override
        $(SCRIPT_DIR)/kconfig.pl 'm+' '+' $(LINUX_DIR)/.config.target /dev/null $(LINUX_DIR)/.config.override > $(LINUX_DIR)/.config.set
        $(call Kernel/SetNoInitramfs)
        rm -rf $(KERNEL_BUILD_DIR)/modules
        cmp -s $(LINUX_DIR)/.config.set $(LINUX_DIR)/.config.prev || { \
                cp $(LINUX_DIR)/.config.set $(LINUX_DIR)/.config; \
                cp $(LINUX_DIR)/.config.set $(LINUX_DIR)/.config.prev; \
        }
        $(_SINGLE) [ -d $(LINUX_DIR)/user_headers ] || $(KERNEL_MAKE) $(if $(findstring uml,$(BOARD)),ARCH=$(ARCH)) INSTALL_HDR_PATH=$(LINUX_DIR)/user_headers headers_install
        #grep '=[ym]' $(LINUX_DIR)/.config.set | LC_ALL=C sort | $(MKHASH) md5 > $(LINUX_DIR)/.vermagic
        echo 619a58e5e502dc9d8c11231596e812c6 > $(LINUX_DIR)/.vermagic
endef
...

About line 117.

Thank you for reply, but if you read my messages carefully, you will see:

I already did this, but linkonce section of compiled module doesn't match with kernel from firmware. There are a lot of kernel options that affects this section size. This is why I need EXACTLY the same config of kernel that was used to build kernel.

1 Like

Well... I bruteforced some config options and was able to match linkonce size, my module could be initialized, but It can not work since other function pointers are different too.

Gents, this shouldn't be THAT hard for users to extend firmware with own modules, why should we reverse engineer your firmware just to get SIMPLE CONFIG FILE? Try to be more open to community.

PLEASE SHARE config.buildinfo FILE

1 Like

Honestly, I'm kind of tired of debricking my router after each 'test' compilation.
I don't know what else I should say to GL.iNET, please read about GPL:

Hi, please use the attached configuration.
config.zip (3.5 KB)

2 Likes

Thank you.

While I'm still unable to get exactly the same VERMAGIC using this config (incomplete config or you are using some kernel modifications), finally after few hours of trying and numbers of recompiling I was able to make module I need work (I hope it will not crash in future :))

Please, include configuration in the future builds (using KERNEL_IKCONFIG compile option or separate file for download)

1 Like

It's me again :slight_smile:
4.7.0-op24 is out, where we can find buildconfig for this version?

1 Like

Looks like I have to beg you once again for few weeks...
Why it is so hard? Please share config, it helps people using packages you dont want to support.

1 Like

I apologize for such a late reply, please use the attached configuration.
config_4.7.0_op24.zip (3.6 KB)

2 Likes

Can you guys provide the same for MT-6000 version 4.7.0 please?

Hi, please use the attached configuration.
config_mt6000_4.7.0.zip (4.4 KB)

1 Like

Thank you!