From matt at traverse.com.au  Wed Nov  1 20:39:06 2023
From: matt at traverse.com.au (Mathew McBride)
Date: Thu, 02 Nov 2023 14:39:06 +1100
Subject: Adding a new platform: renesas rz
In-Reply-To: <CAP8xZ6m-cAZ8fkoxhOd6W_EWcW17W0uggpPRseR3d8rryUaDiQ@mail.gmail.com>
References: <CAP8xZ6m-cAZ8fkoxhOd6W_EWcW17W0uggpPRseR3d8rryUaDiQ@mail.gmail.com>
Message-ID: <ccd8ba1e-43b0-4e39-b0cc-1dc085aa5950@app.fastmail.com>

Hi Michele,

On Mon, Oct 30, 2023, at 8:39 PM, Michele Bisogno wrote:
> Hi,
> 
> I've been a happy OpenWRT user for many years now, always buying
> routers that could allow me to run it easily.
> 
> I've been working (actually only in my free time as a hobby) on
> porting OpenWRT onto this Renesas board:
> https://www.renesas.com/eu/en/products/microcontrollers-microprocessors/rz
> -mpus/rzg2l-evkit-rzg2l-evaluation-board-kit
> which features this Arm Cortex-A55 based device:
> https://www.renesas.com/eu/en/products/microcontrollers-microprocessors/rz
> -mpus/rzg2l-general-purpose-microprocessors-dual-core-arm-cortex-a55-12-gh
> z-cpus-and-single-core-arm-cortex-m33
> 
> I guess this is a new platform, since it does not really fit in any of
> the already supported ones.

Does the Renesas/RZ U-boot have EFI support enabled ('bootefi' command)?
Could you try an armsr/armv8 image and see if it boots?

(You will need to start U-Boot from qspi or sd card and OpenWrt from a USB or different sd card)

If that works, or if we can figure out the necessary changes, a new top level target may not be needed.

I understand Renesas has developed a standard firmware for another CPU in the series (/G2M), but not sure about the /G2L
https://www.renesas.com/us/en/blogs/renesas-rzg2m-awarded-arm-systemready-ir-11-certification

> I got it working and I am polishing the patch before submitting it.
> The support of this device is already mainlined in the Linux kernel,
> so I am using 6.1 as is with the appropriate config.
> Arm Trusted Firmware and u-boot are instead taken from the respective
> Renesas forks, available on github.
At the moment armsr does not have support for building whole machine firmware images with ATF and U-Boot but we could figure out some way to do that if needed.

Best Regards,
Matt



From micbis.openwrt at gmail.com  Thu Nov  2 01:21:12 2023
From: micbis.openwrt at gmail.com (Michele Bisogno)
Date: Thu, 2 Nov 2023 09:21:12 +0100
Subject: Adding a new platform: renesas rz
In-Reply-To: <418c3902-c1dd-48ea-aa3f-bb63fba5403a@app.fastmail.com>
References: <CAP8xZ6m-cAZ8fkoxhOd6W_EWcW17W0uggpPRseR3d8rryUaDiQ@mail.gmail.com>
 <418c3902-c1dd-48ea-aa3f-bb63fba5403a@app.fastmail.com>
Message-ID: <CAP8xZ6=r1XPAjd9dJoNdHVkbquSEDaxAzOT0G03mtet00rQ_RQ@mail.gmail.com>

Hi Matt,

> Does the Renesas/RZ U-boot have EFI support enabled ('bootefi' command)?
> Could you try an armsr/armv8 image and see if it boots?

It does support it but I have never tried it.

> (You will need to start U-Boot from qspi or sd card and OpenWrt from a USB or different sd card)
>
> If that works, or if we can figure out the necessary changes, a new top level target may not be needed.

Yes, let me try.

> I understand Renesas has developed a standard firmware for another CPU in the series (/G2M), but not sure about the /G2L
> https://www.renesas.com/us/en/blogs/renesas-rzg2m-awarded-arm-systemready-ir-11-certification

This is a very good point.
RZ/G2M is a very different device, even though it has got a similar name.
However RZ/G2L may be SR IR compliant, or at least not so far away.

Kind regards,
Michele


From duwe at lst.de  Thu Nov  2 04:41:28 2023
From: duwe at lst.de (Torsten Duwe)
Date: Thu, 2 Nov 2023 12:41:28 +0100
Subject: Adding a new platform: renesas rz
In-Reply-To: <CAOX2RU5joti3TqFBoh=Ubr7hxnv8-SXkhieFx4ud11rOdiK49w@mail.gmail.com>
References: <CAP8xZ6m-cAZ8fkoxhOd6W_EWcW17W0uggpPRseR3d8rryUaDiQ@mail.gmail.com>
	<CAOX2RU5joti3TqFBoh=Ubr7hxnv8-SXkhieFx4ud11rOdiK49w@mail.gmail.com>
Message-ID: <20231102124128.19d207b2@blackhole.lan>

On Mon, 30 Oct 2023 21:40:02 +0100
Robert Marko <robimarko at gmail.com> wrote:

> On Mon, 30 Oct 2023 at 10:40, Michele Bisogno
> <micbis.openwrt at gmail.com> wrote:
> >
> > Hi,
> >
> > I've been a happy OpenWRT user for many years now, always buying
> > routers that could allow me to run it easily.

Same here :-)

[...]
> >
> > For example, naming (renesas? renesas-rz? rz?) and structure of the
> > subfolders. There are other variants I would like to add: RZ/G2LC,
> > RZ/G2UL and maybe others.
> 
> To me, just "renesas" sounds good and then you can introduce the
> individual SoC families as subtargets.

Renesas offers different architectures in their portfolio[1], I haven't
dug into the OpenWRT build system for this issue yet to tell whether it
is able to handle that at this folder level. Much of the above is
"legacy" and does not run OpenWRT(?), but they also seem to aim for
Risc-V. There is a platform called "ramips" and the broadcoms each have
their own subdirectory. None of them have punctuation yet. Maybe call it
"renesasrz"? They're also offering other ARM-based SoCs, and building
common kernels might become difficult.

	Torsten

[1]
https://www.renesas.com/eu/en/products/microcontrollers-microprocessors/other-mcus-mpus


From mail at aparcar.org  Thu Nov  2 10:46:01 2023
From: mail at aparcar.org (Paul Spooren)
Date: Thu, 2 Nov 2023 18:46:01 +0100
Subject: [PATCH firmware-utils] add dlink-sge-image for D-Link devices by
 SGE
In-Reply-To: <20230623120600.16663-1-openwrt@sebastianschaper.net>
References: <20230623120600.16663-1-openwrt@sebastianschaper.net>
Message-ID: <C936EA91-2F0B-4DBC-8EEC-1E7E538F239E@aparcar.org>

Hello,

> On Jun 23, 2023, at 14:06, Sebastian Schaper <openwrt at sebastianschaper.net> wrote:
> 
> This tool will encrypt/decrypt factory images requiring the "SHRS" header
> e.g. COVR-C1200, COVR-P2500, COVR-X1860, DIR-878, DIR-882, ...
> 
> Encryption is loosely based on a series of blogposts by ricksanchez [1]
> and the provided code [2], as well as patches to qca-uboot found in the
> GPL tarball released for D-Link COVR-P2500 Rev. A1 [3].
> 
> Further scripts (e.g. /lib/upgrade/) and keys were found in the GPL tarball
> and/or rootfs of COVR-C1200 (the devices are based on OpenWrt Chaos Calmer
> and failsafe can be entered by pressing 'f' on the serial console during
> boot, allowing to access the file system of the running device).
> 
> For newer devices like COVR-X1860 and DIR-X3260, an updated method of
> vendor key derivation is implemented based on enk.txt from the GPL release.
> 
> [1] https://0x00sec.org/t/breaking-the-d-link-dir3060-firmware-encryption-recon-part-1/21943
> [2] https://github.com/0xricksanchez/dlink-decrypt
> [3] https://tsd.dlink.com.tw/GPL.asp
> 
> Signed-off-by: Sebastian Schaper <openwrt at sebastianschaper.net>
> Tested-By: Alan Luck <luckyhome2008 at gmail.com>
> ---
> 
> This patch is based on previous work on PR #4174, migrated to OpenSSL EVP API
> and extended to include support for newer devices like COVR-X1860.
> 
> The intermediate development stages are tracked at
> https://github.com/s-2/firmware-utils/commits/dlink-sge-image
> and the forum thread
> https://forum.openwrt.org/t/add-support-for-d-link-covr-x1860/161862
> 

? %< ?

> +/*
> +  key.pem as found in GPL tarball, e.g.:
> +  COVRP2500A1_FW101/COVRP2500_GPL_Release/package/tw-prog.priv/imgcrypt/key.pem
> +  encrypted with passphrase: "12345678"
> +*/
> +const unsigned char key_legacy_pem[] = R"(
> +-----BEGIN RSA PRIVATE KEY-----
> +Proc-Type: 4,ENCRYPTED
> +DEK-Info: AES-256-CBC,EAA1FD02CDBC7AA7E62AC821D47823F2
> +
> +1LiXFElARVvVJnikiVqZxC5FS7silmaqZ1yBOfzWuYNLaiEuvoUOylwiT0JYna94
> +nevCGjdU27GOUBsLnhGVulVuD8aiZCGBaZES5BAFtOEz0rrmpJLHxD3txLBh49rM
> +zLfn77/bMfubuhUFw+TPQ9J6SlrwK12IaMBTBTCFf06h+dkY500A0GAESgSA4Cab
> +retvT5/xtnl5jtT7zBYPbDGPDZ0fFoDSa7IqkqJ+chGz4w02UezAuKPPlNTTxD4l

? >% ?

Could you please change the usage of raw strings (R?) with the less pretty `\n\` after each line? This would allow compilation on macOS which uses clang.

Apart from that I tried to get the device running based one your work. Via the web installer an upload and ?successful? flash was possible, however it doesn?t boot afterwards. I'll solder a serial connection later to figure out where things go wrong.

Thanks for your work and patience!

Best,
Paul




From openwrt at sebastianschaper.net  Thu Nov  2 12:16:06 2023
From: openwrt at sebastianschaper.net (Sebastian Schaper)
Date: Thu,  2 Nov 2023 20:16:06 +0100
Subject: [PATCH v2 firmware-utils] add dlink-sge-image for D-Link devices by SGE
Message-ID: <20231102191606.12561-1-openwrt@sebastianschaper.net>

This tool will encrypt/decrypt factory images requiring the "SHRS" header
e.g. COVR-C1200, COVR-P2500, COVR-X1860, DIR-878, DIR-882, ...

Encryption is loosely based on a series of blogposts by ricksanchez [1]
and the provided code [2], as well as patches to qca-uboot found in the
GPL tarball released for D-Link COVR-P2500 Rev. A1 [3].

Further scripts (e.g. /lib/upgrade/) and keys were found in the GPL tarball
and/or rootfs of COVR-C1200 (the devices are based on OpenWrt Chaos Calmer
and failsafe can be entered by pressing 'f' on the serial console during
boot, allowing to access the file system of the running device).

For newer devices like COVR-X1860 and DIR-X3260, an updated method of
vendor key derivation is implemented based on enk.txt from the GPL release.

[1] https://0x00sec.org/t/breaking-the-d-link-dir3060-firmware-encryption-recon-part-1/21943
[2] https://github.com/0xricksanchez/dlink-decrypt
[3] https://tsd.dlink.com.tw/GPL.asp

Signed-off-by: Sebastian Schaper <openwrt at sebastianschaper.net>
Tested-By: Alan Luck <luckyhome2008 at gmail.com>
---

Changes from v1:
	- improve formatting, replace raw strings with individual newlines to
	  fix build on macOS using clang

This patch is based on previous work on PR #4174, migrated to OpenSSL EVP API
and extended to include support for newer devices like COVR-X1860.

The intermediate development stages are tracked at
https://github.com/s-2/firmware-utils/commits/dlink-sge-image
and the forum thread
https://forum.openwrt.org/t/add-support-for-d-link-covr-x1860/161862


 CMakeLists.txt        |   1 +
 src/dlink-sge-image.c | 510 ++++++++++++++++++++++++++++++++++++++++++
 src/dlink-sge-image.h | 344 ++++++++++++++++++++++++++++
 3 files changed, 855 insertions(+)
 create mode 100644 src/dlink-sge-image.c
 create mode 100644 src/dlink-sge-image.h

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c1750d478c..d7d4ed2a7b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -40,6 +40,7 @@ FW_UTIL(buffalo-tftp src/buffalo-lib.c "" "")
 FW_UTIL(cros-vbutil "" "" "${OPENSSL_CRYPTO_LIBRARIES}")
 FW_UTIL(dgfirmware "" "" "")
 FW_UTIL(dgn3500sum "" "" "")
+FW_UTIL(dlink-sge-image "" "" "${OPENSSL_CRYPTO_LIBRARIES}")
 FW_UTIL(dns313-header "" "" "")
 FW_UTIL(edimax_fw_header "" "" "")
 FW_UTIL(encode_crc "" "" "")
diff --git a/src/dlink-sge-image.c b/src/dlink-sge-image.c
new file mode 100644
index 0000000000..b0aefba2d8
--- /dev/null
+++ b/src/dlink-sge-image.c
@@ -0,0 +1,510 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/*
+ * Copyright (C) 2023 Sebastian Schaper <openwrt at sebastianschaper.net>
+ *
+ * This tool encrypts factory images for certain D-Link Devices
+ * manufactured by SGE / T&W, e.g. COVR-C1200, COVR-P2500, DIR-882, ...
+ *
+ * Usage:
+ *   ./dlink-sge-image DEVICE_MODEL infile outfile [-d: decrypt]
+ *
+ */
+
+#include "dlink-sge-image.h"
+
+#include <openssl/evp.h>
+#include <openssl/pem.h>
+
+#include <arpa/inet.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define BUFSIZE		4096
+
+#define HEAD_MAGIC		"SHRS"
+#define HEAD_MAGIC_LEN		4
+#define SHA512_DIGEST_LENGTH	64
+#define RSA_KEY_LENGTH_BYTES	512
+#define AES_BLOCK_SIZE		16
+#define HEADER_LEN		1756
+
+unsigned char aes_iv[AES_BLOCK_SIZE];
+
+unsigned char readbuf[BUFSIZE];
+unsigned char encbuf[BUFSIZE];
+
+unsigned int read_bytes;
+unsigned long read_total;
+unsigned int i;
+
+unsigned char vendor_key[AES_BLOCK_SIZE];
+BIO *rsa_private_bio;
+const EVP_CIPHER *aes128;
+EVP_CIPHER_CTX *aes_ctx;
+
+FILE *input_file;
+FILE *output_file;
+
+int pass_cb(char *buf, int size, int rwflag, void *u)
+{
+    char *tmp = "12345678";
+    size_t len = strlen(tmp);
+
+    if (len > size)
+        len = size;
+    memcpy(buf, tmp, len);
+    return len;
+}
+
+void image_encrypt(void)
+{
+	char buf[HEADER_LEN];
+	const EVP_MD *sha512;
+	EVP_MD_CTX *digest_before;
+	EVP_MD_CTX *digest_post;
+	EVP_MD_CTX *digest_vendor;
+	EVP_PKEY *signing_key;
+	EVP_PKEY_CTX *rsa_ctx;
+	uint32_t payload_length_before, pad_len, sizebuf;
+	unsigned char md_before[SHA512_DIGEST_LENGTH];
+	unsigned char md_post[SHA512_DIGEST_LENGTH];
+	unsigned char md_vendor[SHA512_DIGEST_LENGTH];
+	unsigned char sigret[RSA_KEY_LENGTH_BYTES];
+	size_t siglen;
+	char footer[] = {0x00, 0x00, 0x00, 0x00, 0x30};
+
+	// seek to position 1756 (begin of AES-encrypted data),
+	// write image headers later
+	memset(buf, 0, HEADER_LEN);
+	fwrite(&buf, 1, HEADER_LEN, output_file);
+	digest_before = EVP_MD_CTX_new();
+	digest_post = EVP_MD_CTX_new();
+	digest_vendor = EVP_MD_CTX_new();
+	sha512 = EVP_sha512();
+	EVP_DigestInit_ex(digest_before, sha512, NULL);
+	EVP_DigestInit_ex(digest_post, sha512, NULL);
+	EVP_DigestInit_ex(digest_vendor, sha512, NULL);
+
+	signing_key = PEM_read_bio_PrivateKey(rsa_private_bio, NULL, pass_cb, NULL);
+	rsa_ctx = EVP_PKEY_CTX_new(signing_key, NULL);
+
+	EVP_PKEY_sign_init(rsa_ctx);
+	EVP_PKEY_CTX_set_signature_md(rsa_ctx, sha512);
+
+	memcpy(&aes_iv, &salt, AES_BLOCK_SIZE);
+	aes_ctx = EVP_CIPHER_CTX_new();
+	EVP_EncryptInit_ex(aes_ctx, aes128, NULL, &vendor_key[0], aes_iv);
+	EVP_CIPHER_CTX_set_padding(aes_ctx, 0);
+	int outlen;
+
+	while ((read_bytes = fread(&readbuf, 1, BUFSIZE, input_file)) == BUFSIZE) {
+		EVP_DigestUpdate(digest_before, &readbuf[0], read_bytes);
+		read_total += read_bytes;
+
+		EVP_EncryptUpdate(aes_ctx, encbuf, &outlen, &readbuf[0], BUFSIZE);
+		fwrite(&encbuf, 1, BUFSIZE, output_file);
+
+		EVP_DigestUpdate(digest_post, &encbuf[0], BUFSIZE);
+	}
+
+	// handle last block of data (read_bytes < BUFSIZE)
+	EVP_DigestUpdate(digest_before, &readbuf[0], read_bytes);
+	read_total += read_bytes;
+
+	pad_len = AES_BLOCK_SIZE - (read_total % AES_BLOCK_SIZE);
+	if (pad_len == 0)
+		pad_len = AES_BLOCK_SIZE;
+	memset(&readbuf[read_bytes], 0, pad_len);
+
+	EVP_EncryptUpdate(aes_ctx, encbuf, &outlen, &readbuf[0], read_bytes + pad_len);
+	EVP_CIPHER_CTX_free(aes_ctx);
+	fwrite(&encbuf, 1, read_bytes + pad_len, output_file);
+
+	EVP_DigestUpdate(digest_post, &encbuf[0], read_bytes + pad_len);
+
+	fclose(input_file);
+	payload_length_before = read_total;
+	printf("\npayload_length_before: %li\n", read_total);
+
+	// copy digest state, since we need another one with vendor key appended
+	EVP_MD_CTX_copy_ex(digest_vendor, digest_before);
+
+	EVP_DigestFinal_ex(digest_before, &md_before[0], NULL);
+	EVP_MD_CTX_free(digest_before);
+
+	printf("\ndigest_before: ");
+	for (i = 0; i < SHA512_DIGEST_LENGTH; i++)
+		printf("%02x", md_before[i]);
+
+	EVP_DigestUpdate(digest_vendor, &vendor_key[0], AES_BLOCK_SIZE);
+	EVP_DigestFinal_ex(digest_vendor, &md_vendor[0], NULL);
+	EVP_MD_CTX_free(digest_vendor);
+
+	printf("\ndigest_vendor: ");
+	for (i = 0; i < SHA512_DIGEST_LENGTH; i++)
+		printf("%02x", md_vendor[i]);
+
+	EVP_DigestFinal_ex(digest_post, &md_post[0], NULL);
+	EVP_MD_CTX_free(digest_post);
+
+	printf("\ndigest_post: ");
+	for (i = 0; i < SHA512_DIGEST_LENGTH; i++)
+		printf("%02x", md_post[i]);
+
+	fwrite(&footer, 1, 5, output_file);
+
+	// go back to file header and write all the digests and signatures
+	fseek(output_file, 0, SEEK_SET);
+
+	fwrite(HEAD_MAGIC, 1, HEAD_MAGIC_LEN, output_file);
+
+	// write payload length before
+	sizebuf = htonl(payload_length_before);
+	fwrite((char *) &sizebuf, 1, 4, output_file);
+
+	// write payload length post
+	payload_length_before += pad_len;
+	sizebuf = htonl(payload_length_before);
+	fwrite((char *) &sizebuf, 1, 4, output_file);
+
+	// write salt and digests
+	fwrite(salt, 1, AES_BLOCK_SIZE, output_file);
+	fwrite(&md_vendor[0], 1, SHA512_DIGEST_LENGTH, output_file);
+	fwrite(&md_before[0], 1, SHA512_DIGEST_LENGTH, output_file);
+	fwrite(&md_post[0],   1, SHA512_DIGEST_LENGTH, output_file);
+
+	// zero-fill rsa_pub field, unused in header
+	memset(sigret, 0, RSA_KEY_LENGTH_BYTES);
+	fwrite(&sigret[0], 1, RSA_KEY_LENGTH_BYTES, output_file);
+
+	// sign md_before
+	EVP_PKEY_sign(rsa_ctx, &sigret[0], &siglen, &md_before[0], SHA512_DIGEST_LENGTH);
+	printf("\nsigned before:\n");
+	for (i = 0; i < RSA_KEY_LENGTH_BYTES; i++)
+		printf("%02x", sigret[i]);
+	fwrite(&sigret[0], 1, RSA_KEY_LENGTH_BYTES, output_file);
+
+	// sign md_post
+	EVP_PKEY_sign(rsa_ctx, &sigret[0], &siglen, &md_post[0], SHA512_DIGEST_LENGTH);
+	printf("\nsigned post:\n");
+	for (i = 0; i < RSA_KEY_LENGTH_BYTES; i++)
+		printf("%02x", sigret[i]);
+	fwrite(&sigret[0], 1, RSA_KEY_LENGTH_BYTES, output_file);
+
+	printf("\n");
+
+	fclose(output_file);
+}
+
+void image_decrypt(void)
+{
+	char magic[4];
+	uint32_t payload_length_before, payload_length_post, pad_len;
+	char salt[AES_BLOCK_SIZE];
+	char md_vendor[SHA512_DIGEST_LENGTH];
+	char md_before[SHA512_DIGEST_LENGTH];
+	char md_post[SHA512_DIGEST_LENGTH];
+	EVP_PKEY *signing_key;
+	EVP_PKEY_CTX *rsa_ctx;
+	unsigned char rsa_sign_before[RSA_KEY_LENGTH_BYTES];
+	unsigned char rsa_sign_post[RSA_KEY_LENGTH_BYTES];
+	unsigned char md_post_actual[SHA512_DIGEST_LENGTH];
+	unsigned char md_before_actual[SHA512_DIGEST_LENGTH];
+	unsigned char md_vendor_actual[SHA512_DIGEST_LENGTH];
+	const EVP_MD *sha512;
+	EVP_MD_CTX *digest_before;
+	EVP_MD_CTX *digest_post;
+	EVP_MD_CTX *digest_vendor;
+
+	printf("\ndecrypt mode\n");
+
+	if (fread(&magic, 1, HEAD_MAGIC_LEN, input_file) == 0)
+		goto error_read;
+	if (strncmp(magic, HEAD_MAGIC, HEAD_MAGIC_LEN) != 0) {
+		fprintf(stderr, "Input File header magic does not match '%s'.\n"
+			"Maybe this file is not encrypted?\n", HEAD_MAGIC);
+		goto error;
+	}
+
+	if (fread((char *) &payload_length_before, 1, 4, input_file) == 0)
+		goto error_read;
+	if (fread((char *) &payload_length_post, 1, 4, input_file) == 0)
+		goto error_read;
+	payload_length_before = ntohl(payload_length_before);
+	payload_length_post   = ntohl(payload_length_post);
+
+	if (fread(salt, 1, AES_BLOCK_SIZE, input_file) == 0)
+		goto error_read;
+	if (fread(md_vendor, 1, SHA512_DIGEST_LENGTH, input_file) == 0)
+		goto error_read;
+	if (fread(md_before, 1, SHA512_DIGEST_LENGTH, input_file) == 0)
+		goto error_read;
+	if (fread(md_post, 1, SHA512_DIGEST_LENGTH, input_file) == 0)
+		goto error_read;
+
+	// skip rsa_pub
+	if (fread(readbuf, 1, RSA_KEY_LENGTH_BYTES, input_file) == 0)
+		goto error_read;
+
+	if (fread(rsa_sign_before, 1, RSA_KEY_LENGTH_BYTES, input_file) == 0)
+		goto error_read;
+	if (fread(rsa_sign_post, 1, RSA_KEY_LENGTH_BYTES, input_file) == 0)
+		goto error_read;
+
+	// file should be at position HEADER_LEN now, start AES decryption
+	digest_before = EVP_MD_CTX_new();
+	digest_post = EVP_MD_CTX_new();
+	digest_vendor = EVP_MD_CTX_new();
+	sha512 = EVP_sha512();
+	EVP_DigestInit_ex(digest_before, sha512, NULL);
+	EVP_DigestInit_ex(digest_post, sha512, NULL);
+	EVP_DigestInit_ex(digest_vendor, sha512, NULL);
+
+	memcpy(&aes_iv, &salt, AES_BLOCK_SIZE);
+	aes_ctx = EVP_CIPHER_CTX_new();
+	EVP_DecryptInit_ex(aes_ctx, aes128, NULL, &vendor_key[0], aes_iv);
+	EVP_CIPHER_CTX_set_padding(aes_ctx, 0);
+	int outlen;
+	pad_len = payload_length_post - payload_length_before;
+
+	while (read_total < payload_length_post) {
+		if (read_total + BUFSIZE <= payload_length_post)
+			read_bytes = fread(&readbuf, 1, BUFSIZE, input_file);
+		else
+			read_bytes = fread(&readbuf, 1, payload_length_post - read_total, \
+				input_file);
+
+		read_total += read_bytes;
+
+		EVP_DigestUpdate(digest_post, &readbuf[0], read_bytes);
+
+		EVP_DecryptUpdate(aes_ctx, encbuf, &outlen, &readbuf[0], read_bytes);
+
+		// only update digest_before until payload_length_before,
+		// do not hash decrypted padding
+		if (read_total > payload_length_before) {
+			// only calc hash for data before padding
+			EVP_DigestUpdate(digest_before, &encbuf[0], read_bytes - pad_len);
+			fwrite(&encbuf[0], 1, read_bytes - pad_len, output_file);
+
+			// copy digest state, since we need another one with vendor key appended
+			EVP_MD_CTX_copy_ex(digest_vendor, digest_before);
+
+			// append vendor_key
+			EVP_DigestUpdate(digest_vendor, &vendor_key[0], AES_BLOCK_SIZE);
+		} else {
+			// calc hash for all of read_bytes
+			EVP_DigestUpdate(digest_before, &encbuf[0], read_bytes);
+			fwrite(&encbuf[0], 1, read_bytes, output_file);
+		}
+	}
+
+	fclose(input_file);
+	fclose(output_file);
+	EVP_CIPHER_CTX_free(aes_ctx);
+
+	EVP_DigestFinal_ex(digest_post, &md_post_actual[0], NULL);
+	EVP_MD_CTX_free(digest_post);
+
+	printf("\ndigest_post: ");
+	for (i = 0; i < SHA512_DIGEST_LENGTH; i++)
+		printf("%02x", md_post_actual[i]);
+
+	if (strncmp(md_post, (char *) md_post_actual, SHA512_DIGEST_LENGTH) != 0) {
+		fprintf(stderr, "SHA512 post does not match file contents.\n");
+		goto error;
+	}
+
+	EVP_DigestFinal_ex(digest_before, &md_before_actual[0], NULL);
+	EVP_MD_CTX_free(digest_before);
+
+	printf("\ndigest_before: ");
+	for (i = 0; i < SHA512_DIGEST_LENGTH; i++)
+		printf("%02x", md_before_actual[i]);
+
+	if (strncmp(md_before, (char *) md_before_actual, SHA512_DIGEST_LENGTH) != 0) {
+		fprintf(stderr, "SHA512 before does not match decrypted payload.\n");
+		goto error;
+	}
+
+	EVP_DigestFinal_ex(digest_vendor, &md_vendor_actual[0], NULL);
+	EVP_MD_CTX_free(digest_vendor);
+
+	printf("\ndigest_vendor: ");
+	for (i = 0; i < SHA512_DIGEST_LENGTH; i++)
+		printf("%02x", md_vendor_actual[i]);
+
+	if (strncmp(md_vendor, (char *) md_vendor_actual, SHA512_DIGEST_LENGTH) != 0) {
+		fprintf(stderr, "SHA512 vendor does not match decrypted payload padded" \
+			" with vendor key.\n");
+		goto error;
+	}
+
+	signing_key = PEM_read_bio_PrivateKey(rsa_private_bio, NULL, pass_cb, NULL);
+	rsa_ctx = EVP_PKEY_CTX_new(signing_key, NULL);
+	EVP_PKEY_verify_init(rsa_ctx);
+	EVP_PKEY_CTX_set_signature_md(rsa_ctx, sha512);
+
+	if (EVP_PKEY_verify(rsa_ctx, &rsa_sign_before[0], RSA_KEY_LENGTH_BYTES, \
+		&md_before_actual[0], SHA512_DIGEST_LENGTH)) {
+		printf("\nsignature before verification success");
+	} else {
+		fprintf(stderr, "Signature before verification failed.\nThe decrypted" \
+			" image file may however be flashable via bootloader recovery.\n");
+	}
+
+	if (EVP_PKEY_verify(rsa_ctx, &rsa_sign_post[0], RSA_KEY_LENGTH_BYTES, \
+		&md_post_actual[0], SHA512_DIGEST_LENGTH)) {
+		printf("\nsignature post verification success");
+	} else {
+		fprintf(stderr, "Signature post verification failed.\nThe decrypted" \
+			" image file may however be flashable via bootloader recovery.\n");
+	}
+
+	printf("\n");
+
+	return;
+
+error_read:
+	fprintf(stderr, "Error reading header fields from input file.\n");
+error:
+	fclose(input_file);
+	fclose(output_file);
+	exit(1);
+}
+
+/*
+  generate legacy vendor key for COVR-C1200, COVR-P2500, DIR-882, DIR-2660, ...
+  decrypt ciphertext key2 using aes128 with key1 and iv, write result to *vkey
+*/
+void generate_vendorkey_legacy(unsigned char *vkey)
+{
+	int outlen;
+	memcpy(&aes_iv, &iv, AES_BLOCK_SIZE);
+	aes_ctx = EVP_CIPHER_CTX_new();
+	EVP_DecryptInit_ex(aes_ctx, aes128, NULL, &key1[0], &aes_iv[0]);
+	EVP_CIPHER_CTX_set_padding(aes_ctx, 0);
+	EVP_DecryptUpdate(aes_ctx, vkey, &outlen, &key2[0], AES_BLOCK_SIZE);
+	EVP_CIPHER_CTX_free(aes_ctx);
+}
+
+/*
+  helper function for generate_vendorkey_dimgkey()
+  deinterleave input in chunks of 8 bytes according to pattern,
+  last block shorter than 8 bytes is appended in reverse order
+*/
+void deinterleave(unsigned char *enk, size_t len, unsigned char *vkey)
+{
+	unsigned char i, pattern = 0;
+
+	while (len >= INTERLEAVE_BLOCK_SIZE)
+	{
+		for (i = 0; i < INTERLEAVE_BLOCK_SIZE; i++)
+			*(vkey + i) = *(enk + interleaving_pattern[pattern][i]);
+
+		vkey += INTERLEAVE_BLOCK_SIZE;
+		enk += INTERLEAVE_BLOCK_SIZE;
+		len -= INTERLEAVE_BLOCK_SIZE;
+
+		if (pattern++ >= INTERLEAVE_BLOCK_SIZE)
+			pattern = 0;
+	}
+
+	for (i = 0; i < len; i++)
+		*(vkey + i) = *(enk + (len - i - 1));
+}
+
+/*
+  generate vendor key for COVR-X1860, DIR-X3260, ...
+  base64 decode enk, pass to deinterleave, result will be in *vkey
+*/
+void generate_vendorkey_dimgkey(const unsigned char *enk, size_t len, unsigned char *vkey)
+{
+	unsigned char *decode_buf = malloc(3 * (len / 4));
+	int outlen;
+	EVP_ENCODE_CTX *base64_ctx = EVP_ENCODE_CTX_new();
+	EVP_DecodeInit(base64_ctx);
+	EVP_DecodeUpdate(base64_ctx, decode_buf, &outlen, enk, len);
+	EVP_DecodeFinal(base64_ctx, decode_buf + outlen, &outlen);
+	EVP_ENCODE_CTX_free(base64_ctx);
+
+	// limit deinterleaving output to first 16 bytes
+	deinterleave(decode_buf, AES_BLOCK_SIZE, vkey);
+}
+
+int main(int argc, char **argv)
+{
+	if (argc < 3 || argc > 5) {
+		fprintf(stderr, "Usage:\n"
+			"\tdlink-sge-image DEVICE_MODEL infile outfile [-d: decrypt]\n\n"
+			"DEVICE_MODEL can be any of:\n"
+			"\tCOVR-C1200\n"
+			"\tCOVR-P2500\n"
+			"\tCOVR-X1860\n"
+			"\tDIR-853\n"
+			"\tDIR-867\n"
+			"\tDIR-878\n"
+			"\tDIR-882\n"
+			"\tDIR-1935\n"
+			"\tDIR-2150\n"
+			"\tDIR-X3260\n\n"
+			"Any other value will default to COVR-C1200/P2500/DIR-8xx keys\n"
+			"which may work to decrypt images for several further devices,\n"
+			"however there are currently no private keys known that would\n"
+			"allow for signing images to be used for flashing those devices.\n\n"
+			);
+		exit(1);
+	}
+
+	input_file = fopen(argv[2], "rb");
+	if (input_file == NULL) {
+		fprintf(stderr, "Input File %s could not be opened.\n", argv[2]);
+		exit(1);
+	}
+
+	output_file = fopen(argv[3], "wb");
+	if (input_file == NULL) {
+		fprintf(stderr, "Output File %s could not be opened.\n", argv[3]);
+		fclose(input_file);
+		exit(1);
+	}
+
+	aes128 = EVP_aes_128_cbc();
+
+	if (strncmp(argv[1], "COVR-X1860", 10) == 0)
+	{
+		generate_vendorkey_dimgkey(enk_covrx1860, sizeof(enk_covrx1860), &vendor_key[0]);
+		rsa_private_bio = BIO_new_mem_buf(key_covrx1860_pem, -1);
+	}
+	else if (strncmp(argv[1], "DIR-X3260", 9) == 0)
+	{
+		generate_vendorkey_dimgkey(enk_dirx3260, sizeof(enk_dirx3260), &vendor_key[0]);
+		rsa_private_bio = BIO_new_mem_buf(key_dirx3260_pem, -1);
+	}
+	else if (strncmp(argv[1], "DIR-1260", 8) == 0)
+	{
+		generate_vendorkey_legacy(&vendor_key[0]);
+		rsa_private_bio = BIO_new_mem_buf(key_dir1260_pem, -1);
+	}
+	else if (strncmp(argv[1], "DIR-2150", 8) == 0)
+	{
+		generate_vendorkey_legacy(&vendor_key[0]);
+		rsa_private_bio = BIO_new_mem_buf(key_dir2150_pem, -1);
+	}
+	else
+	{
+		/* COVR-C1200, COVR-P2500, DIR-853, DIR-867, DIR-878, DIR-882, DIR-1935 */
+		generate_vendorkey_legacy(&vendor_key[0]);
+		rsa_private_bio = BIO_new_mem_buf(key_legacy_pem, -1);
+	}
+
+	printf("\nvendor_key: ");
+	for (i = 0; i < AES_BLOCK_SIZE; i++)
+		printf("%02x", vendor_key[i]);
+
+	if (argc == 5 && strncmp(argv[4], "-d", 2) == 0)
+		image_decrypt();
+	else
+		image_encrypt();
+}
diff --git a/src/dlink-sge-image.h b/src/dlink-sge-image.h
new file mode 100644
index 0000000000..9998b7e8a1
--- /dev/null
+++ b/src/dlink-sge-image.h
@@ -0,0 +1,344 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+const unsigned char key1[] =
+	"\x35\x87\x90\x03\x45\x19\xf8\xc8\x23\x5d\xb6\x49\x28\x39\xa7\x3f";
+
+const unsigned char key2[] =
+	"\xc8\xd3\x2f\x40\x9c\xac\xb3\x47\xc8\xd2\x6f\xdc\xb9\x09\x0b\x3c";
+
+const unsigned char iv[] =
+	"\x98\xc9\xd8\xf0\x13\x3d\x06\x95\xe2\xa7\x09\xc8\xb6\x96\x82\xd4";
+
+const unsigned char salt[] =
+	"\x67\xc6\x69\x73\x51\xff\x4a\xec\x29\xcd\xba\xab\xf2\xfb\xe3\x46";
+
+/*
+  enk.txt as found in GPL tarball:
+  COVR-X1860_GPL_Release/MTK7621_AX1800_BASE/vendors/COVR-X1860/imgkey/enk.txt
+*/
+const unsigned char enk_covrx1860[] =
+	"NE1oIS1lKzkkIzZkbX49KTMsMWFkJXEybjheJiN6KjIwNjgx";
+
+/*
+  enk.txt as found in GPL tarball:
+  DIR-X3260_GPL_Release/MTK7621_AX1800_BASE/vendors/DIR-X3260/imgkey/enk.txt
+*/
+const unsigned char enk_dirx3260[] =
+	"NF5yKy10JTl+bSkhNj1kTTIkI3FhIyUsJDU0czMyZmR6Jl4jMzI4KjA2Mg==";
+
+#define INTERLEAVE_BLOCK_SIZE	8
+const unsigned char interleaving_pattern[INTERLEAVE_BLOCK_SIZE][INTERLEAVE_BLOCK_SIZE] = {
+	{2, 5, 7, 4, 0, 6, 1, 3},
+	{7, 3, 2, 6, 4, 5, 1, 0},
+	{5, 1, 6, 7, 3, 0, 4, 2},
+	{0, 3, 7, 6, 5, 4, 2, 1},
+	{1, 5, 7, 0, 3, 2, 6, 4},
+	{3, 6, 2, 5, 4, 7, 1, 0},
+	{6, 0, 5, 1, 3, 4, 2, 7},
+	{4, 6, 7, 3, 2, 0, 1, 5}
+};
+
+/*
+  key.pem as found in GPL tarball, e.g.:
+  COVRP2500A1_FW101/COVRP2500_GPL_Release/package/tw-prog.priv/imgcrypt/key.pem
+  encrypted with passphrase: "12345678"
+*/
+const unsigned char key_legacy_pem[] = "\n\
+-----BEGIN RSA PRIVATE KEY-----\n\
+Proc-Type: 4,ENCRYPTED\n\
+DEK-Info: AES-256-CBC,EAA1FD02CDBC7AA7E62AC821D47823F2\n\
+\n\
+1LiXFElARVvVJnikiVqZxC5FS7silmaqZ1yBOfzWuYNLaiEuvoUOylwiT0JYna94\n\
+nevCGjdU27GOUBsLnhGVulVuD8aiZCGBaZES5BAFtOEz0rrmpJLHxD3txLBh49rM\n\
+zLfn77/bMfubuhUFw+TPQ9J6SlrwK12IaMBTBTCFf06h+dkY500A0GAESgSA4Cab\n\
+retvT5/xtnl5jtT7zBYPbDGPDZ0fFoDSa7IqkqJ+chGz4w02UezAuKPPlNTTxD4l\n\
+aJkBUm/rmnasY5fctkRVLsRXUD3/SlrmABbykROjaY1e+iHQAb8+111cGJBj7KHE\n\
+MasReOMz6/awJe3NhU1SaHfTYGnf/JbHXQ1l07pxqT0sgTU+gEr447yzoZOroV+7\n\
+pX3BfLoe2ZawfOEiAu+TRJmVgbNa5IpO2c9ID2ZFI0iqIiv0PYzoM8RSIX3H4tqP\n\
+UUimdySOBNiBFjj4bsLSo2EmLNdNsCHRVh9rTjTs07iB9QBPeHGFaMnhTDjYJZBj\n\
+gO/U4dOoQpYq5P8WZHecZ7OafSS+tYr5IdbMnpkJwWImlDyGOE1559XB5MRUqFOv\n\
+Csl+eFh2Br8Ks34AA5nJPLHMnN56oAkRQhjj2LC/oK75dElSWNVnlciIceR0vY7j\n\
+pLzPKdLc5UZ+y/fy2EEC6Jwowi4DIDxEx+HCse9lNmVoBN+dtEX4rBAaBewz8ha5\n\
+lOV72k4IWLgvlmmJG6kespPFWd0h+ZzTKdM0i6Rl0Imms9f/Pp1H2A6k+mpD2PkJ\n\
+ZZi711x5UIQSn8wmSgFa4pwVuUuGozg7T64F0K63EeEFMPGQ53r6fKKFt9/cm/Bo\n\
+7bh6wqEqTgRm+/w05MIAo7ksoCCSJ/qPS5jB0VZDy2SJYF/fVAJKCIRZt6RJ/2no\n\
+rzADS0dQG45By5Gfbg+dHnd31jrtd1SEmL8l7R9L2nIi0z5ard3carc3EtKDfny+\n\
+fSOnOGBUPxDiOqoB8ksGXZTasz9BjF/Vt6/KwIbVhM0T0yurUexf6n30tWwVDqpl\n\
+YBW25mgzxjECyNNm7vUAPkzjFgJ2gqvKosF9EALV0p1p3hcC366R5n/0EMJu4OBN\n\
+QM3RmHu4CV7DwuS+2NxKLsFtUCxsWZVw/dd/eG51wEAsQvnuNNwbsW0KezDmEzTo\n\
+WeigJQAHI0MD6kjD9qHcFw+gvcfK1S89kru/edq3E4k9jhxR7jyM1IolInJuwKFM\n\
+Dw7RN42o7O4BIO3uur4ghUoyfJMBlOidULw7Jqq8YcLjWMMSWtEjd6f/m0j7e0B4\n\
+4N40YA3Yzkog1n1/wk69/O6Xdzw7mpAH61JF2VKzAGSjF9VpSg96yC9UE4jgi42C\n\
+Em7QiA10eVtPkIN/qr06xntPmG0d8yZAtsmOL1vaJEgKF3yY2lOIoGMJCSQBqaR9\n\
+xn5TISP4bPUucSZchaukwlm7Q6fJ90utaB5FkjbfjA8EtcMfAqEagXX8nBtSioTf\n\
+miSK1aHRexWgbRZnxsEf9oUHfGjhEd1+EyM7+F1eJUPWxyCGE6H+H+5W55xJL7wA\n\
+vWa38s1yGtibPLef4rVyXtN9aQTkRa++SB59tw0xu7nDEV49oqFDStJr2ByIvdI1\n\
+f0nimeY5EAesvtNUrKdaFWo6PCgnB7XwxG9KumKW4Xr0QFAJWTS31M97M9JnhTV0\n\
+BpZj9XQ90NMQOpHIZaEsWbmbcVAPzkeKWGTNLq5/2jInE7+4Dis6TH7t5ulhyDLJ\n\
+YO49IR814qQBWv4XLODUKK0+5ZHpx63loSFEcMfxUTQMyEdEi6pjdwxTE3a1RrGj\n\
+ZOmgOh7owRapfo3Z39K+GZAaJrFynm1TJllqyaSRX6KUDz3q0FxeTtUtc/hzJ9Ms\n\
+jQ1Xf0R1IPX8SYIHVB5ZX/mrnuXPXlEGw/WZ3eUzPaolRKpFPDxyUll8iZLpOOVK\n\
+wUrN55A1TYO0Qs6oSoQUeS0nshfFHVoeLw6tHvoVXx7LOwA6PfNgrx3yOWPjqp3X\n\
+DViPmcmaw5h50WU34w8YyTm94jamn5zjeVXo3TPDmSxsSovkpiGpHciheK5XmGkp\n\
+DN5i9t/cOvZv7E9h7mXGKZW0opkAcg/mAWelqCKF6yCrX0YbEJLiTn+axGX803+t\n\
+HFTMQaU4ZJ4oer9JrODiXhSqWZU1nVtLvyITELBRU3PdTEAR/5jDgHPg780osG8P\n\
+FqOcNti31PL0+mjbzGybPe52NnEsInCwi6yUtq98ROWgjzi4ogW0f8CPu4szlQ88\n\
+b7QbrPK53ufEutPISdhny0kKTddJIMqRzWOXrN1KkQq4NEICvnXqo94ewxF1BszZ\n\
+8G3qNkxHTP8L3UPBnop6gmm82BbIYNrRLItqvtuPqmOCK5qRr79SvyGPDXnCe3pF\n\
+7yFd1HsdYjLbitPex2g2Iw2+xUhQTOhapTqF2AuZpXCVunrqG6w/zJ2OTIuQVU+W\n\
+Yfaude7su1ghaA+RHY3DXuqJMdYXC8l6beEL35A0LV/LPiTOId5qCIbQb3TdU+kQ\n\
+igC1HWaZ9XelSbsbymor/WmBAcG/u1Txy5s2cwfXAUodgXb2LSSjlKO++oOAQcAQ\n\
+eWd9AOwNXnwcXELuSYYIZQBBGbOx6cmqxYGxNAb4K61n8JxODdO83+Ar0UJHnOtZ\n\
+9gBcE6TifBE07TibkHwQRR4y7+J8dleHSXgXM+iwMsnOfjcC3jcjDI63E3LV5fm1\n\
+ZTvnQYg0B20EXRL3Z65C7lQDkS/iJj/ctDgEEtn5pj12fOXjcEjHRdj1mbpz3MVq\n\
+sS+2wp2gL8jyNjtN/06hVVw6qMoPt5+qKPdvBw7VZ/DCw+gQOcZVjX4BcTEWOR1/\n\
+tTgNnJg9lB3jLmh7MAyTg3PDe+ev7yaYNVCLsmFqHgFeNvbrC3rKbouQ3MT0Hz1f\n\
+F+NR0CrEF2DH1f6Cp9mYh7IrEYTQnPXCtLzOiJKfglFdpok/37v0nG+VkcN9ANhr\n\
+AqoP6KzblcsBSHUD/7SHG6VWCeZhGd/o51+tTh+zCvG9cXG5CKTZV3nILMhFrR6t\n\
+NbsS6ke3VyLqcrvcNk4zr1mJ+J+G1HWhTkSSZgX3AwHoG9xJVZ7BA7ZAkaGwBsIt\n\
+o1UhI6IofI/cZt4iCM9WmKMLM2cSKmW+5AxWyYQbOA0jU/899mEiLPepxygh7IZC\n\
+-----END RSA PRIVATE KEY-----";
+
+/*
+  key.pem as found in GPL tarball:
+  DIR1260_GPL_Release/vendors/DIR-1260/imgkey/key.pem
+  encrypted with passphrase: "12345678"
+*/
+const unsigned char key_dir1260_pem[] = "\n\
+-----BEGIN RSA PRIVATE KEY-----\n\
+Proc-Type: 4,ENCRYPTED\n\
+DEK-Info: AES-256-CBC,FFC890207BA9F13F6CE13F8EF7E69802\n\
+\n\
+3Vxyl4EsdEt6PeY4ThlWieYksjTMMHJnXdK3HKlDRuH5g2sup8t+gCDvMRmC4nYv\n\
+BfbsWPYwUTIvMTot/EBsp73QMKA6SLBdO6ckmuj1L+dwx7w7m1yM/Kvi2W+Wq2YY\n\
+zXHalrv65ZWZE4s1MHrWVs+gYx03FBbfOLBB9MLL+YLauLr+ul+2QErfTzEDBTlg\n\
+6lQlhzmgYg/Lw7jT1K+llhVlTaQzM898+s78GZPLelGrtu1BkU0Lynwb1mhbWVIn\n\
+xe8Pyo0w+FqmJLMpPtW1krMy8p0lt5ASgsDgV0OEQCuWONpbzwaPtBRFFJV4x46d\n\
+IHLVf8TQ8bRgjxphKLqvEonEgXOWORybeIxJHptpLbhD+l5vcNKm4KxfZ4w04btl\n\
+0Rm5vENnu+0L3P9FkUMvccfl04x1ufvFqXbFibpfBJjMxgxLpS3Tpc4aGaV9llD+\n\
+wpW/Jt1Kndjsajw8oKi+vQq8Ag33KCauCmEHyMneNPYhOML3U3eNj+4rtKV/GDHb\n\
+NF/xVWrXCIfZxU7WZrxK3PvKwWbkKd9AVhFC44Cq+4JsCIWjXVncJt/OCct6ZxkM\n\
+RC6sN8zc/Eob40B8h68aePeqkYzXC/2DQEopSrJZe2huIRT1ZZEO6UI+lRxzQBxa\n\
+OwHjsw4orI5cTkkmJiClSLnTNkKXKFcvGcOQlU7mJzAoDjvQE4mqI5zlwKI/pp6G\n\
+Iehns0l4tew8McCGE4Rc4v7SE6XWXuHfGZi5MVuRriBjZWRyCBFhbo6GLsjc7ODo\n\
+pM5rJSQtPeVzogfyvo1Of5azATekzvNfqBWdh+f1AYhV7+o5XNzaNQaPO4pt4iC3\n\
+v2T7muWoM8HxDLZ8MMMqWdQ3l/cD+ecEwI/1d32DwCCFOkDPyqkjB72pGSGNm6aH\n\
+/beHMW1YrUn+TscoZBJ/JdWKPRK2SZfP/Eiy7Ka2iNw9lUQtEbpGbsLtCO0pDJTt\n\
+qjplWFr0t3perFxl2fG3ctX0fm4fA35NPznD9CVLmzm1lgEZK5y45YVLKL27yn3t\n\
+owbfHGHDub0CFKNRdAutyf7M/+IJKA/v4jm6wfm92Bs0bkVIE6/NwKTBFYbI1hAs\n\
+tQBX1rD5zALsT9MZL7Im59t1kv8J4sBPB1i0qUByobN5PRy7rXZR/1ZptgJBIBSs\n\
+wXjdEhPwiwdyrVkcqMRmD0NlXNtYR8LYRP292VzmCeBhtPTpFIWyZEYj3othafL0\n\
+H29NMb2evN66ru6DQnDv+UCx+OqDGUR2rHgJPxWuIhfiUEqKwrvbn9oEUzxuxhef\n\
+TDaKQ0H38NzM4nrvGVun62peU3wztM+R24T0dVqJFT8hZb6AXG/Pn2uOk7wJrXhi\n\
+wD18Uj86troYMcPzs8JbsXyHHtqy6xz1+f76vs+UwhcHbmu8FMRd1G7inVkXbMjq\n\
+ROIxudJ5SvBR6qjpULiFifrbuJRI7faeb0smxhFKQDLY5WID1sT5TdaA5rYwYdkd\n\
+aJVK/MuE7ybMsp4DhUXviV/52MyehPwwzkWT/5S8Qo5ME/nY+kFKpPr6geJ7kL2A\n\
+YyBXT9aVId8AygH54vvLGAAXF7roYzBNm3nL5dM/3g85rMzNblSfz6h0hG7Gs2hT\n\
+LF6qWlGtbXEUr8F4f+Dzrs7Na5oyGqCoWkwdRNuIIRbxrT+74UdY8KHp1LmPm1Yc\n\
+8VdSEjhVBCTLuhcKqRB1sVLazVn9po921hJlzNlmuWeyyT7Ac9Q2BdOBlPTuhYbE\n\
+C1vZ/E/MVAVrBo+Wwn9rWIH09rMa3Q8v5KNvTg3sqkaG72nLAqm+pgNzPQnjUbam\n\
+bzrznitdEN6opASEHswW0sMTrE5pqXA3qzYpMllQ2aJyZS3+1I6naj6xoo9hPpVn\n\
+nBdiASkWjfxkQ5p7fZMNe4qutI+UI4Tsc9jdLpXx/K38h7EO5EwtitOYolyRvNYE\n\
+MCtU7nOYwBLFOvI5KYNuful8X/iAFtqJKPV+QyJVO3fgxsbBP+Zh0CLXcJZCrOwd\n\
++VYWcD86piWfCSgf3oj9JKunhtCp+TI+OuOaWVIFiV/FPCYtHxsqJJ0UfSXv8efl\n\
+eKlSy7tvppCvOuUNvz1b1uGUbOzxJGKQsAvCNCVgQ0NzgEkV6loQJNj9v/6q1MpO\n\
+SF7QCjPq6MQcMY6xKWZ+p/+AuoJ+qb8rtxllHveG4JsfL45xd846Q7Jg8eq7xJMt\n\
+nuRREs2BrdCTmUFgdxZhLMnwPpDQTcM/eua01TIiF4gIqwXiYeu0NxI1v3xMJM/4\n\
+zsblU+SDbRhZV6i3+EK9Y6+OomIiBdxsB5wAhwawxNwN9jOETzENrjqDUtqri3Bq\n\
+GV2VJ28JtlTlv++f8kg1/wB+Rwl7WYzOqhJtW94ATPjylC7pPETdRgZkGI/U90Zp\n\
+694kynQ/iHfxD+gN3AHVFUVUJ6hW3OUpE1bRwaGBNza+stVejbi/5ksWlK4PYJDH\n\
+Yd6JhIdwa8wgnS4oOGVOXgZ811YiQCURNmy9NAXGko1ZESFKGOQFPNdCCw1MZN1+\n\
+PtM2hu/J0cTXnB4zWvaUZt60ztFCWYShCO7yj4Fp6o13jhAsM3D5RekxL6t3ne3Z\n\
+veNaHuZY8my0XCYab6d+b98xKm/QTYzcYS0T7uFapR+SJ0taHMbPo1/8+jhua9re\n\
+aHl/JRd1pUUjVB/kfAvjZiJ+9bonEB5TrBlnrsKOlCfdMRrgrnKzSe+lFuaTh8S1\n\
+W24QLwAWxfzw9O6Xts56mSS4ASXN5aenuIAZbUbgOkTUcWUHVlUAKJlj01juEKhB\n\
+CnED9aSowsrUnoTOv4eZot0/R88xSqtlctOic864fF1G6mZlNgxD4IF+YSmjaoFD\n\
+2jrUKLmlMv2axvyUcOE8fGCm3vQGJHO6VhWLO/xq2+IkmpnHAOQrcf/drFtmOH/b\n\
+Mb6txrJoCRlibG6uRkCuW0Ejfwab8MYmbYrNhCheDpgxxXw1sAIY8A/Z4FfHA89v\n\
+eW9ZFvxIBt+VjZqLQ868jaO+RKrK9RFH0923T93WFV+ux+j6D8wmWmK+SiuUXXjB\n\
+rLk5qQ8CTo02Ioud0qilIpXM4eNb4r0ADKUppFBxcmilM90mhglhRKdkXx/6/FoK\n\
+MYmUNsedz/6n5GDfx3g1XuyD2lVslhEQMPs7WZmia6fh8M0dyuC5OAbys7UVo03V\n\
+-----END RSA PRIVATE KEY-----";
+
+/*
+  key.pem as found in GPL tarball:
+  DIR2150_GPL_Release/vendors/DIR-2150/imgkey/key.pem
+  encrypted with passphrase: "12345678"
+*/
+const unsigned char key_dir2150_pem[] = "\n\
+-----BEGIN RSA PRIVATE KEY-----\n\
+Proc-Type: 4,ENCRYPTED\n\
+DEK-Info: AES-256-CBC,314D3C7FB69E7DDEAF084A0A7CA39069\n\
+\n\
+WJOwksI67gf6vSxxUYkVFe3enSRpmRZaLGjVZZCTKtAseydx0EcIfX1G+SBcxdD7\n\
+YNakD1qyfJLxGL/9pwEaFdCWcjuiOQiAorpbIdRZMq+N8RI5w9ho0/qVmowW+prE\n\
+r/5dWlCGR3JidJI03eJRQcMjdTkqOjbnFGwwVq6u3cLl/MdO9cegDQ/qWNAEo7df\n\
+0Djj09WMVXpDjkqAXjwTWDX3wBRB9HzPEGP07WoTRWqoCfO+qUmjA/Euwtzc/Mcq\n\
+1AGzT6zjHXAJ8Yr9i9opaXvRgteawvARf7qJ3KctfjoB+OXRQCPj7MvsMnB/sCwN\n\
+xXDtfWpXvLnrbtnbpUNh+max3cOy9f9eyVkJ1TfDc4qH/t75dp/umNmVbVMXX04d\n\
+VThbP7WXE/2LP67Bmxwi7B+6QRrWyVzwmuV+UlbyAS7BXnyPgxe8+jXEXZPiN6if\n\
+SR4f4dquR6ZlGEQ9ZaN0Pfd0ZgNEf09Te5v5ENCPdW521hm2nIa4EFWAynOMo7R8\n\
+I4hSmbdPh58uq6+Eb+GxzMaXmODOvGMnfrS9Aud4FONftEVbHgtn8frsSeUt/+TA\n\
+dsRPplYc5IVOij6dnALCiKh8ZP4E91xSTdnqptLpPBBws71+xCSxLbaJg5+1OtRU\n\
+ILMpq9solGFlzzsR2uBp1UsEPGbGwoprjBHX+lkdUehv4DPXm5onIxYsJujNddRA\n\
+mJ8znFtltX7p+vLKXymjgDGXawkCSLyu6t71aux/dNewjLLSQOjJN15InDvYo32I\n\
+w2kXK3p14R/xLHNQK9IpaKK+l/Xa0Rjgb3oqlEJqXAYl3EFwpI02tPhrQedTBybh\n\
+ufj1gC39apiCYtFSux6z/XsJi6BuGX7A8fZbCUFPbDY2q5gsmy665SzxrK2NcHrP\n\
+of1wCGDCpOt80gwKFQwVxo3czHlYjDu/UTefgUDmDh6tVYwo5e+UtgRy1wW3+AEo\n\
+UA2l4adwn5o+ciBlwa6pNI18Y+hjYE/R2puWsDZTt8E/0aj/l84tRt2HQ9SdPi0C\n\
+HKhkVgp+bhWo1SYZTwBkFX0WX/kb6Dw9mj9eY5fFFxGIZzSlTshfVQJzxe61RtO6\n\
+VwzsIOnHc4tCGYmUQo3JAo1t/0EfIEt9H7kadqXZl27C1TZP6Xl8tQ9fDxOp97aw\n\
+saw/B2/DkT+qLvTAPQ5lHUaWMQR+RKPVZSjyqmo7K/xymt2/6KjaRzNfcWulkiv7\n\
+L8oNUsYMJTLIKRoUJ7olTa2X7PxPW0bcBaZE9/Qax7iMS6HnPLB9pJQ09xUJUdDg\n\
+B+jkmtyEthYVCiJfm1FFdM3cub23L5g23ijPpAhzSaMy4AVgvX8rIiEa3u7OKFQf\n\
+RiDOLgp9odYK8lNW5HY4gyB4Z4Sg00VVmVNcpz4j8m/ivS97iyNvDGX6QXPzUcUE\n\
+gIsjjW+9l+/XGqTSUY+zzNgj8EHjH8l3IjXjNwVx/uFPajsZI7u8nYJ0HEhnTzlI\n\
+jdtNgmWtElPshelnS660pflplqHHk1BC2XHG10m2Nmq/AwGuDTdF/LC+tmM3uCqE\n\
+KfPMZa2nOcMs0jonEUEAGfhHlbVv4d4Y3JYip1U4tXobtH1xfgXR5VJt/gX76myz\n\
+0kahRvOE6D/8nmrpEE+3f/hyQGfGNqCiP/pdVC8st7k7LFmWCO32e81rYSksq6uK\n\
+2jt7tcIf7PVpK4ynticK/8BT2cws5JB/R/SMfezSC3KpyJBoeOYan+8wX8TOhz7J\n\
+F/ZG8DdCnpAb45RY3ET5PdWYXQ40k4Wylx47QGDQNJpf7jwc2E0dOTmCGAIG7LPg\n\
+qcAKdWI/PI4QJKo7eljTQBKV2ppCa78jBkaIJ5JRZuxzG8T1pcToPk38tDkjzStG\n\
+QftO8ZvsHHEVsv+eUZO7SJTxXzBs2Vh1LwyVsTd5qvfZuZzdf+lZ/EjUOP5zbwjD\n\
+R+yB0Nuo0SupiLPYfiPtmx4NDZpyAYZFsAUp8lEPKECessc4ckXGJyCpidk2O9U6\n\
+jYA4eRODrTxjAvuHtXpElDPSgx4tZ1geHHiExK2qSKFnQnQaYXgJYkXuVpqGYSO9\n\
+UBFlyTWMgul79uQ2Z2Dqf2/qbsNHQmzLBbSYLvm3kIn0ao9+lR+gtPHa4Ib83I9D\n\
+uBG2SzjA2iAKElZReZo6yNBfOdbAvsxMnGSKaTPZscx60TnSQZdJl0hngubEaFYE\n\
+TeRnM8gM/nfzspRtRpgIwMpjybs2HG1OAp3NLcFPUOZ6XwTU3Uh0w831LxEiX1k/\n\
+M5Ho1j9zUxDebNECsP8AIyEIr5CtmlpS8FYQnsn44+YTZ8EfXxfSAkgFg25zvOQT\n\
+z0C5INH8fY7n8eOK8Wx/fswVtSeMVu75rV7OpT1bM22ZK0JWpL1DTx3NC4AaOFo4\n\
+dus0tJ+Uw7SScwR0cYezJGKBp/wriWUy2FvxuUgw1wlsH8DapKk/oeV47FoANDbH\n\
+RujF1SqGmmvIw3urrRqg7dYvJkJkOJ1gLRRVKsa2WS9fOD9zx7TYTrONOHv22Ufj\n\
+vy/1tbPPG5LO5awSj1kC8e5ULO3FI5diGNnfSqDwXjvVQtnVW6GPpDXC/NTcAJVy\n\
+MWeVdeg29AZPhLprf7sHonkjYCnq5IOm1P7eVmCz2NwbYTrwUd9sxQGFzMTEBgIr\n\
+uaiQaJD/caJhM/W/F2q1cs/QfGUpCJZ6HOgH4vNt2UJ1j/Oh+5Cg2qbtnMfKLQXi\n\
+3jSLbl+J1wo0bLTwSlxhpSkHlaSsMY2qupjjHcafxu5TtnKmSxtQtwsZ4PdiJRJt\n\
+lnjrMtH0uevhXlNw57dArsA7e6SilSaqMCphfif7lANOMD2EM5HoJhZZ/tbw2A2U\n\
+LNjBbQbt5sW4tMbpT0/oURIneNuxuaTVeYGmoCa4c7s45MKXDPqN4UsRMzNO8T9y\n\
+jAorgbJvzUlzTGhiopA7ywrw2dIrfEkBNfMLMfFyuIQDwyskuPc2+nNMnDisj2B5\n\
+6lESaYdfMyNtllwntKFSpP0rAsF72f8tfWutDooIOz0/qfZkXllccvBAbF9EExM+\n\
+VG7WwnGPGpMDd+a1lhgA+JejYEttn6Qmb1BUa/o8yhYqNaYgQicJDH418sF/0o2m\n\
+J7L2fmzOs/91BCnfS8NrIKUHKm7PTjI7rBijRYCUq+aBEv8+4+r3e42CnIlE9TkS\n\
+-----END RSA PRIVATE KEY-----";
+
+/*
+  key.pem as found in GPL tarball:
+  COVR-X1860_GPL_Release/MTK7621_AX1800_BASE/vendors/COVR-X1860/imgkey/key.pem
+  encrypted with passphrase: "12345678"
+*/
+const unsigned char key_covrx1860_pem[] = "\n\
+-----BEGIN RSA PRIVATE KEY-----\n\
+Proc-Type: 4,ENCRYPTED\n\
+DEK-Info: AES-256-CBC,34CCF1AEF0C34EAC5FFAE6BCF81ABB8D\n\
+\n\
+tAwfCeFe4/lfPC1y55k4XvhGYVnu4EBL1hws4YaruDijYfsIzQQ/LSfj43i82aad\n\
+07J4OEfl/LcDtEZ8dLC+SYCcE8ejUlr1TnUq2e9P/qLaAupa9ETX/M1z1ApWDKmI\n\
+EvYTJT7f6kNYPcLTAaaTbkGt9h0prHrmZDq8yvjv1HqefAhn1Hh/UqIq3FEgS/ux\n\
+dwX1DYyjM/LDv7i3fs0fmODTXiiHJXTsNz+61un52q8eCdDfLjmdytiiWPiKOfqB\n\
+3wdE5iSFw2RQEGrAkwHWVRaKKln9zGj/RI5Pu9xg7Nofx0EDfgztFCX6WQvDlZNo\n\
+JKhQtmF9xTeTbuxSqbX667BtAiFkyUdzvaDDv0QFBJDecD9QlR3rfI6Ib+9b1LI1\n\
+Ahmk0zcW5GV3tQw5lYUIESJXpMK51PFfxQb9SuGpNM+yMQYg03qU104Yq0NjHbPW\n\
+k6RsfWyVu6k3rUsqL14/TFZ29z0pfScyPqSY5OrQTUTeabG2J7PAzhgprpeZGZ5n\n\
+pW/BhBNtULlFiABrXKD3Grtxza12qsQuY8ldhd6CIU2joVo2s8y0WvJxnShtKR5H\n\
+MbDH2DYRunJFb7LUfqpjCX2O1eAI+q6uFZ0pD5Vw5JHRHABn+NGDV0F/Mi1gazqd\n\
+rF1hlGo10Xm+2SxbUH4ZxTRKXDC5ocHtO2ylKPqbLOFO4I48VBa5kmPs19wpVGov\n\
+roqbO6Eug8Hwl5CbPttLb11ROekT8O3LUBEtm+rxE007i5YzM4ZSAnOXlG2c0aoi\n\
++pFt3z1Byv4eI+piHbjc2A5qYFOLfj/F/qJ+54u4BeYRWf8nhUooYu+avlkzPm8z\n\
+n47dInw33wyOctQnrEnSG+8D9KtY+/d6gxnS6O0VGeu67NQvmu2n2O8bQdhiHDR6\n\
+N9Lgs2yHVK+R0PAhpnClFKCsk5xACkZ9e7QZWCFBcwvxFtZL24PjUjFlpR++ZQPX\n\
+no55rFNq/xR9QN0rYwDZgXNwmYinGrWdEY/qBuRw/88mf9plrauuYo+NjG7wzxHq\n\
+BXe600Pcu8LZki858AxyqZC1JbwGVjIOGl8JpphxO13pH5sZ5upJwkGvmykdsLFh\n\
+ru3iI26eq6SwT/BanklzCFWqC882zkCl/MwKkxdLVeqH4JRmq/Bz01XMSARsvGXI\n\
+GHHJbtyHrkezQnnX6XO4CNkn8ZLcbK/GUPldNnG2qbtuOqad9AHdMJCg8zadVHI9\n\
+BboA0v0tbxQxBEgveC9A5Jo/azhFl0AKCh+tmguFiA8HVEl1SdRiO9XvMRqYm6w3\n\
+zCPTrLaE85PLBe1shekJlhEchUN1yRQgZuEiX8Spxgp436dAd61SVsUgypgH1ub9\n\
+IgPp2C18iRVmi4FXQby10F/Uy/VgVH6aoWTlO9DfVHMGCrjnA4tGdfaQTWDxp1P3\n\
+5jQpS9bhH33Nqt0/C8cr91ODRzGz9sRqj5bG++FqVz2IvOOzUcVcmkchRYIR6AG2\n\
+2Drms2+mThV9HAgDrq8kSddw6B6pz+pXaC+pbjXeUPBjHEFzOi1NGM049omLtu73\n\
+A3Ao9FemHVoExxzdH3LzeMGQM2r/qZMv0PiNfGyNRW3oWZpfCgg7k/BX6pe38emx\n\
+HFiKzmtfTEu3umOnTRaLGVfWNF5pIaoq175hceT82udOqzGWs+eldB8Cbvogc/qx\n\
+jpaULJXcb++1FvlEPUpB8RO0gmabzAaOCJMAaAVwEc2q1i6Q6wlotMgG+vw/q7mq\n\
+04AeP2jthG5gNBLsKvxaSJHZSfsOQvOWiGqylgr72NGK6eWKzMeLVSwnN+rkSsnG\n\
+QxTVZ++NGdVnC2p4cFXzp7U6wlqEgSyQYHdabAv7Z3NchyUyWWuSinMw+g+8zwxj\n\
+wlV64L2eIAb8tbqtc+gcC1WggU7GG3G2zp6tcmhgdg/COTc6uh1+0DDv+UkPLjwo\n\
+TvAQWRAnUlzcDP3jNOGbiuXiQSWT2595BInkIg3D91xcbB5buiNIlD2Dln5xhq/Q\n\
+BGTJeqhWoeh9ijZY/azgJkGuXr72ghLuf0CQ3j2yP18leg1iYGYI+1eEWkOfc9oo\n\
+oH21euOQuxejrEs6V38YE+HFJX1vXCurkhaj5QnDbsHfuGlkYxvNXRpMip1VfMBd\n\
+FHY+0Z7afGdjal7VesQbMswNnh4rpckEI1wCul9Qyhq2oPsR4hQLkfnm0fEM7Ux1\n\
+CBFpNoH2BFYQ18HN+L5CBUjQVR1KYyAmYFGCgn24x/EKh2OEcd9lL+vTKOkdKCwN\n\
+ZIa6c3tY/ktmrhC5AY8js6Yu63SXHiTkK4UzAGls3zdIVlH4eQ3uRHBuAEmIMAg+\n\
+oKeVr058v2dasuzeOEq1kriMkseZA+2zsk42oDh+kj2U5gSusvjxI0ijYMzuNfAq\n\
+8po/zLlvF8sTHoqhNcf5RpsT+XxchmIcncyE5sXXfDAPoH+LgTPhQG/eRB4qofZ1\n\
+4KLO+a2kv5mMOOCew6gquvCeZ/W5IFwywzKznw5CA52W7lh8xnyTtgsuaBoN06q2\n\
+g9nsAhhf7iMMuS687L1ImID0iyzEymLQxlt4qgQLJKeVXCQbS+jkm0Er8mnrTBDL\n\
+L8Ntj+j4Dz9bIy70p/lw6StmPDFxfQQqMXLiiepdAYFo5A5EYoU41rWDBo+YbRNF\n\
+H8HcEBD4YIuxQrbNT2K3zGFdaqA9imM9B9YHz+EzfBBfrMtDVV7yme/M9CjECXwc\n\
+iKdR+QwtucV7Hnk/NOoD/ZOhXf+ybrcxev/C+/O9sHt06vvg1LL8Qr3eb03c5G7E\n\
+6V//N44JQ69l/Cvzd/TSUUknbVf/0Ydol7kuOuqrfvOcfqdVGY6kR/Phvy8MGTsG\n\
+9t71xyhFeu0IC1DOUqdV1Srsjw7Vm/wSKcJRcPOJO2lIwyv9SDustR2JRFTjfaBh\n\
+a3ZJmRn3q/h3e4AUEJ2pyj6HNKviz69bs2JNEw3UKY0muwCJEZaC9vAXIss8FeIB\n\
+HZKqQC2gv0rjK2RCLVc6cba9/G9tzzx12tOOsQUj/u7mBENKOh+KRNJJ/r9w2zcU\n\
+B98kPyJI9kjBX2P6U7OE2vNe6djiGOscjuDHyXicaDvMY+1veQEBiDtTXwCvSIo1\n\
+dJRYMuMfi+aitz9LQOky3yTHTDWZuRhK0b4JNkZYM1F9v8zGhMR4poDrRLsLb9t9\n\
+-----END RSA PRIVATE KEY-----";
+
+/*
+  key.pem as found in GPL tarball, e.g.:
+  DIR-X3260_GPL_Release/MTK7621_AX1800_BASE/vendors/DIR-X3260/imgkey/key.pem
+  encrypted with passphrase: "12345678"
+*/
+const unsigned char key_dirx3260_pem[] = "\n\
+-----BEGIN RSA PRIVATE KEY-----\n\
+Proc-Type: 4,ENCRYPTED\n\
+DEK-Info: AES-256-CBC,DDAC1FE060CB240242046BDFEEE17E44\n\
+\n\
+qhM8B97/rVJTQhhR/0roN43q9nvIyeT88rAUn7h1pCSUUQz4/8a7jmOWqJBlGfOl\n\
+WOtD6Av8e94i8pTf6BVXBZr2Ei0l3Nr8k10TQ/4KW4HpHoDjnluvAeP35uyppv4B\n\
+wBvi31EO0unC8fbyUMxu9jiNLx5AUCWLsEnIS/1gSusB0j1mIoZomvjEGgHeeW5d\n\
+OpA5oQqMnDZbm2BnxNSqBCcxZArcxv22E9DVtXnGrt4iVPyZe2TKlx6uGwHkqAiM\n\
+Hom9+VgoOrk0Vq0NPnjxehL9m+YhOseJ8O1iwqIWmP5HgVd6fIr8PcpmZYIur4Py\n\
+a60jAAFNXiN5L6KP2A8E7bt66fFbvuFDvCJU2LwzCkWT4J8eSBgthoKJNf+BPCo+\n\
+Up0DsCyEpEGsyTw0fHn9nivLIBOWRrNDoqdWcvcode+hIxIpKBl95lDMnAnTmJv9\n\
+TMsjeVjRuFTJPrH6ujKDGfHrrgey9aVOVl7meEO3bY86JV+/RdtkjkXzKvwIAqcB\n\
+FJ24MzQyLoa7ZrZSrXSm48QlKpNQF5L+wQfoHHnANTsPQ7pXxublNFmn+oxDJ4/y\n\
+xIQDstzLC9ut/Yz/z9Zx25CG3nn9T29E3f0XXgzrWFn6mc7axEnTnsZJqTgXIAmS\n\
+Eb/hzBJE77hv1ewq9u5XLyuGbJcgNmGI+e7fuvtE6wDtUnCtTOoPo6n5aptHIO6X\n\
+3TuJaYAvWdFujdIRFdImLiOrfbE6CUDfw3JmkYyilK7QkkCz2uNUlLOzmyXBypO1\n\
+aMqu2bm1jq5mSkbnNUKCISj86C4xd7rPyPG3aEBnLOEoe4zrRBOeJkliEoTvRmTI\n\
+ApEvbOmOTi5snt13h6gvbR3mDUO2Le6iNuaRW/37IUVpU93htNt5dI6NxCYaO0D1\n\
+YBaZ/q30bQY8xHHHMqAiOepD/tVFCTaUat0RoUPmKhzRdeUTuIP1QZAZNyHXqotI\n\
+vqdYpuBFZ9oH1V6ON7hflEeKtzmSbhDE2XlP/C1ZMbqOB9h09TwjWp+jDxHm39Xc\n\
+tVx9z74PLRI84NROeFBiag3q6fhg84o687FaSASj57fu20r79GTcM/5kUI/mWOBc\n\
+fDVOBBfTGs0FzfAcuCLkktlskqaotVrMmoPAuZdwU5VZNxujb7sa11qKezy6XgqV\n\
+j2BS9rxPu1lYQnk5nKZQi+tmWRLfXZVKmqFluGHvQya0JOw1GK23E8bnyr7B9ed1\n\
+y6xF1cOAfLE4e1X3MHKCuO2GrwOdWC8HQVuH299VGefN95Qcq4UdCbJLnwR7jxnC\n\
+x6Mys6pzyMxr6BUuedN8B0B1CbVfzY9pA6E68Rn6h3vkoxDJ5IlcyOkhZCB2kDb/\n\
+uQ49EyYdGW9lkQ1hjP8TR5+b6vAKjOzLmGFA9HGEJ3wFQcYnX7zrruIbvYT0VXuF\n\
+GleRiwbKyp5G9rWIjLyzGGsNHzviq26NZbghX2UkXEh3Lr7F3OVzP7vWugnmNSrI\n\
+rd3fRcUIiVpzfOlaZ+CgbQbQoGK/FdRlJTt8MIoXc6l16DGmLoECqkSGZ/2nk5I5\n\
+/X77A9P0gLl2hKSC0IpbVA9edIOMv0d3ZtEbVX7npBYyzvbSmhYKhX90JMD/A+9u\n\
+AqOQe9nZ9vrYBcGuB0pHiou6BDsTfPeLzvk7uITzh5gYdWaAfpsxF43LrCy3V+KB\n\
+YVoyloD8S+KPp7fB/o8I4z8bSj3q4RyGeT1m63xDtQDgbZdHWBSbrmZ+m4yJKAD3\n\
+G7JqYcX/CH2TMT/XT+anf2EH8ITF/8ComwBQ477M9/OjHs9K2202tWXmJVLqY74a\n\
+r5013y5f5Vq7WoJBpvzy32Dgrc9NcAqpC+h6GUTwsNNn6Dx8dkLDZW22Bb+bZtZI\n\
++UdGrLsP7PnwJBb70LvQYLT4tZugX3WJDTGUkoa488yIoP3eRG1l/vqEdhbP29m3\n\
+6fBG8O8lP4iypafg44pMhDuLtsmsvhdkcX4QBjCap/VZwLyQXWpN3oZBYepA3Xvk\n\
+Y1XFB26iYJsa0FcqWPsUtZhLtexYJ9urp10elbYBOPj1CUCcZK5b+MEVoylaj/uE\n\
++8GPwcCyjsHpmuA+IHRyYiehToUSSO8Mna+Gys9ffdLeI9fjnBUJWKhFBTwdfOcp\n\
+1BatCy57KN53URR4VEM9yeZDsXUT9oASwybco14cYP1KXUhOGl2D8RS+KQCCCR9w\n\
+q5Eic2YkV6ssV8U5QePhT0tYbn9H6y8wZnXJ5uhE/NosUBzdxzKVF0WOJPGBvSEc\n\
+SyJfVk4RZNVtwjRY7haR5idXg5IEWKKjSE4k+1JiQbLCdKFFzpLtNS4aDDzuly+c\n\
+sRw/1+b9zXnr8wRNXFAeCYm1DnGsnNmq5cMnJpYYx8zEU6FAUgs4xov7kVv4HdO9\n\
+1sP79wxVFh3HMsk7bkm2Bhzs4qXxSVOfx87FhJ88/d38CYwkApiaLLDyn/3In3g+\n\
+R77BOcuS5yWbZZTq115/gxzfzJE3r5A9p1t1chLTWl41WLdEpnJn3uCsMlgcj8Tl\n\
+hqPzVYbULlX3loQO/k17CgWXm+wx8XLCfjlBKRvTMbvii3XOVO8D5J8Fs0RoSfuB\n\
+691WPxVKC2w6xd8fqp7rfCN44QAGoe/72OkaVoqDXmtAe/uB3x9jwo1GniLseDrA\n\
+harP4ylr+7ry03AQMHBniU6pUKoiY9IwPjnfm9YBn1ybhcgbP50GTHgwYOifHnai\n\
+S44eVElqAk2bn9xl6fELLtMEYJ5S2FaKijJNIDIgDr6q/h+Nyv9ZzMVLj8x4HU+t\n\
+4Y2XnkV1jWghzjGmClR+KHdmgxds9lmsTGUKfZB44l8ovXsZwXstITq5Sxa4hDKV\n\
++GQVlvzcGADG3ZurA0Md6StL86oU3+5/xrmMXXvKBVbf/ShpmVSXrszJhlm1EEYw\n\
+BS7kwnj45c2ZJRcxjZxnSeKoJ7Sql0w7FB2kq/XQr0eT2YEulN+oN3jSoCUh4XQ1\n\
+sia9UEZXtFFWZZE2nhGYbfav/hsX0iz7ntVzYVCBG/cMjuUJo5UkYqbb9m58P2PD\n\
+9rt3GjXtO9UB1uhKfAEUkqWbqY6/pHugrNaNfnbRz2YAM92fH6da/z9iVjHG3PdT\n\
+w1+nGS0KL2+sJGFlDvc7fHJmVFZBqWeSQWPJTHimLI9yaIVS5mEnuBjKZpdUB57T\n\
+-----END RSA PRIVATE KEY-----";
-- 
2.34.1



From mail at aparcar.org  Thu Nov  2 16:58:33 2023
From: mail at aparcar.org (Paul Spooren)
Date: Fri, 3 Nov 2023 00:58:33 +0100
Subject: [PATCH v2 firmware-utils] add dlink-sge-image for D-Link devices
 by SGE
In-Reply-To: <20231102191606.12561-1-openwrt@sebastianschaper.net>
References: <20231102191606.12561-1-openwrt@sebastianschaper.net>
Message-ID: <674A2529-4F21-4041-94E3-851C197C821E@aparcar.org>



> On Nov 2, 2023, at 20:16, Sebastian Schaper <openwrt at sebastianschaper.net> wrote:
> 
> This tool will encrypt/decrypt factory images requiring the "SHRS" header
> e.g. COVR-C1200, COVR-P2500, COVR-X1860, DIR-878, DIR-882, ...
> 
> Encryption is loosely based on a series of blogposts by ricksanchez [1]
> and the provided code [2], as well as patches to qca-uboot found in the
> GPL tarball released for D-Link COVR-P2500 Rev. A1 [3].
> 
> Further scripts (e.g. /lib/upgrade/) and keys were found in the GPL tarball
> and/or rootfs of COVR-C1200 (the devices are based on OpenWrt Chaos Calmer
> and failsafe can be entered by pressing 'f' on the serial console during
> boot, allowing to access the file system of the running device).
> 
> For newer devices like COVR-X1860 and DIR-X3260, an updated method of
> vendor key derivation is implemented based on enk.txt from the GPL release.
> 
> [1] https://0x00sec.org/t/breaking-the-d-link-dir3060-firmware-encryption-recon-part-1/21943
> [2] https://github.com/0xricksanchez/dlink-decrypt
> [3] https://tsd.dlink.com.tw/GPL.asp
> 
> Signed-off-by: Sebastian Schaper <openwrt at sebastianschaper.net>
> Tested-By: Alan Luck <luckyhome2008 at gmail.com>
> ---
> 
> Changes from v1:
> - improve formatting, replace raw strings with individual newlines to
>  fix build on macOS using clang

Tested and merged, thank you! Works as expected.

A PR for the bump of firmware-utils is here:
https://github.com/openwrt/openwrt/pull/13861

I?d be happy if you could create a PR for the device itself, I already got it running and it appears to work just fine.

Best,
Paul

From micbis.openwrt at gmail.com  Fri Nov  3 01:04:08 2023
From: micbis.openwrt at gmail.com (Michele Bisogno)
Date: Fri, 3 Nov 2023 09:04:08 +0100
Subject: Adding a new platform: renesas rz
In-Reply-To: <CAP8xZ6=r1XPAjd9dJoNdHVkbquSEDaxAzOT0G03mtet00rQ_RQ@mail.gmail.com>
References: <CAP8xZ6m-cAZ8fkoxhOd6W_EWcW17W0uggpPRseR3d8rryUaDiQ@mail.gmail.com>
 <418c3902-c1dd-48ea-aa3f-bb63fba5403a@app.fastmail.com> <CAP8xZ6=r1XPAjd9dJoNdHVkbquSEDaxAzOT0G03mtet00rQ_RQ@mail.gmail.com>
Message-ID: <CAP8xZ6mhSiUuPmhJZUHNqvr39Q+gDA+tAPdRgGJzPGGjzLctnA@mail.gmail.com>

> Renesas offers different architectures in their portfolio[1], I haven't
> dug into the OpenWRT build system for this issue yet to tell whether it
> is able to handle that at this folder level. Much of the above is
> "legacy" and does not run OpenWRT(?), but they also seem to aim for
> Risc-V. There is a platform called "ramips" and the broadcoms each have
> their own subdirectory. None of them have punctuation yet. Maybe call it
> "renesasrz"? They're also offering other ARM-based SoCs, and building
> common kernels might become difficult.
> Torsten
> [1] https://www.renesas.com/eu/en/products/microcontrollers-microprocessors/other-mcus-mpus

Hi Torsten,

what is listed there is old stuff. Renesas MPUs are now all under the
RZ umbrella.
Well, actually there are also the rcar devices, but these are automotive SoCs.
Yes, there is an RZ device that is not Arm: RZ/Five. For now it is a
single device based on a Andes core.

Kind regards,
Michele


From duwe at lst.de  Fri Nov  3 01:55:27 2023
From: duwe at lst.de (Torsten Duwe)
Date: Fri, 3 Nov 2023 09:55:27 +0100
Subject: Adding a new platform: renesas rz
In-Reply-To: <CAP8xZ6mhSiUuPmhJZUHNqvr39Q+gDA+tAPdRgGJzPGGjzLctnA@mail.gmail.com>
References: <CAP8xZ6m-cAZ8fkoxhOd6W_EWcW17W0uggpPRseR3d8rryUaDiQ@mail.gmail.com>
	<418c3902-c1dd-48ea-aa3f-bb63fba5403a@app.fastmail.com>
	<CAP8xZ6=r1XPAjd9dJoNdHVkbquSEDaxAzOT0G03mtet00rQ_RQ@mail.gmail.com>
	<CAP8xZ6mhSiUuPmhJZUHNqvr39Q+gDA+tAPdRgGJzPGGjzLctnA@mail.gmail.com>
Message-ID: <20231103095527.323aa7d7@blackhole.lan>

Hi Michele,

On Fri, 3 Nov 2023 09:04:08 +0100
Michele Bisogno <micbis.openwrt at gmail.com> wrote:

> > is able to handle that at this folder level. Much of the above is
> > "legacy" and does not run OpenWRT(?), but they also seem to aim for
> > Risc-V. There is a platform called "ramips" and the broadcoms each
> > have their own subdirectory.
[...]
> 
> what is listed there is old stuff.

I thought so, thanks for the confirmation.

> Renesas MPUs are now all under the RZ umbrella.

The question then is: are they similar enough to build from one kernel
source, or will they require different sets of patches?

> Well, actually there are also the rcar devices, but these are
> automotive SoCs. Yes, there is an RZ device that is not Arm: RZ/Five.
> For now it is a single device based on a Andes core.

Have you looked at the peripherials on the SoCs? Is RZ/Five identical
to RZ/Arm in that respect? I've seen this at WinChipHead, for
microcontrollers. The reasoning again would be whether it could be
built from the same source code base.

If not, how about "rzarm", leaving room for future "rzfive"? I know this
sounds like bike shedding, but it might actually save some renaming
work in the future. Naming it just "renesas" does not feel right, IMHO.

	Torsten




From micbis.openwrt at gmail.com  Fri Nov  3 05:28:00 2023
From: micbis.openwrt at gmail.com (Michele Bisogno)
Date: Fri, 3 Nov 2023 13:28:00 +0100
Subject: Adding a new platform: renesas rz
In-Reply-To: <CAP8xZ6mhSiUuPmhJZUHNqvr39Q+gDA+tAPdRgGJzPGGjzLctnA@mail.gmail.com>
References: <CAP8xZ6m-cAZ8fkoxhOd6W_EWcW17W0uggpPRseR3d8rryUaDiQ@mail.gmail.com>
 <418c3902-c1dd-48ea-aa3f-bb63fba5403a@app.fastmail.com> <CAP8xZ6=r1XPAjd9dJoNdHVkbquSEDaxAzOT0G03mtet00rQ_RQ@mail.gmail.com>
 <CAP8xZ6mhSiUuPmhJZUHNqvr39Q+gDA+tAPdRgGJzPGGjzLctnA@mail.gmail.com>
Message-ID: <CAP8xZ6nysJHuCMqquFbhRP3vuoevW=Msn9ELMh2yUePG7APwSg@mail.gmail.com>

Torsten,

> The question then is: are they similar enough to build from one kernel
> source, or will they require different sets of patches?

RZ includes different subseries, as of today: RZ/G, RZ/V and some new
RZ/T run Linux.
Renesas official SW package is based on the CIP Linux, even though the
support of the devices is regularly upstreamed in the Linux kernel.
I kind of know that the maintainers are trying to keep things
consistent and usually the same kernel image works for all the
supported devices, requiring just a different device tree.
My idea at the moment is to add the devices that are supported in Linux 6.1.


> Have you looked at the peripherials on the SoCs? Is RZ/Five identical
> to RZ/Arm in that respect? I've seen this at WinChipHead, for
> microcontrollers. The reasoning again would be whether it could be
> built from the same source code base.

RZ/Five is basically a RZ/G2UL with a RISC-V CPU instead of Arm.
Of course for RZ/Five the same kernel binary cannot work.
On top of that, it's a pity that the RZ/Five started to be supported
from 6.2, I'm not sure what to do with it.

> If not, how about "rzarm", leaving room for future "rzfive"? I know this
> sounds like bike shedding, but it might actually save some renaming
> work in the future. Naming it just "renesas" does not feel right, IMHO.

Honestly I am fine with any naming, that's why I am here asking and
discussing it.

Kind regards,
Michele

On Fri, 3 Nov 2023 at 09:04, Michele Bisogno <micbis.openwrt at gmail.com> wrote:
>
> > Renesas offers different architectures in their portfolio[1], I haven't
> > dug into the OpenWRT build system for this issue yet to tell whether it
> > is able to handle that at this folder level. Much of the above is
> > "legacy" and does not run OpenWRT(?), but they also seem to aim for
> > Risc-V. There is a platform called "ramips" and the broadcoms each have
> > their own subdirectory. None of them have punctuation yet. Maybe call it
> > "renesasrz"? They're also offering other ARM-based SoCs, and building
> > common kernels might become difficult.
> > Torsten
> > [1] https://www.renesas.com/eu/en/products/microcontrollers-microprocessors/other-mcus-mpus
>
> Hi Torsten,
>
> what is listed there is old stuff. Renesas MPUs are now all under the
> RZ umbrella.
> Well, actually there are also the rcar devices, but these are automotive SoCs.
> Yes, there is an RZ device that is not Arm: RZ/Five. For now it is a
> single device based on a Andes core.
>
> Kind regards,
> Michele


From micbis.openwrt at gmail.com  Fri Nov  3 07:49:59 2023
From: micbis.openwrt at gmail.com (Michele Bisogno)
Date: Fri, 3 Nov 2023 15:49:59 +0100
Subject: Adding a new platform: renesas rz
In-Reply-To: <418c3902-c1dd-48ea-aa3f-bb63fba5403a@app.fastmail.com>
References: <CAP8xZ6m-cAZ8fkoxhOd6W_EWcW17W0uggpPRseR3d8rryUaDiQ@mail.gmail.com>
 <418c3902-c1dd-48ea-aa3f-bb63fba5403a@app.fastmail.com>
Message-ID: <CAP8xZ6muaeCiYJrBHb5FAX+SN9Lcf7WHDzuWKagoV0jm77BTrw@mail.gmail.com>

Hi Matt,

> Does the Renesas/RZ U-boot have EFI support enabled ('bootefi' command)?
> Could you try an armsr/armv8 image and see if it boots?

I've just tried:

=> fatload mmc 1:1 0x48000000 openwrt-armsr-armv8-generic-initramfs-kernel.bin
32223744 bytes read in 2669 ms (11.5 MiB/s)
=> bootefi 0x48000000
Scanning disk sd at 11c00000.blk...
Scanning disk sd at 11c10000.blk...
Found 13 disks
No EFI system partition
Booting /openwrt-armsr-armv8-generic-initramfs-kernel.bin
EFI stub: Booting Linux Kernel...
EFI stub: EFI_RNG_PROTOCOL unavailable
EFI stub: ERROR: FIRMWARE BUG: kernel image not aligned on 64k boundary
EFI stub: Using DTB from configuration table
EFI stub: Exiting boot services...

And it hangs here.
I suppose there are still some missing bits in u-boot to make it
happen. I'm investigating.

Kind regards,
Michele


From alexis.lothore at bootlin.com  Fri Nov  3 21:48:40 2023
From: alexis.lothore at bootlin.com (=?UTF-8?q?Alexis=20Lothor=C3=A9?=)
Date: Fri,  3 Nov 2023 21:48:40 -0700
Subject: [PATCH v2 0/2] Add support for rtw8822bu
Message-ID: <20231104044842.726651-1-alexis.lothore@bootlin.com>

Hello,
This series aims to enable support for RTW8822BU dongles. This chip is a
802.11ac wireless usb chip. Corresponding support has been added in Linux
6.1.
This version follows Hauke's suggestion to resplit RTW88 into PCI and USB
options. I finally went further and added options per-chip instead of
per-bus, because the first options would still have "forced" some options
which do not look relevant for all chips in the same family (eg 802.11 AC
enforced for all PCI chips)

Changes in v2:
- re-split exisiting rtw88 package to properly define bus dependency
- Link to V1: http://lists.openwrt.org/pipermail/openwrt-devel/2023-October/041652.html

Alexis Lothor? (2):
  mac80211: split rtw88 configuration for each supported chip
  mac80211: add support for rtw88_8822bu

 package/kernel/mac80211/realtek.mk | 109 +++++++++++++++++++++++++----
 1 file changed, 94 insertions(+), 15 deletions(-)

-- 
2.42.0



From alexis.lothore at bootlin.com  Fri Nov  3 21:48:42 2023
From: alexis.lothore at bootlin.com (=?UTF-8?q?Alexis=20Lothor=C3=A9?=)
Date: Fri,  3 Nov 2023 21:48:42 -0700
Subject: [PATCH v2 2/2] mac80211: add support for rtw88_8822bu
In-Reply-To: <20231104044842.726651-1-alexis.lothore@bootlin.com>
References: <20231104044842.726651-1-alexis.lothore@bootlin.com>
Message-ID: <20231104044842.726651-3-alexis.lothore@bootlin.com>

From: Alexis Lothor? <alexis.lothore at bootlin.com>

Kernel 6.1 has introduced support for RTW8822BU network adapter, which
is an USB variant of the rtw8822b 802.11ac chipset family.

Build and install the corresponding module in the rtw88 package

Signed-off-by: Alexis Lothor? <alexis.lothore at bootlin.com>
---
 package/kernel/mac80211/realtek.mk | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/package/kernel/mac80211/realtek.mk b/package/kernel/mac80211/realtek.mk
index 3cd6740e6c6e..db2c4e395c16 100644
--- a/package/kernel/mac80211/realtek.mk
+++ b/package/kernel/mac80211/realtek.mk
@@ -1,8 +1,8 @@
 PKG_DRIVERS += \
 	rtlwifi rtlwifi-pci rtlwifi-btcoexist rtlwifi-usb rtl8192c-common \
 	rtl8192ce rtl8192se rtl8192de rtl8192cu rtl8723bs rtl8821ae \
-	rtl8xxxu rtw88 rtw88-pci rtw88-8822b rtw88-8822c rtw88-8723d \
-	rtw88-8822be rtw88-8822ce rtw88-8723de
+	rtl8xxxu rtw88 rtw88-pci rtw88-usb rtw88-8822b rtw88-8822c rtw88-8723d \
+	rtw88-8822be rtw88-8822bu rtw88-8822ce rtw88-8723de
 
 config-$(call config_package,rtlwifi) += RTL_CARDS RTLWIFI
 config-$(call config_package,rtlwifi-pci) += RTLWIFI_PCI
@@ -24,8 +24,10 @@ config-y += STAGING
 
 config-$(call config_package,rtw88) += RTW88 RTW88_CORE
 config-$(call config_package,rtw88-pci) += RTW88_PCI
+config-$(call config_package,rtw88-usb) += RTW88_USB
 config-$(call config_package,rtw88-8822b) += RTW88_8822B
 config-$(call config_package,rtw88-8822be) += RTW88_8822BE
+config-$(call config_package,rtw88-8822bu) += RTW88_8822BU
 config-$(call config_package,rtw88-8822c) += RTW88_8822C
 config-$(call config_package,rtw88-8822ce) += RTW88_8822CE
 config-$(call config_package,rtw88-8723d) += RTW88_8723D
@@ -176,7 +178,7 @@ endef
 define KernelPackage/rtw88
   $(call KernelPackage/mac80211/Default)
   TITLE:=Realtek RTW88 common part
-  DEPENDS+= @PCI_SUPPORT +kmod-mac80211
+  DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT) +kmod-mac80211
   FILES:=	$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_core.ko
   AUTOLOAD:=$(call AutoProbe,rtw88_core)
   HIDDEN:=1
@@ -191,6 +193,15 @@ define KernelPackage/rtw88-pci
   HIDDEN:=1
 endef
 
+define KernelPackage/rtw88-usb
+  $(call KernelPackage/mac80211/Default)
+  TITLE:=Realtek RTW88 USB chips support
+  DEPENDS+= @USB_SUPPORT +kmod-rtw88
+  FILES:=	$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_usb.ko
+  AUTOLOAD:=$(call AutoProbe,rtw88_usb)
+  HIDDEN:=1
+endef
+
 define KernelPackage/rtw88-8822b
   $(call KernelPackage/mac80211/Default)
   TITLE:=Realtek RTL8822B family support
@@ -226,6 +237,14 @@ define KernelPackage/rtw88-8822be
   AUTOLOAD:=$(call AutoProbe,rtw88_8822be)
 endef
 
+define KernelPackage/rtw88-8822bu
+  $(call KernelPackage/mac80211/Default)
+  TITLE:=Realtek RTL8822BU support
+  DEPENDS+= +kmod-rtw88-usb +rtl8822be-firmware +kmod-rtw88-8822b
+  FILES:=	$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8822bu.ko
+  AUTOLOAD:=$(call AutoProbe,rtw88_8822bu)
+endef
+
 define KernelPackage/rtw88-8822ce
   $(call KernelPackage/mac80211/Default)
   TITLE:=Realtek RTL8822CE support
-- 
2.42.0



From alexis.lothore at bootlin.com  Fri Nov  3 21:48:41 2023
From: alexis.lothore at bootlin.com (=?UTF-8?q?Alexis=20Lothor=C3=A9?=)
Date: Fri,  3 Nov 2023 21:48:41 -0700
Subject: [PATCH v2 1/2] mac80211: split rtw88 configuration for each supported chip
In-Reply-To: <20231104044842.726651-1-alexis.lothore@bootlin.com>
References: <20231104044842.726651-1-alexis.lothore@bootlin.com>
Message-ID: <20231104044842.726651-2-alexis.lothore@bootlin.com>

From: Alexis Lothor? <alexis.lothore at bootlin.com>

Current rtw88 build configuration builds modules for all chips supported by
rtw88 driver family. This brings the following issues:
- adding a chip with a different bus is not convenient (all chips currently
  depends on PCI)
- some features requirements are not relevant for all chips in family (eg
  802.11AC is enforced but RTW88-8723DE is only a 802.11b/g/n chip)

Remove those constraints/issues by adding one module build option per
supported chip, and add intermediate options to properly cascade
dependencies.

Signed-off-by: Alexis Lothor? <alexis.lothore at bootlin.com>
---
 package/kernel/mac80211/realtek.mk | 90 +++++++++++++++++++++++++-----
 1 file changed, 75 insertions(+), 15 deletions(-)

diff --git a/package/kernel/mac80211/realtek.mk b/package/kernel/mac80211/realtek.mk
index 9c143583265e..3cd6740e6c6e 100644
--- a/package/kernel/mac80211/realtek.mk
+++ b/package/kernel/mac80211/realtek.mk
@@ -1,7 +1,8 @@
 PKG_DRIVERS += \
 	rtlwifi rtlwifi-pci rtlwifi-btcoexist rtlwifi-usb rtl8192c-common \
 	rtl8192ce rtl8192se rtl8192de rtl8192cu rtl8723bs rtl8821ae \
-	rtl8xxxu rtw88
+	rtl8xxxu rtw88 rtw88-pci rtw88-8822b rtw88-8822c rtw88-8723d \
+	rtw88-8822be rtw88-8822ce rtw88-8723de
 
 config-$(call config_package,rtlwifi) += RTL_CARDS RTLWIFI
 config-$(call config_package,rtlwifi-pci) += RTLWIFI_PCI
@@ -21,8 +22,14 @@ config-y += RTL8XXXU_UNTESTED
 config-$(call config_package,rtl8723bs) += RTL8723BS
 config-y += STAGING
 
-config-$(call config_package,rtw88) += RTW88 RTW88_CORE RTW88_PCI
-config-y += RTW88_8822BE RTW88_8822CE RTW88_8723DE
+config-$(call config_package,rtw88) += RTW88 RTW88_CORE
+config-$(call config_package,rtw88-pci) += RTW88_PCI
+config-$(call config_package,rtw88-8822b) += RTW88_8822B
+config-$(call config_package,rtw88-8822be) += RTW88_8822BE
+config-$(call config_package,rtw88-8822c) += RTW88_8822C
+config-$(call config_package,rtw88-8822ce) += RTW88_8822CE
+config-$(call config_package,rtw88-8723d) += RTW88_8723D
+config-$(call config_package,rtw88-8723de) += RTW88_8723DE
 config-$(CONFIG_PACKAGE_RTW88_DEBUG) += RTW88_DEBUG
 config-$(CONFIG_PACKAGE_RTW88_DEBUGFS) += RTW88_DEBUGFS
 
@@ -168,18 +175,71 @@ endef
 
 define KernelPackage/rtw88
   $(call KernelPackage/mac80211/Default)
-  TITLE:=Realtek RTL8822BE/RTL8822CE/RTL8723DE
-  DEPENDS+= @(PCI_SUPPORT) +kmod-mac80211 + at DRIVER_11AC_SUPPORT
-  FILES:=\
-	$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8822be.ko \
-	$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8822b.ko \
-	$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8822ce.ko \
-	$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8822c.ko \
-	$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8723de.ko \
-	$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8723d.ko \
-	$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_core.ko \
-	$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_pci.ko
-  AUTOLOAD:=$(call AutoProbe,rtw88_8822be rtw88_8822ce rtw88_8723de)
+  TITLE:=Realtek RTW88 common part
+  DEPENDS+= @PCI_SUPPORT +kmod-mac80211
+  FILES:=	$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_core.ko
+  AUTOLOAD:=$(call AutoProbe,rtw88_core)
+  HIDDEN:=1
+endef
+
+define KernelPackage/rtw88-pci
+  $(call KernelPackage/mac80211/Default)
+  TITLE:=Realtek RTW88 PCI chips support
+  DEPENDS+= @PCI_SUPPORT +kmod-rtw88
+  FILES:=	$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_pci.ko
+  AUTOLOAD:=$(call AutoProbe,rtw88_pci)
+  HIDDEN:=1
+endef
+
+define KernelPackage/rtw88-8822b
+  $(call KernelPackage/mac80211/Default)
+  TITLE:=Realtek RTL8822B family support
+  DEPENDS+= +kmod-rtw88 + at DRIVER_11AC_SUPPORT
+  FILES:=	$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8822b.ko
+  AUTOLOAD:=$(call AutoProbe,rtw88_8822b)
+  HIDDEN:=1
+endef
+
+define KernelPackage/rtw88-8822c
+  $(call KernelPackage/mac80211/Default)
+  TITLE:=Realtek RTL8822C family support
+  DEPENDS+= +kmod-rtw88 + at DRIVER_11AC_SUPPORT
+  FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8822c.ko
+  AUTOLOAD:=$(call AutoProbe,rtw88_8822c)
+  HIDDEN:=1
+endef
+
+define KernelPackage/rtw88-8723d
+  $(call KernelPackage/mac80211/Default)
+  TITLE:=Realtek RTL8723D family support
+  DEPENDS+= +kmod-rtw88
+  FILES:=	$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8723d.ko
+  AUTOLOAD:=$(call AutoProbe,rtw88_8723d)
+  HIDDEN:=1
+endef
+
+define KernelPackage/rtw88-8822be
+  $(call KernelPackage/mac80211/Default)
+  TITLE:=Realtek RTL8822BE support
+  DEPENDS+= +kmod-rtw88-pci +kmod-rtw88-8822b
+  FILES:=	$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8822be.ko
+  AUTOLOAD:=$(call AutoProbe,rtw88_8822be)
+endef
+
+define KernelPackage/rtw88-8822ce
+  $(call KernelPackage/mac80211/Default)
+  TITLE:=Realtek RTL8822CE support
+  DEPENDS+= +kmod-rtw88-pci +kmod-rtw88-8822c
+  FILES:=	$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8822ce.ko
+  AUTOLOAD:=$(call AutoProbe,rtw88_8822ce)
+endef
+
+define KernelPackage/rtw88-8723de
+  $(call KernelPackage/mac80211/Default)
+  TITLE:=Realtek RTL8723DE support
+  DEPENDS+= +kmod-rtw88-pci +kmod-rtw88-8723d
+  FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8723de.ko
+  AUTOLOAD:=$(call AutoProbe,rtw88_8723)
 endef
 
 define KernelPackage/rtl8723bs
-- 
2.42.0



From philipp_subx at redfish-solutions.com  Sat Nov  4 11:48:29 2023
From: philipp_subx at redfish-solutions.com (Philip Prindeville)
Date: Sat, 4 Nov 2023 12:48:29 -0600
Subject: [PATCH] x86 64: Add new device Cordoba Edge Platform
In-Reply-To: <BB66AB99-9234-4FF0-A8CC-8F5609C50335@aparcar.org>
References: <DU0PR04MB9660FACCB93620F1441E5ABBBDDFA@DU0PR04MB9660.eurprd04.prod.outlook.com>
 <FFA42876-034E-4042-BFBB-10F9E3CD50FF@redfish-solutions.com>
 <DU0PR04MB9660D981F5A91BE2D7D9D0D2BDA1A@DU0PR04MB9660.eurprd04.prod.outlook.com>
 <BB66AB99-9234-4FF0-A8CC-8F5609C50335@aparcar.org>
Message-ID: <728D2D5E-AE6F-42FF-AEFE-199E12FA8FCC@redfish-solutions.com>



> On Oct 30, 2023, at 11:17 AM, Paul Spooren <mail at aparcar.org> wrote:
> 
> Hi,
> 
> We kind of don?t add image just to contain extra drivers. Extra UCI defaults for eth ordering are fine but please don?t add an extra image if it just contains 1-2 extra packages, installable via the ImageBuilder or OPKG.
> 
>> 
>>> On Oct 23, 2023, at 8:52 PM, Xiaojun Liu <xiaojun.liu at silicom.co.il> wrote:
>>> 
>>> Add new device Cordoba Edge Platform
>>> Device name:Cordoba Edge Platform
>>> hardware specifications: CPU - Intel Atom C3000
>>>                        WiFi - mt7915e
>>> 
>>> Signed-off-by: Xiaojun Liu mailto:xiaojun.liu at silicom.co.il
>>> ---
>>> 
>>> target/linux/x86/base-files/etc/board.d/02_network | 11 +++++++++++
>>> target/linux/x86/image/64.mk                       | 10 ++++++++++
>>> 2 files changed, 21 insertions(+)
>>> 
>>> 
>>> diff --git a/target/linux/x86/base-files/etc/board.d/02_network 
>>> b/target/linux/x86/base-files/etc/board.d/02_network
>>> index e00e8c04dd..be56153695 100644
>>> --- a/target/linux/x86/base-files/etc/board.d/02_network
>>> +++ b/target/linux/x86/base-files/etc/board.d/02_network
>>> @@ -75,6 +75,17 @@ traverse-technologies-geos)
>>>       macaddr="$(cat /sys/class/net/eth0/address)" 2>/dev/null
>>>       [ -n "$macaddr" ] && ucidef_set_interface_macaddr "wan" "$macaddr"
>>>       ;;
>>> +silicom-80500-0214-e53)
>>> +        ucidef_set_network_device_path "wan0" "pci0000:00/0000:00:16.0/0000:03:00.0"
>>> +        ucidef_set_network_device_path "wan1" "pci0000:00/0000:00:16.0/0000:03:00.1"
>>> +        ucidef_set_network_device_path "media0" "pci0000:00/0000:00:17.0/0000:02:00.0"
>>> +        ucidef_set_network_device_path "media1" "pci0000:00/0000:00:17.0/0000:02:00.1"
>>> +        ucidef_set_network_device_path "eth0" "pci0000:00/0000:00:0c.0/0000:04:00.0"
>>> +        ucidef_set_network_device_path "eth1" "pci0000:00/0000:00:0e.0/0000:05:00.0"
>>> +        ucidef_set_network_device_path "eth2" "pci0000:00/0000:00:0f.0/0000:06:00.0"
>>> +        ucidef_set_network_device_path "eth3" "pci0000:00/0000:00:10.0/0000:07:00.0"
>>> +        ucidef_set_interfaces_lan_wan "eth0 eth1 eth2 eth3" "wan0"
>>> +        ;;
>>> esac
>>> board_config_flush
>>> 
>>> diff --git a/target/linux/x86/image/64.mk 
>>> b/target/linux/x86/image/64.mk index 5ec9978b66..4addddeb98 100644
>>> --- a/target/linux/x86/image/64.mk
>>> +++ b/target/linux/x86/image/64.mk
>>> @@ -8,3 +8,13 @@ define Device/generic
>>>  GRUB2_VARIANT := generic
>>> endef
>>> TARGET_DEVICES += generic
>>> +
>>> +define Device/cordoba
>>> +  DEVICE_VENDOR := Cordoba
>>> +  DEVICE_MODEL := x86/64
>>> +  DEVICE_PACKAGES += \
>>> +        kmod-igc kmod-ixgbe \
>>> +        kmod-mt7915-firmware
>>> +  GRUB2_VARIANT := generic
>>> +endef
>>> +TARGET_DEVICES += cordoba
> 
> Please remove those lines in 64.mk.
> 
> Thanks for you work and interest in OpenWrt support for your device.
> 
> Best,
> Paul


I?m not sure I understand why.  Would you want someone to build the image and leave out the necessary drivers?  They?re more than just ?extra packages?, they?re *essential* packages.

We have hundreds of profiles for other architectures, even different profiles for different versions of the same base design (like Archer C7).

Why are we so miserly when it comes to x86_64?

-Philip




From philipp_subx at redfish-solutions.com  Sat Nov  4 11:49:03 2023
From: philipp_subx at redfish-solutions.com (Philip Prindeville)
Date: Sat, 4 Nov 2023 12:49:03 -0600
Subject: [PATCH] x86 64: Add new device Cordoba Edge Platform
In-Reply-To: <DU0PR04MB9660D981F5A91BE2D7D9D0D2BDA1A@DU0PR04MB9660.eurprd04.prod.outlook.com>
References: <DU0PR04MB9660FACCB93620F1441E5ABBBDDFA@DU0PR04MB9660.eurprd04.prod.outlook.com>
 <FFA42876-034E-4042-BFBB-10F9E3CD50FF@redfish-solutions.com>
 <DU0PR04MB9660D981F5A91BE2D7D9D0D2BDA1A@DU0PR04MB9660.eurprd04.prod.outlook.com>
Message-ID: <BB88CB17-6461-415E-AE50-C173EE4D25CB@redfish-solutions.com>

That?s a question for a core maintainer.  I?m just a lowly package maintainer.


> On Oct 29, 2023, at 10:29 PM, Xiaojun Liu <xiaojun.liu at silicom.co.il> wrote:
> 
> Hi Philip,
> 
> Thank you! Do you know when it will be merged to Openwrt main thread ?
> 
> -----Original Message-----
> From: Philip Prindeville <philipp_subx at redfish-solutions.com> 
> Sent: Saturday, October 28, 2023 11:09 AM
> To: Xiaojun Liu <xiaojun.liu at silicom.co.il>
> Cc: openwrt-devel at lists.openwrt.org
> Subject: Re: [PATCH] x86 64: Add new device Cordoba Edge Platform
> 
> LGTM
> 
> 
>> On Oct 23, 2023, at 8:52 PM, Xiaojun Liu <xiaojun.liu at silicom.co.il> wrote:
>> 
>> Add new device Cordoba Edge Platform
>> Device name:Cordoba Edge Platform
>> hardware specifications: CPU - Intel Atom C3000
>>                         WiFi - mt7915e
>> 
>> Signed-off-by: Xiaojun Liu mailto:xiaojun.liu at silicom.co.il
>> ---
>> 
>> target/linux/x86/base-files/etc/board.d/02_network | 11 +++++++++++
>> target/linux/x86/image/64.mk                       | 10 ++++++++++
>> 2 files changed, 21 insertions(+)
>> 
>> 
>> diff --git a/target/linux/x86/base-files/etc/board.d/02_network 
>> b/target/linux/x86/base-files/etc/board.d/02_network
>> index e00e8c04dd..be56153695 100644
>> --- a/target/linux/x86/base-files/etc/board.d/02_network
>> +++ b/target/linux/x86/base-files/etc/board.d/02_network
>> @@ -75,6 +75,17 @@ traverse-technologies-geos)
>>        macaddr="$(cat /sys/class/net/eth0/address)" 2>/dev/null
>>        [ -n "$macaddr" ] && ucidef_set_interface_macaddr "wan" "$macaddr"
>>        ;;
>> +silicom-80500-0214-e53)
>> +        ucidef_set_network_device_path "wan0" "pci0000:00/0000:00:16.0/0000:03:00.0"
>> +        ucidef_set_network_device_path "wan1" "pci0000:00/0000:00:16.0/0000:03:00.1"
>> +        ucidef_set_network_device_path "media0" "pci0000:00/0000:00:17.0/0000:02:00.0"
>> +        ucidef_set_network_device_path "media1" "pci0000:00/0000:00:17.0/0000:02:00.1"
>> +        ucidef_set_network_device_path "eth0" "pci0000:00/0000:00:0c.0/0000:04:00.0"
>> +        ucidef_set_network_device_path "eth1" "pci0000:00/0000:00:0e.0/0000:05:00.0"
>> +        ucidef_set_network_device_path "eth2" "pci0000:00/0000:00:0f.0/0000:06:00.0"
>> +        ucidef_set_network_device_path "eth3" "pci0000:00/0000:00:10.0/0000:07:00.0"
>> +        ucidef_set_interfaces_lan_wan "eth0 eth1 eth2 eth3" "wan0"
>> +        ;;
>> esac
>> board_config_flush
>> 
>> diff --git a/target/linux/x86/image/64.mk 
>> b/target/linux/x86/image/64.mk index 5ec9978b66..4addddeb98 100644
>> --- a/target/linux/x86/image/64.mk
>> +++ b/target/linux/x86/image/64.mk
>> @@ -8,3 +8,13 @@ define Device/generic
>>   GRUB2_VARIANT := generic
>> endef
>> TARGET_DEVICES += generic
>> +
>> +define Device/cordoba
>> +  DEVICE_VENDOR := Cordoba
>> +  DEVICE_MODEL := x86/64
>> +  DEVICE_PACKAGES += \
>> +        kmod-igc kmod-ixgbe \
>> +        kmod-mt7915-firmware
>> +  GRUB2_VARIANT := generic
>> +endef
>> +TARGET_DEVICES += cordoba
>> 
>> <x86 64 Add new device Cordoba Edge 
>> Platform.patch>_______________________________________________
>> openwrt-devel mailing list
>> openwrt-devel at lists.openwrt.org
>> https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
>> s.openwrt.org%2Fmailman%2Flistinfo%2Fopenwrt-devel&data=05%7C01%7Cxiao
>> jun.liu%40silicom.co.il%7C72c892dafba644e13de108dbd76352b5%7Cc9e326d8c
>> e4749308612cc99d3c87ad1%7C0%7C0%7C638340593816809713%7CUnknown%7CTWFpb
>> GZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0
>> %3D%7C3000%7C%7C%7C&sdata=iJGXzXkBnJaAuGcu3OrZSPxVeE1WvC2h7w4%2F3t2bLj
>> Q%3D&reserved=0
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel




From noreply at github.com  Sun Nov  5 12:05:39 2023
From: noreply at github.com (Stephen Walker)
Date: Sun, 05 Nov 2023 12:05:39 -0800
Subject: [sdwalker/sdwalker.github.io] eb55ce: This week's update
Message-ID: <sdwalker/sdwalker.github.io/push/refs/heads/master/287b94-eb55ce@github.com>

  Branch: refs/heads/master
  Home:   https://github.com/sdwalker/sdwalker.github.io
  Commit: eb55ce599e7465ddb33d1f425219335fcb11651c
      https://github.com/sdwalker/sdwalker.github.io/commit/eb55ce599e7465ddb33d1f425219335fcb11651c
  Author: Stephen Walker <stephendwalker+github at gmail.com>
  Date:   2023-11-05 (Sun, 05 Nov 2023)

  Changed paths:
    M uscan/index-22.03.html
    M uscan/index-23.05.html
    M uscan/index.html

  Log Message:
  -----------
  This week's update




From xiaojun.liu at silicom.co.il  Mon Nov  6 00:42:35 2023
From: xiaojun.liu at silicom.co.il (Xiaojun Liu)
Date: Mon, 6 Nov 2023 08:42:35 +0000
Subject: [PATCH v1] x86 64: Add driver for Silicom Platform device
Message-ID: <DU0PR04MB9660CEF3C80D29F09CD2750EBDAAA@DU0PR04MB9660.eurprd04.prod.outlook.com>

Add Silicom platform driver for Swisscom BB
and Cordoba family products.
This platform driver provides support for various functions
via the linux LED framework, GPIO framework,
Hardware Monitoring (HWMON) and device attributes.
    
Signed-off-by: Xiaojun Liu mailto:xiaojun.liu at silicom.co.il
--

package/kernel/silicom-platform/Makefile | 44 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)


diff --git a/package/kernel/silicom-platform/Makefile b/package/kernel/silicom-platform/Makefile
new file mode 100644
index 0000000000..a3770cd3e0
--- /dev/null
+++ b/package/kernel/silicom-platform/Makefile
@@ -0,0 +1,44 @@
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/kernel.mk
+
+PKG_NAME:=silicom-platform
+PKG_VERSION:=1.0
+PKG_RELEASE:=1
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://github.com/silicom-ltd/openwrt-silc-drv.git
+PKG_SOURCE_DATE:=2023-11-03
+PKG_SOURCE_VERSION:=fa48edb29dc88af35f3d5eda80258ebff4fdbefe
+PKG_MIRROR_HASH:=07ae21062417110897770983eabadb69c87b1e9824e33b63c3a4313c4a7b37a0
+
+PKG_LICENSE:=GPLv2
+PKG_LICENSE_FILES:=COPYING
+
+PKG_MAINTAINER:=Xiaojun Liu <xiaojun.liu at silicom.co.il>
+
+include $(INCLUDE_DIR)/package.mk
+
+define KernelPackage/silicom-platform
+  SUBMENU:=Other modules
+  TITLE:=Silicom Platform driver for Swisscom BB and Cordoba family products 
+  FILES:=\
+	$(PKG_BUILD_DIR)/$(PKG_NAME)/silicom-platform.ko
+  AUTOLOAD:=$(call AutoProbe,silicom-platform)
+endef
+
+define KernelPackage/silicom-platform/description
+  This platform driver provides support for various functions via
+  the Linux LED framework, GPIO framework, Hardware Monitoring (HWMON)
+  and device attributes.
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+        $(KERNEL_MAKE) $(PKG_JOBS) \
+		M="$(PKG_BUILD_DIR)/$(PKG_NAME)" \
+		modules
+endef
+
+$(eval $(call KernelPackage,silicom-platform))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: x86 64 Add driver for Silicom Platform device.patch
Type: application/octet-stream
Size: 1455 bytes
Desc: x86 64 Add driver for Silicom Platform device.patch
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20231106/e36dab02/attachment.obj>

From quic_shoudil at quicinc.com  Mon Nov  6 18:00:06 2023
From: quic_shoudil at quicinc.com (quic_shoudil at quicinc.com)
Date: Tue,  7 Nov 2023 10:00:06 +0800
Subject: [PATCH] valgrind: fix config missing in menuconfig.
Message-ID: <20231107020006.2923792-1-quic_shoudil@quicinc.com>

From: shoudil <quic_shoudil at quicinc.com>

Enable valgrind related configs in menuconfig to support compile on
32bit arm targets.

Signed-off-by: shoudil <quic_shoudil at quicinc.com>
---
 package/devel/valgrind/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/devel/valgrind/Makefile b/package/devel/valgrind/Makefile
index f696b28c3c..694d63983c 100644
--- a/package/devel/valgrind/Makefile
+++ b/package/devel/valgrind/Makefile
@@ -33,7 +33,7 @@ include $(INCLUDE_DIR)/kernel.mk
 define Package/valgrind
   SECTION:=devel
   CATEGORY:=Development
-  DEPENDS:=@mips||mipsel||mips64||mips64el||i386||x86_64||powerpc||arm_v7||aarch64 +libpthread +librt
+  DEPENDS:=@mips||mipsel||mips64||mips64el||i386||x86_64||powerpc||arm||arm_v7||aarch64 +libpthread +librt
   TITLE:=debugging and profiling tools for Linux
   URL:=http://www.valgrind.org
 endef
-- 
2.25.1



From zajec5 at gmail.com  Tue Nov  7 04:54:14 2023
From: zajec5 at gmail.com (=?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?=)
Date: Tue,  7 Nov 2023 13:54:14 +0100
Subject: [PATCH] treewide: disable CONFIG_SLUB_DEBUG in target configs
Message-ID: <20231107125414.20435-1-zajec5@gmail.com>

From: Rafa? Mi?ecki <rafal at milecki.pl>

>From the symbol help message:
> SLUB has extensive debug support features. Disabling these can result
> in significant savings in code size.

There seems to be no need to enable those debugging features for
standard use.

Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
---
 target/linux/layerscape/armv7/config-5.15 | 1 -
 target/linux/layerscape/armv7/config-6.1  | 2 --
 target/linux/oxnas/config-5.15            | 1 -
 target/linux/qoriq/config-5.15            | 1 -
 target/linux/rockchip/armv8/config-5.15   | 1 -
 target/linux/rockchip/armv8/config-6.1    | 2 --
 target/linux/sifiveu/config-6.1           | 2 --
 7 files changed, 10 deletions(-)

diff --git a/target/linux/layerscape/armv7/config-5.15 b/target/linux/layerscape/armv7/config-5.15
index b5df343f4e..121151f58f 100644
--- a/target/linux/layerscape/armv7/config-5.15
+++ b/target/linux/layerscape/armv7/config-5.15
@@ -562,7 +562,6 @@ CONFIG_SERIAL_XILINX_PS_UART=y
 CONFIG_SERIAL_XILINX_PS_UART_CONSOLE=y
 CONFIG_SGL_ALLOC=y
 CONFIG_SG_POOL=y
-CONFIG_SLUB_DEBUG=y
 CONFIG_SMP=y
 CONFIG_SMP_ON_UP=y
 CONFIG_SMSC_PHY=y
diff --git a/target/linux/layerscape/armv7/config-6.1 b/target/linux/layerscape/armv7/config-6.1
index 0ff16d346e..d60e5824db 100644
--- a/target/linux/layerscape/armv7/config-6.1
+++ b/target/linux/layerscape/armv7/config-6.1
@@ -580,7 +580,6 @@ CONFIG_SERIAL_XILINX_PS_UART=y
 CONFIG_SERIAL_XILINX_PS_UART_CONSOLE=y
 CONFIG_SGL_ALLOC=y
 CONFIG_SG_POOL=y
-CONFIG_SLUB_DEBUG=y
 CONFIG_SMP=y
 CONFIG_SMP_ON_UP=y
 CONFIG_SMSC_PHY=y
@@ -626,7 +625,6 @@ CONFIG_SQUASHFS_ZLIB=y
 CONFIG_SRAM=y
 CONFIG_SRAM_EXEC=y
 CONFIG_SRCU=y
-CONFIG_STACKDEPOT=y
 CONFIG_STACKTRACE=y
 CONFIG_STAGING_BOARD=y
 # CONFIG_STRIP_ASM_SYMS is not set
diff --git a/target/linux/oxnas/config-5.15 b/target/linux/oxnas/config-5.15
index 9540a76774..0cf06ee580 100644
--- a/target/linux/oxnas/config-5.15
+++ b/target/linux/oxnas/config-5.15
@@ -245,7 +245,6 @@ CONFIG_SERIO=y
 CONFIG_SERIO_LIBPS2=y
 CONFIG_SERIO_SERPORT=y
 CONFIG_SGL_ALLOC=y
-CONFIG_SLUB_DEBUG=y
 CONFIG_SOCK_DIAG=y
 CONFIG_SPARSE_IRQ=y
 CONFIG_SPLIT_PTLOCK_CPUS=999999
diff --git a/target/linux/qoriq/config-5.15 b/target/linux/qoriq/config-5.15
index 3f5fd63ad0..39796daf1d 100644
--- a/target/linux/qoriq/config-5.15
+++ b/target/linux/qoriq/config-5.15
@@ -351,7 +351,6 @@ CONFIG_SERIAL_FSL_LPUART=y
 CONFIG_SERIAL_FSL_LPUART_CONSOLE=y
 CONFIG_SERIAL_MCTRL_GPIO=y
 CONFIG_SG_POOL=y
-CONFIG_SLUB_DEBUG=y
 CONFIG_SMP=y
 CONFIG_SOCK_RX_QUEUE_MAPPING=y
 CONFIG_SOC_BUS=y
diff --git a/target/linux/rockchip/armv8/config-5.15 b/target/linux/rockchip/armv8/config-5.15
index 1fc2fcbfb3..54fad098dd 100644
--- a/target/linux/rockchip/armv8/config-5.15
+++ b/target/linux/rockchip/armv8/config-5.15
@@ -528,7 +528,6 @@ CONFIG_SERIO=y
 CONFIG_SERIO_AMBAKMI=y
 CONFIG_SERIO_LIBPS2=y
 CONFIG_SG_POOL=y
-CONFIG_SLUB_DEBUG=y
 CONFIG_SMP=y
 CONFIG_SOCK_RX_QUEUE_MAPPING=y
 CONFIG_SPARSEMEM=y
diff --git a/target/linux/rockchip/armv8/config-6.1 b/target/linux/rockchip/armv8/config-6.1
index 59b343b23b..0f9a89f596 100644
--- a/target/linux/rockchip/armv8/config-6.1
+++ b/target/linux/rockchip/armv8/config-6.1
@@ -570,7 +570,6 @@ CONFIG_SERIO=y
 CONFIG_SERIO_AMBAKMI=y
 CONFIG_SERIO_LIBPS2=y
 CONFIG_SG_POOL=y
-CONFIG_SLUB_DEBUG=y
 CONFIG_SMP=y
 CONFIG_SOCK_RX_QUEUE_MAPPING=y
 CONFIG_SOFTIRQ_ON_OWN_STACK=y
@@ -594,7 +593,6 @@ CONFIG_SQUASHFS_FILE_CACHE=y
 # CONFIG_SQUASHFS_FILE_DIRECT is not set
 CONFIG_SRAM=y
 CONFIG_SRCU=y
-CONFIG_STACKDEPOT=y
 CONFIG_STACKPROTECTOR=y
 CONFIG_STACKPROTECTOR_PER_TASK=y
 CONFIG_STACKPROTECTOR_STRONG=y
diff --git a/target/linux/sifiveu/config-6.1 b/target/linux/sifiveu/config-6.1
index ee97677d78..2bcbcffeda 100644
--- a/target/linux/sifiveu/config-6.1
+++ b/target/linux/sifiveu/config-6.1
@@ -333,7 +333,6 @@ CONFIG_SERIO_SERPORT=y
 CONFIG_SG_POOL=y
 CONFIG_SIFIVE_CCACHE=y
 CONFIG_SIFIVE_PLIC=y
-CONFIG_SLUB_DEBUG=y
 CONFIG_SMP=y
 CONFIG_SOCK_RX_QUEUE_MAPPING=y
 # CONFIG_SOC_MICROCHIP_POLARFIRE is not set
@@ -348,7 +347,6 @@ CONFIG_SPI_MASTER=y
 CONFIG_SPI_MEM=y
 CONFIG_SPI_SIFIVE=y
 CONFIG_SRCU=y
-CONFIG_STACKDEPOT=y
 CONFIG_STACKTRACE=y
 CONFIG_SWIOTLB=y
 CONFIG_SWPHY=y
-- 
2.35.3



From zajec5 at gmail.com  Tue Nov  7 14:25:52 2023
From: zajec5 at gmail.com (=?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?=)
Date: Tue,  7 Nov 2023 23:25:52 +0100
Subject: [PATCH] kernel: provide better control & help for SLUB configuration
Message-ID: <20231107222552.11925-1-zajec5@gmail.com>

From: Rafa? Mi?ecki <rafal at milecki.pl>

Allow selecting KERNEL_SLUB_DEBUG and KERNEL_SLUB_DEBUG_ON manually and
provide detailed help for both.

Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
---
 config/Config-kernel.in | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/config/Config-kernel.in b/config/Config-kernel.in
index a1209d82f3..4529c81fc7 100644
--- a/config/Config-kernel.in
+++ b/config/Config-kernel.in
@@ -682,10 +682,21 @@ config KERNEL_PRINTK_TIME
 	default y
 
 config KERNEL_SLUB_DEBUG
-	bool
+	bool "Enable SLUB debugging support"
+	help
+	  This enables various debugging features:
+	    - Accepts "slub_debug" kernel parameter
+	    - Provides caches debugging options (e.g. tracing, validating)
+	    - Adds /sys/kernel/slab/ attrs for reading amounts of *objects*
+	    - Enables /proc/slabinfo support
+	    - Prints into when running out of memory
 
 config KERNEL_SLUB_DEBUG_ON
-	bool
+	depends on KERNEL_SLUB_DEBUG
+	bool "Boot kernel with basic caches debugging enabled"
+	help
+	  This enables by default sanity_checks, red_zone, poison and store_user
+	  debugging options for all caches.
 
 config KERNEL_SLABINFO
 	select KERNEL_SLUB_DEBUG
-- 
2.35.3



From hacks at slashdirt.org  Wed Nov  8 00:13:31 2023
From: hacks at slashdirt.org (Thibaut)
Date: Wed, 8 Nov 2023 09:13:31 +0100
Subject: [PATCH] kernel: provide better control & help for SLUB
 configuration
In-Reply-To: <20231107222552.11925-1-zajec5@gmail.com>
References: <20231107222552.11925-1-zajec5@gmail.com>
Message-ID: <BFEEF315-DE27-446A-BD03-0679690BE54A@slashdirt.org>

Hi,

> Le 7 nov. 2023 ? 23:25, Rafa? Mi?ecki <zajec5 at gmail.com> a ?crit :
> 
> From: Rafa? Mi?ecki <rafal at milecki.pl>
> 
> Allow selecting KERNEL_SLUB_DEBUG and KERNEL_SLUB_DEBUG_ON manually and
> provide detailed help for both.
> 
> Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
> ---
> config/Config-kernel.in | 15 +++++++++++++--
> 1 file changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/config/Config-kernel.in b/config/Config-kernel.in
> index a1209d82f3..4529c81fc7 100644
> --- a/config/Config-kernel.in
> +++ b/config/Config-kernel.in
> @@ -682,10 +682,21 @@ config KERNEL_PRINTK_TIME
> 	default y
> 
> config KERNEL_SLUB_DEBUG
> -	bool
> +	bool "Enable SLUB debugging support"
> +	help
> +	  This enables various debugging features:
> +	    - Accepts "slub_debug" kernel parameter
> +	    - Provides caches debugging options (e.g. tracing, validating)
> +	    - Adds /sys/kernel/slab/ attrs for reading amounts of *objects*
> +	    - Enables /proc/slabinfo support
> +	    - Prints into when running out of memory

Prints /info/ ?

Also following your previous patch, shouldn?t the help text mention that enabling this option results in significant increase in code size?

Cheers,
T

From e9hack at gmail.com  Thu Nov  9 07:32:37 2023
From: e9hack at gmail.com (e9hack)
Date: Thu, 9 Nov 2023 16:32:37 +0100
Subject: netifd issue
Message-ID: <69ba7ef4-420c-49fb-992f-7f5adfb9ee7a@gmail.com>

Hi,

I face a strange behaviour since commit 516ab774cc16d4b04b3b17a067cbf2649f1adaeb (system-linux: fix race condition on bringing up wireless devices). After a reboot or a full restart of hostapd via 'wifi down; sleep 30; killall hostapd; sleep 5; wifi', only the first of 3 5G AP's is join to the configured bridge. The two faulty AP's are up and connecting is possible, but there is no real network connection. If I change one parameter of the faulty AP's in the config file and do a 'wifi reload', than the 2 AP's are join to the bridges.

Result from 'brctl show' for br-lan and br-tor if two AP's are not working:
bridge name bridge id               STP enabled     interfaces
br-lan      7fff.xxxxxxxxxxxx       no              lan1
                                                     lan2
                                                     phy0-ap0
                                                     phy0-ap1
                                                     phy0-ap6
                                                     phy0-ap7
                                                     phy1-ap0
br-tor      7fff.xxxxxxxxxxxx       no              phy0-ap5

Result from 'brctl show' for  br-lan and br-tor if all AP's are working:
bridge name bridge id               STP enabled     interfaces
br-lan      7fff.xxxxxxxxxxxx       no              lan1
                                                     lan2
                                                     phy0-ap0    2G wpa3-mixed
                                                     phy0-ap1    2G sae-mixed
                                                     phy0-ap6    2G sae
                                                     phy0-ap7    2G wpa3
                                                     phy1-ap0    5G sae-mixed
                                                     phy1-ap1    5G wpa3-mixed
br-tor      7fff.xxxxxxxxxxxx       no              phy0-ap5    2G sae-mixed
                                                     phy1-ap2    5G sae-mixed

If I change the sequence of the 5G AP's in the config file, the behaviour after reboot doesn't change. Only phy1-ap0 does join to the bridge, either to br-lan or to br-tor. The previous netifd commit 40ed7363caf2b22b6e29ed9d9948189c2bc4c8f3 (device: fix build error on 32 bit systems) doesn't have this issue.

Regards,
Hartmut


From hannu.nyman at iki.fi  Thu Nov  9 13:31:41 2023
From: hannu.nyman at iki.fi (Hannu Nyman)
Date: Thu, 9 Nov 2023 23:31:41 +0200
Subject: netifd issue
In-Reply-To: <69ba7ef4-420c-49fb-992f-7f5adfb9ee7a@gmail.com>
References: <69ba7ef4-420c-49fb-992f-7f5adfb9ee7a@gmail.com>
Message-ID: <27f397fb-02b1-4dd6-82f4-f05be790dce2@iki.fi>

e9hack kirjoitti 9.11.2023 klo 17.32:
> I face a strange behaviour since commit 
> 516ab774cc16d4b04b3b17a067cbf2649f1adaeb (system-linux: fix race condition 
> on bringing up wireless devices). After a reboot or a full restart of 
> hostapd via 'wifi down; sleep 30; killall hostapd; sleep 5; wifi', only the 
> first of 3 5G AP's is join to the configured bridge. The two faulty AP's 
> are up and connecting is possible, but there is no real network connection. 
> If I change one parameter of the faulty AP's in the config file and do a 
> 'wifi reload', than the 2 AP's are join to the bridges.
>
> ...
>
> If I change the sequence of the 5G AP's in the config file, the behaviour 
> after reboot doesn't change. Only phy1-ap0 does join to the bridge, either 
> to br-lan or to br-tor. The previous netifd commit 
> 40ed7363caf2b22b6e29ed9d9948189c2bc4c8f3 (device: fix build error on 32 bit 
> systems) doesn't have this issue.


I see the same error.
Some APs do not initially join the bridge, but after making a small pointless 
edit to the AP's config in /etc/config/wireless and reloading wifi, the AP 
then joins the bridge.


 ?OpenWrt SNAPSHOT, r24331-168beef1dd
 ?-----------------------------------------------------
root at router4:~# brctl show
bridge name???? bridge id?????????????? STP enabled???? interfaces
br-lan????????? 7fff.c4411ef8a51f?????? no????????????? lan4
 ??????????????????????????????????????????????????????? lan2
 ??????????????????????????????????????????????????????? hn5wpa3
 ??????????????????????????????????????????????????????? lan3
 ??????????????????????????????????????????????????????? lan1
root at router4:~# nano /etc/config/wireless
root at router4:~# wifi reload
root at router4:~# brctl show
bridge name???? bridge id?????????????? STP enabled???? interfaces
br-lan????????? 7fff.c4411ef8a51f?????? no????????????? lan4
 ??????????????????????????????????????????????????????? hn5wpa2r
 ??????????????????????????????????????????????????????? lan2
 ??????????????????????????????????????????????????????? hn5wpa3
 ??????????????????????????????????????????????????????? lan3
 ??????????????????????????????????????????????????????? lan1




From yangshiji66 at outlook.com  Fri Nov 10 01:28:09 2023
From: yangshiji66 at outlook.com (Shiji Yang)
Date: Fri, 10 Nov 2023 17:28:09 +0800
Subject: [PATCH] kernel: of: remove "mac-address-ascii" support hack
Message-ID: <TYAP286MB0315EF15FE28164766E59A35BCAEA@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM>

From: Shiji Yang <yangshiji66 at qq.com>

ASCII MAC address can be handled by nvmem "fixed-layout" now. And all
related devices were converted to the new "mac-base" layout format.
It's time to remove this hack.

Signed-off-by: Shiji Yang <yangshiji66 at qq.com>
---

Git grep ref:
https://git.openwrt.org/?p=openwrt%2Fopenwrt.git&a=search&h=HEAD&st=grep&s=mac-address-ascii&sr=1

Regards,
Shiji Yang


 ...of_net-add-mac-address-ascii-support.patch | 116 ------------------
 ...of_net-add-mac-address-ascii-support.patch | 116 ------------------
 2 files changed, 232 deletions(-)
 delete mode 100644 target/linux/generic/hack-5.15/601-of_net-add-mac-address-ascii-support.patch
 delete mode 100644 target/linux/generic/hack-6.1/601-of_net-add-mac-address-ascii-support.patch

diff --git a/target/linux/generic/hack-5.15/601-of_net-add-mac-address-ascii-support.patch b/target/linux/generic/hack-5.15/601-of_net-add-mac-address-ascii-support.patch
deleted file mode 100644
index 55866c3135..0000000000
--- a/target/linux/generic/hack-5.15/601-of_net-add-mac-address-ascii-support.patch
+++ /dev/null
@@ -1,116 +0,0 @@
-From: Yousong Zhou <yszhou4tech at gmail.com>
-Subject: [PATCH] of: net: add nvmem cell mac-address-ascii support
-
-This is needed for devices with mac address stored in ascii format,
-e.g. HiWiFi HC6361 to be ported in the following patch.
-
-Submitted-by: Yousong Zhou <yszhou4tech at gmail.com>
----
- net/core/of_net.c | 83 ++++++++++++------
- 1 files changed, 72 insertions(+), 11 deletions(-)
-
---- a/net/core/of_net.c
-+++ b/net/core/of_net.c
-@@ -57,13 +57,70 @@ static int of_get_mac_addr(struct device
- 	return -ENODEV;
- }
- 
-+static void *nvmem_cell_get_mac_address(struct nvmem_cell *cell)
-+{
-+	size_t len;
-+	void *mac;
-+
-+	mac = nvmem_cell_read(cell, &len);
-+	if (IS_ERR(mac))
-+		return mac;
-+	if (len != ETH_ALEN) {
-+		kfree(mac);
-+		return ERR_PTR(-EINVAL);
-+	}
-+	return mac;
-+}
-+
-+static void *nvmem_cell_get_mac_address_ascii(struct nvmem_cell *cell)
-+{
-+	size_t len;
-+	int ret;
-+	void *mac_ascii;
-+	u8 *mac;
-+
-+	mac_ascii = nvmem_cell_read(cell, &len);
-+	if (IS_ERR(mac_ascii))
-+		return mac_ascii;
-+	if (len != ETH_ALEN*2+5) {
-+		kfree(mac_ascii);
-+		return ERR_PTR(-EINVAL);
-+	}
-+	mac = kmalloc(ETH_ALEN, GFP_KERNEL);
-+	if (!mac) {
-+		kfree(mac_ascii);
-+		return ERR_PTR(-ENOMEM);
-+	}
-+	ret = sscanf(mac_ascii, "%2hhx:%2hhx:%2hhx:%2hhx:%2hhx:%2hhx",
-+				&mac[0], &mac[1], &mac[2],
-+				&mac[3], &mac[4], &mac[5]);
-+	kfree(mac_ascii);
-+	if (ret == ETH_ALEN)
-+		return mac;
-+	kfree(mac);
-+	return ERR_PTR(-EINVAL);
-+}
-+
-+static struct nvmem_cell_mac_address_property {
-+	char *name;
-+	void *(*read)(struct nvmem_cell *);
-+} nvmem_cell_mac_address_properties[] = {
-+	{
-+		.name = "mac-address",
-+		.read = nvmem_cell_get_mac_address,
-+	}, {
-+		.name = "mac-address-ascii",
-+		.read = nvmem_cell_get_mac_address_ascii,
-+	},
-+};
-+
- static int of_get_mac_addr_nvmem(struct device_node *np, u8 *addr)
- {
- 	struct platform_device *pdev = of_find_device_by_node(np);
-+	struct nvmem_cell_mac_address_property *property;
- 	struct nvmem_cell *cell;
- 	const void *mac;
--	size_t len;
--	int ret;
-+	int ret, i;
- 
- 	/* Try lookup by device first, there might be a nvmem_cell_lookup
- 	 * associated with a given device.
-@@ -74,17 +131,26 @@ static int of_get_mac_addr_nvmem(struct
- 		return ret;
- 	}
- 
--	cell = of_nvmem_cell_get(np, "mac-address");
-+	for (i = 0; i < ARRAY_SIZE(nvmem_cell_mac_address_properties); i++) {
-+		property = &nvmem_cell_mac_address_properties[i];
-+		cell = of_nvmem_cell_get(np, property->name);
-+		/* For -EPROBE_DEFER don't try other properties.
-+		 * We'll get back to this one.
-+		 */
-+		if (!IS_ERR(cell) || PTR_ERR(cell) == -EPROBE_DEFER)
-+			break;
-+	}
-+
- 	if (IS_ERR(cell))
- 		return PTR_ERR(cell);
- 
--	mac = nvmem_cell_read(cell, &len);
-+	mac = property->read(cell);
- 	nvmem_cell_put(cell);
- 
- 	if (IS_ERR(mac))
- 		return PTR_ERR(mac);
- 
--	if (len != ETH_ALEN || !is_valid_ether_addr(mac)) {
-+	if (!is_valid_ether_addr(mac)) {
- 		kfree(mac);
- 		return -EINVAL;
- 	}
diff --git a/target/linux/generic/hack-6.1/601-of_net-add-mac-address-ascii-support.patch b/target/linux/generic/hack-6.1/601-of_net-add-mac-address-ascii-support.patch
deleted file mode 100644
index 55866c3135..0000000000
--- a/target/linux/generic/hack-6.1/601-of_net-add-mac-address-ascii-support.patch
+++ /dev/null
@@ -1,116 +0,0 @@
-From: Yousong Zhou <yszhou4tech at gmail.com>
-Subject: [PATCH] of: net: add nvmem cell mac-address-ascii support
-
-This is needed for devices with mac address stored in ascii format,
-e.g. HiWiFi HC6361 to be ported in the following patch.
-
-Submitted-by: Yousong Zhou <yszhou4tech at gmail.com>
----
- net/core/of_net.c | 83 ++++++++++++------
- 1 files changed, 72 insertions(+), 11 deletions(-)
-
---- a/net/core/of_net.c
-+++ b/net/core/of_net.c
-@@ -57,13 +57,70 @@ static int of_get_mac_addr(struct device
- 	return -ENODEV;
- }
- 
-+static void *nvmem_cell_get_mac_address(struct nvmem_cell *cell)
-+{
-+	size_t len;
-+	void *mac;
-+
-+	mac = nvmem_cell_read(cell, &len);
-+	if (IS_ERR(mac))
-+		return mac;
-+	if (len != ETH_ALEN) {
-+		kfree(mac);
-+		return ERR_PTR(-EINVAL);
-+	}
-+	return mac;
-+}
-+
-+static void *nvmem_cell_get_mac_address_ascii(struct nvmem_cell *cell)
-+{
-+	size_t len;
-+	int ret;
-+	void *mac_ascii;
-+	u8 *mac;
-+
-+	mac_ascii = nvmem_cell_read(cell, &len);
-+	if (IS_ERR(mac_ascii))
-+		return mac_ascii;
-+	if (len != ETH_ALEN*2+5) {
-+		kfree(mac_ascii);
-+		return ERR_PTR(-EINVAL);
-+	}
-+	mac = kmalloc(ETH_ALEN, GFP_KERNEL);
-+	if (!mac) {
-+		kfree(mac_ascii);
-+		return ERR_PTR(-ENOMEM);
-+	}
-+	ret = sscanf(mac_ascii, "%2hhx:%2hhx:%2hhx:%2hhx:%2hhx:%2hhx",
-+				&mac[0], &mac[1], &mac[2],
-+				&mac[3], &mac[4], &mac[5]);
-+	kfree(mac_ascii);
-+	if (ret == ETH_ALEN)
-+		return mac;
-+	kfree(mac);
-+	return ERR_PTR(-EINVAL);
-+}
-+
-+static struct nvmem_cell_mac_address_property {
-+	char *name;
-+	void *(*read)(struct nvmem_cell *);
-+} nvmem_cell_mac_address_properties[] = {
-+	{
-+		.name = "mac-address",
-+		.read = nvmem_cell_get_mac_address,
-+	}, {
-+		.name = "mac-address-ascii",
-+		.read = nvmem_cell_get_mac_address_ascii,
-+	},
-+};
-+
- static int of_get_mac_addr_nvmem(struct device_node *np, u8 *addr)
- {
- 	struct platform_device *pdev = of_find_device_by_node(np);
-+	struct nvmem_cell_mac_address_property *property;
- 	struct nvmem_cell *cell;
- 	const void *mac;
--	size_t len;
--	int ret;
-+	int ret, i;
- 
- 	/* Try lookup by device first, there might be a nvmem_cell_lookup
- 	 * associated with a given device.
-@@ -74,17 +131,26 @@ static int of_get_mac_addr_nvmem(struct
- 		return ret;
- 	}
- 
--	cell = of_nvmem_cell_get(np, "mac-address");
-+	for (i = 0; i < ARRAY_SIZE(nvmem_cell_mac_address_properties); i++) {
-+		property = &nvmem_cell_mac_address_properties[i];
-+		cell = of_nvmem_cell_get(np, property->name);
-+		/* For -EPROBE_DEFER don't try other properties.
-+		 * We'll get back to this one.
-+		 */
-+		if (!IS_ERR(cell) || PTR_ERR(cell) == -EPROBE_DEFER)
-+			break;
-+	}
-+
- 	if (IS_ERR(cell))
- 		return PTR_ERR(cell);
- 
--	mac = nvmem_cell_read(cell, &len);
-+	mac = property->read(cell);
- 	nvmem_cell_put(cell);
- 
- 	if (IS_ERR(mac))
- 		return PTR_ERR(mac);
- 
--	if (len != ETH_ALEN || !is_valid_ether_addr(mac)) {
-+	if (!is_valid_ether_addr(mac)) {
- 		kfree(mac);
- 		return -EINVAL;
- 	}
-- 
2.39.2



From yangshiji66 at outlook.com  Fri Nov 10 01:41:52 2023
From: yangshiji66 at outlook.com (Shiji Yang)
Date: Fri, 10 Nov 2023 17:41:52 +0800
Subject: [PATCH] kernel: of: add DT MAC address bitwise operation support
Message-ID: <TYAP286MB03156B011531AA32993867BEBCAEA@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM>

From: Shiji Yang <yangshiji66 at qq.com>

This patch allow user to perform basic bitwise clear/set operation on
OF DT MAC address. We use two new added dt-bindings to specific the
MAC address bits clear/set mask. "mac-address-bitwise-set" can be used
to set bit. And "mac-address-bitwise-clear" can be used to clear bit.

Signed-off-by: Shiji Yang <yangshiji66 at qq.com>
---

Hi!
This patch can benefit a lot of devices.

Git grep ref:

macaddr_setbit_la
https://git.openwrt.org/?p=openwrt%2Fopenwrt.git&a=search&h=HEAD&st=grep&s=macaddr_setbit_la&sr=1

macaddr_setbit
https://git.openwrt.org/?p=openwrt%2Fopenwrt.git&a=search&h=HEAD&st=grep&s=macaddr_setbit&sr=1

macaddr_unsetbit
https://git.openwrt.org/?p=openwrt%2Fopenwrt.git&a=search&h=HEAD&st=grep&s=macaddr_unsetbit&sr=1

If this hack/idea is unacceptable, please let me know. Thanks!

Regards,
Shiji Yang


 ...-cell-MAC-address-bitwise-operation-.patch | 101 ++++++++++++++++++
 ...-cell-MAC-address-bitwise-operation-.patch | 101 ++++++++++++++++++
 2 files changed, 202 insertions(+)
 create mode 100644 target/linux/generic/hack-5.15/686-of-net-add-NVMEM-cell-MAC-address-bitwise-operation-.patch
 create mode 100644 target/linux/generic/hack-6.1/686-of-net-add-NVMEM-cell-MAC-address-bitwise-operation-.patch

diff --git a/target/linux/generic/hack-5.15/686-of-net-add-NVMEM-cell-MAC-address-bitwise-operation-.patch b/target/linux/generic/hack-5.15/686-of-net-add-NVMEM-cell-MAC-address-bitwise-operation-.patch
new file mode 100644
index 0000000000..396eed8f4a
--- /dev/null
+++ b/target/linux/generic/hack-5.15/686-of-net-add-NVMEM-cell-MAC-address-bitwise-operation-.patch
@@ -0,0 +1,101 @@
+From: Shiji Yang <yangshiji66 at outlook.com>
+Date: Sun, 16 Jul 2023 21:00:15 +0800
+Subject: [PATCH] of: net: add DT MAC address bitwise operation support
+
+This patch allow user to perform basic bitwise clear/set operation on
+OF DT MAC address. We use two new added dt-bindings to specific the
+MAC address bits clear/set mask. "mac-address-bitwise-set" can be used
+to set bit. And "mac-address-bitwise-clear" can be used to clear bit.
+
+The "mac-address-bitwise-*" property consists of two 32-bit(4 Bytes)
+hexadecimal. The first hex number mask the Byte[1-2] and the second
+one mask the Byte[3-6]. Each MAC address bit corresponds to the unique
+mask bit. When setting mask bit to "1", OF driver will clear/set the
+corresponding MAC address bit.
+
+Sample MAC Address and Property Mask:
+AA: BB : CC : DD : EE : FF      -->  mask:  <0xAABB 0xCCDDEEFF>
+^         ^              ^
+Byte[1]   Byte[3]        Byte[6]
+
+Usage Example:
+Assuming the base MAC address is "00:11:22:33:44:55", and we have dts
+as follows. then the final MAC address should be "ff:11:22:33:44:66".
+
+0xff1122334466 = 0x001122334455 & (~0x0000000000ff) | 0xff0000000066
+
+&gmac0 {
+	nvmem-cells = <&macaddr_base>;
+	nvmem-cell-names = "mac-address";
+	mac-address-bitwise-clear = <0x0000 0x000000ff>;
+	mac-address-bitwise-set = <0xff00 0x00000066>;
+};
+
+Signed-off-by: Shiji Yang <yangshiji66 at outlook.com>
+---
+ net/core/of_net.c | 35 +++++++++++++++++++----------------
+ 1 file changed, 19 insertions(+), 16 deletions(-)
+
+--- a/net/core/of_net.c
++++ b/net/core/of_net.c
+@@ -154,17 +154,10 @@ free:
+ */
+ int of_get_mac_address(struct device_node *np, u8 *addr)
+ {
+-	u32 inc_idx, mac_inc, mac_val;
++	u32 inc_idx, mac_inc;
++	u64 mac_val, mac_msk;
+ 	int ret;
+ 
+-	/* Check first if the increment byte is present and valid.
+-	 * If not set assume to increment the last byte if found.
+-	 */
+-	if (of_property_read_u32(np, "mac-address-increment-byte", &inc_idx))
+-		inc_idx = 5;
+-	if (inc_idx < 3 || inc_idx > 5)
+-		return -EINVAL;
+-
+ 	if (!np)
+ 		return -ENODEV;
+ 
+@@ -185,16 +178,24 @@ int of_get_mac_address(struct device_nod
+ 		return ret;
+ 
+ found:
++	mac_val = ether_addr_to_u64(addr);
++
++	if (!of_property_read_u64(np, "mac-address-bitwise-clear", &mac_msk))
++		mac_val &= ~mac_msk;
++
++	if (!of_property_read_u64(np, "mac-address-bitwise-set", &mac_msk))
++		mac_val |= mac_msk;
++
+ 	if (!of_property_read_u32(np, "mac-address-increment", &mac_inc)) {
+-		/* Convert to a contiguous value */
+-		mac_val = (addr[3] << 16) + (addr[4] << 8) + addr[5];
++		/* Check first if the increment byte is present and valid.
++		 * If not set assume to increment the last byte if found.
++		 */
++		if (of_property_read_u32(np, "mac-address-increment-byte", &inc_idx))
++			inc_idx = 5;
++		if (inc_idx < 3 || inc_idx > 5)
++			return -EINVAL;
+ 		mac_val += mac_inc << 8 * (5-inc_idx);
+ 
+-		/* Apply the incremented value handling overflow case */
+-		addr[3] = (mac_val >> 16) & 0xff;
+-		addr[4] = (mac_val >> 8) & 0xff;
+-		addr[5] = (mac_val >> 0) & 0xff;
+-
+ 		/* Remove mac-address-increment and mac-address-increment-byte
+ 		 * DT property to make sure MAC address would not get incremented
+ 		 * more if this function is stared again. */
+@@ -202,6 +203,8 @@ found:
+ 		of_remove_property(np, of_find_property(np, "mac-address-increment-byte", NULL));
+ 	}
+ 
++	u64_to_ether_addr(mac_val, addr);
++
+ 	of_add_mac_address(np, addr);
+ 	return ret;
+ }
diff --git a/target/linux/generic/hack-6.1/686-of-net-add-NVMEM-cell-MAC-address-bitwise-operation-.patch b/target/linux/generic/hack-6.1/686-of-net-add-NVMEM-cell-MAC-address-bitwise-operation-.patch
new file mode 100644
index 0000000000..396eed8f4a
--- /dev/null
+++ b/target/linux/generic/hack-6.1/686-of-net-add-NVMEM-cell-MAC-address-bitwise-operation-.patch
@@ -0,0 +1,101 @@
+From: Shiji Yang <yangshiji66 at outlook.com>
+Date: Sun, 16 Jul 2023 21:00:15 +0800
+Subject: [PATCH] of: net: add DT MAC address bitwise operation support
+
+This patch allow user to perform basic bitwise clear/set operation on
+OF DT MAC address. We use two new added dt-bindings to specific the
+MAC address bits clear/set mask. "mac-address-bitwise-set" can be used
+to set bit. And "mac-address-bitwise-clear" can be used to clear bit.
+
+The "mac-address-bitwise-*" property consists of two 32-bit(4 Bytes)
+hexadecimal. The first hex number mask the Byte[1-2] and the second
+one mask the Byte[3-6]. Each MAC address bit corresponds to the unique
+mask bit. When setting mask bit to "1", OF driver will clear/set the
+corresponding MAC address bit.
+
+Sample MAC Address and Property Mask:
+AA: BB : CC : DD : EE : FF      -->  mask:  <0xAABB 0xCCDDEEFF>
+^         ^              ^
+Byte[1]   Byte[3]        Byte[6]
+
+Usage Example:
+Assuming the base MAC address is "00:11:22:33:44:55", and we have dts
+as follows. then the final MAC address should be "ff:11:22:33:44:66".
+
+0xff1122334466 = 0x001122334455 & (~0x0000000000ff) | 0xff0000000066
+
+&gmac0 {
+	nvmem-cells = <&macaddr_base>;
+	nvmem-cell-names = "mac-address";
+	mac-address-bitwise-clear = <0x0000 0x000000ff>;
+	mac-address-bitwise-set = <0xff00 0x00000066>;
+};
+
+Signed-off-by: Shiji Yang <yangshiji66 at outlook.com>
+---
+ net/core/of_net.c | 35 +++++++++++++++++++----------------
+ 1 file changed, 19 insertions(+), 16 deletions(-)
+
+--- a/net/core/of_net.c
++++ b/net/core/of_net.c
+@@ -154,17 +154,10 @@ free:
+ */
+ int of_get_mac_address(struct device_node *np, u8 *addr)
+ {
+-	u32 inc_idx, mac_inc, mac_val;
++	u32 inc_idx, mac_inc;
++	u64 mac_val, mac_msk;
+ 	int ret;
+ 
+-	/* Check first if the increment byte is present and valid.
+-	 * If not set assume to increment the last byte if found.
+-	 */
+-	if (of_property_read_u32(np, "mac-address-increment-byte", &inc_idx))
+-		inc_idx = 5;
+-	if (inc_idx < 3 || inc_idx > 5)
+-		return -EINVAL;
+-
+ 	if (!np)
+ 		return -ENODEV;
+ 
+@@ -185,16 +178,24 @@ int of_get_mac_address(struct device_nod
+ 		return ret;
+ 
+ found:
++	mac_val = ether_addr_to_u64(addr);
++
++	if (!of_property_read_u64(np, "mac-address-bitwise-clear", &mac_msk))
++		mac_val &= ~mac_msk;
++
++	if (!of_property_read_u64(np, "mac-address-bitwise-set", &mac_msk))
++		mac_val |= mac_msk;
++
+ 	if (!of_property_read_u32(np, "mac-address-increment", &mac_inc)) {
+-		/* Convert to a contiguous value */
+-		mac_val = (addr[3] << 16) + (addr[4] << 8) + addr[5];
++		/* Check first if the increment byte is present and valid.
++		 * If not set assume to increment the last byte if found.
++		 */
++		if (of_property_read_u32(np, "mac-address-increment-byte", &inc_idx))
++			inc_idx = 5;
++		if (inc_idx < 3 || inc_idx > 5)
++			return -EINVAL;
+ 		mac_val += mac_inc << 8 * (5-inc_idx);
+ 
+-		/* Apply the incremented value handling overflow case */
+-		addr[3] = (mac_val >> 16) & 0xff;
+-		addr[4] = (mac_val >> 8) & 0xff;
+-		addr[5] = (mac_val >> 0) & 0xff;
+-
+ 		/* Remove mac-address-increment and mac-address-increment-byte
+ 		 * DT property to make sure MAC address would not get incremented
+ 		 * more if this function is stared again. */
+@@ -202,6 +203,8 @@ found:
+ 		of_remove_property(np, of_find_property(np, "mac-address-increment-byte", NULL));
+ 	}
+ 
++	u64_to_ether_addr(mac_val, addr);
++
+ 	of_add_mac_address(np, addr);
+ 	return ret;
+ }
-- 
2.39.2



From rafal at milecki.pl  Fri Nov 10 01:46:40 2023
From: rafal at milecki.pl (=?UTF-8?Q?Rafa=C5=82_Mi=C5=82ecki?=)
Date: Fri, 10 Nov 2023 10:46:40 +0100
Subject: [PATCH] kernel: of: remove "mac-address-ascii" support hack
In-Reply-To: <TYAP286MB0315EF15FE28164766E59A35BCAEA@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM>
References: <TYAP286MB0315EF15FE28164766E59A35BCAEA@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM>
Message-ID: <13a33cd3ced769f4a504fcf13c7bc6d0@milecki.pl>

On 2023-11-10 10:28, Shiji Yang wrote:
> From: Shiji Yang <yangshiji66 at qq.com>
> 
> ASCII MAC address can be handled by nvmem "fixed-layout" now. And all
> related devices were converted to the new "mac-base" layout format.
> It's time to remove this hack.

Oh, I was hoping for that for a long time. Looks great.

-- 
Rafa? Mi?ecki


From rafal at milecki.pl  Fri Nov 10 01:55:49 2023
From: rafal at milecki.pl (=?UTF-8?Q?Rafa=C5=82_Mi=C5=82ecki?=)
Date: Fri, 10 Nov 2023 10:55:49 +0100
Subject: [PATCH] kernel: of: add DT MAC address bitwise operation support
In-Reply-To: <TYAP286MB03156B011531AA32993867BEBCAEA@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM>
References: <TYAP286MB03156B011531AA32993867BEBCAEA@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM>
Message-ID: <40a28d93b758c2dace144d5e78c43c19@milecki.pl>

On 2023-11-10 10:41, Shiji Yang wrote:
> From: Shiji Yang <yangshiji66 at qq.com>
> 
> This patch allow user to perform basic bitwise clear/set operation on
> OF DT MAC address. We use two new added dt-bindings to specific the
> MAC address bits clear/set mask. "mac-address-bitwise-set" can be used
> to set bit. And "mac-address-bitwise-clear" can be used to clear bit.

I'd like this binding to be documented and send upstream for a review.

I know 804-nvmem-core-support-mac-base-fixed-layout-cells.patch is still
not upstreamed and I'm not proud of it (I'm waiting for upstream NVMEM
layouts reword). Still we have an /official/ "mac-base" binding at
least. I'd be nice to have DT guys opinion on binding like this.

-- 
Rafa? Mi?ecki


From zajec5 at gmail.com  Fri Nov 10 02:25:05 2023
From: zajec5 at gmail.com (=?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?=)
Date: Fri, 10 Nov 2023 11:25:05 +0100
Subject: [PATCH] ath79: use "fixed-layout" for Embedded Wireless devices
Message-ID: <20231110102505.24322-1-zajec5@gmail.com>

From: Rafa? Mi?ecki <rafal at milecki.pl>

Those devices have Ethernet interfaces using base MAC address increased
by 0x40 in the 3rd indexed byte (00:00:00:FF:00:00). To describe that we
were using a custom (downstream) "mac-address-increment-byte" property.

The same result can be achieved by using "mac-base" with a properly
adjusted offset value (0x40 << 16). It may be not pretty but it should
work without custom property or downstream kernel patch to support it.

Cc: Ansuel Smith <ansuelsmth at gmail.com>
Cc: Catrinel Catrinescu <cc at 80211.de>
Cc: Felix Fietkau <nbd at nbd.name>
Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
---
 .../dts/ar9331_embeddedwireless_dorin.dts     | 26 ++++++++--------
 .../dts/ar9344_embeddedwireless_balin.dts     | 30 ++++++++++---------
 2 files changed, 29 insertions(+), 27 deletions(-)

diff --git a/target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts b/target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts
index de6b709b5c..6286f203ef 100644
--- a/target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts
+++ b/target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts
@@ -85,6 +85,18 @@
 				label = "art";
 				reg = <0xff0000 0x010000>;
 				read-only;
+
+				nvmem-layout {
+					compatible = "fixed-layout";
+					#address-cells = <1>;
+					#size-cells = <1>;
+
+					macaddr_art_1002: macaddr at 1002 {
+						compatible = "mac-base";
+						reg = <0x1002 0x6>;
+						#nvmem-cell-cells = <1>;
+					};
+				};
 			};
 		};
 	};
@@ -93,10 +105,8 @@
 &eth1 {
 	status = "okay";
 
-	nvmem-cells = <&macaddr_art_1002>;
+	nvmem-cells = <&macaddr_art_1002 0x400000>;
 	nvmem-cell-names = "mac-address";
-	mac-address-increment-byte = <3>;
-	mac-address-increment = <0x40>;
 };
 
 &mdio1 {
@@ -108,13 +118,3 @@
 
 	mtd-cal-data = <&art 0x1000>;
 };
-
-&art {
-	compatible = "nvmem-cells";
-	#address-cells = <1>;
-	#size-cells = <1>;
-
-	macaddr_art_1002: macaddr at 1002 {
-		reg = <0x1002 0x6>;
-	};
-};
diff --git a/target/linux/ath79/dts/ar9344_embeddedwireless_balin.dts b/target/linux/ath79/dts/ar9344_embeddedwireless_balin.dts
index a84c273f86..de13865818 100644
--- a/target/linux/ath79/dts/ar9344_embeddedwireless_balin.dts
+++ b/target/linux/ath79/dts/ar9344_embeddedwireless_balin.dts
@@ -83,16 +83,20 @@
 				reg = <0xff0000 0x010000>;
 				read-only;
 
-				compatible = "nvmem-cells";
-				#address-cells = <1>;
-				#size-cells = <1>;
-
-				calibration_art_1000: calibration_data at 1000 {
-					reg = <0x1000 0x440>;
-				};
-
-				macaddr_art_1002: macaddr at 1002 {
-					reg = <0x1002 0x6>;
+				nvmem-layout {
+					compatible = "fixed-layout";
+					#address-cells = <1>;
+					#size-cells = <1>;
+
+					calibration_art_1000: calibration_data at 1000 {
+						reg = <0x1000 0x440>;
+					};
+
+					macaddr_art_1002: macaddr at 1002 {
+						compatible = "mac-base";
+						reg = <0x1002 0x6>;
+						#nvmem-cell-cells = <1>;
+					};
 				};
 			};
 		};
@@ -106,10 +110,8 @@
 &eth1 {
 	status = "okay";
 
-	nvmem-cells = <&macaddr_art_1002>;
+	nvmem-cells = <&macaddr_art_1002 0x400000>;
 	nvmem-cell-names = "mac-address";
-	mac-address-increment-byte = <3>;
-	mac-address-increment = <0x40>;
 
 	gmac-config {
 		device = <&gmac>;
@@ -121,7 +123,7 @@
 &wmac {
 	status = "okay";
 
-	nvmem-cells = <&macaddr_art_1002>, <&calibration_art_1000>;
+	nvmem-cells = <&macaddr_art_1002 0>, <&calibration_art_1000>;
 	nvmem-cell-names = "mac-address", "calibration";
 };
 
-- 
2.35.3



From yangshiji66 at outlook.com  Fri Nov 10 04:28:43 2023
From: yangshiji66 at outlook.com (Shiji Yang)
Date: Fri, 10 Nov 2023 20:28:43 +0800
Subject: [PATCH] kernel: of: add DT MAC address bitwise operation support
In-Reply-To: <TYAP286MB03156B011531AA32993867BEBCAEA@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM>
References: <TYAP286MB03156B011531AA32993867BEBCAEA@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM>
Message-ID: <OSYP286MB0312B727A9DDB794D590887DBCAEA@OSYP286MB0312.JPNP286.PROD.OUTLOOK.COM>

On Nov. 10, 2023, 9:46 a.m., Rafa? Mi?ecki wrote:

>On 2023-11-10 10:41, Shiji Yang wrote:
>> From: Shiji Yang <yangshiji66 at qq.com>
>> 
>> This patch allow user to perform basic bitwise clear/set operation on
>> OF DT MAC address. We use two new added dt-bindings to specific the
>> MAC address bits clear/set mask. "mac-address-bitwise-set" can be used
>> to set bit. And "mac-address-bitwise-clear" can be used to clear bit.
>
>I'd like this binding to be documented and send upstream for a review.
>
>I know 804-nvmem-core-support-mac-base-fixed-layout-cells.patch is still
>not upstreamed and I'm not proud of it (I'm waiting for upstream NVMEM
>layouts reword). Still we have an /official/ "mac-base" binding at
>least. I'd be nice to have DT guys opinion on binding like this.
>
>-- 
>Rafa? Mi?ecki

Hi!

Thanks for your reply. I'll try to rework and send it upstream when
I have time. Feel free to remove this patch from the patchwork.

Regards,
Shiji Yang


From nbd at nbd.name  Fri Nov 10 04:59:15 2023
From: nbd at nbd.name (Felix Fietkau)
Date: Fri, 10 Nov 2023 13:59:15 +0100
Subject: netifd issue
In-Reply-To: <27f397fb-02b1-4dd6-82f4-f05be790dce2@iki.fi>
References: <69ba7ef4-420c-49fb-992f-7f5adfb9ee7a@gmail.com>
 <27f397fb-02b1-4dd6-82f4-f05be790dce2@iki.fi>
Message-ID: <200a6514-7179-49b0-aefd-cb3d59f78168@nbd.name>

On 09.11.23 22:31, Hannu Nyman wrote:
> e9hack kirjoitti 9.11.2023 klo 17.32:
>> I face a strange behaviour since commit 
>> 516ab774cc16d4b04b3b17a067cbf2649f1adaeb (system-linux: fix race condition 
>> on bringing up wireless devices). After a reboot or a full restart of 
>> hostapd via 'wifi down; sleep 30; killall hostapd; sleep 5; wifi', only the 
>> first of 3 5G AP's is join to the configured bridge. The two faulty AP's 
>> are up and connecting is possible, but there is no real network connection. 
>> If I change one parameter of the faulty AP's in the config file and do a 
>> 'wifi reload', than the 2 AP's are join to the bridges.
>>
>> ...
>>
>> If I change the sequence of the 5G AP's in the config file, the behaviour 
>> after reboot doesn't change. Only phy1-ap0 does join to the bridge, either 
>> to br-lan or to br-tor. The previous netifd commit 
>> 40ed7363caf2b22b6e29ed9d9948189c2bc4c8f3 (device: fix build error on 32 bit 
>> systems) doesn't have this issue.
> 
> 
> I see the same error.
> Some APs do not initially join the bridge, but after making a small pointless
> edit to the AP's config in /etc/config/wireless and reloading wifi, the AP
> then joins the bridge.
> 
> 
>   ?OpenWrt SNAPSHOT, r24331-168beef1dd
>   ?-----------------------------------------------------
> root at router4:~# brctl show
> bridge name???? bridge id?????????????? STP enabled???? interfaces
> br-lan????????? 7fff.c4411ef8a51f?????? no????????????? lan4
>   ??????????????????????????????????????????????????????? lan2
>   ??????????????????????????????????????????????????????? hn5wpa3
>   ??????????????????????????????????????????????????????? lan3
>   ??????????????????????????????????????????????????????? lan1
> root at router4:~# nano /etc/config/wireless
> root at router4:~# wifi reload
> root at router4:~# brctl show
> bridge name???? bridge id?????????????? STP enabled???? interfaces
> br-lan????????? 7fff.c4411ef8a51f?????? no????????????? lan4
>   ??????????????????????????????????????????????????????? hn5wpa2r
>   ??????????????????????????????????????????????????????? lan2
>   ??????????????????????????????????????????????????????? hn5wpa3
>   ??????????????????????????????????????????????????????? lan3
>   ??????????????????????????????????????????????????????? lan1

I think I found the cause of this regression while looking at the code 
again. It seems that the hotplug-added devices are removed too early 
based on DEV_EVENT_REMOVE events.
Please try this fix: https://nbd.name/p/2791d8d4

Thanks,

- Felix



From nbd at nbd.name  Fri Nov 10 05:13:11 2023
From: nbd at nbd.name (Felix Fietkau)
Date: Fri, 10 Nov 2023 14:13:11 +0100
Subject: netifd issue
In-Reply-To: <200a6514-7179-49b0-aefd-cb3d59f78168@nbd.name>
References: <69ba7ef4-420c-49fb-992f-7f5adfb9ee7a@gmail.com>
 <27f397fb-02b1-4dd6-82f4-f05be790dce2@iki.fi>
 <200a6514-7179-49b0-aefd-cb3d59f78168@nbd.name>
Message-ID: <3aa57df8-3055-443a-b80f-af5876dbbffc@nbd.name>

On 10.11.23 13:59, Felix Fietkau wrote:
> On 09.11.23 22:31, Hannu Nyman wrote:
>> e9hack kirjoitti 9.11.2023 klo 17.32:
>>> I face a strange behaviour since commit 
>>> 516ab774cc16d4b04b3b17a067cbf2649f1adaeb (system-linux: fix race condition 
>>> on bringing up wireless devices). After a reboot or a full restart of 
>>> hostapd via 'wifi down; sleep 30; killall hostapd; sleep 5; wifi', only the 
>>> first of 3 5G AP's is join to the configured bridge. The two faulty AP's 
>>> are up and connecting is possible, but there is no real network connection. 
>>> If I change one parameter of the faulty AP's in the config file and do a 
>>> 'wifi reload', than the 2 AP's are join to the bridges.
>>>
>>> ...
>>>
>>> If I change the sequence of the 5G AP's in the config file, the behaviour 
>>> after reboot doesn't change. Only phy1-ap0 does join to the bridge, either 
>>> to br-lan or to br-tor. The previous netifd commit 
>>> 40ed7363caf2b22b6e29ed9d9948189c2bc4c8f3 (device: fix build error on 32 bit 
>>> systems) doesn't have this issue.
>> 
>> 
>> I see the same error.
>> Some APs do not initially join the bridge, but after making a small pointless
>> edit to the AP's config in /etc/config/wireless and reloading wifi, the AP
>> then joins the bridge.
>> 
>> 
>>   ?OpenWrt SNAPSHOT, r24331-168beef1dd
>>   ?-----------------------------------------------------
>> root at router4:~# brctl show
>> bridge name???? bridge id?????????????? STP enabled???? interfaces
>> br-lan????????? 7fff.c4411ef8a51f?????? no????????????? lan4
>>   ??????????????????????????????????????????????????????? lan2
>>   ??????????????????????????????????????????????????????? hn5wpa3
>>   ??????????????????????????????????????????????????????? lan3
>>   ??????????????????????????????????????????????????????? lan1
>> root at router4:~# nano /etc/config/wireless
>> root at router4:~# wifi reload
>> root at router4:~# brctl show
>> bridge name???? bridge id?????????????? STP enabled???? interfaces
>> br-lan????????? 7fff.c4411ef8a51f?????? no????????????? lan4
>>   ??????????????????????????????????????????????????????? hn5wpa2r
>>   ??????????????????????????????????????????????????????? lan2
>>   ??????????????????????????????????????????????????????? hn5wpa3
>>   ??????????????????????????????????????????????????????? lan3
>>   ??????????????????????????????????????????????????????? lan1
> 
> I think I found the cause of this regression while looking at the code
> again. It seems that the hotplug-added devices are removed too early
> based on DEV_EVENT_REMOVE events.
> Please try this fix: https://nbd.name/p/2791d8d4
Sorry, the last patch was incomplete. Here is the correct version:
https://nbd.name/p/8a6bc06b

Thanks,

- Felix



From cc at 80211.de  Fri Nov 10 05:28:44 2023
From: cc at 80211.de (Catrinel Catrinescu)
Date: Fri, 10 Nov 2023 13:28:44 +0000
Subject: Approved  RE: [PATCH] ath79: use "fixed-layout" for Embedded Wireless
 devices
In-Reply-To: <20231110102505.24322-1-zajec5@gmail.com>
References: <20231110102505.24322-1-zajec5@gmail.com>
Message-ID: <AM6PR03MB383274226AF510902A71C309EFAEA@AM6PR03MB3832.eurprd03.prod.outlook.com>

Hi Rafal

Your patches for our Dorin & Balin modules are good, many thanks.
You can push the patches upstream.


Best regards & have a nice weekend
Catrinel


-----Original Message-----
From: Rafa? Mi?ecki <zajec5 at gmail.com> 
Sent: Friday, 10 November 2023 11:25
To: openwrt-devel at lists.openwrt.org
Cc: yangshiji66 at outlook.com; Hauke Mehrtens <hauke at hauke-m.de>; Rafa? Mi?ecki <rafal at milecki.pl>; Ansuel Smith <ansuelsmth at gmail.com>; Catrinel Catrinescu <cc at 80211.de>; Felix Fietkau <nbd at nbd.name>
Subject: [PATCH] ath79: use "fixed-layout" for Embedded Wireless devices

From: Rafa? Mi?ecki <rafal at milecki.pl>

Those devices have Ethernet interfaces using base MAC address increased by 0x40 in the 3rd indexed byte (00:00:00:FF:00:00). To describe that we were using a custom (downstream) "mac-address-increment-byte" property.

The same result can be achieved by using "mac-base" with a properly adjusted offset value (0x40 << 16). It may be not pretty but it should work without custom property or downstream kernel patch to support it.

Cc: Ansuel Smith <ansuelsmth at gmail.com>
Cc: Catrinel Catrinescu <cc at 80211.de>
Cc: Felix Fietkau <nbd at nbd.name>
Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
---
 .../dts/ar9331_embeddedwireless_dorin.dts     | 26 ++++++++--------
 .../dts/ar9344_embeddedwireless_balin.dts     | 30 ++++++++++---------
 2 files changed, 29 insertions(+), 27 deletions(-)

diff --git a/target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts b/target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts
index de6b709b5c..6286f203ef 100644
--- a/target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts
+++ b/target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts
@@ -85,6 +85,18 @@
 				label = "art";
 				reg = <0xff0000 0x010000>;
 				read-only;
+
+				nvmem-layout {
+					compatible = "fixed-layout";
+					#address-cells = <1>;
+					#size-cells = <1>;
+
+					macaddr_art_1002: macaddr at 1002 {
+						compatible = "mac-base";
+						reg = <0x1002 0x6>;
+						#nvmem-cell-cells = <1>;
+					};
+				};
 			};
 		};
 	};
@@ -93,10 +105,8 @@
 &eth1 {
 	status = "okay";
 
-	nvmem-cells = <&macaddr_art_1002>;
+	nvmem-cells = <&macaddr_art_1002 0x400000>;
 	nvmem-cell-names = "mac-address";
-	mac-address-increment-byte = <3>;
-	mac-address-increment = <0x40>;
 };
 
 &mdio1 {
@@ -108,13 +118,3 @@
 
 	mtd-cal-data = <&art 0x1000>;
 };
-
-&art {
-	compatible = "nvmem-cells";
-	#address-cells = <1>;
-	#size-cells = <1>;
-
-	macaddr_art_1002: macaddr at 1002 {
-		reg = <0x1002 0x6>;
-	};
-};
diff --git a/target/linux/ath79/dts/ar9344_embeddedwireless_balin.dts b/target/linux/ath79/dts/ar9344_embeddedwireless_balin.dts
index a84c273f86..de13865818 100644
--- a/target/linux/ath79/dts/ar9344_embeddedwireless_balin.dts
+++ b/target/linux/ath79/dts/ar9344_embeddedwireless_balin.dts
@@ -83,16 +83,20 @@
 				reg = <0xff0000 0x010000>;
 				read-only;
 
-				compatible = "nvmem-cells";
-				#address-cells = <1>;
-				#size-cells = <1>;
-
-				calibration_art_1000: calibration_data at 1000 {
-					reg = <0x1000 0x440>;
-				};
-
-				macaddr_art_1002: macaddr at 1002 {
-					reg = <0x1002 0x6>;
+				nvmem-layout {
+					compatible = "fixed-layout";
+					#address-cells = <1>;
+					#size-cells = <1>;
+
+					calibration_art_1000: calibration_data at 1000 {
+						reg = <0x1000 0x440>;
+					};
+
+					macaddr_art_1002: macaddr at 1002 {
+						compatible = "mac-base";
+						reg = <0x1002 0x6>;
+						#nvmem-cell-cells = <1>;
+					};
 				};
 			};
 		};
@@ -106,10 +110,8 @@
 &eth1 {
 	status = "okay";
 
-	nvmem-cells = <&macaddr_art_1002>;
+	nvmem-cells = <&macaddr_art_1002 0x400000>;
 	nvmem-cell-names = "mac-address";
-	mac-address-increment-byte = <3>;
-	mac-address-increment = <0x40>;
 
 	gmac-config {
 		device = <&gmac>;
@@ -121,7 +123,7 @@
 &wmac {
 	status = "okay";
 
-	nvmem-cells = <&macaddr_art_1002>, <&calibration_art_1000>;
+	nvmem-cells = <&macaddr_art_1002 0>, <&calibration_art_1000>;
 	nvmem-cell-names = "mac-address", "calibration";  };
 
--
2.35.3


From e9hack at gmail.com  Fri Nov 10 06:09:47 2023
From: e9hack at gmail.com (e9hack)
Date: Fri, 10 Nov 2023 15:09:47 +0100
Subject: netifd issue
In-Reply-To: <3aa57df8-3055-443a-b80f-af5876dbbffc@nbd.name>
References: <69ba7ef4-420c-49fb-992f-7f5adfb9ee7a@gmail.com>
 <27f397fb-02b1-4dd6-82f4-f05be790dce2@iki.fi>
 <200a6514-7179-49b0-aefd-cb3d59f78168@nbd.name>
 <3aa57df8-3055-443a-b80f-af5876dbbffc@nbd.name>
Message-ID: <b69b1891-9518-47e5-9337-f89ba262e6fb@gmail.com>

Sorry, but it doesn't solve the issue.

Regards,
Hartmut

Am 10.11.2023 um 14:13 schrieb Felix Fietkau:
>> I think I found the cause of this regression while looking at the code
>> again. It seems that the hotplug-added devices are removed too early
>> based on DEV_EVENT_REMOVE events.
>> Please try this fix: https://nbd.name/p/2791d8d4
> Sorry, the last patch was incomplete. Here is the correct version:
> https://nbd.name/p/8a6bc06b
> 
> Thanks,
> 
> - Felix
> 



From e9hack at gmail.com  Fri Nov 10 06:21:09 2023
From: e9hack at gmail.com (e9hack)
Date: Fri, 10 Nov 2023 15:21:09 +0100
Subject: netifd issue
In-Reply-To: <b69b1891-9518-47e5-9337-f89ba262e6fb@gmail.com>
References: <69ba7ef4-420c-49fb-992f-7f5adfb9ee7a@gmail.com>
 <27f397fb-02b1-4dd6-82f4-f05be790dce2@iki.fi>
 <200a6514-7179-49b0-aefd-cb3d59f78168@nbd.name>
 <3aa57df8-3055-443a-b80f-af5876dbbffc@nbd.name>
 <b69b1891-9518-47e5-9337-f89ba262e6fb@gmail.com>
Message-ID: <425b6bdb-5c1d-4a19-803e-32538168308a@gmail.com>

Too fast. I did reboot with the old version again. The patched version does work.

Sorry!

Regards,
Hartmut

Am 10.11.2023 um 15:09 schrieb e9hack:
> Sorry, but it doesn't solve the issue.
> 
> Regards,
> Hartmut
> 
> Am 10.11.2023 um 14:13 schrieb Felix Fietkau:
>>> I think I found the cause of this regression while looking at the code
>>> again. It seems that the hotplug-added devices are removed too early
>>> based on DEV_EVENT_REMOVE events.
>>> Please try this fix: https://nbd.name/p/2791d8d4
>> Sorry, the last patch was incomplete. Here is the correct version:
>> https://nbd.name/p/8a6bc06b
>>
>> Thanks,
>>
>> - Felix
>>
> 



From nbd at nbd.name  Fri Nov 10 06:38:53 2023
From: nbd at nbd.name (Felix Fietkau)
Date: Fri, 10 Nov 2023 15:38:53 +0100
Subject: netifd issue
In-Reply-To: <425b6bdb-5c1d-4a19-803e-32538168308a@gmail.com>
References: <69ba7ef4-420c-49fb-992f-7f5adfb9ee7a@gmail.com>
 <27f397fb-02b1-4dd6-82f4-f05be790dce2@iki.fi>
 <200a6514-7179-49b0-aefd-cb3d59f78168@nbd.name>
 <3aa57df8-3055-443a-b80f-af5876dbbffc@nbd.name>
 <b69b1891-9518-47e5-9337-f89ba262e6fb@gmail.com>
 <425b6bdb-5c1d-4a19-803e-32538168308a@gmail.com>
Message-ID: <d45e532a-f809-4170-90c2-2e4907baa526@nbd.name>

On 10.11.23 15:21, e9hack wrote:
> Too fast. I did reboot with the old version again. The patched version does work.

Fix pushed, thanks for testing!

- Felix



From hannu.nyman at iki.fi  Sat Nov 11 00:54:32 2023
From: hannu.nyman at iki.fi (Hannu Nyman)
Date: Sat, 11 Nov 2023 10:54:32 +0200
Subject: netifd issue
In-Reply-To: <d45e532a-f809-4170-90c2-2e4907baa526@nbd.name>
References: <69ba7ef4-420c-49fb-992f-7f5adfb9ee7a@gmail.com>
 <27f397fb-02b1-4dd6-82f4-f05be790dce2@iki.fi>
 <200a6514-7179-49b0-aefd-cb3d59f78168@nbd.name>
 <3aa57df8-3055-443a-b80f-af5876dbbffc@nbd.name>
 <b69b1891-9518-47e5-9337-f89ba262e6fb@gmail.com>
 <425b6bdb-5c1d-4a19-803e-32538168308a@gmail.com>
 <d45e532a-f809-4170-90c2-2e4907baa526@nbd.name>
Message-ID: <dd2d52da-faee-4499-96bc-4ea18f024e10@iki.fi>

Felix Fietkau kirjoitti 10.11.2023 klo 16.38:
> On 10.11.23 15:21, e9hack wrote:
>> Too fast. I did reboot with the old version again. The patched version 
>> does work.
>
> Fix pushed, thanks for testing!
>
> - Felix
>

Thanks,

I tested the current netifd with the fix, and it seems to work ok, again.

Please remember to backport the fixed netifd to 23.05, as currently 23.05 has 
the faulty version.


Hannu




From hauke at hauke-m.de  Sat Nov 11 13:32:43 2023
From: hauke at hauke-m.de (Hauke Mehrtens)
Date: Sat, 11 Nov 2023 22:32:43 +0100
Subject: [PATCH ustream-ssl 2/2] cmake: Fail if undefined symbols are used
In-Reply-To: <20231111213243.3338889-1-hauke@hauke-m.de>
References: <20231111213243.3338889-1-hauke@hauke-m.de>
Message-ID: <20231111213243.3338889-2-hauke@hauke-m.de>

Make the linking of the shared library fail when undefined symbols are
used. Linking undefined symbols in a shared library normally works and
the linking of the binary using the shared library fails. We also
compile some example applications and they failed already.

Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 CMakeLists.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2de6590..f4dca0d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,6 +10,7 @@ ENDIF()
 ADD_DEFINITIONS(-Wno-unused-parameter -Wmissing-declarations)
 
 SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
+SET(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined")
 
 IF(MBEDTLS)
   ADD_DEFINITIONS(-DHAVE_MBEDTLS)
-- 
2.39.2



From hauke at hauke-m.de  Sat Nov 11 13:32:42 2023
From: hauke at hauke-m.de (Hauke Mehrtens)
Date: Sat, 11 Nov 2023 22:32:42 +0100
Subject: [PATCH ustream-ssl 1/2] ustream-mbedtls: Add compatibility with Mbed TLS 3.0.0
Message-ID: <20231111213243.3338889-1-hauke@hauke-m.de>

This adds support for compiling the code against Mbed TLS 3.0.0.
It still compiles against Mbed TLS 2.28.

The following changes were needed:
 * DES and 3DES was removed
 * mbedtls_pk_context->pk_info is private, use mbedtls_pk_get_type()
   to check if it was initialized
 * mbedtls_pk_parse_keyfile() now gets a random callback
 * mbedtls/certs.h contains test data and is not installed any more and
   not needed.

Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 ustream-mbedtls.c | 12 +++++++++++-
 ustream-mbedtls.h |  1 -
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/ustream-mbedtls.c b/ustream-mbedtls.c
index 7fc7874..1c70cac 100644
--- a/ustream-mbedtls.c
+++ b/ustream-mbedtls.c
@@ -110,9 +110,15 @@ static const int default_ciphersuites_client[] =
 	AES_CBC_CIPHERS(ECDHE_ECDSA),
 	AES_CBC_CIPHERS(ECDHE_RSA),
 	AES_CBC_CIPHERS(DHE_RSA),
+/* Removed in Mbed TLS 3.0.0 */
+#ifdef MBEDTLS_TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA
 	MBEDTLS_TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA,
+#endif
 	AES_CIPHERS(RSA),
+/* Removed in Mbed TLS 3.0.0 */
+#ifdef MBEDTLS_TLS_RSA_WITH_3DES_EDE_CBC_SHA
 	MBEDTLS_TLS_RSA_WITH_3DES_EDE_CBC_SHA,
+#endif
 	0
 };
 
@@ -171,7 +177,7 @@ static void ustream_ssl_update_own_cert(struct ustream_ssl_ctx *ctx)
 	if (!ctx->cert.version)
 		return;
 
-	if (!ctx->key.pk_info)
+	if (mbedtls_pk_get_type(&ctx->key) == MBEDTLS_PK_NONE)
 		return;
 
 	mbedtls_ssl_conf_own_cert(&ctx->conf, &ctx->cert, &ctx->key);
@@ -206,7 +212,11 @@ __hidden int __ustream_ssl_set_key_file(struct ustream_ssl_ctx *ctx, const char
 {
 	int ret;
 
+#if (MBEDTLS_VERSION_NUMBER >= 0x03000000)
+	ret = mbedtls_pk_parse_keyfile(&ctx->key, file, NULL, _random, NULL);
+#else
 	ret = mbedtls_pk_parse_keyfile(&ctx->key, file, NULL);
+#endif
 	if (ret)
 		return -1;
 
diff --git a/ustream-mbedtls.h b/ustream-mbedtls.h
index e622e5e..7e7c699 100644
--- a/ustream-mbedtls.h
+++ b/ustream-mbedtls.h
@@ -21,7 +21,6 @@
 
 #include <mbedtls/net_sockets.h>
 #include <mbedtls/ssl.h>
-#include <mbedtls/certs.h>
 #include <mbedtls/x509.h>
 #include <mbedtls/rsa.h>
 #include <mbedtls/error.h>
-- 
2.39.2



From linus.walleij at linaro.org  Sat Nov 11 14:02:19 2023
From: linus.walleij at linaro.org (Linus Walleij)
Date: Sat, 11 Nov 2023 23:02:19 +0100
Subject: [PATCH 0/2] Enable USB serial console on the D-Link DNS-313
Message-ID: <20231111-dns313-usb-serial-v1-0-6402033bcdfb@linaro.org>

This patch set makes it possible to plug in a USB cable
into the device USB B receptacle on the DNS-313 and
it will appear as /dev/ttyACM0 on the host and there will
be a serial console on it, at 115200 baud.

This is useful for users who don't like to solder in
their device to get a serial console.

The custom inittab is a bit ugly, but I've seen that this
seems to be what other devices do, other ideas welcome.

Signed-off-by: Linus Walleij <linus.walleij at linaro.org>
---
Linus Walleij (2):
      kernel: usb: Autoprobe g_serial
      gemini: Activate serial USB console on the DNS-313

 package/kernel/linux/modules/usb.mk        | 2 +-
 target/linux/gemini/Makefile               | 2 +-
 target/linux/gemini/base-files/etc/inittab | 4 ++++
 target/linux/gemini/image/Makefile         | 2 +-
 4 files changed, 7 insertions(+), 3 deletions(-)
---
base-commit: b7cf706539eb3a788441c8a8debaa8c36e5c54cf
change-id: 20231111-dns313-usb-serial-b9ac47e3a27e

Best regards,
-- 
Linus Walleij <linus.walleij at linaro.org>



From linus.walleij at linaro.org  Sat Nov 11 14:02:21 2023
From: linus.walleij at linaro.org (Linus Walleij)
Date: Sat, 11 Nov 2023 23:02:21 +0100
Subject: [PATCH 2/2] gemini: Activate serial USB console on the DNS-313
In-Reply-To: <20231111-dns313-usb-serial-v1-0-6402033bcdfb@linaro.org>
References: <20231111-dns313-usb-serial-v1-0-6402033bcdfb@linaro.org>
Message-ID: <20231111-dns313-usb-serial-v1-2-6402033bcdfb@linaro.org>

This brings up a serial console on the USB device port of
the DNS-313.

Signed-off-by: Linus Walleij <linus.walleij at linaro.org>
---
 target/linux/gemini/Makefile               | 2 +-
 target/linux/gemini/base-files/etc/inittab | 4 ++++
 target/linux/gemini/image/Makefile         | 2 +-
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/target/linux/gemini/Makefile b/target/linux/gemini/Makefile
index b7f1962c9a59..238d8c4f0c4d 100644
--- a/target/linux/gemini/Makefile
+++ b/target/linux/gemini/Makefile
@@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
 ARCH:=arm
 BOARD:=gemini
 BOARDNAME:=Cortina Systems CS351x
-FEATURES:=squashfs pci rtc usb dt gpio display ext4 rootfs-part boot-part
+FEATURES:=squashfs pci rtc usb usbgadget dt gpio display ext4 rootfs-part boot-part
 CPU_TYPE:=fa526
 SUBTARGETS:=generic
 
diff --git a/target/linux/gemini/base-files/etc/inittab b/target/linux/gemini/base-files/etc/inittab
new file mode 100644
index 000000000000..253036402d83
--- /dev/null
+++ b/target/linux/gemini/base-files/etc/inittab
@@ -0,0 +1,4 @@
+::sysinit:/etc/init.d/rcS S boot
+::shutdown:/etc/init.d/rcS K shutdown
+::askconsole:/usr/libexec/login.sh
+ttyGS0::askfirst:/usr/libexec/login.sh
diff --git a/target/linux/gemini/image/Makefile b/target/linux/gemini/image/Makefile
index 3fce3172ed63..6a0397e0503f 100644
--- a/target/linux/gemini/image/Makefile
+++ b/target/linux/gemini/image/Makefile
@@ -168,7 +168,7 @@ define Device/dlink_dns-313
 	DEVICE_VENDOR := D-Link
 	DEVICE_MODEL := DNS-313 1-Bay Network Storage Enclosure
 	DEVICE_DTS := gemini-dlink-dns-313
-	DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES)
+	DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES) kmod-usb-gadget kmod-usb-gadget-serial
 	BLOCKSIZE := 1k
 	FILESYSTEMS := ext4
 	IMAGES := factory.bin.gz

-- 
2.34.1



From linus.walleij at linaro.org  Sat Nov 11 14:02:20 2023
From: linus.walleij at linaro.org (Linus Walleij)
Date: Sat, 11 Nov 2023 23:02:20 +0100
Subject: [PATCH 1/2] kernel: usb: Autoprobe g_serial
In-Reply-To: <20231111-dns313-usb-serial-v1-0-6402033bcdfb@linaro.org>
References: <20231111-dns313-usb-serial-v1-0-6402033bcdfb@linaro.org>
Message-ID: <20231111-dns313-usb-serial-v1-1-6402033bcdfb@linaro.org>

For devices using USB gadget serial we need to probe the modules
usb_f_acm and g_serial in order, then the available UDC (USB device
controller) interface will be hooked up to a serial port as
/dev/ttyGS0. (On the host side this appears as /dev/ttyACM0
when plugging in the USB cable.)

I don't quite understand why this wasn't done before for the
module explicitly called kmod-usb-serial.

Before this patch we have to enter a console and type

  modprobe g_serial

To get a serial console on /dev/ttyGS0, after this it is
automatic.

Since you might only have the serial console, it is a bit
catch 22 to have to use a serial console to activate the
serial console.

Signed-off-by: Linus Walleij <linus.walleij at linaro.org>
---
 package/kernel/linux/modules/usb.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/kernel/linux/modules/usb.mk b/package/kernel/linux/modules/usb.mk
index 0a5f5a8993c9..f54dc4380737 100644
--- a/package/kernel/linux/modules/usb.mk
+++ b/package/kernel/linux/modules/usb.mk
@@ -207,7 +207,7 @@ define KernelPackage/usb-gadget-serial
 	$(LINUX_DIR)/drivers/usb/gadget/function/usb_f_obex.ko \
 	$(LINUX_DIR)/drivers/usb/gadget/function/usb_f_serial.ko \
 	$(LINUX_DIR)/drivers/usb/gadget/legacy/g_serial.ko
-  AUTOLOAD:=$(call AutoLoad,52,usb_f_acm)
+  AUTOLOAD:=$(call AutoLoad,52,usb_f_acm g_serial)
   $(call AddDepends/usb)
 endef
 

-- 
2.34.1



From rosenp at gmail.com  Sat Nov 11 15:48:58 2023
From: rosenp at gmail.com (Rosen Penev)
Date: Sat, 11 Nov 2023 15:48:58 -0800
Subject: [PATCH ustream-ssl 2/2] cmake: Fail if undefined symbols are used
In-Reply-To: <20231111213243.3338889-2-hauke@hauke-m.de>
References: <20231111213243.3338889-1-hauke@hauke-m.de> <20231111213243.3338889-2-hauke@hauke-m.de>
Message-ID: <CAKxU2N-1ESZ9bb291w7JTAKAf2UkDjyomXCC-_4ceSG0d25YqQ@mail.gmail.com>

On Sat, Nov 11, 2023 at 1:35?PM Hauke Mehrtens <hauke at hauke-m.de> wrote:
>
> Make the linking of the shared library fail when undefined symbols are
> used. Linking undefined symbols in a shared library normally works and
> the linking of the binary using the shared library fails. We also
> compile some example applications and they failed already.
>
> Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
> ---
>  CMakeLists.txt | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/CMakeLists.txt b/CMakeLists.txt
> index 2de6590..f4dca0d 100644
> --- a/CMakeLists.txt
> +++ b/CMakeLists.txt
> @@ -10,6 +10,7 @@ ENDIF()
>  ADD_DEFINITIONS(-Wno-unused-parameter -Wmissing-declarations)
>
>  SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
> +SET(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined")
probably better to convert to meson, which passes this by default.
>
>  IF(MBEDTLS)
>    ADD_DEFINITIONS(-DHAVE_MBEDTLS)
> --
> 2.39.2
>
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel


From rosenp at gmail.com  Sun Nov 12 11:14:47 2023
From: rosenp at gmail.com (Rosen Penev)
Date: Sun, 12 Nov 2023 11:14:47 -0800
Subject: [PATCH] ath79: use "fixed-layout" for Embedded Wireless devices
In-Reply-To: <20231110102505.24322-1-zajec5@gmail.com>
References: <20231110102505.24322-1-zajec5@gmail.com>
Message-ID: <CAKxU2N-rpxSPK8+JJbnGKhxO9g2fkpV02mX5FVjgVrjY8BBzqg@mail.gmail.com>

On Fri, Nov 10, 2023 at 2:27?AM Rafa? Mi?ecki <zajec5 at gmail.com> wrote:
>
> From: Rafa? Mi?ecki <rafal at milecki.pl>
>
> Those devices have Ethernet interfaces using base MAC address increased
> by 0x40 in the 3rd indexed byte (00:00:00:FF:00:00). To describe that we
> were using a custom (downstream) "mac-address-increment-byte" property.
>
> The same result can be achieved by using "mac-base" with a properly
> adjusted offset value (0x40 << 16). It may be not pretty but it should
> work without custom property or downstream kernel patch to support it.
>
> Cc: Ansuel Smith <ansuelsmth at gmail.com>
> Cc: Catrinel Catrinescu <cc at 80211.de>
> Cc: Felix Fietkau <nbd at nbd.name>
> Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
Reviewed-by: Rosen Penev <rosenp at gmail.com>
> ---
>  .../dts/ar9331_embeddedwireless_dorin.dts     | 26 ++++++++--------
>  .../dts/ar9344_embeddedwireless_balin.dts     | 30 ++++++++++---------
>  2 files changed, 29 insertions(+), 27 deletions(-)
>
> diff --git a/target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts b/target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts
> index de6b709b5c..6286f203ef 100644
> --- a/target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts
> +++ b/target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts
> @@ -85,6 +85,18 @@
>                                 label = "art";
>                                 reg = <0xff0000 0x010000>;
>                                 read-only;
> +
> +                               nvmem-layout {
> +                                       compatible = "fixed-layout";
> +                                       #address-cells = <1>;
> +                                       #size-cells = <1>;
> +
> +                                       macaddr_art_1002: macaddr at 1002 {
> +                                               compatible = "mac-base";
> +                                               reg = <0x1002 0x6>;
> +                                               #nvmem-cell-cells = <1>;
> +                                       };
> +                               };
>                         };
>                 };
>         };
> @@ -93,10 +105,8 @@
>  &eth1 {
>         status = "okay";
>
> -       nvmem-cells = <&macaddr_art_1002>;
> +       nvmem-cells = <&macaddr_art_1002 0x400000>;
>         nvmem-cell-names = "mac-address";
> -       mac-address-increment-byte = <3>;
> -       mac-address-increment = <0x40>;
>  };
>
>  &mdio1 {
> @@ -108,13 +118,3 @@
>
>         mtd-cal-data = <&art 0x1000>;
>  };
> -
> -&art {
> -       compatible = "nvmem-cells";
> -       #address-cells = <1>;
> -       #size-cells = <1>;
> -
> -       macaddr_art_1002: macaddr at 1002 {
> -               reg = <0x1002 0x6>;
> -       };
> -};
> diff --git a/target/linux/ath79/dts/ar9344_embeddedwireless_balin.dts b/target/linux/ath79/dts/ar9344_embeddedwireless_balin.dts
> index a84c273f86..de13865818 100644
> --- a/target/linux/ath79/dts/ar9344_embeddedwireless_balin.dts
> +++ b/target/linux/ath79/dts/ar9344_embeddedwireless_balin.dts
> @@ -83,16 +83,20 @@
>                                 reg = <0xff0000 0x010000>;
>                                 read-only;
>
> -                               compatible = "nvmem-cells";
> -                               #address-cells = <1>;
> -                               #size-cells = <1>;
> -
> -                               calibration_art_1000: calibration_data at 1000 {
> -                                       reg = <0x1000 0x440>;
> -                               };
> -
> -                               macaddr_art_1002: macaddr at 1002 {
> -                                       reg = <0x1002 0x6>;
> +                               nvmem-layout {
> +                                       compatible = "fixed-layout";
> +                                       #address-cells = <1>;
> +                                       #size-cells = <1>;
> +
> +                                       calibration_art_1000: calibration_data at 1000 {
> +                                               reg = <0x1000 0x440>;
> +                                       };
> +
> +                                       macaddr_art_1002: macaddr at 1002 {
> +                                               compatible = "mac-base";
> +                                               reg = <0x1002 0x6>;
> +                                               #nvmem-cell-cells = <1>;
> +                                       };
>                                 };
>                         };
>                 };
> @@ -106,10 +110,8 @@
>  &eth1 {
>         status = "okay";
>
> -       nvmem-cells = <&macaddr_art_1002>;
> +       nvmem-cells = <&macaddr_art_1002 0x400000>;
>         nvmem-cell-names = "mac-address";
> -       mac-address-increment-byte = <3>;
> -       mac-address-increment = <0x40>;
>
>         gmac-config {
>                 device = <&gmac>;
> @@ -121,7 +123,7 @@
>  &wmac {
>         status = "okay";
>
> -       nvmem-cells = <&macaddr_art_1002>, <&calibration_art_1000>;
> +       nvmem-cells = <&macaddr_art_1002 0>, <&calibration_art_1000>;
>         nvmem-cell-names = "mac-address", "calibration";
>  };
>
> --
> 2.35.3
>
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel


From rosenp at gmail.com  Sun Nov 12 11:16:19 2023
From: rosenp at gmail.com (Rosen Penev)
Date: Sun, 12 Nov 2023 11:16:19 -0800
Subject: [PATCH ustream-ssl 1/2] ustream-mbedtls: Add compatibility with
 Mbed TLS 3.0.0
In-Reply-To: <20231111213243.3338889-1-hauke@hauke-m.de>
References: <20231111213243.3338889-1-hauke@hauke-m.de>
Message-ID: <CAKxU2N8fnTB+gdqa=VsS-MS4CoDjdbzbUqSma75zrVAxOGSvrA@mail.gmail.com>

On Sat, Nov 11, 2023 at 1:35?PM Hauke Mehrtens <hauke at hauke-m.de> wrote:
>
> This adds support for compiling the code against Mbed TLS 3.0.0.
> It still compiles against Mbed TLS 2.28.
>
> The following changes were needed:
>  * DES and 3DES was removed
>  * mbedtls_pk_context->pk_info is private, use mbedtls_pk_get_type()
>    to check if it was initialized
>  * mbedtls_pk_parse_keyfile() now gets a random callback
>  * mbedtls/certs.h contains test data and is not installed any more and
>    not needed.
>
> Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
> ---
>  ustream-mbedtls.c | 12 +++++++++++-
>  ustream-mbedtls.h |  1 -
>  2 files changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/ustream-mbedtls.c b/ustream-mbedtls.c
> index 7fc7874..1c70cac 100644
> --- a/ustream-mbedtls.c
> +++ b/ustream-mbedtls.c
> @@ -110,9 +110,15 @@ static const int default_ciphersuites_client[] =
>         AES_CBC_CIPHERS(ECDHE_ECDSA),
>         AES_CBC_CIPHERS(ECDHE_RSA),
>         AES_CBC_CIPHERS(DHE_RSA),
> +/* Removed in Mbed TLS 3.0.0 */
are these for Windows XP compatibility?
> +#ifdef MBEDTLS_TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA
>         MBEDTLS_TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA,
> +#endif
>         AES_CIPHERS(RSA),
> +/* Removed in Mbed TLS 3.0.0 */
> +#ifdef MBEDTLS_TLS_RSA_WITH_3DES_EDE_CBC_SHA
>         MBEDTLS_TLS_RSA_WITH_3DES_EDE_CBC_SHA,
> +#endif
>         0
>  };
>
> @@ -171,7 +177,7 @@ static void ustream_ssl_update_own_cert(struct ustream_ssl_ctx *ctx)
>         if (!ctx->cert.version)
>                 return;
>
> -       if (!ctx->key.pk_info)
> +       if (mbedtls_pk_get_type(&ctx->key) == MBEDTLS_PK_NONE)
>                 return;
>
>         mbedtls_ssl_conf_own_cert(&ctx->conf, &ctx->cert, &ctx->key);
> @@ -206,7 +212,11 @@ __hidden int __ustream_ssl_set_key_file(struct ustream_ssl_ctx *ctx, const char
>  {
>         int ret;
>
> +#if (MBEDTLS_VERSION_NUMBER >= 0x03000000)
> +       ret = mbedtls_pk_parse_keyfile(&ctx->key, file, NULL, _random, NULL);
> +#else
>         ret = mbedtls_pk_parse_keyfile(&ctx->key, file, NULL);
> +#endif
>         if (ret)
>                 return -1;
>
> diff --git a/ustream-mbedtls.h b/ustream-mbedtls.h
> index e622e5e..7e7c699 100644
> --- a/ustream-mbedtls.h
> +++ b/ustream-mbedtls.h
> @@ -21,7 +21,6 @@
>
>  #include <mbedtls/net_sockets.h>
>  #include <mbedtls/ssl.h>
> -#include <mbedtls/certs.h>
>  #include <mbedtls/x509.h>
>  #include <mbedtls/rsa.h>
>  #include <mbedtls/error.h>
> --
> 2.39.2
>
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel


From rosenp at gmail.com  Sun Nov 12 11:17:49 2023
From: rosenp at gmail.com (Rosen Penev)
Date: Sun, 12 Nov 2023 11:17:49 -0800
Subject: [PATCH] kernel: of: remove "mac-address-ascii" support hack
In-Reply-To: <TYAP286MB0315EF15FE28164766E59A35BCAEA@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM>
References: <TYAP286MB0315EF15FE28164766E59A35BCAEA@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM>
Message-ID: <CAKxU2N9VS5e4rA9jshAW0bMrpYxcboQmMPbxF0dFaZ+kLt5pNQ@mail.gmail.com>

On Fri, Nov 10, 2023 at 1:31?AM Shiji Yang <yangshiji66 at outlook.com> wrote:
>
> From: Shiji Yang <yangshiji66 at qq.com>
>
> ASCII MAC address can be handled by nvmem "fixed-layout" now. And all
> related devices were converted to the new "mac-base" layout format.
> It's time to remove this hack.
>
> Signed-off-by: Shiji Yang <yangshiji66 at qq.com>
Reviewed-by: Rosen Penev <rosenp at gmail.com>
> ---
>
> Git grep ref:
> https://git.openwrt.org/?p=openwrt%2Fopenwrt.git&a=search&h=HEAD&st=grep&s=mac-address-ascii&sr=1
>
> Regards,
> Shiji Yang
>
>
>  ...of_net-add-mac-address-ascii-support.patch | 116 ------------------
>  ...of_net-add-mac-address-ascii-support.patch | 116 ------------------
>  2 files changed, 232 deletions(-)
>  delete mode 100644 target/linux/generic/hack-5.15/601-of_net-add-mac-address-ascii-support.patch
>  delete mode 100644 target/linux/generic/hack-6.1/601-of_net-add-mac-address-ascii-support.patch
>
> diff --git a/target/linux/generic/hack-5.15/601-of_net-add-mac-address-ascii-support.patch b/target/linux/generic/hack-5.15/601-of_net-add-mac-address-ascii-support.patch
> deleted file mode 100644
> index 55866c3135..0000000000
> --- a/target/linux/generic/hack-5.15/601-of_net-add-mac-address-ascii-support.patch
> +++ /dev/null
> @@ -1,116 +0,0 @@
> -From: Yousong Zhou <yszhou4tech at gmail.com>
> -Subject: [PATCH] of: net: add nvmem cell mac-address-ascii support
> -
> -This is needed for devices with mac address stored in ascii format,
> -e.g. HiWiFi HC6361 to be ported in the following patch.
> -
> -Submitted-by: Yousong Zhou <yszhou4tech at gmail.com>
> ----
> - net/core/of_net.c | 83 ++++++++++++------
> - 1 files changed, 72 insertions(+), 11 deletions(-)
> -
> ---- a/net/core/of_net.c
> -+++ b/net/core/of_net.c
> -@@ -57,13 +57,70 @@ static int of_get_mac_addr(struct device
> -       return -ENODEV;
> - }
> -
> -+static void *nvmem_cell_get_mac_address(struct nvmem_cell *cell)
> -+{
> -+      size_t len;
> -+      void *mac;
> -+
> -+      mac = nvmem_cell_read(cell, &len);
> -+      if (IS_ERR(mac))
> -+              return mac;
> -+      if (len != ETH_ALEN) {
> -+              kfree(mac);
> -+              return ERR_PTR(-EINVAL);
> -+      }
> -+      return mac;
> -+}
> -+
> -+static void *nvmem_cell_get_mac_address_ascii(struct nvmem_cell *cell)
> -+{
> -+      size_t len;
> -+      int ret;
> -+      void *mac_ascii;
> -+      u8 *mac;
> -+
> -+      mac_ascii = nvmem_cell_read(cell, &len);
> -+      if (IS_ERR(mac_ascii))
> -+              return mac_ascii;
> -+      if (len != ETH_ALEN*2+5) {
> -+              kfree(mac_ascii);
> -+              return ERR_PTR(-EINVAL);
> -+      }
> -+      mac = kmalloc(ETH_ALEN, GFP_KERNEL);
> -+      if (!mac) {
> -+              kfree(mac_ascii);
> -+              return ERR_PTR(-ENOMEM);
> -+      }
> -+      ret = sscanf(mac_ascii, "%2hhx:%2hhx:%2hhx:%2hhx:%2hhx:%2hhx",
> -+                              &mac[0], &mac[1], &mac[2],
> -+                              &mac[3], &mac[4], &mac[5]);
> -+      kfree(mac_ascii);
> -+      if (ret == ETH_ALEN)
> -+              return mac;
> -+      kfree(mac);
> -+      return ERR_PTR(-EINVAL);
> -+}
> -+
> -+static struct nvmem_cell_mac_address_property {
> -+      char *name;
> -+      void *(*read)(struct nvmem_cell *);
> -+} nvmem_cell_mac_address_properties[] = {
> -+      {
> -+              .name = "mac-address",
> -+              .read = nvmem_cell_get_mac_address,
> -+      }, {
> -+              .name = "mac-address-ascii",
> -+              .read = nvmem_cell_get_mac_address_ascii,
> -+      },
> -+};
> -+
> - static int of_get_mac_addr_nvmem(struct device_node *np, u8 *addr)
> - {
> -       struct platform_device *pdev = of_find_device_by_node(np);
> -+      struct nvmem_cell_mac_address_property *property;
> -       struct nvmem_cell *cell;
> -       const void *mac;
> --      size_t len;
> --      int ret;
> -+      int ret, i;
> -
> -       /* Try lookup by device first, there might be a nvmem_cell_lookup
> -        * associated with a given device.
> -@@ -74,17 +131,26 @@ static int of_get_mac_addr_nvmem(struct
> -               return ret;
> -       }
> -
> --      cell = of_nvmem_cell_get(np, "mac-address");
> -+      for (i = 0; i < ARRAY_SIZE(nvmem_cell_mac_address_properties); i++) {
> -+              property = &nvmem_cell_mac_address_properties[i];
> -+              cell = of_nvmem_cell_get(np, property->name);
> -+              /* For -EPROBE_DEFER don't try other properties.
> -+               * We'll get back to this one.
> -+               */
> -+              if (!IS_ERR(cell) || PTR_ERR(cell) == -EPROBE_DEFER)
> -+                      break;
> -+      }
> -+
> -       if (IS_ERR(cell))
> -               return PTR_ERR(cell);
> -
> --      mac = nvmem_cell_read(cell, &len);
> -+      mac = property->read(cell);
> -       nvmem_cell_put(cell);
> -
> -       if (IS_ERR(mac))
> -               return PTR_ERR(mac);
> -
> --      if (len != ETH_ALEN || !is_valid_ether_addr(mac)) {
> -+      if (!is_valid_ether_addr(mac)) {
> -               kfree(mac);
> -               return -EINVAL;
> -       }
> diff --git a/target/linux/generic/hack-6.1/601-of_net-add-mac-address-ascii-support.patch b/target/linux/generic/hack-6.1/601-of_net-add-mac-address-ascii-support.patch
> deleted file mode 100644
> index 55866c3135..0000000000
> --- a/target/linux/generic/hack-6.1/601-of_net-add-mac-address-ascii-support.patch
> +++ /dev/null
> @@ -1,116 +0,0 @@
> -From: Yousong Zhou <yszhou4tech at gmail.com>
> -Subject: [PATCH] of: net: add nvmem cell mac-address-ascii support
> -
> -This is needed for devices with mac address stored in ascii format,
> -e.g. HiWiFi HC6361 to be ported in the following patch.
> -
> -Submitted-by: Yousong Zhou <yszhou4tech at gmail.com>
> ----
> - net/core/of_net.c | 83 ++++++++++++------
> - 1 files changed, 72 insertions(+), 11 deletions(-)
> -
> ---- a/net/core/of_net.c
> -+++ b/net/core/of_net.c
> -@@ -57,13 +57,70 @@ static int of_get_mac_addr(struct device
> -       return -ENODEV;
> - }
> -
> -+static void *nvmem_cell_get_mac_address(struct nvmem_cell *cell)
> -+{
> -+      size_t len;
> -+      void *mac;
> -+
> -+      mac = nvmem_cell_read(cell, &len);
> -+      if (IS_ERR(mac))
> -+              return mac;
> -+      if (len != ETH_ALEN) {
> -+              kfree(mac);
> -+              return ERR_PTR(-EINVAL);
> -+      }
> -+      return mac;
> -+}
> -+
> -+static void *nvmem_cell_get_mac_address_ascii(struct nvmem_cell *cell)
> -+{
> -+      size_t len;
> -+      int ret;
> -+      void *mac_ascii;
> -+      u8 *mac;
> -+
> -+      mac_ascii = nvmem_cell_read(cell, &len);
> -+      if (IS_ERR(mac_ascii))
> -+              return mac_ascii;
> -+      if (len != ETH_ALEN*2+5) {
> -+              kfree(mac_ascii);
> -+              return ERR_PTR(-EINVAL);
> -+      }
> -+      mac = kmalloc(ETH_ALEN, GFP_KERNEL);
> -+      if (!mac) {
> -+              kfree(mac_ascii);
> -+              return ERR_PTR(-ENOMEM);
> -+      }
> -+      ret = sscanf(mac_ascii, "%2hhx:%2hhx:%2hhx:%2hhx:%2hhx:%2hhx",
> -+                              &mac[0], &mac[1], &mac[2],
> -+                              &mac[3], &mac[4], &mac[5]);
> -+      kfree(mac_ascii);
> -+      if (ret == ETH_ALEN)
> -+              return mac;
> -+      kfree(mac);
> -+      return ERR_PTR(-EINVAL);
> -+}
> -+
> -+static struct nvmem_cell_mac_address_property {
> -+      char *name;
> -+      void *(*read)(struct nvmem_cell *);
> -+} nvmem_cell_mac_address_properties[] = {
> -+      {
> -+              .name = "mac-address",
> -+              .read = nvmem_cell_get_mac_address,
> -+      }, {
> -+              .name = "mac-address-ascii",
> -+              .read = nvmem_cell_get_mac_address_ascii,
> -+      },
> -+};
> -+
> - static int of_get_mac_addr_nvmem(struct device_node *np, u8 *addr)
> - {
> -       struct platform_device *pdev = of_find_device_by_node(np);
> -+      struct nvmem_cell_mac_address_property *property;
> -       struct nvmem_cell *cell;
> -       const void *mac;
> --      size_t len;
> --      int ret;
> -+      int ret, i;
> -
> -       /* Try lookup by device first, there might be a nvmem_cell_lookup
> -        * associated with a given device.
> -@@ -74,17 +131,26 @@ static int of_get_mac_addr_nvmem(struct
> -               return ret;
> -       }
> -
> --      cell = of_nvmem_cell_get(np, "mac-address");
> -+      for (i = 0; i < ARRAY_SIZE(nvmem_cell_mac_address_properties); i++) {
> -+              property = &nvmem_cell_mac_address_properties[i];
> -+              cell = of_nvmem_cell_get(np, property->name);
> -+              /* For -EPROBE_DEFER don't try other properties.
> -+               * We'll get back to this one.
> -+               */
> -+              if (!IS_ERR(cell) || PTR_ERR(cell) == -EPROBE_DEFER)
> -+                      break;
> -+      }
> -+
> -       if (IS_ERR(cell))
> -               return PTR_ERR(cell);
> -
> --      mac = nvmem_cell_read(cell, &len);
> -+      mac = property->read(cell);
> -       nvmem_cell_put(cell);
> -
> -       if (IS_ERR(mac))
> -               return PTR_ERR(mac);
> -
> --      if (len != ETH_ALEN || !is_valid_ether_addr(mac)) {
> -+      if (!is_valid_ether_addr(mac)) {
> -               kfree(mac);
> -               return -EINVAL;
> -       }
> --
> 2.39.2
>
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel


From hauke at hauke-m.de  Sun Nov 12 12:12:13 2023
From: hauke at hauke-m.de (Hauke Mehrtens)
Date: Sun, 12 Nov 2023 21:12:13 +0100
Subject: [PATCH ustream-ssl 1/2] ustream-mbedtls: Add compatibility with
 Mbed TLS 3.0.0
In-Reply-To: <CAKxU2N8fnTB+gdqa=VsS-MS4CoDjdbzbUqSma75zrVAxOGSvrA@mail.gmail.com>
References: <20231111213243.3338889-1-hauke@hauke-m.de>
 <CAKxU2N8fnTB+gdqa=VsS-MS4CoDjdbzbUqSma75zrVAxOGSvrA@mail.gmail.com>
Message-ID: <d5ab0d18-af63-4f8e-aa0d-cd77da6542fb@hauke-m.de>

On 11/12/23 20:16, Rosen Penev wrote:
> On Sat, Nov 11, 2023 at 1:35?PM Hauke Mehrtens <hauke at hauke-m.de> wrote:
>>
>> This adds support for compiling the code against Mbed TLS 3.0.0.
>> It still compiles against Mbed TLS 2.28.
>>
>> The following changes were needed:
>>   * DES and 3DES was removed
>>   * mbedtls_pk_context->pk_info is private, use mbedtls_pk_get_type()
>>     to check if it was initialized
>>   * mbedtls_pk_parse_keyfile() now gets a random callback
>>   * mbedtls/certs.h contains test data and is not installed any more and
>>     not needed.
>>
>> Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
>> ---
>>   ustream-mbedtls.c | 12 +++++++++++-
>>   ustream-mbedtls.h |  1 -
>>   2 files changed, 11 insertions(+), 2 deletions(-)
>>
>> diff --git a/ustream-mbedtls.c b/ustream-mbedtls.c
>> index 7fc7874..1c70cac 100644
>> --- a/ustream-mbedtls.c
>> +++ b/ustream-mbedtls.c
>> @@ -110,9 +110,15 @@ static const int default_ciphersuites_client[] =
>>          AES_CBC_CIPHERS(ECDHE_ECDSA),
>>          AES_CBC_CIPHERS(ECDHE_RSA),
>>          AES_CBC_CIPHERS(DHE_RSA),
>> +/* Removed in Mbed TLS 3.0.0 */
> are these for Windows XP compatibility?

No, This is for the TLS client. I assume this is for some legacy 
embedded webserver.

Mbed TLS 3.0.0 also removes support for TLS 1.0 and 1.1, it only support 
TLS 1.2 and 1.3, this could cause some problems with older equipment and 
legacy WPA enterprise clients.

Hauke


From noreply at github.com  Sun Nov 12 15:18:34 2023
From: noreply at github.com (Stephen Walker)
Date: Sun, 12 Nov 2023 15:18:34 -0800
Subject: [sdwalker/sdwalker.github.io] 141bf6: This week's update
Message-ID: <sdwalker/sdwalker.github.io/push/refs/heads/master/eb55ce-141bf6@github.com>

  Branch: refs/heads/master
  Home:   https://github.com/sdwalker/sdwalker.github.io
  Commit: 141bf646922bc3e1d13c2e7394646972c50652fa
      https://github.com/sdwalker/sdwalker.github.io/commit/141bf646922bc3e1d13c2e7394646972c50652fa
  Author: Stephen Walker <stephendwalker+github at gmail.com>
  Date:   2023-11-12 (Sun, 12 Nov 2023)

  Changed paths:
    M uscan/index-22.03.html
    M uscan/index-23.05.html
    M uscan/index.html

  Log Message:
  -----------
  This week's update




From philipp_subx at redfish-solutions.com  Sun Nov 12 17:31:29 2023
From: philipp_subx at redfish-solutions.com (Philip Prindeville)
Date: Sun, 12 Nov 2023 18:31:29 -0700
Subject: Adding a new x86 image or related packages to the default x86
 image
In-Reply-To: <20230915011955.1e12377f@mir>
References: <8682698C-4740-430A-906D-B8DE1AA93C1A@aparcar.org>
 <20230915011955.1e12377f@mir>
Message-ID: <E4E2EB72-FE41-436A-A4E2-D6716C4FCE68@redfish-solutions.com>



> On Sep 14, 2023, at 5:19 PM, Stefan Lippers-Hollmann <s.l-h at gmx.de> wrote:
> 
> Hi
> 
> On 2023-09-14, Paul Spooren wrote:
>> Hi,
>> 
>> I?d like to merge the PR which adds the Mellanox Spectrum SN2100 to 
>> OpenWrt[1]. In its current state a new x86 image would be added next 
>> to the generic x86 image. Another approach is to add all related 
>> packages to the default image. Either way creates a working image.
>> 
>> I remember that people were complaining about a ?bloated? x86 image 
>> which slows down their container/VM needs. So what would be a simple 
>> way forward here?
> [...]
> 
> If at all reasonably possible (assuming the size increase is roughly in
> the ball park  of 1-2 MB for the total image), I'd suggest to stick to a 
> single x86_64 image for maintenance and testing reasons alone. The bump
> of the x86 targets to kernel v6.1 -while easy- is mostly stalled due to
> there being three 32 bit x86 sub-targets and the need to go through the
> kernel config rebase three times, which is wearing thin the patience and 
> motivation of doing so (x86_64 alone would have been ready >2 months 
> ago). Unless these SN2100 devices suddenly become a cheap commodity and 
> ubiquitous among OpenWrt developers and -users, I fear that it would 
> just add to this churn and pretty much rot away in the tree, while at 
> the same time making progress harder for the other x86{,_64} devices.
> 
> Regards
> Stefan Lippers-Hollmann


Sometime back I tried to add "pcituils" and "usbutils" to the generic x86_64 image, and was told that they weren't sufficiently "ubiquitous" to add to the default image.

I note that they can be removed from the BOM easily by doing:

DEVICE_PACKAGES += -pciutils -usbutils

And that would remove them if they were already present in $(DEVICE_PACKAGES).

I've never encountered an x86_64 platform that didn't have both USB and PCI, as they've without question become a "cheap commodity".

Contrarily, I've yet to own or operate a platform that has a Mellanox switch.  This seems arbitrary.

-Philip




From ehem+openwrt at m5p.com  Sun Nov 12 18:19:27 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Sun, 12 Nov 2023 18:19:27 -0800
Subject: Adding a new x86 image or related packages to the default x86
 image
In-Reply-To: <E4E2EB72-FE41-436A-A4E2-D6716C4FCE68@redfish-solutions.com>
References: <8682698C-4740-430A-906D-B8DE1AA93C1A@aparcar.org>
 <20230915011955.1e12377f@mir>
 <E4E2EB72-FE41-436A-A4E2-D6716C4FCE68@redfish-solutions.com>
Message-ID: <ZVGHrxxvqzJve0nf@mattapan.m5p.com>

> On Sep 14, 2023, at 5:19 PM, Stefan Lippers-Hollmann <s.l-h at gmx.de> wrote:
> 
> On 2023-09-14, Paul Spooren wrote:
>> 
>> I?d like to merge the PR which adds the Mellanox Spectrum SN2100 to 
>> OpenWrt[1]. In its current state a new x86 image would be added next 
>> to the generic x86 image. Another approach is to add all related 
>> packages to the default image. Either way creates a working image.
>> 
>> I remember that people were complaining about a ?bloated? x86 image 
>> which slows down their container/VM needs. So what would be a simple 
>> way forward here?
> [...]
> 
> If at all reasonably possible (assuming the size increase is roughly in
> the ball park  of 1-2 MB for the total image), I'd suggest to stick to a 
> single x86_64 image for maintenance and testing reasons alone. The bump
> of the x86 targets to kernel v6.1 -while easy- is mostly stalled due to
> there being three 32 bit x86 sub-targets and the need to go through the
> kernel config rebase three times, which is wearing thin the patience and 
> motivation of doing so (x86_64 alone would have been ready >2 months 
> ago). Unless these SN2100 devices suddenly become a cheap commodity and 
> ubiquitous among OpenWrt developers and -users, I fear that it would 
> just add to this churn and pretty much rot away in the tree, while at 
> the same time making progress harder for the other x86{,_64} devices.

In that case I would suggest removing the x86/generic target.  Since it
has CONFIG_MPENTIUM4=y, that is only appropriate for a very small number
of computers.  The earlier ones are covered by x86/legacy, the later ones
are covered by x86/64.

I don't know what others are running into, but the bigger issue for VMs
(possibly containers as well) is memory is expensive.  A small VM
machine could have 2GB of memory.  OpenWRT's baseline of 128MB is quite
nice for sticking a full-featured AP in a VM.


On Sun, Nov 12, 2023 at 06:31:29PM -0700, Philip Prindeville wrote:
> 
> Sometime back I tried to add "pcituils" and "usbutils" to the generic x86_64 image, and was told that they weren't sufficiently "ubiquitous" to add to the default image.
> 
> I note that they can be removed from the BOM easily by doing:
> 
> DEVICE_PACKAGES += -pciutils -usbutils
> 
> And that would remove them if they were already present in $(DEVICE_PACKAGES).
> 
> I've never encountered an x86_64 platform that didn't have both USB and PCI, as they've without question become a "cheap commodity".
> 
> Contrarily, I've yet to own or operate a platform that has a Mellanox switch.  This seems arbitrary.
> 

I've encountered plenty of amd64 devices which lacked USB, PCI, PATA,
SATA, SCSI and SAS.  They're all VMs, yet they're quite functional (an AP
in VM will almost certainly need PCI).

I think the various hypervisors could do with targeted builds.  Mostly
this involves removing nearly all common drivers, then keeping/adding a
small number of specialized drivers.


-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |         ehem+sigmsg at m5p.com  PGP 87145445         |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445




From xiaojun.liu at silicom.co.il  Sun Nov 12 19:59:45 2023
From: xiaojun.liu at silicom.co.il (Xiaojun Liu)
Date: Mon, 13 Nov 2023 03:59:45 +0000
Subject: [PATCH] x86 64: Add new device Cordoba Edge Platform
Message-ID: <DU0PR04MB9660A34629F7ED975029298DBDB3A@DU0PR04MB9660.eurprd04.prod.outlook.com>

Add new device Cordoba Edge Platform
hardware specifications: CPU - Intel Atom C3000
                           Ethernet - 2 10Gbps ixgbe SPF+
                                      2 1Gbps  ixgbe RJ45/SPF
                                      4 2.5Gbps  igc RJ45
                           WiFi - mt7915e
                           LED  - 3 multicolor(red|blue|green) LEDs
   
Signed-off-by: Xiaojun Liu mailto:xiaojun.liu at silicom.co.il
--

diff --git a/target/linux/x86/base-files/etc/board.d/01_leds b/target/linux/x86/base-files/etc/board.d/01_leds
index efc5460df3..47ea0929e6 100644
--- a/target/linux/x86/base-files/etc/board.d/01_leds
+++ b/target/linux/x86/base-files/etc/board.d/01_leds
@@ -28,6 +28,10 @@ traverse-technologies-geos)
 	ucidef_set_led_netdev "wlan" "WiFi" "geos:2" "phy0tpt"
 	ucidef_set_led_default "diag" "DIAG" "geos:3" "1"
 	;;
+silicom-80500-0214-*)
+        ucidef_set_led_netdev "wan" "WAN" "multicolor:fp_center" "wan0"
+        ucidef_set_led_netdev "lan" "LAN" "multicolor:fp_right" "br-lan"
+        ;;
 esac
 board_config_flush
 
diff --git a/target/linux/x86/base-files/etc/board.d/02_network b/target/linux/x86/base-files/etc/board.d/02_network
index e00e8c04dd..5174906264 100644
--- a/target/linux/x86/base-files/etc/board.d/02_network
+++ b/target/linux/x86/base-files/etc/board.d/02_network
@@ -75,6 +75,17 @@ traverse-technologies-geos)
 	macaddr="$(cat /sys/class/net/eth0/address)" 2>/dev/null
 	[ -n "$macaddr" ] && ucidef_set_interface_macaddr "wan" "$macaddr"
 	;;
+silicom-80500-0214-*)
+        ucidef_set_network_device_path "wan0" "pci0000:00/0000:00:16.0/0000:03:00.0"
+        ucidef_set_network_device_path "wan1" "pci0000:00/0000:00:16.0/0000:03:00.1"
+        ucidef_set_network_device_path "media0" "pci0000:00/0000:00:17.0/0000:02:00.1"
+        ucidef_set_network_device_path "media1" "pci0000:00/0000:00:17.0/0000:02:00.0"
+        ucidef_set_network_device_path "eth0" "pci0000:00/0000:00:0c.0/0000:04:00.0"
+        ucidef_set_network_device_path "eth1" "pci0000:00/0000:00:0e.0/0000:05:00.0"
+        ucidef_set_network_device_path "eth2" "pci0000:00/0000:00:0f.0/0000:06:00.0"
+        ucidef_set_network_device_path "eth3" "pci0000:00/0000:00:10.0/0000:07:00.0"
+        ucidef_set_interfaces_lan_wan "eth0 eth1 eth2 eth3" "wan0"
+        ;;
 esac
 board_config_flush

-------------- next part --------------
A non-text attachment was scrubbed...
Name: x86 64 Add new device Cordoba Edge Platform.patch
Type: application/octet-stream
Size: 1896 bytes
Desc: x86 64 Add new device Cordoba Edge Platform.patch
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20231113/e1547e2b/attachment-0001.obj>

From mail at aparcar.org  Mon Nov 13 04:30:10 2023
From: mail at aparcar.org (Paul Spooren)
Date: Mon, 13 Nov 2023 13:30:10 +0100
Subject: Adding a new x86 image or related packages to the default x86
 image
In-Reply-To: <ZVGHrxxvqzJve0nf@mattapan.m5p.com>
References: <8682698C-4740-430A-906D-B8DE1AA93C1A@aparcar.org>
 <20230915011955.1e12377f@mir>
 <E4E2EB72-FE41-436A-A4E2-D6716C4FCE68@redfish-solutions.com>
 <ZVGHrxxvqzJve0nf@mattapan.m5p.com>
Message-ID: <334B1B53-A224-439C-94B7-F1F06BDB896E@aparcar.org>

Hi all,

How about we follow the approach of Alpine Linux[1] and offer a standard, an extended and a virtual firmware for the x86/64 target?

What packages specifically is another discussion but the approach could be that standard contains all kmods to get network working on all device, extended includes extra LED drivers etc and virtual only contains network drivers for, well, virtual things.

Best,
Paul

[1]: https://alpinelinux.org/downloads/

> On Nov 13, 2023, at 03:19, Elliott Mitchell <ehem+openwrt at m5p.com> wrote:
> 
>> On Sep 14, 2023, at 5:19 PM, Stefan Lippers-Hollmann <s.l-h at gmx.de> wrote:
>> 
>> On 2023-09-14, Paul Spooren wrote:
>>> 
>>> I?d like to merge the PR which adds the Mellanox Spectrum SN2100 to 
>>> OpenWrt[1]. In its current state a new x86 image would be added next 
>>> to the generic x86 image. Another approach is to add all related 
>>> packages to the default image. Either way creates a working image.
>>> 
>>> I remember that people were complaining about a ?bloated? x86 image 
>>> which slows down their container/VM needs. So what would be a simple 
>>> way forward here?
>> [...]
>> 
>> If at all reasonably possible (assuming the size increase is roughly in
>> the ball park  of 1-2 MB for the total image), I'd suggest to stick to a 
>> single x86_64 image for maintenance and testing reasons alone. The bump
>> of the x86 targets to kernel v6.1 -while easy- is mostly stalled due to
>> there being three 32 bit x86 sub-targets and the need to go through the
>> kernel config rebase three times, which is wearing thin the patience and 
>> motivation of doing so (x86_64 alone would have been ready >2 months 
>> ago). Unless these SN2100 devices suddenly become a cheap commodity and 
>> ubiquitous among OpenWrt developers and -users, I fear that it would 
>> just add to this churn and pretty much rot away in the tree, while at 
>> the same time making progress harder for the other x86{,_64} devices.
> 
> In that case I would suggest removing the x86/generic target.  Since it
> has CONFIG_MPENTIUM4=y, that is only appropriate for a very small number
> of computers.  The earlier ones are covered by x86/legacy, the later ones
> are covered by x86/64.
> 
> I don't know what others are running into, but the bigger issue for VMs
> (possibly containers as well) is memory is expensive.  A small VM
> machine could have 2GB of memory.  OpenWRT's baseline of 128MB is quite
> nice for sticking a full-featured AP in a VM.
> 
> 
> On Sun, Nov 12, 2023 at 06:31:29PM -0700, Philip Prindeville wrote:
>> 
>> Sometime back I tried to add "pcituils" and "usbutils" to the generic x86_64 image, and was told that they weren't sufficiently "ubiquitous" to add to the default image.
>> 
>> I note that they can be removed from the BOM easily by doing:
>> 
>> DEVICE_PACKAGES += -pciutils -usbutils
>> 
>> And that would remove them if they were already present in $(DEVICE_PACKAGES).
>> 
>> I've never encountered an x86_64 platform that didn't have both USB and PCI, as they've without question become a "cheap commodity".
>> 
>> Contrarily, I've yet to own or operate a platform that has a Mellanox switch.  This seems arbitrary.
>> 
> 
> I've encountered plenty of amd64 devices which lacked USB, PCI, PATA,
> SATA, SCSI and SAS.  They're all VMs, yet they're quite functional (an AP
> in VM will almost certainly need PCI).
> 
> I think the various hypervisors could do with targeted builds.  Mostly
> this involves removing nearly all common drivers, then keeping/adding a
> small number of specialized drivers.
> 
> 
> -- 
> (\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
> \BS (    |         ehem+sigmsg at m5p.com  PGP 87145445         |    )   /
>  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
> 8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445
> 
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel



From daniel at makrotopia.org  Mon Nov 13 04:48:14 2023
From: daniel at makrotopia.org (Daniel Golle)
Date: Mon, 13 Nov 2023 12:48:14 +0000
Subject: Adding a new x86 image or related packages to the default x86
 image
In-Reply-To: <334B1B53-A224-439C-94B7-F1F06BDB896E@aparcar.org>
References: <8682698C-4740-430A-906D-B8DE1AA93C1A@aparcar.org>
 <20230915011955.1e12377f@mir>
 <E4E2EB72-FE41-436A-A4E2-D6716C4FCE68@redfish-solutions.com>
 <ZVGHrxxvqzJve0nf@mattapan.m5p.com>
 <334B1B53-A224-439C-94B7-F1F06BDB896E@aparcar.org>
Message-ID: <ZVIbDvzYE4140iA4@makrotopia.org>

On Mon, Nov 13, 2023 at 01:30:10PM +0100, Paul Spooren wrote:
> Hi all,
> 
> How about we follow the approach of Alpine Linux[1] and offer a standard, an extended and a virtual firmware for the x86/64 target?
> 
> What packages specifically is another discussion but the approach could be that standard contains all kmods to get network working on all device, extended includes extra LED drivers etc and virtual only contains network drivers for, well, virtual things.

+1
I like that much more than adding board-specific images on a platform
with standardized boot process (such as x86 or armsr).

> 
> Best,
> Paul
> 
> [1]: https://alpinelinux.org/downloads/
> 
> > On Nov 13, 2023, at 03:19, Elliott Mitchell <ehem+openwrt at m5p.com> wrote:
> > 
> >> On Sep 14, 2023, at 5:19 PM, Stefan Lippers-Hollmann <s.l-h at gmx.de> wrote:
> >> 
> >> On 2023-09-14, Paul Spooren wrote:
> >>> 
> >>> I?d like to merge the PR which adds the Mellanox Spectrum SN2100 to 
> >>> OpenWrt[1]. In its current state a new x86 image would be added next 
> >>> to the generic x86 image. Another approach is to add all related 
> >>> packages to the default image. Either way creates a working image.
> >>> 
> >>> I remember that people were complaining about a ?bloated? x86 image 
> >>> which slows down their container/VM needs. So what would be a simple 
> >>> way forward here?
> >> [...]
> >> 
> >> If at all reasonably possible (assuming the size increase is roughly in
> >> the ball park  of 1-2 MB for the total image), I'd suggest to stick to a 
> >> single x86_64 image for maintenance and testing reasons alone. The bump
> >> of the x86 targets to kernel v6.1 -while easy- is mostly stalled due to
> >> there being three 32 bit x86 sub-targets and the need to go through the
> >> kernel config rebase three times, which is wearing thin the patience and 
> >> motivation of doing so (x86_64 alone would have been ready >2 months 
> >> ago). Unless these SN2100 devices suddenly become a cheap commodity and 
> >> ubiquitous among OpenWrt developers and -users, I fear that it would 
> >> just add to this churn and pretty much rot away in the tree, while at 
> >> the same time making progress harder for the other x86{,_64} devices.
> > 
> > In that case I would suggest removing the x86/generic target.  Since it
> > has CONFIG_MPENTIUM4=y, that is only appropriate for a very small number
> > of computers.  The earlier ones are covered by x86/legacy, the later ones
> > are covered by x86/64.
> > 
> > I don't know what others are running into, but the bigger issue for VMs
> > (possibly containers as well) is memory is expensive.  A small VM
> > machine could have 2GB of memory.  OpenWRT's baseline of 128MB is quite
> > nice for sticking a full-featured AP in a VM.
> > 
> > 
> > On Sun, Nov 12, 2023 at 06:31:29PM -0700, Philip Prindeville wrote:
> >> 
> >> Sometime back I tried to add "pcituils" and "usbutils" to the generic x86_64 image, and was told that they weren't sufficiently "ubiquitous" to add to the default image.
> >> 
> >> I note that they can be removed from the BOM easily by doing:
> >> 
> >> DEVICE_PACKAGES += -pciutils -usbutils
> >> 
> >> And that would remove them if they were already present in $(DEVICE_PACKAGES).
> >> 
> >> I've never encountered an x86_64 platform that didn't have both USB and PCI, as they've without question become a "cheap commodity".
> >> 
> >> Contrarily, I've yet to own or operate a platform that has a Mellanox switch.  This seems arbitrary.
> >> 
> > 
> > I've encountered plenty of amd64 devices which lacked USB, PCI, PATA,
> > SATA, SCSI and SAS.  They're all VMs, yet they're quite functional (an AP
> > in VM will almost certainly need PCI).
> > 
> > I think the various hypervisors could do with targeted builds.  Mostly
> > this involves removing nearly all common drivers, then keeping/adding a
> > small number of specialized drivers.
> > 
> > 
> > -- 
> > (\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
> > \BS (    |         ehem+sigmsg at m5p.com  PGP 87145445         |    )   /
> >  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
> > 8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445
> > 
> > 
> > 
> > _______________________________________________
> > openwrt-devel mailing list
> > openwrt-devel at lists.openwrt.org
> > https://lists.openwrt.org/mailman/listinfo/openwrt-devel
> 


From hannu.nyman at iki.fi  Mon Nov 13 07:55:09 2023
From: hannu.nyman at iki.fi (Hannu Nyman)
Date: Mon, 13 Nov 2023 17:55:09 +0200
Subject: Unbalanced prioritization in the images buildbot? (main branch
 deprioritized too much)
Message-ID: <d089fb49-d964-4f7b-8a49-9d5a497902f9@iki.fi>

Looks like the release branches might have a too strong priority in the 
combined image buildbot, so that release branches get always built before the 
development main/master.

Recently there has been a steady flow of mostly small/unessential 
fixes/improvements for 22.03 and 23.05, so buildbot has been focused on 
building 22.03-SNAPSHOT and 23.05-SNAPSHOT (and the ongoing 23.05.1 build), 
and the main branch builds do lag really badly.

There was a bug in netifd WLAN device / hotplug handling that Felix fixed 
already 3 days ago, but we are still offering faulty downloads for half of 
the targets in main, as buildbot is prioritising? 22.03 and 23.05 due to new 
commits in them. Oldest (and faulty) main build downloads are currently from 
Wed 8th = 5 days ago. That affects the imagebuilder/auc/attendedsysupgrade 
users, too.

The combined queue for images looks nice in principle, but can apparently 
lead into discrimination of main/master, if there are steadily new commits to 
the dormant stable branches.

There should maybe be some sanity check that each target gets built at least 
after X days since the last build, even if there are newer commits in the 
prioritized release branches. The "time since last build" should have a 
growing weight.




From hacks at slashdirt.org  Mon Nov 13 08:26:44 2023
From: hacks at slashdirt.org (Thibaut)
Date: Mon, 13 Nov 2023 17:26:44 +0100
Subject: Unbalanced prioritization in the images buildbot? (main branch
 deprioritized too much)
In-Reply-To: <d089fb49-d964-4f7b-8a49-9d5a497902f9@iki.fi>
References: <d089fb49-d964-4f7b-8a49-9d5a497902f9@iki.fi>
Message-ID: <0959D57B-F533-4186-9283-19A8467D3671@slashdirt.org>

Hi,

> Le 13 nov. 2023 ? 16:55, Hannu Nyman <hannu.nyman at iki.fi> a ?crit :
> 
> Looks like the release branches might have a too strong priority in the combined image buildbot, so that release branches get always built before the development main/master.
> 
> Recently there has been a steady flow of mostly small/unessential fixes/improvements for 22.03 and 23.05, so buildbot has been focused on building 22.03-SNAPSHOT and 23.05-SNAPSHOT (and the ongoing 23.05.1 build), and the main branch builds do lag really badly.
> 
> There was a bug in netifd WLAN device / hotplug handling that Felix fixed already 3 days ago, but we are still offering faulty downloads for half of the targets in main, as buildbot is prioritising  22.03 and 23.05 due to new commits in them. Oldest (and faulty) main build downloads are currently from Wed 8th = 5 days ago. That affects the imagebuilder/auc/attendedsysupgrade users, too.
> 
> The combined queue for images looks nice in principle, but can apparently lead into discrimination of main/master, if there are steadily new commits to the dormant stable branches.

I think it?s working exactly as designed. The release branches are prioritized over main by virtue of being *release* branches.
AIUI the purpose of autobuilder on the main branch is a convenience facility mainly used for confirming that new commits build correctly(*), not (IMHO) a way to ? offer ? images [for end users]. Users running bleeding edge are likely to build their own images anyway.

Furthermore the turn around time for any one commit to be fully built on any one branch is about a couple days on the current infrastructure, so ? 3 days ? is actually a very short timeframe in that context.

> There should maybe be some sanity check that each target gets built at least after X days since the last build, even if there are newer commits in the prioritized release branches. The "time since last build" should have a growing weight.

I disagree. Having up to date release branches is more important than having up-to-date main snapshot, so that the release branches are always confirmed to be in a releasable state should the need arise.

In any case, another way to tackle this problem would be to switch from continuous builds that starve the build resources to periodic builds that don?t (e.g. once a week), in which case it becomes possible to predictably and consistently build all branches.

(*) considering the amount of CI now going on, there would be less need to run the builders continuously and the periodic proposal above could make more sense.

My 2c.

T

From ynezz at true.cz  Mon Nov 13 11:54:34 2023
From: ynezz at true.cz (Petr =?utf-8?Q?=C5=A0tetiar?=)
Date: Mon, 13 Nov 2023 19:54:34 +0000
Subject: Adding a new x86 image or related packages to the default x86
 image
In-Reply-To: <334B1B53-A224-439C-94B7-F1F06BDB896E@aparcar.org>
References: <8682698C-4740-430A-906D-B8DE1AA93C1A@aparcar.org>
 <20230915011955.1e12377f@mir>
 <E4E2EB72-FE41-436A-A4E2-D6716C4FCE68@redfish-solutions.com>
 <ZVGHrxxvqzJve0nf@mattapan.m5p.com>
 <334B1B53-A224-439C-94B7-F1F06BDB896E@aparcar.org>
Message-ID: <ZVJ++hvLXXWsej4E@meh.true.cz>

Paul Spooren <mail at aparcar.org> [2023-11-13 13:30:10]:

Hi,

> How about we follow the approach of Alpine Linux[1] and offer a standard, an extended and a virtual firmware for the x86/64 target?

FYI that pull request added 27 firmware ASIC blobs, thus increased x86/64
image from 10 MiB to 41 MiB, but actually just 1 firmware ASIC blob
mlxsw_spectrum-13.2010.1006.mfa2 (1.6MiB) is needed, so I would instead recommend to
fix that mlx firmware package and call it a day?

Cheers,

Petr


From ynezz at true.cz  Mon Nov 13 12:32:44 2023
From: ynezz at true.cz (Petr =?utf-8?Q?=C5=A0tetiar?=)
Date: Mon, 13 Nov 2023 20:32:44 +0000
Subject: Unbalanced prioritization in the images buildbot? (main branch
 deprioritized too much)
In-Reply-To: <0959D57B-F533-4186-9283-19A8467D3671@slashdirt.org>
References: <d089fb49-d964-4f7b-8a49-9d5a497902f9@iki.fi>
 <0959D57B-F533-4186-9283-19A8467D3671@slashdirt.org>
Message-ID: <ZVKH3ATwDVXaiwrH@meh.true.cz>

Thibaut <hacks at slashdirt.org> [2023-11-13 17:26:44]:

Hi,

> In any case, another way to tackle this problem would be to switch from
> continuous builds that starve the build resources to periodic builds that
> don?t (e.g. once a week),

other options:

 * add more build workers :-)
 * use different GitPoller polling interval settings
   (master=5 minutes, 23.05=12 hours, 22.03=24 hours)

Cheers,

Petr


From daniel at makrotopia.org  Mon Nov 13 12:49:59 2023
From: daniel at makrotopia.org (Daniel Golle)
Date: Mon, 13 Nov 2023 20:49:59 +0000
Subject: Adding a new x86 image or related packages to the default x86
 image
In-Reply-To: <ZVJ++hvLXXWsej4E@meh.true.cz>
References: <8682698C-4740-430A-906D-B8DE1AA93C1A@aparcar.org>
 <20230915011955.1e12377f@mir>
 <E4E2EB72-FE41-436A-A4E2-D6716C4FCE68@redfish-solutions.com>
 <ZVGHrxxvqzJve0nf@mattapan.m5p.com>
 <334B1B53-A224-439C-94B7-F1F06BDB896E@aparcar.org>
 <ZVJ++hvLXXWsej4E@meh.true.cz>
Message-ID: <ZVKL97qCPw8SJzHP@makrotopia.org>

On Mon, Nov 13, 2023 at 07:54:34PM +0000, Petr ?tetiar wrote:
> Paul Spooren <mail at aparcar.org> [2023-11-13 13:30:10]:
> 
> Hi,
> 
> > How about we follow the approach of Alpine Linux[1] and offer a standard, an extended and a virtual firmware for the x86/64 target?
> 
> FYI that pull request added 27 firmware ASIC blobs, thus increased x86/64
> image from 10 MiB to 41 MiB, but actually just 1 firmware ASIC blob
> mlxsw_spectrum-13.2010.1006.mfa2 (1.6MiB) is needed, so I would instead recommend to
> fix that mlx firmware package and call it a day?

Thanks for pointing this out, increasing the default image by 1.6MiB is
bearable on x86 and that alone does not justify the introduction of
device specific images imho.


From hacks at slashdirt.org  Mon Nov 13 13:20:28 2023
From: hacks at slashdirt.org (Thibaut)
Date: Mon, 13 Nov 2023 22:20:28 +0100
Subject: Unbalanced prioritization in the images buildbot? (main branch
 deprioritized too much)
In-Reply-To: <ZVKH3ATwDVXaiwrH@meh.true.cz>
References: <d089fb49-d964-4f7b-8a49-9d5a497902f9@iki.fi>
 <0959D57B-F533-4186-9283-19A8467D3671@slashdirt.org>
 <ZVKH3ATwDVXaiwrH@meh.true.cz>
Message-ID: <093BD1B5-FA29-45A0-B05E-A11216403E05@slashdirt.org>



> Le 13 nov. 2023 ? 21:32, Petr ?tetiar <ynezz at true.cz> a ?crit :
> 
> Thibaut <hacks at slashdirt.org> [2023-11-13 17:26:44]:
> 
> Hi,
> 
>> In any case, another way to tackle this problem would be to switch from
>> continuous builds that starve the build resources to periodic builds that
>> don?t (e.g. once a week),
> 
> other options:
> 
> * add more build workers :-)
> * use different GitPoller polling interval settings
>   (master=5 minutes, 23.05=12 hours, 22.03=24 hours)

GitPoller accepts a single poll interval. What you?re suggesting would require separating each branch, i.e. returning to the previous situation. It would also entirely defeat the purpose of prioritizing branches at the Scheduler level.

Also note that even with a 24h poll interval you could still starve the master builds.

Which is why I think either we accept the current situation as being ? as designed ?, or we switch to a periodic build schedule (which imho makes a lot more sense considering that build resources aren?t infinitely expandable). This would have the added benefit of ensuring *consistency* across targets, i.e. ensuring that whichever commit is built is built on *all* targets. Currently master will typically build and produce images for different commits across targets when there is a lot of commit activity.

Cheers

From robimarko at gmail.com  Mon Nov 13 13:24:41 2023
From: robimarko at gmail.com (Robert Marko)
Date: Mon, 13 Nov 2023 22:24:41 +0100
Subject: Unbalanced prioritization in the images buildbot? (main branch
 deprioritized too much)
In-Reply-To: <093BD1B5-FA29-45A0-B05E-A11216403E05@slashdirt.org>
References: <d089fb49-d964-4f7b-8a49-9d5a497902f9@iki.fi> <0959D57B-F533-4186-9283-19A8467D3671@slashdirt.org>
 <ZVKH3ATwDVXaiwrH@meh.true.cz> <093BD1B5-FA29-45A0-B05E-A11216403E05@slashdirt.org>
Message-ID: <CAOX2RU4fqdpcADo0MF6LB8aNmEwdaOdjxJRJCkewshrpucPUWg@mail.gmail.com>

On Mon, 13 Nov 2023 at 22:21, Thibaut <hacks at slashdirt.org> wrote:
>
>
>
> > Le 13 nov. 2023 ? 21:32, Petr ?tetiar <ynezz at true.cz> a ?crit :
> >
> > Thibaut <hacks at slashdirt.org> [2023-11-13 17:26:44]:
> >
> > Hi,
> >
> >> In any case, another way to tackle this problem would be to switch from
> >> continuous builds that starve the build resources to periodic builds that
> >> don?t (e.g. once a week),
> >
> > other options:
> >
> > * add more build workers :-)
> > * use different GitPoller polling interval settings
> >   (master=5 minutes, 23.05=12 hours, 22.03=24 hours)
>
> GitPoller accepts a single poll interval. What you?re suggesting would require separating each branch, i.e. returning to the previous situation. It would also entirely defeat the purpose of prioritizing branches at the Scheduler level.
>
> Also note that even with a 24h poll interval you could still starve the master builds.
>
> Which is why I think either we accept the current situation as being ? as designed ?, or we switch to a periodic build schedule (which imho makes a lot more sense considering that build resources aren?t infinitely expandable). This would have the added benefit of ensuring *consistency* across targets, i.e. ensuring that whichever commit is built is built on *all* targets. Currently master will typically build and produce images for different commits across targets when there is a lot of commit activity.

Personally, time-based builds make more sense to me.
Having all of targets built of the same commit would be nice.

Regards,
Robert
>
> Cheers
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel


From ehem+openwrt at m5p.com  Mon Nov 13 18:26:04 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Mon, 13 Nov 2023 18:26:04 -0800
Subject: Adding a new x86 image or related packages to the default x86
 image
In-Reply-To: <ZVIbDvzYE4140iA4@makrotopia.org>
References: <8682698C-4740-430A-906D-B8DE1AA93C1A@aparcar.org>
 <20230915011955.1e12377f@mir>
 <E4E2EB72-FE41-436A-A4E2-D6716C4FCE68@redfish-solutions.com>
 <ZVGHrxxvqzJve0nf@mattapan.m5p.com>
 <334B1B53-A224-439C-94B7-F1F06BDB896E@aparcar.org>
 <ZVIbDvzYE4140iA4@makrotopia.org>
Message-ID: <ZVLavGP70nbg5tOp@mattapan.m5p.com>

On Mon, Nov 13, 2023 at 12:48:14PM +0000, Daniel Golle wrote:
> On Mon, Nov 13, 2023 at 01:30:10PM +0100, Paul Spooren wrote:
> > 
> > How about we follow the approach of Alpine Linux[1] and offer a standard, an extended and a virtual firmware for the x86/64 target?
> > 
> > What packages specifically is another discussion but the approach could be that standard contains all kmods to get network working on all device, extended includes extra LED drivers etc and virtual only contains network drivers for, well, virtual things.
> 
> +1
> I like that much more than adding board-specific images on a platform
> with standardized boot process (such as x86 or armsr).

Are you stating you're planning to modify OpenWRT's boot process to
match the standard way of dealing with that standardized boot process?
Mainly, using a minimal kernel and then using an initial ramdisk to
load device drivers as appropriate to the hardware.

Failing that, I suppose it would be acceptable to have an initial
ramdisk which simply tried to load all modules.  Then it would be
possible to remove unneeded modules later.


The real issue is VMs are unlikely to see devices typically present on
bare metal computers.  Thermal capabilities?  Nope.  Processor frequency
selection?  Nope.  Microcode reloading?  Nope.

Each hypervisor will have a small set of drivers guaranteed to be
present.  These though will be completely different between hypervisors.

I don't know whether it is possible to omit all types of framebuffer from
a Hyper-V VM.  If it isn't possible, then having a framebuffer driver
will be required for Hyper-V, but this consumes somewhere 0.5-1.5MB on
any VM which can omit the framebuffer.

Meanwhile Xen's block device driver isn't even based on SCSI.  As a
result it can completely remove the SCSI subsystem, this saves
another 0.5-1.5MB on a Xen VM.

10MB might not be much for a 2GB VM.  For a 128MB VM, those excess
drivers are a distinct burden.


I've got a WIP patch series for making distinct kernel builds rather
less of a burden.  The series will need some significant testing.


-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |         ehem+sigmsg at m5p.com  PGP 87145445         |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445




From daniel at makrotopia.org  Mon Nov 13 19:44:57 2023
From: daniel at makrotopia.org (Daniel Golle)
Date: Tue, 14 Nov 2023 03:44:57 +0000
Subject: Adding a new x86 image or related packages to the default x86
 image
In-Reply-To: <ZVLavGP70nbg5tOp@mattapan.m5p.com>
References: <8682698C-4740-430A-906D-B8DE1AA93C1A@aparcar.org>
 <20230915011955.1e12377f@mir>
 <E4E2EB72-FE41-436A-A4E2-D6716C4FCE68@redfish-solutions.com>
 <ZVGHrxxvqzJve0nf@mattapan.m5p.com>
 <334B1B53-A224-439C-94B7-F1F06BDB896E@aparcar.org>
 <ZVIbDvzYE4140iA4@makrotopia.org>
 <ZVLavGP70nbg5tOp@mattapan.m5p.com>
Message-ID: <ZVLtOZvmxFt8KKJK@makrotopia.org>

On Mon, Nov 13, 2023 at 06:26:04PM -0800, Elliott Mitchell wrote:
> On Mon, Nov 13, 2023 at 12:48:14PM +0000, Daniel Golle wrote:
> > On Mon, Nov 13, 2023 at 01:30:10PM +0100, Paul Spooren wrote:
> > > 
> > > How about we follow the approach of Alpine Linux[1] and offer a standard, an extended and a virtual firmware for the x86/64 target?
> > > 
> > > What packages specifically is another discussion but the approach could be that standard contains all kmods to get network working on all device, extended includes extra LED drivers etc and virtual only contains network drivers for, well, virtual things.
> > 
> > +1
> > I like that much more than adding board-specific images on a platform
> > with standardized boot process (such as x86 or armsr).
> 
> Are you stating you're planning to modify OpenWRT's boot process to
> match the standard way of dealing with that standardized boot process?
> Mainly, using a minimal kernel and then using an initial ramdisk to
> load device drivers as appropriate to the hardware.

Using squashfs (which is what we are doing) has actually quite
a similar effect than using initramfs. Filesystem cache of files which
aren't accessed gets freed.

What is missing is hotplug-based loading of kmods based on present
devices -- right now every module present gets loaded and remains
loaded indefinitely even if the hardware isn't present.

> 
> Failing that, I suppose it would be acceptable to have an initial
> ramdisk which simply tried to load all modules.  Then it would be
> possible to remove unneeded modules later.

You can already do that and the effect on memory consumption is
the same as an initrd (which is literally just uncommitted filesystem
cache). The only difference is that the initramfs needs to be
decompressed in one piece which takes a lot of time while squashfs
can be read and decompressed on-the-fly obviously.
And initramfs needs to be explicitely freed (using pivot_root) while
in case of squashfs files can always be loaded from flash and stay in
the filesystem cache in RAM as long as they are being used and the
space isn't needed for anything else.

> 
> 
> The real issue is VMs are unlikely to see devices typically present on
> bare metal computers.  Thermal capabilities?  Nope.  Processor frequency
> selection?  Nope.  Microcode reloading?  Nope.

Here I agree. We should have a 'slim/vm' image without any 'real' hardware
drivers.

> 
> Each hypervisor will have a small set of drivers guaranteed to be
> present.  These though will be completely different between hypervisors.

Do you really think having just the (partially shared) drivers for 3
hypervisors (KVM/virtio, Hyper-V, VMWare) present in one image is too
much? Those drivers are very tiny...

> 
> I don't know whether it is possible to omit all types of framebuffer from
> a Hyper-V VM.  If it isn't possible, then having a framebuffer driver
> will be required for Hyper-V, but this consumes somewhere 0.5-1.5MB on
> any VM which can omit the framebuffer.

Framebuffer support can entirely be built as modules and we can do that
instead of having it built-in on x86.
Feel free to suggest patches.

> 
> Meanwhile Xen's block device driver isn't even based on SCSI.  As a
> result it can completely remove the SCSI subsystem, this saves
> another 0.5-1.5MB on a Xen VM.

Ok, that would really require different kernel builds (as in:
subtargets) and not just different images. One for booting from
all kinds of physical storage and one for booting from virtualized
virtio block or NVMe via IOMMU.

> 
> 10MB might not be much for a 2GB VM.  For a 128MB VM, those excess
> drivers are a distinct burden.
> 
> 
> I've got a WIP patch series for making distinct kernel builds rather
> less of a burden.  The series will need some significant testing.

I understand the additional build resources, maintainance and
debugging efforts can be justified when having a very high number of
identical devices, as it is typically the case only in very large
deployments (think: major ISPs and hotspot providers having in-house
R&D).

However, OpenWrt (the distribution) supports thousands of different
devices, and that becomes possible only because all devices within a
subtarget share use the exact same kernel build. Not just because of
build resources, but also because almost all testing and debugging is
covered in the subtarget level and hence we are talking about a
somehow manageable workload -- one can nearly reproduce and debug
most issues on any of the devices (can be hundreds) on a subtarget
using a single or at most 4 different reference devices.

OpenWrt (the build-system) could offer such a feature for people
wanting to create super-optimizied builds themselves.


From philipp_subx at redfish-solutions.com  Mon Nov 13 20:33:38 2023
From: philipp_subx at redfish-solutions.com (Philip Prindeville)
Date: Mon, 13 Nov 2023 21:33:38 -0700
Subject: Adding a new x86 image or related packages to the default x86
 image
In-Reply-To: <ZVLavGP70nbg5tOp@mattapan.m5p.com>
References: <8682698C-4740-430A-906D-B8DE1AA93C1A@aparcar.org>
 <20230915011955.1e12377f@mir>
 <E4E2EB72-FE41-436A-A4E2-D6716C4FCE68@redfish-solutions.com>
 <ZVGHrxxvqzJve0nf@mattapan.m5p.com>
 <334B1B53-A224-439C-94B7-F1F06BDB896E@aparcar.org>
 <ZVIbDvzYE4140iA4@makrotopia.org> <ZVLavGP70nbg5tOp@mattapan.m5p.com>
Message-ID: <EE485D4C-07A3-4456-813F-E5868FBE1DCE@redfish-solutions.com>



> On Nov 13, 2023, at 7:26 PM, Elliott Mitchell <ehem+openwrt at m5p.com> wrote:
> 
> On Mon, Nov 13, 2023 at 12:48:14PM +0000, Daniel Golle wrote:
>> On Mon, Nov 13, 2023 at 01:30:10PM +0100, Paul Spooren wrote:
>>> 
>>> How about we follow the approach of Alpine Linux[1] and offer a standard, an extended and a virtual firmware for the x86/64 target?
>>> 
>>> What packages specifically is another discussion but the approach could be that standard contains all kmods to get network working on all device, extended includes extra LED drivers etc and virtual only contains network drivers for, well, virtual things.
>> 
>> +1
>> I like that much more than adding board-specific images on a platform
>> with standardized boot process (such as x86 or armsr).
> 
> [...]
> 
> The real issue is VMs are unlikely to see devices typically present on
> bare metal computers.  Thermal capabilities?  Nope.  Processor frequency
> selection?  Nope.  Microcode reloading?  Nope.
> 
> Each hypervisor will have a small set of drivers guaranteed to be
> present.  These though will be completely different between hypervisors.


With KVM and kmod-vfio-pci you can do reverse-pass thru where the host isn't controlling the hardware but the guest is.  I know some people who do this to test WiFi drivers from KVM guests.

-Philip



From ehem+openwrt at m5p.com  Mon Nov 13 21:44:02 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Mon, 13 Nov 2023 21:44:02 -0800
Subject: Adding a new x86 image or related packages to the default x86
 image
In-Reply-To: <ZVLtOZvmxFt8KKJK@makrotopia.org>
References: <8682698C-4740-430A-906D-B8DE1AA93C1A@aparcar.org>
 <20230915011955.1e12377f@mir>
 <E4E2EB72-FE41-436A-A4E2-D6716C4FCE68@redfish-solutions.com>
 <ZVGHrxxvqzJve0nf@mattapan.m5p.com>
 <334B1B53-A224-439C-94B7-F1F06BDB896E@aparcar.org>
 <ZVIbDvzYE4140iA4@makrotopia.org>
 <ZVLavGP70nbg5tOp@mattapan.m5p.com>
 <ZVLtOZvmxFt8KKJK@makrotopia.org>
Message-ID: <ZVMJIvB/S9jfNxpn@mattapan.m5p.com>

On Tue, Nov 14, 2023 at 03:44:57AM +0000, Daniel Golle wrote:
> On Mon, Nov 13, 2023 at 06:26:04PM -0800, Elliott Mitchell wrote:
> > On Mon, Nov 13, 2023 at 12:48:14PM +0000, Daniel Golle wrote:
> > > On Mon, Nov 13, 2023 at 01:30:10PM +0100, Paul Spooren wrote:
> > > > 
> > > > How about we follow the approach of Alpine Linux[1] and offer a standard, an extended and a virtual firmware for the x86/64 target?
> > > > 
> > > > What packages specifically is another discussion but the approach could be that standard contains all kmods to get network working on all device, extended includes extra LED drivers etc and virtual only contains network drivers for, well, virtual things.
> > > 
> > > +1
> > > I like that much more than adding board-specific images on a platform
> > > with standardized boot process (such as x86 or armsr).
> > 
> > Are you stating you're planning to modify OpenWRT's boot process to
> > match the standard way of dealing with that standardized boot process?
> > Mainly, using a minimal kernel and then using an initial ramdisk to
> > load device drivers as appropriate to the hardware.
> 
> Using squashfs (which is what we are doing) has actually quite
> a similar effect than using initramfs. Filesystem cache of files which
> aren't accessed gets freed.
> 
> What is missing is hotplug-based loading of kmods based on present
> devices -- right now every module present gets loaded and remains
> loaded indefinitely even if the hardware isn't present.

First, an initial ramdisk allows the kernel to not include any block
drivers, but instead load them during boot.  ie a VM build could include
drivers for interacting with every hypervisor, but only load the ones
for the hypervisor in use.

Second, while suboptimal having those drivers as modules allows them to
be unloaded.  If the drivers for every hypervisor were unconditionally
loaded, the inappropriate ones might be unloaded by /etc/rc.local.


> > Each hypervisor will have a small set of drivers guaranteed to be
> > present.  These though will be completely different between hypervisors.
> 
> Do you really think having just the (partially shared) drivers for 3
> hypervisors (KVM/virtio, Hyper-V, VMWare) present in one image is too
> much? Those drivers are very tiny...

Permanently built into the kernel?  Not acceptable.

Having a single shared initial ramdisk which always loads all modules
for every hypervisor?  Acceptable.

Tiny is relative.  For a bare-metal computer with 128GB of memory, 10MB
isn't going to make too much difference.  For a 128MB VM, 10MB does make
a significant difference.


> > 10MB might not be much for a 2GB VM.  For a 128MB VM, those excess
> > drivers are a distinct burden.
> > 
> > 
> > I've got a WIP patch series for making distinct kernel builds rather
> > less of a burden.  The series will need some significant testing.

> However, OpenWrt (the distribution) supports thousands of different
> devices, and that becomes possible only because all devices within a
> subtarget share use the exact same kernel build. Not just because of
> build resources, but also because almost all testing and debugging is
> covered in the subtarget level and hence we are talking about a
> somehow manageable workload -- one can nearly reproduce and debug
> most issues on any of the devices (can be hundreds) on a subtarget
> using a single or at most 4 different reference devices.

Hmm.

As stated above, having everything as a module is acceptable to me.  The
issue here is there isn't much use of modules in OpenWRT.


On Mon, Nov 13, 2023 at 09:33:38PM -0700, Philip Prindeville wrote:
> 
> > On Nov 13, 2023, at 7:26 PM, Elliott Mitchell <ehem+openwrt at m5p.com> wrote:
> > 
> > Each hypervisor will have a small set of drivers guaranteed to be
> > present.  These though will be completely different between hypervisors.
> 
> With KVM and kmod-vfio-pci you can do reverse-pass thru where the host isn't controlling the hardware but the guest is.  I know some people who do this to test WiFi drivers from KVM guests.
> 

I haven't tested this with every hypervisor, but I'm pretty sure every
hypervisor of note can do this.  The configuration steps are different,
but the result is exactly the same.

You're thinking too small.  This can be used for testing, but this is
also entirely feasible for a serious use AP in a VM.

As stated previously, the makers of embedded acces points have been
suggesting pushing server tasks onto your AP.  Yet the opposite is
possible, a server can have all the hardware for a full AP.


-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |         ehem+sigmsg at m5p.com  PGP 87145445         |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445




From philipp_subx at redfish-solutions.com  Mon Nov 13 22:34:05 2023
From: philipp_subx at redfish-solutions.com (Philip Prindeville)
Date: Mon, 13 Nov 2023 23:34:05 -0700
Subject: Adding a new x86 image or related packages to the default x86
 image
In-Reply-To: <ZVMJIvB/S9jfNxpn@mattapan.m5p.com>
References: <8682698C-4740-430A-906D-B8DE1AA93C1A@aparcar.org>
 <20230915011955.1e12377f@mir>
 <E4E2EB72-FE41-436A-A4E2-D6716C4FCE68@redfish-solutions.com>
 <ZVGHrxxvqzJve0nf@mattapan.m5p.com>
 <334B1B53-A224-439C-94B7-F1F06BDB896E@aparcar.org>
 <ZVIbDvzYE4140iA4@makrotopia.org> <ZVLavGP70nbg5tOp@mattapan.m5p.com>
 <ZVLtOZvmxFt8KKJK@makrotopia.org> <ZVMJIvB/S9jfNxpn@mattapan.m5p.com>
Message-ID: <BA52E68F-BF74-476B-8432-BA164506A65C@redfish-solutions.com>



> On Nov 13, 2023, at 10:44 PM, Elliott Mitchell <ehem+openwrt at m5p.com> wrote:
> 
> On Tue, Nov 14, 2023 at 03:44:57AM +0000, Daniel Golle wrote:
>> On Mon, Nov 13, 2023 at 06:26:04PM -0800, Elliott Mitchell wrote:
>>> On Mon, Nov 13, 2023 at 12:48:14PM +0000, Daniel Golle wrote:
>>>> On Mon, Nov 13, 2023 at 01:30:10PM +0100, Paul Spooren wrote:
>>>>> 
>>>>> How about we follow the approach of Alpine Linux[1] and offer a standard, an extended and a virtual firmware for the x86/64 target?
>>>>> 
>>>>> What packages specifically is another discussion but the approach could be that standard contains all kmods to get network working on all device, extended includes extra LED drivers etc and virtual only contains network drivers for, well, virtual things.
>>>> 
>>>> +1
>>>> I like that much more than adding board-specific images on a platform
>>>> with standardized boot process (such as x86 or armsr).
>>> 
>>> Are you stating you're planning to modify OpenWRT's boot process to
>>> match the standard way of dealing with that standardized boot process?
>>> Mainly, using a minimal kernel and then using an initial ramdisk to
>>> load device drivers as appropriate to the hardware.
>> 
>> Using squashfs (which is what we are doing) has actually quite
>> a similar effect than using initramfs. Filesystem cache of files which
>> aren't accessed gets freed.
>> 
>> What is missing is hotplug-based loading of kmods based on present
>> devices -- right now every module present gets loaded and remains
>> loaded indefinitely even if the hardware isn't present.
> 
> First, an initial ramdisk allows the kernel to not include any block
> drivers, but instead load them during boot.  ie a VM build could include
> drivers for interacting with every hypervisor, but only load the ones
> for the hypervisor in use.
> 
> Second, while suboptimal having those drivers as modules allows them to
> be unloaded.  If the drivers for every hypervisor were unconditionally
> loaded, the inappropriate ones might be unloaded by /etc/rc.local.
> 
> 
>>> Each hypervisor will have a small set of drivers guaranteed to be
>>> present.  These though will be completely different between hypervisors.
>> 
>> Do you really think having just the (partially shared) drivers for 3
>> hypervisors (KVM/virtio, Hyper-V, VMWare) present in one image is too
>> much? Those drivers are very tiny...
> 
> Permanently built into the kernel?  Not acceptable.


Every once-in-a-while a vulnerable driver is discovered that is a CVE even when it's not active.

Having the modules linked in makes it harder to blacklist their initialization.

-Philip




From ynezz at true.cz  Tue Nov 14 00:59:07 2023
From: ynezz at true.cz (Petr =?utf-8?Q?=C5=A0tetiar?=)
Date: Tue, 14 Nov 2023 08:59:07 +0000
Subject: Unbalanced prioritization in the images buildbot? (main branch
 deprioritized too much)
In-Reply-To: <093BD1B5-FA29-45A0-B05E-A11216403E05@slashdirt.org>
References: <d089fb49-d964-4f7b-8a49-9d5a497902f9@iki.fi>
 <0959D57B-F533-4186-9283-19A8467D3671@slashdirt.org>
 <ZVKH3ATwDVXaiwrH@meh.true.cz>
 <093BD1B5-FA29-45A0-B05E-A11216403E05@slashdirt.org>
Message-ID: <ZVM2mUiWkZMxPCWA@meh.true.cz>

Thibaut <hacks at slashdirt.org> [2023-11-13 22:20:28]:

Hi,

> GitPoller accepts a single poll interval. What you?re suggesting would
> require separating each branch, i.e. returning to the previous situation.

IIUC then you can have multiple GitPoller instances, so wouldn't something
along this lines work?

	diff --git a/phase1/master.cfg b/phase1/master.cfg
	index 6f6c650cf54c..6cbd0c8d9609 100644
	--- a/phase1/master.cfg
	+++ b/phase1/master.cfg
	@@ -341,15 +341,16 @@ populateTargets()
	 # about source code changes.

	 c["change_source"] = []
	-c["change_source"].append(
	-    GitPoller(
	-        repo_url,
	-        workdir=work_dir + "/work.git",
	-        branches=branchNames,
	-        pollAtLaunch=True,
	-        pollinterval=300,
	+for branch in branchNames:
	+    c["change_source"].append(
	+        GitPoller(
	+            repo_url,
	+            branch=branch,
	+            workdir=work_dir + "/work.git",
	+            pollAtLaunch=True,
	+            pollinterval=pollinterval_for_branch(branch),
	+        )
	     )
	-)

> Also note that even with a 24h poll interval you could still starve the master builds.

Sure, but meanwhile it would still allow to build quite a bunch of the master
targets, so improving current situation.

> or we switch to a periodic build schedule

What about handling of security fixes in this once a week periodic build
proposal?

Going forward with this approach, we would still probably need some custom
scheduler which would be able to skim through the commit content and trigger
build when certain patterns are found, like a word 'security' or CVE number?

> This would have the added benefit of ensuring *consistency*
> across targets, i.e. ensuring that whichever commit is built is built on
> *all* targets.

I'm probably missing something, but what is this consistency good for?

I would actually prefer to select say top X targets (ideally have them in
testbeds for automatic runtime testing) and increase build priorities for
those in phase1/phase2 builds, making sure, that we provide builds to actual
users/testers first and build the rest afterwards.

Those targets would be clearly marked as such in the source tree, for example:

 FEATURES+=ci-tier1

 (or introduce some new variable?)

we would need to define and document this selection process of course as well :)

Cheers,

Petr


From mail at david-bauer.net  Tue Nov 14 01:02:36 2023
From: mail at david-bauer.net (David Bauer)
Date: Tue, 14 Nov 2023 10:02:36 +0100
Subject: Adding a new x86 image or related packages to the default x86
 image
In-Reply-To: <ZVKL97qCPw8SJzHP@makrotopia.org>
References: <8682698C-4740-430A-906D-B8DE1AA93C1A@aparcar.org>
 <20230915011955.1e12377f@mir>
 <E4E2EB72-FE41-436A-A4E2-D6716C4FCE68@redfish-solutions.com>
 <ZVGHrxxvqzJve0nf@mattapan.m5p.com>
 <334B1B53-A224-439C-94B7-F1F06BDB896E@aparcar.org>
 <ZVJ++hvLXXWsej4E@meh.true.cz> <ZVKL97qCPw8SJzHP@makrotopia.org>
Message-ID: <a56a790b-0140-45f0-bd7c-286c5dd46c8c@david-bauer.net>

Hi Daniel,
Hi Petr,

On 11/13/23 21:49, Daniel Golle wrote:
> On Mon, Nov 13, 2023 at 07:54:34PM +0000, Petr ?tetiar wrote:
>> Paul Spooren <mail at aparcar.org> [2023-11-13 13:30:10]:
>>
>> Hi,
>>
>>> How about we follow the approach of Alpine Linux[1] and offer a standard, an extended and a virtual firmware for the x86/64 target?
>>
>> FYI that pull request added 27 firmware ASIC blobs, thus increased x86/64
>> image from 10 MiB to 41 MiB, but actually just 1 firmware ASIC blob
>> mlxsw_spectrum-13.2010.1006.mfa2 (1.6MiB) is needed, so I would instead recommend to
>> fix that mlx firmware package and call it a day?
> 
> Thanks for pointing this out, increasing the default image by 1.6MiB is
> bearable on x86 and that alone does not justify the introduction of
> device specific images imho.

Sounds reasonable to me, regardless of how we want to
proceed with the x64 target in general.

Is there already a patch series / PR in the works?
Otherwise, I'd look into that.

Best
David

> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel


From hacks at slashdirt.org  Tue Nov 14 01:24:28 2023
From: hacks at slashdirt.org (Thibaut)
Date: Tue, 14 Nov 2023 10:24:28 +0100
Subject: Unbalanced prioritization in the images buildbot? (main branch
 deprioritized too much)
In-Reply-To: <ZVM2mUiWkZMxPCWA@meh.true.cz>
References: <d089fb49-d964-4f7b-8a49-9d5a497902f9@iki.fi>
 <0959D57B-F533-4186-9283-19A8467D3671@slashdirt.org>
 <ZVKH3ATwDVXaiwrH@meh.true.cz>
 <093BD1B5-FA29-45A0-B05E-A11216403E05@slashdirt.org>
 <ZVM2mUiWkZMxPCWA@meh.true.cz>
Message-ID: <A7327FA2-3A06-4010-AFF9-84181EEC4315@slashdirt.org>



> Le 14 nov. 2023 ? 09:59, Petr ?tetiar <ynezz at true.cz> a ?crit :
> 
> Thibaut <hacks at slashdirt.org> [2023-11-13 22:20:28]:
> 
> Hi,
> 
>> GitPoller accepts a single poll interval. What you?re suggesting would
>> require separating each branch, i.e. returning to the previous situation.
> 
> IIUC then you can have multiple GitPoller instances, so wouldn't something
> along this lines work?
> 
> 	diff --git a/phase1/master.cfg b/phase1/master.cfg
> 	index 6f6c650cf54c..6cbd0c8d9609 100644
> 	--- a/phase1/master.cfg
> 	+++ b/phase1/master.cfg
> 	@@ -341,15 +341,16 @@ populateTargets()
> 	 # about source code changes.
> 
> 	 c["change_source"] = []
> 	-c["change_source"].append(
> 	-    GitPoller(
> 	-        repo_url,
> 	-        workdir=work_dir + "/work.git",
> 	-        branches=branchNames,
> 	-        pollAtLaunch=True,
> 	-        pollinterval=300,
> 	+for branch in branchNames:
> 	+    c["change_source"].append(
> 	+        GitPoller(
> 	+            repo_url,
> 	+            branch=branch,
> 	+            workdir=work_dir + "/work.git",
> 	+            pollAtLaunch=True,
> 	+            pollinterval=pollinterval_for_branch(branch),
> 	+        )
> 	     )
> 	-)
> 

I?m pretty sure this would explode should two or more gitpoller instances happen to update at the same time.

It also defeats the branch priority purpose and solves nothing: say you have a 24h interval on some high priority branch. It only takes two separate commits at 24h interval to that branch to still starve master.

>> Also note that even with a 24h poll interval you could still starve the master builds.
> 
> Sure, but meanwhile it would still allow to build quite a bunch of the master
> targets, so improving current situation.

There?s a much easier way to do this: we just stop prioritizing (release) branches.

Treat all builders [there?s one builder per branch per target] equally and rank them by time last run (regardless of branch) and voila, problem solved, no branch *and* no target can be starved.

Of course we would still keep tag builds at maximum priority in that scenario.

This should be a 2-3-line change, let me know if I should submit this.

Of course for low traffic branches, the first new commit will get priority over everything else (if the branch hasn?t been built in a long time), but that I believe is quite ? logical ? and acceptable.

>> or we switch to a periodic build schedule
> 
> What about handling of security fixes in this once a week periodic build
> proposal?

I don?t follow, what do security fixes have to do with snapshot builds? Surely this is not suggesting that we address security issues via the snapshot builds, especially when, as I pointed out earlier, there is no guarantee that any given commit will be built unequivocally on *all* targets?

My understanding is that security fixes are handled via service releases; I don?t expect users (that includes myself) to keep constantly looking at the git history to find if/when a CVE has been addressed in the snapshot builds.

> Going forward with this approach, we would still probably need some custom
> scheduler which would be able to skim through the commit content and trigger
> build when certain patterns are found, like a word 'security' or CVE number?

See above, I?m afraid this doesn?t make sense to me.

>> This would have the added benefit of ensuring *consistency*
>> across targets, i.e. ensuring that whichever commit is built is built on
>> *all* targets.
> 
> I'm probably missing something, but what is this consistency good for?

Even testing field.

> I would actually prefer to select say top X targets (ideally have them in
> testbeds for automatic runtime testing) and increase build priorities for
> those in phase1/phase2 builds, making sure, that we provide builds to actual
> users/testers first and build the rest afterwards.
> 
> Those targets would be clearly marked as such in the source tree, for example:
> 
> FEATURES+=ci-tier1

I didn?t know we were going to second-class some targets now?

Cheers
T

From ynezz at true.cz  Tue Nov 14 04:25:42 2023
From: ynezz at true.cz (Petr =?utf-8?Q?=C5=A0tetiar?=)
Date: Tue, 14 Nov 2023 12:25:42 +0000
Subject: Unbalanced prioritization in the images buildbot? (main branch
 deprioritized too much)
In-Reply-To: <A7327FA2-3A06-4010-AFF9-84181EEC4315@slashdirt.org>
References: <d089fb49-d964-4f7b-8a49-9d5a497902f9@iki.fi>
 <0959D57B-F533-4186-9283-19A8467D3671@slashdirt.org>
 <ZVKH3ATwDVXaiwrH@meh.true.cz>
 <093BD1B5-FA29-45A0-B05E-A11216403E05@slashdirt.org>
 <ZVM2mUiWkZMxPCWA@meh.true.cz>
 <A7327FA2-3A06-4010-AFF9-84181EEC4315@slashdirt.org>
Message-ID: <ZVNnPjqWsEhW3y83@meh.true.cz>

Thibaut <hacks at slashdirt.org> [2023-11-14 10:24:28]:

Hi,

> I don?t follow, what do security fixes have to do with snapshot builds?

OpenWrt builds and deliver package fixes continuosly from the snapshot builds.

> I don?t expect users (that includes myself) to keep constantly looking at
> the git history to find if/when a CVE has been addressed in the snapshot
> builds.

You're not expected to do this, we send out security advisories if its
important, where you can usually find recommended mitigations, like for
example:

 https://forum.openwrt.org/c/announcements/14
 https://lists.openwrt.org/pipermail/openwrt-announce/2022-October/000033.html

most of the fixes can be handled with `opkg update; opkg upgrade`

Cheers,

Petr


From ynezz at true.cz  Tue Nov 14 04:30:49 2023
From: ynezz at true.cz (Petr =?utf-8?Q?=C5=A0tetiar?=)
Date: Tue, 14 Nov 2023 12:30:49 +0000
Subject: Adding a new x86 image or related packages to the default x86
 image
In-Reply-To: <a56a790b-0140-45f0-bd7c-286c5dd46c8c@david-bauer.net>
References: <8682698C-4740-430A-906D-B8DE1AA93C1A@aparcar.org>
 <20230915011955.1e12377f@mir>
 <E4E2EB72-FE41-436A-A4E2-D6716C4FCE68@redfish-solutions.com>
 <ZVGHrxxvqzJve0nf@mattapan.m5p.com>
 <334B1B53-A224-439C-94B7-F1F06BDB896E@aparcar.org>
 <ZVJ++hvLXXWsej4E@meh.true.cz>
 <ZVKL97qCPw8SJzHP@makrotopia.org>
 <a56a790b-0140-45f0-bd7c-286c5dd46c8c@david-bauer.net>
Message-ID: <ZVNoefkrYqOOOeup@meh.true.cz>

David Bauer <mail at david-bauer.net> [2023-11-14 10:02:36]:

Hi,

> Is there already a patch series / PR in the works?

AFAIK there is just PR #13924 attempting to workaround #13886

> Otherwise, I'd look into that.

Great, thanks!

Cheers,

Petr


From hacks at slashdirt.org  Tue Nov 14 05:25:50 2023
From: hacks at slashdirt.org (Thibaut)
Date: Tue, 14 Nov 2023 14:25:50 +0100
Subject: Unbalanced prioritization in the images buildbot? (main branch
 deprioritized too much)
In-Reply-To: <ZVNnPjqWsEhW3y83@meh.true.cz>
References: <d089fb49-d964-4f7b-8a49-9d5a497902f9@iki.fi>
 <0959D57B-F533-4186-9283-19A8467D3671@slashdirt.org>
 <ZVKH3ATwDVXaiwrH@meh.true.cz>
 <093BD1B5-FA29-45A0-B05E-A11216403E05@slashdirt.org>
 <ZVM2mUiWkZMxPCWA@meh.true.cz>
 <A7327FA2-3A06-4010-AFF9-84181EEC4315@slashdirt.org>
 <ZVNnPjqWsEhW3y83@meh.true.cz>
Message-ID: <1145E9F2-25FB-4E90-8760-7BE022840453@slashdirt.org>

Hi,

> Le 14 nov. 2023 ? 13:25, Petr ?tetiar <ynezz at true.cz> a ?crit :
> 
> Thibaut <hacks at slashdirt.org> [2023-11-14 10:24:28]:
> 
> Hi,
> 
>> I don?t follow, what do security fixes have to do with snapshot builds?
> 
> OpenWrt builds and deliver package fixes continuosly from the snapshot builds.
> 
>> I don?t expect users (that includes myself) to keep constantly looking at
>> the git history to find if/when a CVE has been addressed in the snapshot
>> builds.
> 
> You're not expected to do this, we send out security advisories if its
> important, where you can usually find recommended mitigations, like for
> example:
> 
> https://forum.openwrt.org/c/announcements/14
> https://lists.openwrt.org/pipermail/openwrt-announce/2022-October/000033.html
> 
> most of the fixes can be handled with `opkg update; opkg upgrade`

I?m sorry, I must have missed the part where we advertised that master snapshots are a maintained 'release' suitable for use in a security-conscious context :)

Anyway, I have added an additional commit to my PR that removes branch priority: while it won?t solve the intrinsic resource waste that our buildbot system currently is, it should assuage the concerns raised in this thread.

Cheers,
T

From til.kaiser at gmx.de  Tue Nov 14 08:07:25 2023
From: til.kaiser at gmx.de (Til Kaiser)
Date: Tue, 14 Nov 2023 17:07:25 +0100
Subject: Adding a new x86 image or related packages to the default x86
 image
In-Reply-To: <ZVKL97qCPw8SJzHP@makrotopia.org>
References: <8682698C-4740-430A-906D-B8DE1AA93C1A@aparcar.org>
 <20230915011955.1e12377f@mir>
 <E4E2EB72-FE41-436A-A4E2-D6716C4FCE68@redfish-solutions.com>
 <ZVGHrxxvqzJve0nf@mattapan.m5p.com>
 <334B1B53-A224-439C-94B7-F1F06BDB896E@aparcar.org>
 <ZVJ++hvLXXWsej4E@meh.true.cz> <ZVKL97qCPw8SJzHP@makrotopia.org>
Message-ID: <67d2b264-21ed-48ee-b7c2-ccd1dd6fe7b6@gmx.de>

On 11/13/23 21:49, Daniel Golle wrote:

> On Mon, Nov 13, 2023 at 07:54:34PM +0000, Petr ?tetiar wrote:
>> Paul Spooren <mail at aparcar.org> [2023-11-13 13:30:10]:
>>
>> Hi,
>>
>>> How about we follow the approach of Alpine Linux[1] and offer a standard, an extended and a virtual firmware for the x86/64 target?
>> FYI that pull request added 27 firmware ASIC blobs, thus increased x86/64
>> image from 10 MiB to 41 MiB, but actually just 1 firmware ASIC blob
>> mlxsw_spectrum-13.2010.1006.mfa2 (1.6MiB) is needed, so I would instead recommend to
>> fix that mlx firmware package and call it a day?
> Thanks for pointing this out, increasing the default image by 1.6MiB is
> bearable on x86 and that alone does not justify the introduction of
> device specific images imho.
Greetings,

First of all, I am sorry for the problems caused by the commit I made
back then.

Unfortunately, there are three more problems:
First, the kmod-leds-mlxcpld module cannot be probed during boot on
other x86 devices, resulting in the following error message:
[??? 8.531720] kmodloader: 1 module could not be probed
[??? 8.532613] kmodloader: - leds-mlxcpld - 0

Second, only the firmware files for the Spectrum-1 Series (SN2XXX) have
been added so far. Originally, we had plans to add the firmware files
for the Spectrum-2, -3, and -4 Series as well. The current Spectrum-4
Series firmware files are even 8MB big (although it seems they are only
supported from Kernel version 6.2 onward).

And last, Mellanox doesn't even recommend the firmware file flashed by
the driver:
https://github.com/Mellanox/mlxsw/wiki/5.15-Release-notes#supported-firmware.
So you should actually flash another one, which means we would
theoretically need two firmware files for each Spectrum Series.
But I haven't run into problems yet with the one the driver flashed.

I think removing the packages from the default x86 is the best solution
for now, so they must be manually added while configuring the image.
Later, they could be still added back to the appropriate target, if
there might be a better solution.
I also just opened a pull request (#13981) regarding that.

Kind regards
Til


From ynezz at true.cz  Tue Nov 14 09:06:33 2023
From: ynezz at true.cz (Petr =?utf-8?Q?=C5=A0tetiar?=)
Date: Tue, 14 Nov 2023 18:06:33 +0100
Subject: Unbalanced prioritization in the images buildbot? (main branch
 deprioritized too much)
In-Reply-To: <1145E9F2-25FB-4E90-8760-7BE022840453@slashdirt.org>
References: <d089fb49-d964-4f7b-8a49-9d5a497902f9@iki.fi>
 <0959D57B-F533-4186-9283-19A8467D3671@slashdirt.org>
 <ZVKH3ATwDVXaiwrH@meh.true.cz>
 <093BD1B5-FA29-45A0-B05E-A11216403E05@slashdirt.org>
 <ZVM2mUiWkZMxPCWA@meh.true.cz>
 <A7327FA2-3A06-4010-AFF9-84181EEC4315@slashdirt.org>
 <ZVNnPjqWsEhW3y83@meh.true.cz>
 <1145E9F2-25FB-4E90-8760-7BE022840453@slashdirt.org>
Message-ID: <20231114170633.GA39423@meh.true.cz>

Thibaut <hacks at slashdirt.org> [2023-11-14 14:25:50]:

> I?m sorry, I must have missed the part where we advertised that master
> snapshots are a maintained 'release' suitable for use in a
> security-conscious context :)

There is no difference actually, it applies to all branches/releases, so it really
doesn't matter if you use main snapshot or 23.05.1 release.

Once the commit lands in the corresponding branch (main, openwrt-23.05 or
openwrt-22.03) then the packages are going to be built on buildbot and become
available for `opkg upgrade`, so you don't need to wait for a tagged release
to get certain fixes possible by a package upgrade.

In other words, https://downloads.openwrt.org/releases/23.05.0/ that
`packages` folder is a symlink to packages-23.05, populated by 23.05 snapshot
builds.

Cheers,

Petr


From hacks at slashdirt.org  Tue Nov 14 09:21:42 2023
From: hacks at slashdirt.org (Thibaut)
Date: Tue, 14 Nov 2023 18:21:42 +0100
Subject: Unbalanced prioritization in the images buildbot? (main branch
 deprioritized too much)
In-Reply-To: <20231114170633.GA39423@meh.true.cz>
References: <d089fb49-d964-4f7b-8a49-9d5a497902f9@iki.fi>
 <0959D57B-F533-4186-9283-19A8467D3671@slashdirt.org>
 <ZVKH3ATwDVXaiwrH@meh.true.cz>
 <093BD1B5-FA29-45A0-B05E-A11216403E05@slashdirt.org>
 <ZVM2mUiWkZMxPCWA@meh.true.cz>
 <A7327FA2-3A06-4010-AFF9-84181EEC4315@slashdirt.org>
 <ZVNnPjqWsEhW3y83@meh.true.cz>
 <1145E9F2-25FB-4E90-8760-7BE022840453@slashdirt.org>
 <20231114170633.GA39423@meh.true.cz>
Message-ID: <5504173A-A2F7-4078-BA1D-56349CDB4582@slashdirt.org>



> Le 14 nov. 2023 ? 18:06, Petr ?tetiar <ynezz at true.cz> a ?crit :
> 
> Thibaut <hacks at slashdirt.org> [2023-11-14 14:25:50]:
> 
>> I?m sorry, I must have missed the part where we advertised that master
>> snapshots are a maintained 'release' suitable for use in a
>> security-conscious context :)
> 
> There is no difference actually, it applies to all branches/releases, so it really
> doesn't matter if you use main snapshot or 23.05.1 release.
> 
> Once the commit lands in the corresponding branch (main, openwrt-23.05 or
> openwrt-22.03) then the packages are going to be built on buildbot and become
> available for `opkg upgrade`, so you don't need to wait for a tagged release
> to get certain fixes possible by a package upgrade.
> 
> In other words, https://downloads.openwrt.org/releases/23.05.0/ that
> `packages` folder is a symlink to packages-23.05, populated by 23.05 snapshot
> builds.

I understand this rationale for *releases* branch. Not for master. Hence prioritizing the releases branches, which, as we?ve seen just today, has merits.

But I rest my case and I have provided a fix already.

Cheers,
T

From ehem+openwrt at m5p.com  Tue Nov 14 17:08:53 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Tue, 14 Nov 2023 17:08:53 -0800
Subject: [PATCH 00/11] Misc kernel config cleanup and small adjustments
Message-ID: <cover.1700010533.git.ehem+openwrt@m5p.com>

This isn't really a very strong theme for this batch.  There is more work
for x86 targets than other platforms, but some pieces effect all
platforms.

Some of these are pure cleanup.  Kernel options which may have required
being set in the past, but no longer need to be set.

A few are adjusting defaults.  More platforms feature HW RNGs than don't
and these have been becoming more common.  As such it makes more sense
for CONFIG_HW_RANDOM=y in the generic configuration, then have platforms
which lack override and remove the functionality.

Then there is 4eda2fddf2 which is simply wrong.  In exchange I found two
pieces of Geode hardware whose drivers were being included in every x86
kernel.

There is x32 which could have value.  I would like to setup an
experimental build.  This may be too buggy for general consumption, but
having a test build for experimentation would be good.


Elliott Mitchell (11):
  kernel: change CONFIG_HW_RANDOM default to y
  kernel/generic: remove CONFIG_FB_NOTIFY
  kernel: purge CONFIG_FS_MBCACHE
  kernel: remove ext2 support from kernel
  kernel/x86: remove CONFIG_HDMI
  Revert "x86/geode: enable X86_INTEL_LPSS to select PINCTRL"
  kernel/x86: move Geode HW random from generic to geode
  kernel/x86: move SCx200 support from generic to geode
  kernel/x86: remove CONFIG_M686 from common configuration
  packages/x86: detect architecture, not x86/64 target
  kernel/x86: enable x32 support for amd64

 package/firmware/intel-microcode/Makefile     |  2 +-
 package/kernel/linux/modules/crypto.mk        |  2 +-
 package/kernel/linux/modules/virt.mk          |  4 +--
 package/libs/wolfssl/Makefile                 |  2 +-
 target/linux/airoha/config-5.15               |  1 -
 target/linux/apm821xx/config-5.15             |  1 +
 target/linux/apm821xx/config-6.1              |  1 +
 target/linux/archs38/config-5.15              |  2 +-
 target/linux/armsr/armv7/config-6.1           |  1 +
 target/linux/armsr/armv8/config-6.1           |  1 -
 target/linux/armsr/config-6.1                 |  1 -
 target/linux/at91/sam9x/config-5.15           |  2 --
 target/linux/at91/sama5/config-5.15           |  2 --
 target/linux/at91/sama7/config-5.15           |  2 --
 target/linux/ath25/config-5.15                |  1 -
 target/linux/ath79/config-5.15                |  1 +
 target/linux/ath79/config-6.1                 |  1 +
 target/linux/bcm27xx/bcm2708/config-6.1       |  2 --
 target/linux/bcm27xx/bcm2709/config-6.1       |  2 --
 target/linux/bcm27xx/bcm2710/config-6.1       |  2 --
 target/linux/bcm27xx/bcm2711/config-6.1       |  2 --
 target/linux/bcm47xx/config-5.15              |  1 -
 target/linux/bcm4908/config-5.15              |  1 +
 target/linux/bcm4908/config-6.1               |  1 +
 target/linux/bcm53xx/config-5.15              |  1 -
 target/linux/bcm53xx/config-6.1               |  1 -
 target/linux/bcm63xx/config-5.15              |  1 -
 target/linux/bmips/bcm6318/config-5.15        |  1 +
 target/linux/bmips/bcm6318/config-6.1         |  1 +
 target/linux/bmips/bcm63268/config-5.15       |  1 -
 target/linux/bmips/bcm63268/config-6.1        |  1 -
 target/linux/bmips/bcm6328/config-5.15        |  1 +
 target/linux/bmips/bcm6328/config-6.1         |  1 +
 target/linux/bmips/bcm6358/config-5.15        |  1 +
 target/linux/bmips/bcm6358/config-6.1         |  1 +
 target/linux/bmips/bcm6362/config-5.15        |  1 -
 target/linux/bmips/bcm6362/config-6.1         |  1 -
 target/linux/bmips/bcm6368/config-5.15        |  1 -
 target/linux/bmips/bcm6368/config-6.1         |  1 -
 target/linux/gemini/config-6.1                |  2 --
 target/linux/generic/config-5.15              |  6 ++---
 target/linux/generic/config-6.1               |  6 ++---
 target/linux/imx/config-5.15                  |  2 --
 target/linux/ipq40xx/config-6.1               |  1 -
 target/linux/ipq806x/config-6.1               |  1 -
 target/linux/ixp4xx/config-6.1                |  2 --
 target/linux/kirkwood/config-5.15             |  1 -
 target/linux/lantiq/ase/config-5.15           |  1 -
 target/linux/lantiq/falcon/config-5.15        |  1 +
 target/linux/lantiq/xrx200/config-5.15        |  1 -
 target/linux/lantiq/xway/config-5.15          |  1 -
 target/linux/lantiq/xway_legacy/config-5.15   |  1 +
 target/linux/layerscape/armv7/config-5.15     |  2 --
 target/linux/layerscape/armv7/config-6.1      |  2 --
 target/linux/layerscape/armv8_64b/config-5.15 |  2 --
 target/linux/layerscape/armv8_64b/config-6.1  |  2 --
 target/linux/malta/config-5.15                |  2 +-
 target/linux/malta/config-6.1                 |  2 +-
 target/linux/mediatek/filogic/config-5.15     |  2 --
 target/linux/mediatek/filogic/config-6.1      |  2 --
 target/linux/mediatek/mt7622/config-5.15      |  2 --
 target/linux/mediatek/mt7622/config-6.1       |  2 --
 target/linux/mediatek/mt7623/config-5.15      |  2 --
 target/linux/mediatek/mt7623/config-6.1       |  2 --
 target/linux/mediatek/mt7629/config-5.15      |  1 -
 target/linux/mediatek/mt7629/config-6.1       |  1 -
 target/linux/mpc85xx/config-5.15              |  1 -
 target/linux/mvebu/config-5.15                |  2 --
 target/linux/mvebu/config-6.1                 |  2 --
 target/linux/mxs/config-5.15                  |  2 +-
 target/linux/mxs/config-6.1                   |  2 +-
 target/linux/octeon/config-5.15               |  2 --
 target/linux/octeontx/config-5.15             |  1 -
 target/linux/omap/config-5.15                 |  2 --
 target/linux/oxnas/config-5.15                |  1 +
 target/linux/oxnas/ox810se/config-default     |  1 -
 target/linux/pistachio/config-5.15            |  2 +-
 target/linux/qoriq/config-5.15                |  2 --
 target/linux/qualcommax/config-6.1            |  1 +
 target/linux/ramips/mt7620/config-5.15        |  1 +
 target/linux/ramips/mt7621/config-5.15        |  1 +
 target/linux/ramips/mt76x8/config-5.15        |  1 +
 target/linux/ramips/rt288x/config-5.15        |  1 +
 target/linux/ramips/rt305x/config-5.15        |  1 +
 target/linux/ramips/rt3883/config-5.15        |  1 +
 target/linux/realtek/rtl838x/config-5.15      |  1 +
 target/linux/realtek/rtl839x/config-5.15      |  1 +
 target/linux/realtek/rtl930x/config-5.15      |  1 +
 target/linux/realtek/rtl931x/config-5.15      |  1 +
 target/linux/rockchip/armv8/config-5.15       |  2 +-
 target/linux/rockchip/armv8/config-6.1        |  2 +-
 target/linux/sifiveu/config-6.1               |  2 +-
 target/linux/sunxi/config-5.15                |  2 --
 target/linux/sunxi/config-6.1                 |  2 --
 target/linux/tegra/config-5.15                |  2 +-
 target/linux/uml/config-5.15                  |  2 --
 target/linux/uml/config-6.1                   |  2 --
 target/linux/x86/64/config-5.15               |  2 --
 target/linux/x86/64/config-6.1                |  3 ---
 target/linux/x86/config-5.15                  | 12 +++------
 target/linux/x86/config-6.1                   | 13 ++++------
 target/linux/x86/generic/config-5.15          |  2 --
 target/linux/x86/generic/config-6.1           |  2 --
 target/linux/x86/geode/config-5.15            | 23 ++++-------------
 target/linux/x86/geode/config-6.1             | 25 ++++---------------
 target/linux/x86/legacy/config-5.15           |  2 --
 target/linux/x86/legacy/config-6.1            |  2 --
 target/linux/x86/modules.mk                   |  2 +-
 target/linux/zynq/config-5.15                 |  2 +-
 109 files changed, 67 insertions(+), 175 deletions(-)

-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |       ehem+openwrt at m5p.com     PGP 87145445       |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445





From ehem+openwrt at m5p.com  Tue Nov 14 17:08:53 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Tue, 14 Nov 2023 17:08:53 -0800
Subject: [PATCH 01/11] kernel: change CONFIG_HW_RANDOM default to y
In-Reply-To: <cover.1700010533.git.ehem+openwrt@m5p.com>
References: <cover.1700010533.git.ehem+openwrt@m5p.com>
Message-ID: <03ffea5f21a8a601be55260bfef75bea77794178.1700010533.git.ehem+openwrt@m5p.com>

Date: Sat, 22 Apr 2023 10:46:30 -0700

Many devices do not have hardware random number generators.  Yet
more do than don't, and they are becoming more common.

Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>
---
v2:  As requested, since there is a dislike of =n even though it
works fine with all tools.
---
 target/linux/airoha/config-5.15               | 1 -
 target/linux/apm821xx/config-5.15             | 1 +
 target/linux/apm821xx/config-6.1              | 1 +
 target/linux/archs38/config-5.15              | 1 +
 target/linux/armsr/armv7/config-6.1           | 1 +
 target/linux/armsr/armv8/config-6.1           | 1 -
 target/linux/at91/sam9x/config-5.15           | 1 -
 target/linux/at91/sama5/config-5.15           | 1 -
 target/linux/at91/sama7/config-5.15           | 1 -
 target/linux/ath25/config-5.15                | 1 -
 target/linux/ath79/config-5.15                | 1 +
 target/linux/ath79/config-6.1                 | 1 +
 target/linux/bcm27xx/bcm2708/config-6.1       | 1 -
 target/linux/bcm27xx/bcm2709/config-6.1       | 1 -
 target/linux/bcm27xx/bcm2710/config-6.1       | 1 -
 target/linux/bcm27xx/bcm2711/config-6.1       | 1 -
 target/linux/bcm47xx/config-5.15              | 1 -
 target/linux/bcm4908/config-5.15              | 1 +
 target/linux/bcm4908/config-6.1               | 1 +
 target/linux/bcm53xx/config-5.15              | 1 -
 target/linux/bcm53xx/config-6.1               | 1 -
 target/linux/bcm63xx/config-5.15              | 1 -
 target/linux/bmips/bcm6318/config-5.15        | 1 +
 target/linux/bmips/bcm6318/config-6.1         | 1 +
 target/linux/bmips/bcm63268/config-5.15       | 1 -
 target/linux/bmips/bcm63268/config-6.1        | 1 -
 target/linux/bmips/bcm6328/config-5.15        | 1 +
 target/linux/bmips/bcm6328/config-6.1         | 1 +
 target/linux/bmips/bcm6358/config-5.15        | 1 +
 target/linux/bmips/bcm6358/config-6.1         | 1 +
 target/linux/bmips/bcm6362/config-5.15        | 1 -
 target/linux/bmips/bcm6362/config-6.1         | 1 -
 target/linux/bmips/bcm6368/config-5.15        | 1 -
 target/linux/bmips/bcm6368/config-6.1         | 1 -
 target/linux/gemini/config-6.1                | 1 -
 target/linux/generic/config-5.15              | 2 +-
 target/linux/generic/config-6.1               | 2 +-
 target/linux/imx/config-5.15                  | 1 -
 target/linux/ipq40xx/config-6.1               | 1 -
 target/linux/ipq806x/config-6.1               | 1 -
 target/linux/ixp4xx/config-6.1                | 1 -
 target/linux/kirkwood/config-5.15             | 1 -
 target/linux/lantiq/ase/config-5.15           | 1 -
 target/linux/lantiq/falcon/config-5.15        | 1 +
 target/linux/lantiq/xrx200/config-5.15        | 1 -
 target/linux/lantiq/xway/config-5.15          | 1 -
 target/linux/lantiq/xway_legacy/config-5.15   | 1 +
 target/linux/layerscape/armv7/config-5.15     | 1 -
 target/linux/layerscape/armv7/config-6.1      | 1 -
 target/linux/layerscape/armv8_64b/config-5.15 | 1 -
 target/linux/layerscape/armv8_64b/config-6.1  | 1 -
 target/linux/malta/config-5.15                | 1 +
 target/linux/malta/config-6.1                 | 1 +
 target/linux/mediatek/filogic/config-5.15     | 1 -
 target/linux/mediatek/filogic/config-6.1      | 1 -
 target/linux/mediatek/mt7622/config-5.15      | 1 -
 target/linux/mediatek/mt7622/config-6.1       | 1 -
 target/linux/mediatek/mt7623/config-5.15      | 1 -
 target/linux/mediatek/mt7623/config-6.1       | 1 -
 target/linux/mediatek/mt7629/config-5.15      | 1 -
 target/linux/mediatek/mt7629/config-6.1       | 1 -
 target/linux/mpc85xx/config-5.15              | 1 -
 target/linux/mvebu/config-5.15                | 1 -
 target/linux/mvebu/config-6.1                 | 1 -
 target/linux/mxs/config-5.15                  | 1 +
 target/linux/mxs/config-6.1                   | 1 +
 target/linux/octeon/config-5.15               | 1 -
 target/linux/octeontx/config-5.15             | 1 -
 target/linux/omap/config-5.15                 | 1 -
 target/linux/oxnas/config-5.15                | 1 +
 target/linux/pistachio/config-5.15            | 1 +
 target/linux/qoriq/config-5.15                | 1 -
 target/linux/qualcommax/config-6.1            | 1 +
 target/linux/ramips/mt7620/config-5.15        | 1 +
 target/linux/ramips/mt7621/config-5.15        | 1 +
 target/linux/ramips/mt76x8/config-5.15        | 1 +
 target/linux/ramips/rt288x/config-5.15        | 1 +
 target/linux/ramips/rt305x/config-5.15        | 1 +
 target/linux/ramips/rt3883/config-5.15        | 1 +
 target/linux/realtek/rtl838x/config-5.15      | 1 +
 target/linux/realtek/rtl839x/config-5.15      | 1 +
 target/linux/realtek/rtl930x/config-5.15      | 1 +
 target/linux/realtek/rtl931x/config-5.15      | 1 +
 target/linux/rockchip/armv8/config-5.15       | 1 +
 target/linux/rockchip/armv8/config-6.1        | 1 +
 target/linux/sifiveu/config-6.1               | 1 +
 target/linux/sunxi/config-5.15                | 1 -
 target/linux/sunxi/config-6.1                 | 1 -
 target/linux/tegra/config-5.15                | 1 +
 target/linux/uml/config-5.15                  | 1 -
 target/linux/uml/config-6.1                   | 1 -
 target/linux/x86/config-5.15                  | 1 -
 target/linux/x86/config-6.1                   | 1 -
 target/linux/zynq/config-5.15                 | 1 +
 94 files changed, 40 insertions(+), 56 deletions(-)

diff --git a/target/linux/airoha/config-5.15 b/target/linux/airoha/config-5.15
index ae6c1d5089..83fca5e7ea 100644
--- a/target/linux/airoha/config-5.15
+++ b/target/linux/airoha/config-5.15
@@ -129,7 +129,6 @@ CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
 CONFIG_HAVE_SMP=y
 CONFIG_HOTPLUG_CPU=y
-CONFIG_HW_RANDOM=y
 CONFIG_HZ_FIXED=0
 CONFIG_INITRAMFS_SOURCE=""
 # CONFIG_IOMMU_DEBUGFS is not set
diff --git a/target/linux/apm821xx/config-5.15 b/target/linux/apm821xx/config-5.15
index adcccbe567..806280714a 100644
--- a/target/linux/apm821xx/config-5.15
+++ b/target/linux/apm821xx/config-5.15
@@ -92,6 +92,7 @@ CONFIG_GPIO_GENERIC_PLATFORM=y
 CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
+# CONFIG_HW_RANDOM is not set
 CONFIG_I2C=y
 CONFIG_I2C_BOARDINFO=y
 CONFIG_I2C_CHARDEV=y
diff --git a/target/linux/apm821xx/config-6.1 b/target/linux/apm821xx/config-6.1
index 2979312101..18ff61ddf2 100644
--- a/target/linux/apm821xx/config-6.1
+++ b/target/linux/apm821xx/config-6.1
@@ -101,6 +101,7 @@ CONFIG_GPIO_GENERIC_PLATFORM=y
 CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
+# CONFIG_HW_RANDOM is not set
 CONFIG_I2C=y
 CONFIG_I2C_BOARDINFO=y
 CONFIG_I2C_CHARDEV=y
diff --git a/target/linux/archs38/config-5.15 b/target/linux/archs38/config-5.15
index d4b1c5ab60..b526c0efe0 100644
--- a/target/linux/archs38/config-5.15
+++ b/target/linux/archs38/config-5.15
@@ -112,6 +112,7 @@ CONFIG_GRACE_PERIOD=y
 CONFIG_HANDLE_DOMAIN_IRQ=y
 CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
+# CONFIG_HW_RANDOM is not set
 CONFIG_HZ_PERIODIC=y
 CONFIG_I2C=y
 CONFIG_I2C_BOARDINFO=y
diff --git a/target/linux/armsr/armv7/config-6.1 b/target/linux/armsr/armv7/config-6.1
index 664ef2e05b..4b465097a6 100644
--- a/target/linux/armsr/armv7/config-6.1
+++ b/target/linux/armsr/armv7/config-6.1
@@ -50,6 +50,7 @@ CONFIG_GENERIC_IRQ_MULTI_HANDLER=y
 CONFIG_GENERIC_VDSO_32=y
 CONFIG_HARDEN_BRANCH_PREDICTOR=y
 CONFIG_HAVE_SMP=y
+# CONFIG_HW_RANDOM is not set
 CONFIG_HZ_FIXED=0
 CONFIG_HZ_PERIODIC=y
 CONFIG_MIGHT_HAVE_CACHE_L2X0=y
diff --git a/target/linux/armsr/armv8/config-6.1 b/target/linux/armsr/armv8/config-6.1
index 0ead973064..a4c132df55 100644
--- a/target/linux/armsr/armv8/config-6.1
+++ b/target/linux/armsr/armv8/config-6.1
@@ -332,7 +332,6 @@ CONFIG_HOTPLUG_PCI_ACPI=y
 # CONFIG_HOTPLUG_PCI_CPCI is not set
 # CONFIG_HOTPLUG_PCI_PCIE is not set
 # CONFIG_HOTPLUG_PCI_SHPC is not set
-CONFIG_HW_RANDOM=y
 CONFIG_HW_RANDOM_ARM_SMCCC_TRNG=y
 # CONFIG_HW_RANDOM_HISI is not set
 CONFIG_HW_RANDOM_VIRTIO=y
diff --git a/target/linux/at91/sam9x/config-5.15 b/target/linux/at91/sam9x/config-5.15
index 34c6d96b1c..2c29ca2369 100644
--- a/target/linux/at91/sam9x/config-5.15
+++ b/target/linux/at91/sam9x/config-5.15
@@ -127,7 +127,6 @@ CONFIG_HARDIRQS_SW_RESEND=y
 CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
-CONFIG_HW_RANDOM=y
 CONFIG_HW_RANDOM_ATMEL=y
 CONFIG_HZ=128
 CONFIG_HZ_FIXED=128
diff --git a/target/linux/at91/sama5/config-5.15 b/target/linux/at91/sama5/config-5.15
index 3e51deb98e..6130e288dd 100644
--- a/target/linux/at91/sama5/config-5.15
+++ b/target/linux/at91/sama5/config-5.15
@@ -201,7 +201,6 @@ CONFIG_HAVE_SMP=y
 CONFIG_HDMI=y
 CONFIG_HID=y
 CONFIG_HID_GENERIC=y
-CONFIG_HW_RANDOM=y
 CONFIG_HW_RANDOM_ATMEL=y
 CONFIG_HZ_FIXED=0
 CONFIG_I2C=y
diff --git a/target/linux/at91/sama7/config-5.15 b/target/linux/at91/sama7/config-5.15
index 150059bf50..23b74890ea 100644
--- a/target/linux/at91/sama7/config-5.15
+++ b/target/linux/at91/sama7/config-5.15
@@ -188,7 +188,6 @@ CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
 CONFIG_HAVE_SMP=y
 CONFIG_HW_CONSOLE=y
-CONFIG_HW_RANDOM=y
 CONFIG_HZ_FIXED=0
 CONFIG_I2C=y
 CONFIG_I2C_AT91=y
diff --git a/target/linux/ath25/config-5.15 b/target/linux/ath25/config-5.15
index a27ad4980f..b784f0aeb4 100644
--- a/target/linux/ath25/config-5.15
+++ b/target/linux/ath25/config-5.15
@@ -63,7 +63,6 @@ CONFIG_HARDWARE_WATCHPOINTS=y
 CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
-CONFIG_HW_RANDOM=y
 CONFIG_HZ_PERIODIC=y
 CONFIG_INITRAMFS_SOURCE=""
 CONFIG_IP17XX_PHY=y
diff --git a/target/linux/ath79/config-5.15 b/target/linux/ath79/config-5.15
index 5b1b0d5add..3660cf9a8d 100644
--- a/target/linux/ath79/config-5.15
+++ b/target/linux/ath79/config-5.15
@@ -80,6 +80,7 @@ CONFIG_HARDWARE_WATCHPOINTS=y
 CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
+# CONFIG_HW_RANDOM is not set
 CONFIG_HZ_PERIODIC=y
 CONFIG_INITRAMFS_SOURCE=""
 CONFIG_IRQCHIP=y
diff --git a/target/linux/ath79/config-6.1 b/target/linux/ath79/config-6.1
index e3119f99a1..559f024c43 100644
--- a/target/linux/ath79/config-6.1
+++ b/target/linux/ath79/config-6.1
@@ -86,6 +86,7 @@ CONFIG_HARDWARE_WATCHPOINTS=y
 CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
+# CONFIG_HW_RANDOM is not set
 CONFIG_HZ_PERIODIC=y
 CONFIG_INITRAMFS_SOURCE=""
 CONFIG_IRQCHIP=y
diff --git a/target/linux/bcm27xx/bcm2708/config-6.1 b/target/linux/bcm27xx/bcm2708/config-6.1
index c5d604e6bc..244fa67656 100644
--- a/target/linux/bcm27xx/bcm2708/config-6.1
+++ b/target/linux/bcm27xx/bcm2708/config-6.1
@@ -200,7 +200,6 @@ CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
 CONFIG_HW_CONSOLE=y
-CONFIG_HW_RANDOM=y
 CONFIG_HW_RANDOM_BCM2835=y
 CONFIG_HZ_FIXED=0
 CONFIG_I2C=y
diff --git a/target/linux/bcm27xx/bcm2709/config-6.1 b/target/linux/bcm27xx/bcm2709/config-6.1
index ec2e7f3fa6..7bdde533ab 100644
--- a/target/linux/bcm27xx/bcm2709/config-6.1
+++ b/target/linux/bcm27xx/bcm2709/config-6.1
@@ -253,7 +253,6 @@ CONFIG_HIGHMEM=y
 CONFIG_HIGHPTE=y
 CONFIG_HOTPLUG_CPU=y
 CONFIG_HW_CONSOLE=y
-CONFIG_HW_RANDOM=y
 CONFIG_HW_RANDOM_BCM2835=y
 CONFIG_HW_RANDOM_IPROC_RNG200=y
 CONFIG_HZ_FIXED=0
diff --git a/target/linux/bcm27xx/bcm2710/config-6.1 b/target/linux/bcm27xx/bcm2710/config-6.1
index b0abd49c7f..dd2d87d583 100644
--- a/target/linux/bcm27xx/bcm2710/config-6.1
+++ b/target/linux/bcm27xx/bcm2710/config-6.1
@@ -260,7 +260,6 @@ CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
 CONFIG_HOTPLUG_CPU=y
 CONFIG_HW_CONSOLE=y
-CONFIG_HW_RANDOM=y
 CONFIG_HW_RANDOM_BCM2835=y
 CONFIG_I2C=y
 # CONFIG_I2C_BCM2708 is not set
diff --git a/target/linux/bcm27xx/bcm2711/config-6.1 b/target/linux/bcm27xx/bcm2711/config-6.1
index ff88926e3d..7313c6447c 100644
--- a/target/linux/bcm27xx/bcm2711/config-6.1
+++ b/target/linux/bcm27xx/bcm2711/config-6.1
@@ -266,7 +266,6 @@ CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
 CONFIG_HOTPLUG_CPU=y
 CONFIG_HW_CONSOLE=y
-CONFIG_HW_RANDOM=y
 CONFIG_HW_RANDOM_IPROC_RNG200=y
 CONFIG_I2C=y
 # CONFIG_I2C_BCM2708 is not set
diff --git a/target/linux/bcm47xx/config-5.15 b/target/linux/bcm47xx/config-5.15
index 6f091c0e7f..234dd71aa6 100644
--- a/target/linux/bcm47xx/config-5.15
+++ b/target/linux/bcm47xx/config-5.15
@@ -82,7 +82,6 @@ CONFIG_HARDWARE_WATCHPOINTS=y
 CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
-CONFIG_HW_RANDOM=y
 CONFIG_HZ_PERIODIC=y
 CONFIG_INITRAMFS_SOURCE=""
 CONFIG_IRQ_DOMAIN=y
diff --git a/target/linux/bcm4908/config-5.15 b/target/linux/bcm4908/config-5.15
index 892985f7f4..b260ec46f5 100644
--- a/target/linux/bcm4908/config-5.15
+++ b/target/linux/bcm4908/config-5.15
@@ -111,6 +111,7 @@ CONFIG_HANDLE_DOMAIN_IRQ=y
 CONFIG_HARDIRQS_SW_RESEND=y
 CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
+# CONFIG_HW_RANDOM is not set
 CONFIG_HZ_PERIODIC=y
 CONFIG_I2C=y
 CONFIG_I2C_BOARDINFO=y
diff --git a/target/linux/bcm4908/config-6.1 b/target/linux/bcm4908/config-6.1
index 8311277237..4e0fe0d8df 100644
--- a/target/linux/bcm4908/config-6.1
+++ b/target/linux/bcm4908/config-6.1
@@ -112,6 +112,7 @@ CONFIG_HANDLE_DOMAIN_IRQ=y
 CONFIG_HARDIRQS_SW_RESEND=y
 CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
+# CONFIG_HW_RANDOM is not set
 CONFIG_HZ_PERIODIC=y
 CONFIG_I2C=y
 CONFIG_I2C_BOARDINFO=y
diff --git a/target/linux/bcm53xx/config-5.15 b/target/linux/bcm53xx/config-5.15
index 9cd1f079d1..32efa37c34 100644
--- a/target/linux/bcm53xx/config-5.15
+++ b/target/linux/bcm53xx/config-5.15
@@ -165,7 +165,6 @@ CONFIG_HAS_IOPORT_MAP=y
 CONFIG_HAVE_SMP=y
 CONFIG_HIGHMEM=y
 CONFIG_HIGHPTE=y
-CONFIG_HW_RANDOM=y
 CONFIG_HW_RANDOM_BCM2835=y
 CONFIG_HZ_FIXED=0
 CONFIG_HZ_PERIODIC=y
diff --git a/target/linux/bcm53xx/config-6.1 b/target/linux/bcm53xx/config-6.1
index fba523175a..c8fadf63e2 100644
--- a/target/linux/bcm53xx/config-6.1
+++ b/target/linux/bcm53xx/config-6.1
@@ -174,7 +174,6 @@ CONFIG_HAS_IOPORT_MAP=y
 CONFIG_HAVE_SMP=y
 CONFIG_HIGHMEM=y
 CONFIG_HIGHPTE=y
-CONFIG_HW_RANDOM=y
 CONFIG_HW_RANDOM_BCM2835=y
 CONFIG_HZ_FIXED=0
 CONFIG_HZ_PERIODIC=y
diff --git a/target/linux/bcm63xx/config-5.15 b/target/linux/bcm63xx/config-5.15
index f19d45362e..5184b8bc43 100644
--- a/target/linux/bcm63xx/config-5.15
+++ b/target/linux/bcm63xx/config-5.15
@@ -96,7 +96,6 @@ CONFIG_HANDLE_DOMAIN_IRQ=y
 CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
-CONFIG_HW_RANDOM=y
 CONFIG_HW_RANDOM_BCM2835=y
 CONFIG_HZ_PERIODIC=y
 CONFIG_INITRAMFS_SOURCE=""
diff --git a/target/linux/bmips/bcm6318/config-5.15 b/target/linux/bmips/bcm6318/config-5.15
index 50401a58e8..b88dfa33c1 100644
--- a/target/linux/bmips/bcm6318/config-5.15
+++ b/target/linux/bmips/bcm6318/config-5.15
@@ -106,6 +106,7 @@ CONFIG_HARDIRQS_SW_RESEND=y
 CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
+# CONFIG_HW_RANDOM is not set
 CONFIG_HZ_PERIODIC=y
 CONFIG_INITRAMFS_SOURCE=""
 CONFIG_IRQCHIP=y
diff --git a/target/linux/bmips/bcm6318/config-6.1 b/target/linux/bmips/bcm6318/config-6.1
index 526319da33..43b36356ff 100644
--- a/target/linux/bmips/bcm6318/config-6.1
+++ b/target/linux/bmips/bcm6318/config-6.1
@@ -115,6 +115,7 @@ CONFIG_HARDIRQS_SW_RESEND=y
 CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
+# CONFIG_HW_RANDOM is not set
 CONFIG_HZ_PERIODIC=y
 CONFIG_INITRAMFS_SOURCE=""
 CONFIG_IRQCHIP=y
diff --git a/target/linux/bmips/bcm63268/config-5.15 b/target/linux/bmips/bcm63268/config-5.15
index 09754e9f8b..86de828ad6 100644
--- a/target/linux/bmips/bcm63268/config-5.15
+++ b/target/linux/bmips/bcm63268/config-5.15
@@ -107,7 +107,6 @@ CONFIG_HARDIRQS_SW_RESEND=y
 CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
-CONFIG_HW_RANDOM=y
 CONFIG_HW_RANDOM_BCM2835=y
 CONFIG_HZ_PERIODIC=y
 CONFIG_INITRAMFS_SOURCE=""
diff --git a/target/linux/bmips/bcm63268/config-6.1 b/target/linux/bmips/bcm63268/config-6.1
index 624c00556d..b7677bcb32 100644
--- a/target/linux/bmips/bcm63268/config-6.1
+++ b/target/linux/bmips/bcm63268/config-6.1
@@ -116,7 +116,6 @@ CONFIG_HARDIRQS_SW_RESEND=y
 CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
-CONFIG_HW_RANDOM=y
 CONFIG_HW_RANDOM_BCM2835=y
 CONFIG_HZ_PERIODIC=y
 CONFIG_INITRAMFS_SOURCE=""
diff --git a/target/linux/bmips/bcm6328/config-5.15 b/target/linux/bmips/bcm6328/config-5.15
index 1e7712ead6..2bc2f4e627 100644
--- a/target/linux/bmips/bcm6328/config-5.15
+++ b/target/linux/bmips/bcm6328/config-5.15
@@ -107,6 +107,7 @@ CONFIG_HARDIRQS_SW_RESEND=y
 CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
+# CONFIG_HW_RANDOM is not set
 CONFIG_HZ_PERIODIC=y
 CONFIG_INITRAMFS_SOURCE=""
 CONFIG_IRQCHIP=y
diff --git a/target/linux/bmips/bcm6328/config-6.1 b/target/linux/bmips/bcm6328/config-6.1
index 5b33e93236..edf04f0cdd 100644
--- a/target/linux/bmips/bcm6328/config-6.1
+++ b/target/linux/bmips/bcm6328/config-6.1
@@ -116,6 +116,7 @@ CONFIG_HARDIRQS_SW_RESEND=y
 CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
+# CONFIG_HW_RANDOM is not set
 CONFIG_HZ_PERIODIC=y
 CONFIG_INITRAMFS_SOURCE=""
 CONFIG_IRQCHIP=y
diff --git a/target/linux/bmips/bcm6358/config-5.15 b/target/linux/bmips/bcm6358/config-5.15
index 5d7a299444..59c8f0410a 100644
--- a/target/linux/bmips/bcm6358/config-5.15
+++ b/target/linux/bmips/bcm6358/config-5.15
@@ -104,6 +104,7 @@ CONFIG_HARDIRQS_SW_RESEND=y
 CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
+# CONFIG_HW_RANDOM is not set
 CONFIG_HZ_PERIODIC=y
 CONFIG_INITRAMFS_SOURCE=""
 CONFIG_IRQCHIP=y
diff --git a/target/linux/bmips/bcm6358/config-6.1 b/target/linux/bmips/bcm6358/config-6.1
index 8ca1ca3af5..1e4dcbd765 100644
--- a/target/linux/bmips/bcm6358/config-6.1
+++ b/target/linux/bmips/bcm6358/config-6.1
@@ -113,6 +113,7 @@ CONFIG_HARDIRQS_SW_RESEND=y
 CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
+# CONFIG_HW_RANDOM is not set
 CONFIG_HZ_PERIODIC=y
 CONFIG_INITRAMFS_SOURCE=""
 CONFIG_IRQCHIP=y
diff --git a/target/linux/bmips/bcm6362/config-5.15 b/target/linux/bmips/bcm6362/config-5.15
index 5f9b528d95..4ef27da1f4 100644
--- a/target/linux/bmips/bcm6362/config-5.15
+++ b/target/linux/bmips/bcm6362/config-5.15
@@ -107,7 +107,6 @@ CONFIG_HARDIRQS_SW_RESEND=y
 CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
-CONFIG_HW_RANDOM=y
 CONFIG_HW_RANDOM_BCM2835=y
 CONFIG_HZ_PERIODIC=y
 CONFIG_INITRAMFS_SOURCE=""
diff --git a/target/linux/bmips/bcm6362/config-6.1 b/target/linux/bmips/bcm6362/config-6.1
index dba808dfb2..67ea1207c7 100644
--- a/target/linux/bmips/bcm6362/config-6.1
+++ b/target/linux/bmips/bcm6362/config-6.1
@@ -116,7 +116,6 @@ CONFIG_HARDIRQS_SW_RESEND=y
 CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
-CONFIG_HW_RANDOM=y
 CONFIG_HW_RANDOM_BCM2835=y
 CONFIG_HZ_PERIODIC=y
 CONFIG_INITRAMFS_SOURCE=""
diff --git a/target/linux/bmips/bcm6368/config-5.15 b/target/linux/bmips/bcm6368/config-5.15
index 910d36ce0b..a91c03ada5 100644
--- a/target/linux/bmips/bcm6368/config-5.15
+++ b/target/linux/bmips/bcm6368/config-5.15
@@ -106,7 +106,6 @@ CONFIG_HARDIRQS_SW_RESEND=y
 CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
-CONFIG_HW_RANDOM=y
 CONFIG_HW_RANDOM_BCM2835=y
 CONFIG_HZ_PERIODIC=y
 CONFIG_INITRAMFS_SOURCE=""
diff --git a/target/linux/bmips/bcm6368/config-6.1 b/target/linux/bmips/bcm6368/config-6.1
index 13915425d8..27b19df5aa 100644
--- a/target/linux/bmips/bcm6368/config-6.1
+++ b/target/linux/bmips/bcm6368/config-6.1
@@ -115,7 +115,6 @@ CONFIG_HARDIRQS_SW_RESEND=y
 CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
-CONFIG_HW_RANDOM=y
 CONFIG_HW_RANDOM_BCM2835=y
 CONFIG_HZ_PERIODIC=y
 CONFIG_INITRAMFS_SOURCE=""
diff --git a/target/linux/gemini/config-6.1 b/target/linux/gemini/config-6.1
index ae0922f5dc..4ad4ce9b6c 100644
--- a/target/linux/gemini/config-6.1
+++ b/target/linux/gemini/config-6.1
@@ -213,7 +213,6 @@ CONFIG_HIGHMEM=y
 CONFIG_HIGHPTE=y
 CONFIG_HWMON=y
 CONFIG_HW_CONSOLE=y
-CONFIG_HW_RANDOM=y
 CONFIG_HZ_FIXED=0
 CONFIG_I2C=y
 CONFIG_I2C_ALGOBIT=y
diff --git a/target/linux/generic/config-5.15 b/target/linux/generic/config-5.15
index bc2509ff47..09628ef0da 100644
--- a/target/linux/generic/config-5.15
+++ b/target/linux/generic/config-5.15
@@ -2449,7 +2449,7 @@ CONFIG_HPET_MMAP_DEFAULT=y
 # CONFIG_HWSPINLOCK is not set
 # CONFIG_HWSPINLOCK_OMAP is not set
 CONFIG_HW_PERF_EVENTS=y
-# CONFIG_HW_RANDOM is not set
+CONFIG_HW_RANDOM=y
 # CONFIG_HW_RANDOM_AMD is not set
 # CONFIG_HW_RANDOM_ARM_SMCCC_TRNG is not set
 # CONFIG_HW_RANDOM_ATMEL is not set
diff --git a/target/linux/generic/config-6.1 b/target/linux/generic/config-6.1
index cc339e476f..2073c40cc5 100644
--- a/target/linux/generic/config-6.1
+++ b/target/linux/generic/config-6.1
@@ -2550,7 +2550,7 @@ CONFIG_HPET_MMAP_DEFAULT=y
 # CONFIG_HWSPINLOCK is not set
 # CONFIG_HWSPINLOCK_OMAP is not set
 CONFIG_HW_PERF_EVENTS=y
-# CONFIG_HW_RANDOM is not set
+CONFIG_HW_RANDOM=y
 # CONFIG_HW_RANDOM_AMD is not set
 # CONFIG_HW_RANDOM_ARM_SMCCC_TRNG is not set
 # CONFIG_HW_RANDOM_ATMEL is not set
diff --git a/target/linux/imx/config-5.15 b/target/linux/imx/config-5.15
index 7caaacbed7..dc57ea0fff 100644
--- a/target/linux/imx/config-5.15
+++ b/target/linux/imx/config-5.15
@@ -213,7 +213,6 @@ CONFIG_HAS_IOPORT_MAP=y
 CONFIG_HAVE_ARM_ARCH_TIMER=y
 CONFIG_HAVE_SMP=y
 CONFIG_HWMON=y
-CONFIG_HW_RANDOM=y
 CONFIG_HZ_FIXED=0
 CONFIG_HZ_PERIODIC=y
 CONFIG_I2C=y
diff --git a/target/linux/ipq40xx/config-6.1 b/target/linux/ipq40xx/config-6.1
index e84823aacd..eb5b6a9671 100644
--- a/target/linux/ipq40xx/config-6.1
+++ b/target/linux/ipq40xx/config-6.1
@@ -209,7 +209,6 @@ CONFIG_HIGHMEM=y
 # CONFIG_HIGHPTE is not set
 CONFIG_HWSPINLOCK=y
 CONFIG_HWSPINLOCK_QCOM=y
-CONFIG_HW_RANDOM=y
 CONFIG_HW_RANDOM_OPTEE=y
 CONFIG_HZ_FIXED=0
 CONFIG_I2C=y
diff --git a/target/linux/ipq806x/config-6.1 b/target/linux/ipq806x/config-6.1
index e31e822380..c8d4a6dd7b 100644
--- a/target/linux/ipq806x/config-6.1
+++ b/target/linux/ipq806x/config-6.1
@@ -200,7 +200,6 @@ CONFIG_HOTPLUG_CPU=y
 CONFIG_HWMON=y
 CONFIG_HWSPINLOCK=y
 CONFIG_HWSPINLOCK_QCOM=y
-CONFIG_HW_RANDOM=y
 CONFIG_HZ_FIXED=0
 CONFIG_I2C=y
 CONFIG_I2C_BOARDINFO=y
diff --git a/target/linux/ixp4xx/config-6.1 b/target/linux/ixp4xx/config-6.1
index 4c4aa11969..45f017a6f8 100644
--- a/target/linux/ixp4xx/config-6.1
+++ b/target/linux/ixp4xx/config-6.1
@@ -115,7 +115,6 @@ CONFIG_HAS_IOPORT_MAP=y
 CONFIG_HDLC=y
 CONFIG_HWMON=y
 CONFIG_HWMON_VID=y
-CONFIG_HW_RANDOM=y
 CONFIG_HW_RANDOM_IXP4XX=y
 CONFIG_HZ_FIXED=0
 CONFIG_HZ_PERIODIC=y
diff --git a/target/linux/kirkwood/config-5.15 b/target/linux/kirkwood/config-5.15
index ce19fce6ee..82f0c5b8cc 100644
--- a/target/linux/kirkwood/config-5.15
+++ b/target/linux/kirkwood/config-5.15
@@ -124,7 +124,6 @@ CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
 CONFIG_HWMON=y
-CONFIG_HW_RANDOM=y
 CONFIG_HW_RANDOM_OMAP=y
 CONFIG_HZ_FIXED=0
 CONFIG_HZ_PERIODIC=y
diff --git a/target/linux/lantiq/ase/config-5.15 b/target/linux/lantiq/ase/config-5.15
index 195e49df69..c0ea2733d0 100644
--- a/target/linux/lantiq/ase/config-5.15
+++ b/target/linux/lantiq/ase/config-5.15
@@ -9,7 +9,6 @@ CONFIG_FIRMWARE_MEMMAP=y
 CONFIG_GENERIC_ALLOCATOR=y
 CONFIG_GPIO_GENERIC=y
 CONFIG_GPIO_GENERIC_PLATFORM=y
-CONFIG_HW_RANDOM=y
 # CONFIG_ISDN is not set
 CONFIG_LANTIQ_ETOP=y
 CONFIG_NLS=y
diff --git a/target/linux/lantiq/falcon/config-5.15 b/target/linux/lantiq/falcon/config-5.15
index 3041c65dbd..cba2357f1b 100644
--- a/target/linux/lantiq/falcon/config-5.15
+++ b/target/linux/lantiq/falcon/config-5.15
@@ -1,4 +1,5 @@
 CONFIG_CPU_HAS_DIEI=y
+# CONFIG_HW_RANDOM is not set
 CONFIG_MTD_NAND_CORE=y
 CONFIG_MTD_NAND_ECC=y
 CONFIG_MTD_NAND_ECC_SW_HAMMING=y
diff --git a/target/linux/lantiq/xrx200/config-5.15 b/target/linux/lantiq/xrx200/config-5.15
index 4dfd55274a..d2d235a989 100644
--- a/target/linux/lantiq/xrx200/config-5.15
+++ b/target/linux/lantiq/xrx200/config-5.15
@@ -15,7 +15,6 @@ CONFIG_EXTRA_FIRMWARE_DIR="firmware"
 CONFIG_GENERIC_ALLOCATOR=y
 CONFIG_GRO_CELLS=y
 CONFIG_HWMON=y
-CONFIG_HW_RANDOM=y
 CONFIG_ICPLUS_PHY=y
 CONFIG_IFX_VPE_EXT=y
 CONFIG_INPUT=y
diff --git a/target/linux/lantiq/xway/config-5.15 b/target/linux/lantiq/xway/config-5.15
index 5a6f15dafd..9f6c75c0b4 100644
--- a/target/linux/lantiq/xway/config-5.15
+++ b/target/linux/lantiq/xway/config-5.15
@@ -17,7 +17,6 @@ CONFIG_FWNODE_MDIO=y
 CONFIG_GENERIC_ALLOCATOR=y
 CONFIG_GENERIC_FIND_FIRST_BIT=y
 CONFIG_GPIO_CDEV=y
-CONFIG_HW_RANDOM=y
 CONFIG_INPUT=y
 CONFIG_INPUT_EVDEV=y
 # CONFIG_ISDN is not set
diff --git a/target/linux/lantiq/xway_legacy/config-5.15 b/target/linux/lantiq/xway_legacy/config-5.15
index c177d2a935..cdd2eb8f8a 100644
--- a/target/linux/lantiq/xway_legacy/config-5.15
+++ b/target/linux/lantiq/xway_legacy/config-5.15
@@ -7,6 +7,7 @@ CONFIG_CRYPTO_DEFLATE=y
 CONFIG_CRYPTO_LZO=y
 CONFIG_GENERIC_ALLOCATOR=y
 # CONFIG_GPIO_SYSFS is not set
+# CONFIG_HW_RANDOM is not set
 CONFIG_INPUT=y
 CONFIG_INPUT_EVDEV=y
 CONFIG_INPUT_POLLDEV=y
diff --git a/target/linux/layerscape/armv7/config-5.15 b/target/linux/layerscape/armv7/config-5.15
index 121151f58f..21901d524f 100644
--- a/target/linux/layerscape/armv7/config-5.15
+++ b/target/linux/layerscape/armv7/config-5.15
@@ -275,7 +275,6 @@ CONFIG_HIGHPTE=y
 CONFIG_HOTPLUG_CPU=y
 CONFIG_HVC_DRIVER=y
 CONFIG_HW_CONSOLE=y
-CONFIG_HW_RANDOM=y
 CONFIG_HZ_FIXED=0
 CONFIG_I2C=y
 CONFIG_I2C_BOARDINFO=y
diff --git a/target/linux/layerscape/armv7/config-6.1 b/target/linux/layerscape/armv7/config-6.1
index d60e5824db..e0d362c53f 100644
--- a/target/linux/layerscape/armv7/config-6.1
+++ b/target/linux/layerscape/armv7/config-6.1
@@ -288,7 +288,6 @@ CONFIG_HIGHPTE=y
 CONFIG_HOTPLUG_CPU=y
 CONFIG_HVC_DRIVER=y
 CONFIG_HW_CONSOLE=y
-CONFIG_HW_RANDOM=y
 CONFIG_HZ_FIXED=0
 CONFIG_I2C=y
 CONFIG_I2C_BOARDINFO=y
diff --git a/target/linux/layerscape/armv8_64b/config-5.15 b/target/linux/layerscape/armv8_64b/config-5.15
index 610da9b18e..ba625a9465 100644
--- a/target/linux/layerscape/armv8_64b/config-5.15
+++ b/target/linux/layerscape/armv8_64b/config-5.15
@@ -371,7 +371,6 @@ CONFIG_HVC_IRQ=y
 CONFIG_HVC_XEN=y
 CONFIG_HVC_XEN_FRONTEND=y
 CONFIG_HW_CONSOLE=y
-CONFIG_HW_RANDOM=y
 CONFIG_I2C=y
 CONFIG_I2C_BOARDINFO=y
 CONFIG_I2C_CHARDEV=y
diff --git a/target/linux/layerscape/armv8_64b/config-6.1 b/target/linux/layerscape/armv8_64b/config-6.1
index a2a4a633af..2b606c43b0 100644
--- a/target/linux/layerscape/armv8_64b/config-6.1
+++ b/target/linux/layerscape/armv8_64b/config-6.1
@@ -393,7 +393,6 @@ CONFIG_HVC_IRQ=y
 CONFIG_HVC_XEN=y
 CONFIG_HVC_XEN_FRONTEND=y
 CONFIG_HW_CONSOLE=y
-CONFIG_HW_RANDOM=y
 CONFIG_I2C=y
 CONFIG_I2C_BOARDINFO=y
 CONFIG_I2C_CHARDEV=y
diff --git a/target/linux/malta/config-5.15 b/target/linux/malta/config-5.15
index bbedaf5633..592db8b3a8 100644
--- a/target/linux/malta/config-5.15
+++ b/target/linux/malta/config-5.15
@@ -100,6 +100,7 @@ CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
 CONFIG_HW_CONSOLE=y
+# CONFIG_HW_RANDOM is not set
 CONFIG_I8253=y
 CONFIG_I8253_LOCK=y
 CONFIG_I8259=y
diff --git a/target/linux/malta/config-6.1 b/target/linux/malta/config-6.1
index 9ce439ee38..85048b6cd0 100644
--- a/target/linux/malta/config-6.1
+++ b/target/linux/malta/config-6.1
@@ -101,6 +101,7 @@ CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
 CONFIG_HW_CONSOLE=y
+# CONFIG_HW_RANDOM is not set
 CONFIG_I8253=y
 CONFIG_I8253_LOCK=y
 CONFIG_I8259=y
diff --git a/target/linux/mediatek/filogic/config-5.15 b/target/linux/mediatek/filogic/config-5.15
index 2ffc466b7c..031ae51979 100644
--- a/target/linux/mediatek/filogic/config-5.15
+++ b/target/linux/mediatek/filogic/config-5.15
@@ -176,7 +176,6 @@ CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
 CONFIG_HWMON=y
-CONFIG_HW_RANDOM=y
 CONFIG_HW_RANDOM_MTK=y
 CONFIG_I2C=y
 CONFIG_I2C_BOARDINFO=y
diff --git a/target/linux/mediatek/filogic/config-6.1 b/target/linux/mediatek/filogic/config-6.1
index 36cb9c1e4e..48322e473a 100644
--- a/target/linux/mediatek/filogic/config-6.1
+++ b/target/linux/mediatek/filogic/config-6.1
@@ -193,7 +193,6 @@ CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
 CONFIG_HWMON=y
-CONFIG_HW_RANDOM=y
 CONFIG_HW_RANDOM_MTK=y
 CONFIG_I2C=y
 CONFIG_I2C_BOARDINFO=y
diff --git a/target/linux/mediatek/mt7622/config-5.15 b/target/linux/mediatek/mt7622/config-5.15
index 643eaa45b6..1d5a799b4c 100644
--- a/target/linux/mediatek/mt7622/config-5.15
+++ b/target/linux/mediatek/mt7622/config-5.15
@@ -198,7 +198,6 @@ CONFIG_HARDIRQS_SW_RESEND=y
 CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
-CONFIG_HW_RANDOM=y
 CONFIG_HW_RANDOM_MTK=y
 CONFIG_I2C=y
 CONFIG_I2C_BOARDINFO=y
diff --git a/target/linux/mediatek/mt7622/config-6.1 b/target/linux/mediatek/mt7622/config-6.1
index 7055e4d728..73d26c3f2b 100644
--- a/target/linux/mediatek/mt7622/config-6.1
+++ b/target/linux/mediatek/mt7622/config-6.1
@@ -199,7 +199,6 @@ CONFIG_HARDIRQS_SW_RESEND=y
 CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
-CONFIG_HW_RANDOM=y
 CONFIG_HW_RANDOM_MTK=y
 CONFIG_I2C=y
 CONFIG_I2C_BOARDINFO=y
diff --git a/target/linux/mediatek/mt7623/config-5.15 b/target/linux/mediatek/mt7623/config-5.15
index 039a904f19..cb158845ad 100644
--- a/target/linux/mediatek/mt7623/config-5.15
+++ b/target/linux/mediatek/mt7623/config-5.15
@@ -260,7 +260,6 @@ CONFIG_HIGHPTE=y
 CONFIG_HOTPLUG_CPU=y
 CONFIG_HWMON=y
 CONFIG_HW_CONSOLE=y
-CONFIG_HW_RANDOM=y
 CONFIG_HW_RANDOM_MTK=y
 CONFIG_HZ_FIXED=0
 CONFIG_I2C=y
diff --git a/target/linux/mediatek/mt7623/config-6.1 b/target/linux/mediatek/mt7623/config-6.1
index b6a75ab80a..63bbbed430 100644
--- a/target/linux/mediatek/mt7623/config-6.1
+++ b/target/linux/mediatek/mt7623/config-6.1
@@ -275,7 +275,6 @@ CONFIG_HIGHPTE=y
 CONFIG_HOTPLUG_CPU=y
 CONFIG_HWMON=y
 CONFIG_HW_CONSOLE=y
-CONFIG_HW_RANDOM=y
 CONFIG_HW_RANDOM_MTK=y
 CONFIG_HZ_FIXED=0
 CONFIG_I2C=y
diff --git a/target/linux/mediatek/mt7629/config-5.15 b/target/linux/mediatek/mt7629/config-5.15
index 08089dde2a..d467f8fbb0 100644
--- a/target/linux/mediatek/mt7629/config-5.15
+++ b/target/linux/mediatek/mt7629/config-5.15
@@ -138,7 +138,6 @@ CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
 CONFIG_HAVE_SMP=y
 CONFIG_HOTPLUG_CPU=y
-CONFIG_HW_RANDOM=y
 CONFIG_HW_RANDOM_MTK=y
 CONFIG_HZ_FIXED=0
 CONFIG_INITRAMFS_SOURCE=""
diff --git a/target/linux/mediatek/mt7629/config-6.1 b/target/linux/mediatek/mt7629/config-6.1
index c0c501e59e..3e1a2f6fb9 100644
--- a/target/linux/mediatek/mt7629/config-6.1
+++ b/target/linux/mediatek/mt7629/config-6.1
@@ -152,7 +152,6 @@ CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
 CONFIG_HAVE_SMP=y
 CONFIG_HOTPLUG_CPU=y
-CONFIG_HW_RANDOM=y
 CONFIG_HW_RANDOM_MTK=y
 CONFIG_HZ_FIXED=0
 CONFIG_INITRAMFS_SOURCE=""
diff --git a/target/linux/mpc85xx/config-5.15 b/target/linux/mpc85xx/config-5.15
index 86b300ffc3..1df73b8171 100644
--- a/target/linux/mpc85xx/config-5.15
+++ b/target/linux/mpc85xx/config-5.15
@@ -100,7 +100,6 @@ CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
 # CONFIG_HIVEAP_330 is not set
-CONFIG_HW_RANDOM=y
 CONFIG_HZ_PERIODIC=y
 CONFIG_I2C=y
 CONFIG_I2C_BOARDINFO=y
diff --git a/target/linux/mvebu/config-5.15 b/target/linux/mvebu/config-5.15
index 0811ee6d4c..87bb79d25e 100644
--- a/target/linux/mvebu/config-5.15
+++ b/target/linux/mvebu/config-5.15
@@ -203,7 +203,6 @@ CONFIG_HIGHPTE=y
 CONFIG_HOTPLUG_CPU=y
 CONFIG_HWBM=y
 CONFIG_HWMON=y
-CONFIG_HW_RANDOM=y
 CONFIG_HZ_FIXED=0
 CONFIG_HZ_PERIODIC=y
 CONFIG_I2C=y
diff --git a/target/linux/mvebu/config-6.1 b/target/linux/mvebu/config-6.1
index 88e5fff4d9..56934c807a 100644
--- a/target/linux/mvebu/config-6.1
+++ b/target/linux/mvebu/config-6.1
@@ -209,7 +209,6 @@ CONFIG_HIGHPTE=y
 CONFIG_HOTPLUG_CPU=y
 CONFIG_HWBM=y
 CONFIG_HWMON=y
-CONFIG_HW_RANDOM=y
 CONFIG_HZ_FIXED=0
 CONFIG_HZ_PERIODIC=y
 CONFIG_I2C=y
diff --git a/target/linux/mxs/config-5.15 b/target/linux/mxs/config-5.15
index 67b2cfa373..0aa73e1eb3 100644
--- a/target/linux/mxs/config-5.15
+++ b/target/linux/mxs/config-5.15
@@ -111,6 +111,7 @@ CONFIG_HARDIRQS_SW_RESEND=y
 CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
+# CONFIG_HW_RANDOM is not set
 CONFIG_HZ_FIXED=0
 CONFIG_HZ_PERIODIC=y
 CONFIG_I2C=y
diff --git a/target/linux/mxs/config-6.1 b/target/linux/mxs/config-6.1
index b23aef6969..1f131c4d5f 100644
--- a/target/linux/mxs/config-6.1
+++ b/target/linux/mxs/config-6.1
@@ -109,6 +109,7 @@ CONFIG_HARDIRQS_SW_RESEND=y
 CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
+# CONFIG_HW_RANDOM is not set
 CONFIG_HZ_FIXED=0
 CONFIG_HZ_PERIODIC=y
 CONFIG_I2C=y
diff --git a/target/linux/octeon/config-5.15 b/target/linux/octeon/config-5.15
index 2350e45295..dbda116622 100644
--- a/target/linux/octeon/config-5.15
+++ b/target/linux/octeon/config-5.15
@@ -99,7 +99,6 @@ CONFIG_HARDWARE_WATCHPOINTS=y
 CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
-CONFIG_HW_RANDOM=y
 CONFIG_HW_RANDOM_OCTEON=y
 CONFIG_HZ_PERIODIC=y
 CONFIG_I2C=y
diff --git a/target/linux/octeontx/config-5.15 b/target/linux/octeontx/config-5.15
index 9ca1589643..8508898d5e 100644
--- a/target/linux/octeontx/config-5.15
+++ b/target/linux/octeontx/config-5.15
@@ -201,7 +201,6 @@ CONFIG_HOTPLUG_CPU=y
 CONFIG_HUGETLBFS=y
 CONFIG_HUGETLB_PAGE=y
 CONFIG_HWSPINLOCK=y
-CONFIG_HW_RANDOM=y
 CONFIG_HW_RANDOM_CAVIUM=y
 CONFIG_HW_RANDOM_OPTEE=y
 CONFIG_I2C=y
diff --git a/target/linux/omap/config-5.15 b/target/linux/omap/config-5.15
index 888345c75a..98bebfc9b2 100644
--- a/target/linux/omap/config-5.15
+++ b/target/linux/omap/config-5.15
@@ -284,7 +284,6 @@ CONFIG_HSI=y
 CONFIG_HSI_BOARDINFO=y
 # CONFIG_HSI_CHAR is not set
 CONFIG_HWMON=y
-CONFIG_HW_RANDOM=y
 CONFIG_HW_RANDOM_OMAP=y
 CONFIG_HZ_FIXED=0
 CONFIG_I2C=y
diff --git a/target/linux/oxnas/config-5.15 b/target/linux/oxnas/config-5.15
index 0cf06ee580..29fed9f648 100644
--- a/target/linux/oxnas/config-5.15
+++ b/target/linux/oxnas/config-5.15
@@ -135,6 +135,7 @@ CONFIG_HAS_IOPORT_MAP=y
 CONFIG_HID=y
 CONFIG_HID_GENERIC=y
 CONFIG_HWMON=y
+# CONFIG_HW_RANDOM is not set
 CONFIG_HZ_FIXED=0
 CONFIG_ICPLUS_PHY=y
 CONFIG_INET_DIAG=y
diff --git a/target/linux/pistachio/config-5.15 b/target/linux/pistachio/config-5.15
index c16a0c4551..db6d91ac9c 100644
--- a/target/linux/pistachio/config-5.15
+++ b/target/linux/pistachio/config-5.15
@@ -118,6 +118,7 @@ CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
 CONFIG_HOTPLUG_CPU=y
+# CONFIG_HW_RANDOM is not set
 CONFIG_HZ_PERIODIC=y
 CONFIG_I2C=y
 CONFIG_I2C_BOARDINFO=y
diff --git a/target/linux/qoriq/config-5.15 b/target/linux/qoriq/config-5.15
index 39796daf1d..7da3f40de5 100644
--- a/target/linux/qoriq/config-5.15
+++ b/target/linux/qoriq/config-5.15
@@ -171,7 +171,6 @@ CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
 CONFIG_HWMON=y
 CONFIG_HW_CONSOLE=y
-CONFIG_HW_RANDOM=y
 CONFIG_I2C=y
 CONFIG_I2C_BOARDINFO=y
 CONFIG_I2C_MPC=y
diff --git a/target/linux/qualcommax/config-6.1 b/target/linux/qualcommax/config-6.1
index 7a983b961b..d6af1a4ff2 100644
--- a/target/linux/qualcommax/config-6.1
+++ b/target/linux/qualcommax/config-6.1
@@ -184,6 +184,7 @@ CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
 CONFIG_HWSPINLOCK=y
 CONFIG_HWSPINLOCK_QCOM=y
+# CONFIG_HW_RANDOM is not set
 CONFIG_I2C=y
 CONFIG_I2C_BOARDINFO=y
 CONFIG_I2C_CHARDEV=y
diff --git a/target/linux/ramips/mt7620/config-5.15 b/target/linux/ramips/mt7620/config-5.15
index 641b93e582..61882b53f9 100644
--- a/target/linux/ramips/mt7620/config-5.15
+++ b/target/linux/ramips/mt7620/config-5.15
@@ -80,6 +80,7 @@ CONFIG_HARDWARE_WATCHPOINTS=y
 CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
+# CONFIG_HW_RANDOM is not set
 CONFIG_HZ_PERIODIC=y
 CONFIG_ICPLUS_PHY=y
 CONFIG_INITRAMFS_SOURCE=""
diff --git a/target/linux/ramips/mt7621/config-5.15 b/target/linux/ramips/mt7621/config-5.15
index 05e4c1ce87..f08ca3bb1d 100644
--- a/target/linux/ramips/mt7621/config-5.15
+++ b/target/linux/ramips/mt7621/config-5.15
@@ -90,6 +90,7 @@ CONFIG_HARDWARE_WATCHPOINTS=y
 CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
+# CONFIG_HW_RANDOM is not set
 CONFIG_I2C=y
 CONFIG_I2C_ALGOBIT=y
 CONFIG_I2C_BOARDINFO=y
diff --git a/target/linux/ramips/mt76x8/config-5.15 b/target/linux/ramips/mt76x8/config-5.15
index bd1d3688b8..840bcd133d 100644
--- a/target/linux/ramips/mt76x8/config-5.15
+++ b/target/linux/ramips/mt76x8/config-5.15
@@ -79,6 +79,7 @@ CONFIG_HARDWARE_WATCHPOINTS=y
 CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
+# CONFIG_HW_RANDOM is not set
 CONFIG_HZ_PERIODIC=y
 CONFIG_ICPLUS_PHY=y
 CONFIG_INITRAMFS_SOURCE=""
diff --git a/target/linux/ramips/rt288x/config-5.15 b/target/linux/ramips/rt288x/config-5.15
index 9f502c220f..3f9014796a 100644
--- a/target/linux/ramips/rt288x/config-5.15
+++ b/target/linux/ramips/rt288x/config-5.15
@@ -68,6 +68,7 @@ CONFIG_HARDWARE_WATCHPOINTS=y
 CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
+# CONFIG_HW_RANDOM is not set
 CONFIG_HZ_PERIODIC=y
 CONFIG_INITRAMFS_SOURCE=""
 CONFIG_IP17XX_PHY=y
diff --git a/target/linux/ramips/rt305x/config-5.15 b/target/linux/ramips/rt305x/config-5.15
index 5af80adca6..9241739e65 100644
--- a/target/linux/ramips/rt305x/config-5.15
+++ b/target/linux/ramips/rt305x/config-5.15
@@ -73,6 +73,7 @@ CONFIG_HARDWARE_WATCHPOINTS=y
 CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
+# CONFIG_HW_RANDOM is not set
 CONFIG_HZ_PERIODIC=y
 CONFIG_INITRAMFS_SOURCE=""
 CONFIG_IRQCHIP=y
diff --git a/target/linux/ramips/rt3883/config-5.15 b/target/linux/ramips/rt3883/config-5.15
index 2977a3b531..a83e629bbe 100644
--- a/target/linux/ramips/rt3883/config-5.15
+++ b/target/linux/ramips/rt3883/config-5.15
@@ -71,6 +71,7 @@ CONFIG_HARDWARE_WATCHPOINTS=y
 CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
+# CONFIG_HW_RANDOM is not set
 CONFIG_HZ_PERIODIC=y
 CONFIG_INITRAMFS_SOURCE=""
 CONFIG_IRQCHIP=y
diff --git a/target/linux/realtek/rtl838x/config-5.15 b/target/linux/realtek/rtl838x/config-5.15
index ad2c1b43cc..0c116e792d 100644
--- a/target/linux/realtek/rtl838x/config-5.15
+++ b/target/linux/realtek/rtl838x/config-5.15
@@ -97,6 +97,7 @@ CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
 CONFIG_HWMON=y
+# CONFIG_HW_RANDOM is not set
 CONFIG_HZ_PERIODIC=y
 CONFIG_I2C=y
 CONFIG_I2C_ALGOBIT=y
diff --git a/target/linux/realtek/rtl839x/config-5.15 b/target/linux/realtek/rtl839x/config-5.15
index 5fa52ba882..a247841783 100644
--- a/target/linux/realtek/rtl839x/config-5.15
+++ b/target/linux/realtek/rtl839x/config-5.15
@@ -95,6 +95,7 @@ CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
 CONFIG_HWMON=y
+# CONFIG_HW_RANDOM is not set
 CONFIG_HZ_PERIODIC=y
 CONFIG_I2C=y
 CONFIG_I2C_ALGOBIT=y
diff --git a/target/linux/realtek/rtl930x/config-5.15 b/target/linux/realtek/rtl930x/config-5.15
index af5f2ca7a3..e73b8daa6b 100644
--- a/target/linux/realtek/rtl930x/config-5.15
+++ b/target/linux/realtek/rtl930x/config-5.15
@@ -77,6 +77,7 @@ CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
 CONFIG_HWMON=y
+# CONFIG_HW_RANDOM is not set
 CONFIG_HZ_PERIODIC=y
 CONFIG_I2C=y
 CONFIG_I2C_ALGOBIT=y
diff --git a/target/linux/realtek/rtl931x/config-5.15 b/target/linux/realtek/rtl931x/config-5.15
index 2da27941c7..f881585faa 100644
--- a/target/linux/realtek/rtl931x/config-5.15
+++ b/target/linux/realtek/rtl931x/config-5.15
@@ -83,6 +83,7 @@ CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
 CONFIG_HIGHMEM=y
 CONFIG_HWMON=y
+# CONFIG_HW_RANDOM is not set
 CONFIG_HZ_PERIODIC=y
 CONFIG_I2C=y
 CONFIG_I2C_ALGOBIT=y
diff --git a/target/linux/rockchip/armv8/config-5.15 b/target/linux/rockchip/armv8/config-5.15
index 54fad098dd..90ad250aeb 100644
--- a/target/linux/rockchip/armv8/config-5.15
+++ b/target/linux/rockchip/armv8/config-5.15
@@ -253,6 +253,7 @@ CONFIG_HUGETLB_PAGE=y
 CONFIG_HWMON=y
 CONFIG_HWSPINLOCK=y
 CONFIG_HW_CONSOLE=y
+# CONFIG_HW_RANDOM is not set
 CONFIG_I2C=y
 CONFIG_I2C_BOARDINFO=y
 CONFIG_I2C_CHARDEV=y
diff --git a/target/linux/rockchip/armv8/config-6.1 b/target/linux/rockchip/armv8/config-6.1
index 0f9a89f596..7cea55373b 100644
--- a/target/linux/rockchip/armv8/config-6.1
+++ b/target/linux/rockchip/armv8/config-6.1
@@ -285,6 +285,7 @@ CONFIG_HUGETLB_PAGE=y
 CONFIG_HWMON=y
 CONFIG_HWSPINLOCK=y
 CONFIG_HW_CONSOLE=y
+# CONFIG_HW_RANDOM is not set
 CONFIG_I2C=y
 CONFIG_I2C_BOARDINFO=y
 CONFIG_I2C_CHARDEV=y
diff --git a/target/linux/sifiveu/config-6.1 b/target/linux/sifiveu/config-6.1
index 2bcbcffeda..bd8526c814 100644
--- a/target/linux/sifiveu/config-6.1
+++ b/target/linux/sifiveu/config-6.1
@@ -160,6 +160,7 @@ CONFIG_HOTPLUG_PCI_SHPC=y
 CONFIG_HVC_DRIVER=y
 CONFIG_HVC_RISCV_SBI=y
 CONFIG_HW_CONSOLE=y
+# CONFIG_HW_RANDOM is not set
 CONFIG_HZ_PERIODIC=y
 CONFIG_I2C=y
 CONFIG_I2C_BOARDINFO=y
diff --git a/target/linux/sunxi/config-5.15 b/target/linux/sunxi/config-5.15
index 6a7baf7bae..daadef4283 100644
--- a/target/linux/sunxi/config-5.15
+++ b/target/linux/sunxi/config-5.15
@@ -210,7 +210,6 @@ CONFIG_HIGHPTE=y
 CONFIG_HOTPLUG_CPU=y
 CONFIG_HWMON=y
 CONFIG_HW_CONSOLE=y
-CONFIG_HW_RANDOM=y
 CONFIG_HW_RANDOM_TIMERIOMEM=y
 CONFIG_HZ_FIXED=0
 CONFIG_I2C=y
diff --git a/target/linux/sunxi/config-6.1 b/target/linux/sunxi/config-6.1
index a76834c13a..5af7ff7a66 100644
--- a/target/linux/sunxi/config-6.1
+++ b/target/linux/sunxi/config-6.1
@@ -214,7 +214,6 @@ CONFIG_HIGHPTE=y
 CONFIG_HOTPLUG_CPU=y
 CONFIG_HWMON=y
 CONFIG_HW_CONSOLE=y
-CONFIG_HW_RANDOM=y
 CONFIG_HW_RANDOM_TIMERIOMEM=y
 CONFIG_HZ_FIXED=0
 CONFIG_I2C=y
diff --git a/target/linux/tegra/config-5.15 b/target/linux/tegra/config-5.15
index 257ffda252..3af9175721 100644
--- a/target/linux/tegra/config-5.15
+++ b/target/linux/tegra/config-5.15
@@ -235,6 +235,7 @@ CONFIG_HIGHMEM=y
 CONFIG_HIGHPTE=y
 CONFIG_HOTPLUG_CPU=y
 CONFIG_HWMON=y
+# CONFIG_HW_RANDOM is not set
 CONFIG_HZ_FIXED=0
 CONFIG_HZ_PERIODIC=y
 CONFIG_I2C=y
diff --git a/target/linux/uml/config-5.15 b/target/linux/uml/config-5.15
index ac13cda703..82cf4e9143 100644
--- a/target/linux/uml/config-5.15
+++ b/target/linux/uml/config-5.15
@@ -45,7 +45,6 @@ CONFIG_GENERIC_FIND_FIRST_BIT=y
 CONFIG_GENERIC_IRQ_SHOW=y
 CONFIG_HOSTFS=y
 CONFIG_HVC_DRIVER=y
-CONFIG_HW_RANDOM=y
 CONFIG_HZ_PERIODIC=y
 CONFIG_IA32_FEAT_CTL=y
 CONFIG_INITRAMFS_SOURCE=""
diff --git a/target/linux/uml/config-6.1 b/target/linux/uml/config-6.1
index da4eaac3ac..94e4c90a9e 100644
--- a/target/linux/uml/config-6.1
+++ b/target/linux/uml/config-6.1
@@ -50,7 +50,6 @@ CONFIG_GENERIC_IRQ_SHOW=y
 CONFIG_GPIO_CDEV=y
 CONFIG_HOSTFS=y
 CONFIG_HVC_DRIVER=y
-CONFIG_HW_RANDOM=y
 CONFIG_HZ_PERIODIC=y
 CONFIG_IA32_FEAT_CTL=y
 CONFIG_INITRAMFS_SOURCE=""
diff --git a/target/linux/x86/config-5.15 b/target/linux/x86/config-5.15
index cf94f3bbff..d7ddca845b 100644
--- a/target/linux/x86/config-5.15
+++ b/target/linux/x86/config-5.15
@@ -159,7 +159,6 @@ CONFIG_HPET_EMULATE_RTC=y
 CONFIG_HPET_TIMER=y
 # CONFIG_HP_WATCHDOG is not set
 CONFIG_HW_CONSOLE=y
-CONFIG_HW_RANDOM=y
 CONFIG_HW_RANDOM_GEODE=y
 CONFIG_HW_RANDOM_VIA=y
 # CONFIG_HYPERVISOR_GUEST is not set
diff --git a/target/linux/x86/config-6.1 b/target/linux/x86/config-6.1
index 6776d05be3..07d6f8bc35 100644
--- a/target/linux/x86/config-6.1
+++ b/target/linux/x86/config-6.1
@@ -168,7 +168,6 @@ CONFIG_HIGHPTE=y
 CONFIG_HPET_EMULATE_RTC=y
 CONFIG_HPET_TIMER=y
 CONFIG_HW_CONSOLE=y
-CONFIG_HW_RANDOM=y
 CONFIG_HW_RANDOM_GEODE=y
 CONFIG_HW_RANDOM_VIA=y
 # CONFIG_HYPERVISOR_GUEST is not set
diff --git a/target/linux/zynq/config-5.15 b/target/linux/zynq/config-5.15
index d1d7392440..60ba49a5f9 100644
--- a/target/linux/zynq/config-5.15
+++ b/target/linux/zynq/config-5.15
@@ -232,6 +232,7 @@ CONFIG_HIGHPTE=y
 CONFIG_HOTPLUG_CPU=y
 CONFIG_HWMON=y
 CONFIG_HW_CONSOLE=y
+# CONFIG_HW_RANDOM is not set
 CONFIG_HZ_FIXED=0
 CONFIG_I2C=y
 CONFIG_I2C_ALGOBIT=y
-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |       ehem+openwrt at m5p.com     PGP 87145445       |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445





From ehem+openwrt at m5p.com  Tue Nov 14 17:08:53 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Tue, 14 Nov 2023 17:08:53 -0800
Subject: [PATCH 02/11] kernel/generic: remove CONFIG_FB_NOTIFY
In-Reply-To: <cover.1700010533.git.ehem+openwrt@m5p.com>
References: <cover.1700010533.git.ehem+openwrt@m5p.com>
Message-ID: <c731d76de12e0ecce6e0bcba585512c829a28e60.1700010534.git.ehem+openwrt@m5p.com>

Date: Tue, 25 Apr 2023 16:23:20 -0700

This option is automatically enabled by CONFIG_FB=y.  There is no
reason to specifically enable it.

Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>
Reviewed-by: Philip Prindeville <philipp at redfish-solutions.com> 04/2023
---
 target/linux/generic/config-5.15 | 1 -
 target/linux/generic/config-6.1  | 1 -
 2 files changed, 2 deletions(-)

diff --git a/target/linux/generic/config-5.15 b/target/linux/generic/config-5.15
index 09628ef0da..09bd33c3d6 100644
--- a/target/linux/generic/config-5.15
+++ b/target/linux/generic/config-5.15
@@ -1984,7 +1984,6 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
 # CONFIG_FB_MXS is not set
 # CONFIG_FB_N411 is not set
 # CONFIG_FB_NEOMAGIC is not set
-CONFIG_FB_NOTIFY=y
 # CONFIG_FB_NVIDIA is not set
 # CONFIG_FB_OF is not set
 # CONFIG_FB_OMAP2 is not set
diff --git a/target/linux/generic/config-6.1 b/target/linux/generic/config-6.1
index 2073c40cc5..f352a869fd 100644
--- a/target/linux/generic/config-6.1
+++ b/target/linux/generic/config-6.1
@@ -2071,7 +2071,6 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
 # CONFIG_FB_MXS is not set
 # CONFIG_FB_N411 is not set
 # CONFIG_FB_NEOMAGIC is not set
-CONFIG_FB_NOTIFY=y
 # CONFIG_FB_NVIDIA is not set
 # CONFIG_FB_OF is not set
 # CONFIG_FB_OMAP2 is not set
-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |       ehem+openwrt at m5p.com     PGP 87145445       |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445





From ehem+openwrt at m5p.com  Tue Nov 14 17:08:53 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Tue, 14 Nov 2023 17:08:53 -0800
Subject: [PATCH 03/11] kernel: purge CONFIG_FS_MBCACHE
In-Reply-To: <cover.1700010533.git.ehem+openwrt@m5p.com>
References: <cover.1700010533.git.ehem+openwrt@m5p.com>
Message-ID: <bbdb9472a7831035f426702b4dedf2c70b739f2d.1700010534.git.ehem+openwrt@m5p.com>

Date: Tue, 9 May 2023 14:36:00 -0700

There is no point in attempting to set CONFIG_FS_MBCACHE.  The way
the Kconfig files are setup, your choice will be overridden.  As
such there isn't any point in documenting a default.

Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>
---
 target/linux/archs38/config-5.15              | 1 -
 target/linux/armsr/config-6.1                 | 1 -
 target/linux/at91/sam9x/config-5.15           | 1 -
 target/linux/at91/sama5/config-5.15           | 1 -
 target/linux/at91/sama7/config-5.15           | 1 -
 target/linux/bcm27xx/bcm2708/config-6.1       | 1 -
 target/linux/bcm27xx/bcm2709/config-6.1       | 1 -
 target/linux/bcm27xx/bcm2710/config-6.1       | 1 -
 target/linux/bcm27xx/bcm2711/config-6.1       | 1 -
 target/linux/gemini/config-6.1                | 1 -
 target/linux/imx/config-5.15                  | 1 -
 target/linux/ixp4xx/config-6.1                | 1 -
 target/linux/layerscape/armv7/config-5.15     | 1 -
 target/linux/layerscape/armv7/config-6.1      | 1 -
 target/linux/layerscape/armv8_64b/config-5.15 | 1 -
 target/linux/layerscape/armv8_64b/config-6.1  | 1 -
 target/linux/malta/config-5.15                | 1 -
 target/linux/malta/config-6.1                 | 1 -
 target/linux/mediatek/filogic/config-5.15     | 1 -
 target/linux/mediatek/filogic/config-6.1      | 1 -
 target/linux/mediatek/mt7622/config-5.15      | 1 -
 target/linux/mediatek/mt7622/config-6.1       | 1 -
 target/linux/mediatek/mt7623/config-5.15      | 1 -
 target/linux/mediatek/mt7623/config-6.1       | 1 -
 target/linux/mvebu/config-5.15                | 1 -
 target/linux/mvebu/config-6.1                 | 1 -
 target/linux/mxs/config-5.15                  | 1 -
 target/linux/mxs/config-6.1                   | 1 -
 target/linux/octeon/config-5.15               | 1 -
 target/linux/omap/config-5.15                 | 1 -
 target/linux/oxnas/ox810se/config-default     | 1 -
 target/linux/pistachio/config-5.15            | 1 -
 target/linux/qoriq/config-5.15                | 1 -
 target/linux/rockchip/armv8/config-5.15       | 1 -
 target/linux/rockchip/armv8/config-6.1        | 1 -
 target/linux/sifiveu/config-6.1               | 1 -
 target/linux/sunxi/config-5.15                | 1 -
 target/linux/sunxi/config-6.1                 | 1 -
 target/linux/tegra/config-5.15                | 1 -
 target/linux/uml/config-5.15                  | 1 -
 target/linux/uml/config-6.1                   | 1 -
 target/linux/x86/config-5.15                  | 1 -
 target/linux/x86/config-6.1                   | 1 -
 target/linux/zynq/config-5.15                 | 1 -
 44 files changed, 44 deletions(-)

diff --git a/target/linux/archs38/config-5.15 b/target/linux/archs38/config-5.15
index b526c0efe0..9e537951df 100644
--- a/target/linux/archs38/config-5.15
+++ b/target/linux/archs38/config-5.15
@@ -87,7 +87,6 @@ CONFIG_FB=y
 CONFIG_FB_CMDLINE=y
 CONFIG_FIXED_PHY=y
 CONFIG_FS_IOMAP=y
-CONFIG_FS_MBCACHE=y
 CONFIG_FS_POSIX_ACL=y
 CONFIG_FWNODE_MDIO=y
 CONFIG_FW_LOADER_PAGED_BUF=y
diff --git a/target/linux/armsr/config-6.1 b/target/linux/armsr/config-6.1
index d1dac69da4..745a5caf9d 100644
--- a/target/linux/armsr/config-6.1
+++ b/target/linux/armsr/config-6.1
@@ -138,7 +138,6 @@ CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
 # CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
 CONFIG_FRAME_POINTER=y
 CONFIG_FS_IOMAP=y
-CONFIG_FS_MBCACHE=y
 CONFIG_FW_LOADER_PAGED_BUF=y
 CONFIG_GENERIC_ALLOCATOR=y
 CONFIG_GENERIC_ARCH_TOPOLOGY=y
diff --git a/target/linux/at91/sam9x/config-5.15 b/target/linux/at91/sam9x/config-5.15
index 2c29ca2369..5a902d5cd1 100644
--- a/target/linux/at91/sam9x/config-5.15
+++ b/target/linux/at91/sam9x/config-5.15
@@ -95,7 +95,6 @@ CONFIG_FIXED_PHY=y
 CONFIG_FIX_EARLYCON_MEM=y
 CONFIG_FREEZER=y
 CONFIG_FS_IOMAP=y
-CONFIG_FS_MBCACHE=y
 CONFIG_FWNODE_MDIO=y
 CONFIG_FW_CACHE=y
 CONFIG_FW_LOADER_PAGED_BUF=y
diff --git a/target/linux/at91/sama5/config-5.15 b/target/linux/at91/sama5/config-5.15
index 6130e288dd..4cf28c5f33 100644
--- a/target/linux/at91/sama5/config-5.15
+++ b/target/linux/at91/sama5/config-5.15
@@ -163,7 +163,6 @@ CONFIG_FIX_EARLYCON_MEM=y
 CONFIG_FORCE_MAX_ZONEORDER=15
 CONFIG_FREEZER=y
 CONFIG_FS_IOMAP=y
-CONFIG_FS_MBCACHE=y
 CONFIG_FWNODE_MDIO=y
 CONFIG_FW_CACHE=y
 CONFIG_FW_LOADER_PAGED_BUF=y
diff --git a/target/linux/at91/sama7/config-5.15 b/target/linux/at91/sama7/config-5.15
index 23b74890ea..86187089bf 100644
--- a/target/linux/at91/sama7/config-5.15
+++ b/target/linux/at91/sama7/config-5.15
@@ -150,7 +150,6 @@ CONFIG_FIXED_PHY=y
 CONFIG_FIX_EARLYCON_MEM=y
 CONFIG_FORCE_MAX_ZONEORDER=15
 CONFIG_FS_IOMAP=y
-CONFIG_FS_MBCACHE=y
 CONFIG_FWNODE_MDIO=y
 CONFIG_FW_LOADER_PAGED_BUF=y
 CONFIG_GENERIC_ALLOCATOR=y
diff --git a/target/linux/bcm27xx/bcm2708/config-6.1 b/target/linux/bcm27xx/bcm2708/config-6.1
index 244fa67656..913063ef1a 100644
--- a/target/linux/bcm27xx/bcm2708/config-6.1
+++ b/target/linux/bcm27xx/bcm2708/config-6.1
@@ -164,7 +164,6 @@ CONFIG_FRAMEBUFFER_CONSOLE=y
 CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
 CONFIG_FREEZER=y
 CONFIG_FS_IOMAP=y
-CONFIG_FS_MBCACHE=y
 CONFIG_FS_POSIX_ACL=y
 CONFIG_FWNODE_MDIO=y
 CONFIG_FW_CACHE=y
diff --git a/target/linux/bcm27xx/bcm2709/config-6.1 b/target/linux/bcm27xx/bcm2709/config-6.1
index 7bdde533ab..446a42a967 100644
--- a/target/linux/bcm27xx/bcm2709/config-6.1
+++ b/target/linux/bcm27xx/bcm2709/config-6.1
@@ -201,7 +201,6 @@ CONFIG_FREEZER=y
 CONFIG_FS_ENCRYPTION=y
 CONFIG_FS_ENCRYPTION_ALGS=y
 CONFIG_FS_IOMAP=y
-CONFIG_FS_MBCACHE=y
 CONFIG_FS_POSIX_ACL=y
 CONFIG_FWNODE_MDIO=y
 CONFIG_FW_CACHE=y
diff --git a/target/linux/bcm27xx/bcm2710/config-6.1 b/target/linux/bcm27xx/bcm2710/config-6.1
index dd2d87d583..0ce37ed741 100644
--- a/target/linux/bcm27xx/bcm2710/config-6.1
+++ b/target/linux/bcm27xx/bcm2710/config-6.1
@@ -211,7 +211,6 @@ CONFIG_FSL_ERRATUM_A008585=y
 CONFIG_FS_ENCRYPTION=y
 CONFIG_FS_ENCRYPTION_ALGS=y
 CONFIG_FS_IOMAP=y
-CONFIG_FS_MBCACHE=y
 CONFIG_FS_POSIX_ACL=y
 CONFIG_FWNODE_MDIO=y
 CONFIG_FW_CACHE=y
diff --git a/target/linux/bcm27xx/bcm2711/config-6.1 b/target/linux/bcm27xx/bcm2711/config-6.1
index 7313c6447c..883e01ea62 100644
--- a/target/linux/bcm27xx/bcm2711/config-6.1
+++ b/target/linux/bcm27xx/bcm2711/config-6.1
@@ -216,7 +216,6 @@ CONFIG_FSL_ERRATUM_A008585=y
 CONFIG_FS_ENCRYPTION=y
 CONFIG_FS_ENCRYPTION_ALGS=y
 CONFIG_FS_IOMAP=y
-CONFIG_FS_MBCACHE=y
 CONFIG_FS_POSIX_ACL=y
 CONFIG_FWNODE_MDIO=y
 CONFIG_FW_CACHE=y
diff --git a/target/linux/gemini/config-6.1 b/target/linux/gemini/config-6.1
index 4ad4ce9b6c..8ff608abce 100644
--- a/target/linux/gemini/config-6.1
+++ b/target/linux/gemini/config-6.1
@@ -171,7 +171,6 @@ CONFIG_FRAMEBUFFER_CONSOLE=y
 CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
 # CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
 CONFIG_FS_IOMAP=y
-CONFIG_FS_MBCACHE=y
 CONFIG_FS_POSIX_ACL=y
 CONFIG_FTTMR010_TIMER=y
 CONFIG_FTWDT010_WATCHDOG=y
diff --git a/target/linux/imx/config-5.15 b/target/linux/imx/config-5.15
index dc57ea0fff..e0b73fd4fc 100644
--- a/target/linux/imx/config-5.15
+++ b/target/linux/imx/config-5.15
@@ -169,7 +169,6 @@ CONFIG_FSL_GUTS=y
 CONFIG_FS_ENCRYPTION=y
 CONFIG_FS_ENCRYPTION_ALGS=y
 CONFIG_FS_IOMAP=y
-CONFIG_FS_MBCACHE=y
 CONFIG_FS_POSIX_ACL=y
 CONFIG_FWNODE_MDIO=y
 CONFIG_FW_LOADER_PAGED_BUF=y
diff --git a/target/linux/ixp4xx/config-6.1 b/target/linux/ixp4xx/config-6.1
index 45f017a6f8..a7b14bfb66 100644
--- a/target/linux/ixp4xx/config-6.1
+++ b/target/linux/ixp4xx/config-6.1
@@ -81,7 +81,6 @@ CONFIG_FIXED_PHY=y
 CONFIG_FIX_EARLYCON_MEM=y
 CONFIG_FORCE_PCI=y
 CONFIG_FS_IOMAP=y
-CONFIG_FS_MBCACHE=y
 CONFIG_FWNODE_MDIO=y
 CONFIG_FW_LOADER_PAGED_BUF=y
 CONFIG_FW_LOADER_SYSFS=y
diff --git a/target/linux/layerscape/armv7/config-5.15 b/target/linux/layerscape/armv7/config-5.15
index 21901d524f..69e408db71 100644
--- a/target/linux/layerscape/armv7/config-5.15
+++ b/target/linux/layerscape/armv7/config-5.15
@@ -214,7 +214,6 @@ CONFIG_FSL_PQ_MDIO=y
 CONFIG_FSL_RCPM=y
 CONFIG_FSL_XGMAC_MDIO=y
 CONFIG_FS_IOMAP=y
-CONFIG_FS_MBCACHE=y
 CONFIG_FS_POSIX_ACL=y
 CONFIG_FTRACE=y
 # CONFIG_FTRACE_SYSCALLS is not set
diff --git a/target/linux/layerscape/armv7/config-6.1 b/target/linux/layerscape/armv7/config-6.1
index e0d362c53f..552db1c141 100644
--- a/target/linux/layerscape/armv7/config-6.1
+++ b/target/linux/layerscape/armv7/config-6.1
@@ -224,7 +224,6 @@ CONFIG_FSL_PQ_MDIO=y
 CONFIG_FSL_RCPM=y
 CONFIG_FSL_XGMAC_MDIO=y
 CONFIG_FS_IOMAP=y
-CONFIG_FS_MBCACHE=y
 CONFIG_FS_POSIX_ACL=y
 CONFIG_FTRACE=y
 # CONFIG_FTRACE_SYSCALLS is not set
diff --git a/target/linux/layerscape/armv8_64b/config-5.15 b/target/linux/layerscape/armv8_64b/config-5.15
index ba625a9465..f8f8b59c12 100644
--- a/target/linux/layerscape/armv8_64b/config-5.15
+++ b/target/linux/layerscape/armv8_64b/config-5.15
@@ -298,7 +298,6 @@ CONFIG_FSL_MC_UAPI_SUPPORT=y
 CONFIG_FSL_RCPM=y
 CONFIG_FSL_XGMAC_MDIO=y
 CONFIG_FS_IOMAP=y
-CONFIG_FS_MBCACHE=y
 CONFIG_FS_POSIX_ACL=y
 CONFIG_FUSE_FS=y
 CONFIG_FWNODE_MDIO=y
diff --git a/target/linux/layerscape/armv8_64b/config-6.1 b/target/linux/layerscape/armv8_64b/config-6.1
index 2b606c43b0..6db1fc7052 100644
--- a/target/linux/layerscape/armv8_64b/config-6.1
+++ b/target/linux/layerscape/armv8_64b/config-6.1
@@ -318,7 +318,6 @@ CONFIG_FSL_MC_UAPI_SUPPORT=y
 CONFIG_FSL_RCPM=y
 CONFIG_FSL_XGMAC_MDIO=y
 CONFIG_FS_IOMAP=y
-CONFIG_FS_MBCACHE=y
 CONFIG_FS_POSIX_ACL=y
 CONFIG_FUSE_FS=y
 CONFIG_FWNODE_MDIO=y
diff --git a/target/linux/malta/config-5.15 b/target/linux/malta/config-5.15
index 592db8b3a8..480b738b2d 100644
--- a/target/linux/malta/config-5.15
+++ b/target/linux/malta/config-5.15
@@ -70,7 +70,6 @@ CONFIG_DUMMY_CONSOLE=y
 CONFIG_EXT4_FS=y
 CONFIG_F2FS_FS=y
 CONFIG_FS_IOMAP=y
-CONFIG_FS_MBCACHE=y
 CONFIG_FS_POSIX_ACL=y
 CONFIG_FW_LOADER_PAGED_BUF=y
 CONFIG_GENERIC_ATOMIC64=y
diff --git a/target/linux/malta/config-6.1 b/target/linux/malta/config-6.1
index 85048b6cd0..bb95793072 100644
--- a/target/linux/malta/config-6.1
+++ b/target/linux/malta/config-6.1
@@ -71,7 +71,6 @@ CONFIG_DUMMY_CONSOLE=y
 CONFIG_EXT4_FS=y
 CONFIG_F2FS_FS=y
 CONFIG_FS_IOMAP=y
-CONFIG_FS_MBCACHE=y
 CONFIG_FS_POSIX_ACL=y
 CONFIG_FW_LOADER_PAGED_BUF=y
 CONFIG_GENERIC_ATOMIC64=y
diff --git a/target/linux/mediatek/filogic/config-5.15 b/target/linux/mediatek/filogic/config-5.15
index 031ae51979..a8f117f2c4 100644
--- a/target/linux/mediatek/filogic/config-5.15
+++ b/target/linux/mediatek/filogic/config-5.15
@@ -135,7 +135,6 @@ CONFIG_FIXED_PHY=y
 CONFIG_FIX_EARLYCON_MEM=y
 CONFIG_FRAME_POINTER=y
 CONFIG_FS_IOMAP=y
-CONFIG_FS_MBCACHE=y
 CONFIG_FWNODE_MDIO=y
 CONFIG_FW_LOADER_PAGED_BUF=y
 CONFIG_GENERIC_ALLOCATOR=y
diff --git a/target/linux/mediatek/filogic/config-6.1 b/target/linux/mediatek/filogic/config-6.1
index 48322e473a..b41e87e10b 100644
--- a/target/linux/mediatek/filogic/config-6.1
+++ b/target/linux/mediatek/filogic/config-6.1
@@ -150,7 +150,6 @@ CONFIG_FIXED_PHY=y
 CONFIG_FIX_EARLYCON_MEM=y
 CONFIG_FRAME_POINTER=y
 CONFIG_FS_IOMAP=y
-CONFIG_FS_MBCACHE=y
 CONFIG_FWNODE_MDIO=y
 CONFIG_FW_LOADER_PAGED_BUF=y
 CONFIG_FW_LOADER_SYSFS=y
diff --git a/target/linux/mediatek/mt7622/config-5.15 b/target/linux/mediatek/mt7622/config-5.15
index 1d5a799b4c..99a170a2a8 100644
--- a/target/linux/mediatek/mt7622/config-5.15
+++ b/target/linux/mediatek/mt7622/config-5.15
@@ -158,7 +158,6 @@ CONFIG_FIXED_PHY=y
 CONFIG_FIX_EARLYCON_MEM=y
 CONFIG_FRAME_POINTER=y
 CONFIG_FS_IOMAP=y
-CONFIG_FS_MBCACHE=y
 CONFIG_FWNODE_MDIO=y
 CONFIG_FW_LOADER_PAGED_BUF=y
 CONFIG_GENERIC_ALLOCATOR=y
diff --git a/target/linux/mediatek/mt7622/config-6.1 b/target/linux/mediatek/mt7622/config-6.1
index 73d26c3f2b..26f6d8a1b1 100644
--- a/target/linux/mediatek/mt7622/config-6.1
+++ b/target/linux/mediatek/mt7622/config-6.1
@@ -157,7 +157,6 @@ CONFIG_FIX_EARLYCON_MEM=y
 CONFIG_FRAME_POINTER=y
 CONFIG_FRAME_WARN=2048
 CONFIG_FS_IOMAP=y
-CONFIG_FS_MBCACHE=y
 CONFIG_FWNODE_MDIO=y
 CONFIG_FW_LOADER_PAGED_BUF=y
 CONFIG_FW_LOADER_SYSFS=y
diff --git a/target/linux/mediatek/mt7623/config-5.15 b/target/linux/mediatek/mt7623/config-5.15
index cb158845ad..e13a67f0b1 100644
--- a/target/linux/mediatek/mt7623/config-5.15
+++ b/target/linux/mediatek/mt7623/config-5.15
@@ -212,7 +212,6 @@ CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
 CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
 CONFIG_FREEZER=y
 CONFIG_FS_IOMAP=y
-CONFIG_FS_MBCACHE=y
 CONFIG_FWNODE_MDIO=y
 CONFIG_FW_CACHE=y
 CONFIG_FW_LOADER_PAGED_BUF=y
diff --git a/target/linux/mediatek/mt7623/config-6.1 b/target/linux/mediatek/mt7623/config-6.1
index 63bbbed430..2ff27a1f4c 100644
--- a/target/linux/mediatek/mt7623/config-6.1
+++ b/target/linux/mediatek/mt7623/config-6.1
@@ -226,7 +226,6 @@ CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
 CONFIG_FRAME_WARN=1024
 CONFIG_FREEZER=y
 CONFIG_FS_IOMAP=y
-CONFIG_FS_MBCACHE=y
 CONFIG_FWNODE_MDIO=y
 CONFIG_FW_CACHE=y
 CONFIG_FW_LOADER_PAGED_BUF=y
diff --git a/target/linux/mvebu/config-5.15 b/target/linux/mvebu/config-5.15
index 87bb79d25e..8b1c64b6d9 100644
--- a/target/linux/mvebu/config-5.15
+++ b/target/linux/mvebu/config-5.15
@@ -151,7 +151,6 @@ CONFIG_F2FS_FS=y
 CONFIG_FIXED_PHY=y
 CONFIG_FIX_EARLYCON_MEM=y
 CONFIG_FS_IOMAP=y
-CONFIG_FS_MBCACHE=y
 CONFIG_FWNODE_MDIO=y
 CONFIG_FW_LOADER_PAGED_BUF=y
 CONFIG_GENERIC_ALLOCATOR=y
diff --git a/target/linux/mvebu/config-6.1 b/target/linux/mvebu/config-6.1
index 56934c807a..b84c3aeef9 100644
--- a/target/linux/mvebu/config-6.1
+++ b/target/linux/mvebu/config-6.1
@@ -157,7 +157,6 @@ CONFIG_F2FS_FS=y
 CONFIG_FIXED_PHY=y
 CONFIG_FIX_EARLYCON_MEM=y
 CONFIG_FS_IOMAP=y
-CONFIG_FS_MBCACHE=y
 CONFIG_FWNODE_MDIO=y
 CONFIG_FW_LOADER_PAGED_BUF=y
 CONFIG_FW_LOADER_SYSFS=y
diff --git a/target/linux/mxs/config-5.15 b/target/linux/mxs/config-5.15
index 0aa73e1eb3..e98cbb03d5 100644
--- a/target/linux/mxs/config-5.15
+++ b/target/linux/mxs/config-5.15
@@ -80,7 +80,6 @@ CONFIG_FEC=y
 CONFIG_FIXED_PHY=y
 CONFIG_FIX_EARLYCON_MEM=y
 CONFIG_FS_IOMAP=y
-CONFIG_FS_MBCACHE=y
 CONFIG_FWNODE_MDIO=y
 CONFIG_FW_LOADER_PAGED_BUF=y
 CONFIG_GENERIC_ALLOCATOR=y
diff --git a/target/linux/mxs/config-6.1 b/target/linux/mxs/config-6.1
index 1f131c4d5f..d8547e9859 100644
--- a/target/linux/mxs/config-6.1
+++ b/target/linux/mxs/config-6.1
@@ -79,7 +79,6 @@ CONFIG_FEC=y
 CONFIG_FIXED_PHY=y
 CONFIG_FIX_EARLYCON_MEM=y
 CONFIG_FS_IOMAP=y
-CONFIG_FS_MBCACHE=y
 CONFIG_FWNODE_MDIO=y
 CONFIG_FW_LOADER_PAGED_BUF=y
 CONFIG_GENERIC_ALLOCATOR=y
diff --git a/target/linux/octeon/config-5.15 b/target/linux/octeon/config-5.15
index dbda116622..14d8eafbde 100644
--- a/target/linux/octeon/config-5.15
+++ b/target/linux/octeon/config-5.15
@@ -71,7 +71,6 @@ CONFIG_F2FS_FS=y
 CONFIG_FAT_FS=y
 CONFIG_FIXED_PHY=y
 CONFIG_FS_IOMAP=y
-CONFIG_FS_MBCACHE=y
 CONFIG_FWNODE_MDIO=y
 CONFIG_FW_LOADER_PAGED_BUF=y
 CONFIG_GENERIC_ALLOCATOR=y
diff --git a/target/linux/omap/config-5.15 b/target/linux/omap/config-5.15
index 98bebfc9b2..aa03d9a05b 100644
--- a/target/linux/omap/config-5.15
+++ b/target/linux/omap/config-5.15
@@ -225,7 +225,6 @@ CONFIG_FHANDLE=y
 CONFIG_FIXED_PHY=y
 CONFIG_FIX_EARLYCON_MEM=y
 CONFIG_FS_IOMAP=y
-CONFIG_FS_MBCACHE=y
 CONFIG_FS_POSIX_ACL=y
 CONFIG_FWNODE_MDIO=y
 CONFIG_FW_LOADER_PAGED_BUF=y
diff --git a/target/linux/oxnas/ox810se/config-default b/target/linux/oxnas/ox810se/config-default
index 5d2d49c288..5d762a1c44 100644
--- a/target/linux/oxnas/ox810se/config-default
+++ b/target/linux/oxnas/ox810se/config-default
@@ -4,5 +4,4 @@ CONFIG_CPU_IDLE_GOV_MENU=y
 CONFIG_CPU_IDLE_MULTIPLE_DRIVERS=y
 # CONFIG_DEBUG_UNCOMPRESS is not set
 CONFIG_EXT4_FS=y
-CONFIG_FS_MBCACHE=y
 CONFIG_MACH_OX810SE=y
diff --git a/target/linux/pistachio/config-5.15 b/target/linux/pistachio/config-5.15
index db6d91ac9c..be5b622b49 100644
--- a/target/linux/pistachio/config-5.15
+++ b/target/linux/pistachio/config-5.15
@@ -81,7 +81,6 @@ CONFIG_FIT_IMAGE_FDT_MARDUK=y
 # CONFIG_FIT_IMAGE_FDT_XILFPGA is not set
 CONFIG_FIXED_PHY=y
 CONFIG_FS_IOMAP=y
-CONFIG_FS_MBCACHE=y
 CONFIG_FS_POSIX_ACL=y
 CONFIG_FWNODE_MDIO=y
 CONFIG_FW_LOADER_PAGED_BUF=y
diff --git a/target/linux/qoriq/config-5.15 b/target/linux/qoriq/config-5.15
index 7da3f40de5..e6d2075724 100644
--- a/target/linux/qoriq/config-5.15
+++ b/target/linux/qoriq/config-5.15
@@ -129,7 +129,6 @@ CONFIG_FSL_SOC=y
 CONFIG_FSL_SOC_BOOKE=y
 CONFIG_FSL_XGMAC_MDIO=y
 CONFIG_FS_IOMAP=y
-CONFIG_FS_MBCACHE=y
 CONFIG_FS_POSIX_ACL=y
 CONFIG_FTL=y
 CONFIG_FUNCTION_ERROR_INJECTION=y
diff --git a/target/linux/rockchip/armv8/config-5.15 b/target/linux/rockchip/armv8/config-5.15
index 90ad250aeb..4b3eac25c2 100644
--- a/target/linux/rockchip/armv8/config-5.15
+++ b/target/linux/rockchip/armv8/config-5.15
@@ -198,7 +198,6 @@ CONFIG_FIX_EARLYCON_MEM=y
 # CONFIG_FORTIFY_SOURCE is not set
 CONFIG_FRAME_POINTER=y
 CONFIG_FS_IOMAP=y
-CONFIG_FS_MBCACHE=y
 CONFIG_FS_POSIX_ACL=y
 CONFIG_FWNODE_MDIO=y
 CONFIG_FW_LOADER_PAGED_BUF=y
diff --git a/target/linux/rockchip/armv8/config-6.1 b/target/linux/rockchip/armv8/config-6.1
index 7cea55373b..55ad7ef386 100644
--- a/target/linux/rockchip/armv8/config-6.1
+++ b/target/linux/rockchip/armv8/config-6.1
@@ -226,7 +226,6 @@ CONFIG_FIX_EARLYCON_MEM=y
 # CONFIG_FORTIFY_SOURCE is not set
 CONFIG_FRAME_POINTER=y
 CONFIG_FS_IOMAP=y
-CONFIG_FS_MBCACHE=y
 CONFIG_FS_POSIX_ACL=y
 CONFIG_FWNODE_MDIO=y
 CONFIG_FW_LOADER_PAGED_BUF=y
diff --git a/target/linux/sifiveu/config-6.1 b/target/linux/sifiveu/config-6.1
index bd8526c814..51ff357db4 100644
--- a/target/linux/sifiveu/config-6.1
+++ b/target/linux/sifiveu/config-6.1
@@ -111,7 +111,6 @@ CONFIG_FONT_SUPPORT=y
 CONFIG_FPU=y
 CONFIG_FRAME_POINTER=y
 CONFIG_FS_IOMAP=y
-CONFIG_FS_MBCACHE=y
 CONFIG_FWNODE_MDIO=y
 CONFIG_FW_LOADER_PAGED_BUF=y
 CONFIG_FW_LOADER_SYSFS=y
diff --git a/target/linux/sunxi/config-5.15 b/target/linux/sunxi/config-5.15
index daadef4283..cd702a4f43 100644
--- a/target/linux/sunxi/config-5.15
+++ b/target/linux/sunxi/config-5.15
@@ -163,7 +163,6 @@ CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
 CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
 CONFIG_FREEZER=y
 CONFIG_FS_IOMAP=y
-CONFIG_FS_MBCACHE=y
 CONFIG_FS_POSIX_ACL=y
 CONFIG_FWNODE_MDIO=y
 CONFIG_FW_CACHE=y
diff --git a/target/linux/sunxi/config-6.1 b/target/linux/sunxi/config-6.1
index 5af7ff7a66..43cbacc5e8 100644
--- a/target/linux/sunxi/config-6.1
+++ b/target/linux/sunxi/config-6.1
@@ -167,7 +167,6 @@ CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
 CONFIG_FRAME_WARN=2048
 CONFIG_FREEZER=y
 CONFIG_FS_IOMAP=y
-CONFIG_FS_MBCACHE=y
 CONFIG_FS_POSIX_ACL=y
 CONFIG_FWNODE_MDIO=y
 CONFIG_FW_CACHE=y
diff --git a/target/linux/tegra/config-5.15 b/target/linux/tegra/config-5.15
index 3af9175721..bf6c6cc8d4 100644
--- a/target/linux/tegra/config-5.15
+++ b/target/linux/tegra/config-5.15
@@ -185,7 +185,6 @@ CONFIG_FB_SYS_FOPS=y
 CONFIG_FB_SYS_IMAGEBLIT=y
 CONFIG_FIX_EARLYCON_MEM=y
 CONFIG_FS_IOMAP=y
-CONFIG_FS_MBCACHE=y
 CONFIG_FW_LOADER_PAGED_BUF=y
 CONFIG_GENERIC_ALLOCATOR=y
 CONFIG_GENERIC_ARCH_TOPOLOGY=y
diff --git a/target/linux/uml/config-5.15 b/target/linux/uml/config-5.15
index 82cf4e9143..32154633a4 100644
--- a/target/linux/uml/config-5.15
+++ b/target/linux/uml/config-5.15
@@ -36,7 +36,6 @@ CONFIG_EXT4_FS=y
 CONFIG_F2FS_FS=y
 CONFIG_FAILOVER=y
 CONFIG_FS_IOMAP=y
-CONFIG_FS_MBCACHE=y
 CONFIG_FW_LOADER_PAGED_BUF=y
 CONFIG_GENERIC_CLOCKEVENTS=y
 # CONFIG_GENERIC_CPU is not set
diff --git a/target/linux/uml/config-6.1 b/target/linux/uml/config-6.1
index 94e4c90a9e..1c2dd5faae 100644
--- a/target/linux/uml/config-6.1
+++ b/target/linux/uml/config-6.1
@@ -39,7 +39,6 @@ CONFIG_EXT4_FS=y
 CONFIG_F2FS_FS=y
 CONFIG_FAILOVER=y
 CONFIG_FS_IOMAP=y
-CONFIG_FS_MBCACHE=y
 CONFIG_FW_LOADER_PAGED_BUF=y
 CONFIG_FW_LOADER_SYSFS=y
 CONFIG_GCC11_NO_ARRAY_BOUNDS=y
diff --git a/target/linux/x86/config-5.15 b/target/linux/x86/config-5.15
index d7ddca845b..57941a53bf 100644
--- a/target/linux/x86/config-5.15
+++ b/target/linux/x86/config-5.15
@@ -110,7 +110,6 @@ CONFIG_FIRMWARE_MEMMAP=y
 CONFIG_FIX_EARLYCON_MEM=y
 CONFIG_FRAME_POINTER=y
 CONFIG_FS_IOMAP=y
-CONFIG_FS_MBCACHE=y
 CONFIG_FUSION=y
 # CONFIG_FUSION_CTL is not set
 # CONFIG_FUSION_LOGGING is not set
diff --git a/target/linux/x86/config-6.1 b/target/linux/x86/config-6.1
index 07d6f8bc35..979bb400c1 100644
--- a/target/linux/x86/config-6.1
+++ b/target/linux/x86/config-6.1
@@ -118,7 +118,6 @@ CONFIG_FIRMWARE_MEMMAP=y
 CONFIG_FIX_EARLYCON_MEM=y
 CONFIG_FRAME_POINTER=y
 CONFIG_FS_IOMAP=y
-CONFIG_FS_MBCACHE=y
 CONFIG_FUSION=y
 # CONFIG_FUSION_CTL is not set
 # CONFIG_FUSION_LOGGING is not set
diff --git a/target/linux/zynq/config-5.15 b/target/linux/zynq/config-5.15
index 60ba49a5f9..a227618357 100644
--- a/target/linux/zynq/config-5.15
+++ b/target/linux/zynq/config-5.15
@@ -181,7 +181,6 @@ CONFIG_FPGA_MGR_ZYNQ_FPGA=y
 CONFIG_FPGA_REGION=y
 CONFIG_FREEZER=y
 CONFIG_FS_IOMAP=y
-CONFIG_FS_MBCACHE=y
 CONFIG_FWNODE_MDIO=y
 CONFIG_FW_CACHE=y
 CONFIG_FW_LOADER_PAGED_BUF=y
-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |       ehem+openwrt at m5p.com     PGP 87145445       |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445





From ehem+openwrt at m5p.com  Tue Nov 14 17:08:53 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Tue, 14 Nov 2023 17:08:53 -0800
Subject: [PATCH 04/11] kernel: remove ext2 support from kernel
In-Reply-To: <cover.1700010533.git.ehem+openwrt@m5p.com>
References: <cover.1700010533.git.ehem+openwrt@m5p.com>
Message-ID: <a51bf44038104412e8b02d839050b6163981ec8d.1700010534.git.ehem+openwrt@m5p.com>

Date: Tue, 9 May 2023 13:57:31 -0700

While functional and small during its time, ext2 support should no
longer be enabled by default.  For most purposes aside from memory
footprint, ext4 is rather superior.  Time to play Taps.

Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>
---

I haven't done builds to confirm the size delta.  I suspect it won't
be very large. Mostly this is to finish killing off ext2 and make
sure no one tries to install a new system with ext2.
---
 target/linux/generic/config-5.15 | 3 +--
 target/linux/generic/config-6.1  | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/target/linux/generic/config-5.15 b/target/linux/generic/config-5.15
index 09bd33c3d6..c005d0c3f9 100644
--- a/target/linux/generic/config-5.15
+++ b/target/linux/generic/config-5.15
@@ -1891,14 +1891,13 @@ CONFIG_EXPERT=y
 CONFIG_EXPORTFS=y
 # CONFIG_EXPORTFS_BLOCK_OPS is not set
 # CONFIG_EXT2_FS is not set
-CONFIG_EXT2_FS_XATTR=y
 # CONFIG_EXT3_FS is not set
 # CONFIG_EXT4_DEBUG is not set
 # CONFIG_EXT4_ENCRYPTION is not set
 # CONFIG_EXT4_FS is not set
 # CONFIG_EXT4_FS_POSIX_ACL is not set
 # CONFIG_EXT4_FS_SECURITY is not set
-CONFIG_EXT4_USE_FOR_EXT2=y
+# CONFIG_EXT4_USE_FOR_EXT2 is not set
 # CONFIG_EXTCON is not set
 # CONFIG_EXTCON_ADC_JACK is not set
 # CONFIG_EXTCON_ARIZONA is not set
diff --git a/target/linux/generic/config-6.1 b/target/linux/generic/config-6.1
index f352a869fd..eed5337d92 100644
--- a/target/linux/generic/config-6.1
+++ b/target/linux/generic/config-6.1
@@ -1977,14 +1977,13 @@ CONFIG_EXPERT=y
 CONFIG_EXPORTFS=y
 # CONFIG_EXPORTFS_BLOCK_OPS is not set
 # CONFIG_EXT2_FS is not set
-CONFIG_EXT2_FS_XATTR=y
 # CONFIG_EXT3_FS is not set
 # CONFIG_EXT4_DEBUG is not set
 # CONFIG_EXT4_ENCRYPTION is not set
 # CONFIG_EXT4_FS is not set
 # CONFIG_EXT4_FS_POSIX_ACL is not set
 # CONFIG_EXT4_FS_SECURITY is not set
-CONFIG_EXT4_USE_FOR_EXT2=y
+# CONFIG_EXT4_USE_FOR_EXT2 is not set
 # CONFIG_EXTCON is not set
 # CONFIG_EXTCON_ADC_JACK is not set
 # CONFIG_EXTCON_ARIZONA is not set
-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |       ehem+openwrt at m5p.com     PGP 87145445       |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445





From ehem+openwrt at m5p.com  Tue Nov 14 17:08:53 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Tue, 14 Nov 2023 17:08:53 -0800
Subject: [PATCH 05/11] kernel/x86: remove CONFIG_HDMI
In-Reply-To: <cover.1700010533.git.ehem+openwrt@m5p.com>
References: <cover.1700010533.git.ehem+openwrt@m5p.com>
Message-ID: <9c95b8806da4341a639064c4dcd256e7743c4a30.1700010534.git.ehem+openwrt@m5p.com>

Date: Tue, 31 Oct 2023 11:06:58 -0700

This is an internal boolean value.  The value routinely gets
overriden and should never be overtly set.

Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>
---
 target/linux/x86/64/config-5.15      | 1 -
 target/linux/x86/64/config-6.1       | 1 -
 target/linux/x86/generic/config-5.15 | 1 -
 target/linux/x86/generic/config-6.1  | 1 -
 target/linux/x86/legacy/config-5.15  | 1 -
 target/linux/x86/legacy/config-6.1   | 1 -
 6 files changed, 6 deletions(-)

diff --git a/target/linux/x86/64/config-5.15 b/target/linux/x86/64/config-5.15
index 28a4758e57..1db3180c84 100644
--- a/target/linux/x86/64/config-5.15
+++ b/target/linux/x86/64/config-5.15
@@ -207,7 +207,6 @@ CONFIG_GPIO_ICH=y
 CONFIG_GPIO_SCH=y
 CONFIG_HALTPOLL_CPUIDLE=y
 CONFIG_HARDLOCKUP_CHECK_TIMESTAMP=y
-CONFIG_HDMI=y
 CONFIG_HIBERNATE_CALLBACKS=y
 CONFIG_HID_BATTERY_STRENGTH=y
 CONFIG_HID_GENERIC=y
diff --git a/target/linux/x86/64/config-6.1 b/target/linux/x86/64/config-6.1
index 66ae3e35f0..6609f555ba 100644
--- a/target/linux/x86/64/config-6.1
+++ b/target/linux/x86/64/config-6.1
@@ -227,7 +227,6 @@ CONFIG_GPIO_ICH=y
 CONFIG_GPIO_SCH=y
 CONFIG_HALTPOLL_CPUIDLE=y
 CONFIG_HARDLOCKUP_CHECK_TIMESTAMP=y
-CONFIG_HDMI=y
 CONFIG_HIBERNATE_CALLBACKS=y
 CONFIG_HID_BATTERY_STRENGTH=y
 CONFIG_HID_GENERIC=y
diff --git a/target/linux/x86/generic/config-5.15 b/target/linux/x86/generic/config-5.15
index c10e1b610b..a06175f33a 100644
--- a/target/linux/x86/generic/config-5.15
+++ b/target/linux/x86/generic/config-5.15
@@ -157,7 +157,6 @@ CONFIG_GPIO_ACPI=y
 CONFIG_GPIO_CDEV=y
 CONFIG_GUP_GET_PTE_LOW_HIGH=y
 CONFIG_HALTPOLL_CPUIDLE=y
-CONFIG_HDMI=y
 CONFIG_HIBERNATE_CALLBACKS=y
 CONFIG_HID_BATTERY_STRENGTH=y
 CONFIG_HID_GENERIC=y
diff --git a/target/linux/x86/generic/config-6.1 b/target/linux/x86/generic/config-6.1
index b7c79de273..e62dc6575e 100644
--- a/target/linux/x86/generic/config-6.1
+++ b/target/linux/x86/generic/config-6.1
@@ -166,7 +166,6 @@ CONFIG_GPIO_ACPI=y
 CONFIG_GPIO_CDEV=y
 CONFIG_GUP_GET_PTE_LOW_HIGH=y
 CONFIG_HALTPOLL_CPUIDLE=y
-CONFIG_HDMI=y
 CONFIG_HIBERNATE_CALLBACKS=y
 CONFIG_HID_BATTERY_STRENGTH=y
 CONFIG_HID_GENERIC=y
diff --git a/target/linux/x86/legacy/config-5.15 b/target/linux/x86/legacy/config-5.15
index 8e17703cbc..b6a29d57c9 100644
--- a/target/linux/x86/legacy/config-5.15
+++ b/target/linux/x86/legacy/config-5.15
@@ -108,7 +108,6 @@ CONFIG_FONT_SUPPORT=y
 CONFIG_FRAMEBUFFER_CONSOLE=y
 CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
 # CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
-CONFIG_HDMI=y
 CONFIG_HID_BATTERY_STRENGTH=y
 # CONFIG_HIGHMEM4G is not set
 CONFIG_HPET=y
diff --git a/target/linux/x86/legacy/config-6.1 b/target/linux/x86/legacy/config-6.1
index efa1eabe82..c1b132d834 100644
--- a/target/linux/x86/legacy/config-6.1
+++ b/target/linux/x86/legacy/config-6.1
@@ -113,7 +113,6 @@ CONFIG_FRAMEBUFFER_CONSOLE=y
 CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
 # CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
 # CONFIG_GIGABYTE_WMI is not set
-CONFIG_HDMI=y
 CONFIG_HID_BATTERY_STRENGTH=y
 # CONFIG_HIGHMEM4G is not set
 CONFIG_HPET=y
-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |       ehem+openwrt at m5p.com     PGP 87145445       |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445





From ehem+openwrt at m5p.com  Fri Nov  3 22:57:43 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Fri, 3 Nov 2023 22:57:43 -0700
Subject: [PATCH 06/11] Revert "x86/geode: enable X86_INTEL_LPSS to select
 PINCTRL"
In-Reply-To: <cover.1700010533.git.ehem+openwrt@m5p.com>
References: <cover.1700010533.git.ehem+openwrt@m5p.com>
Message-ID: <dd102b65605e1c9c943ff5bfe88880831ff212f5.1700010534.git.ehem+openwrt@m5p.com>

Enabling an Intel chipset feature on a platform originally made by
National Semiconductor and later bought by AMD.  Could we cut the Intel
enthusiasm?

This reverts commit 4eda2fddf2995c8ade2b1e0faddc8ce1f1e0ec5f.

Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>
---
 target/linux/x86/geode/config-5.15 | 18 +-----------------
 target/linux/x86/geode/config-6.1  | 20 +-------------------
 2 files changed, 2 insertions(+), 36 deletions(-)

diff --git a/target/linux/x86/geode/config-5.15 b/target/linux/x86/geode/config-5.15
index 0104b1e7b3..6463934b77 100644
--- a/target/linux/x86/geode/config-5.15
+++ b/target/linux/x86/geode/config-5.15
@@ -94,22 +94,6 @@ CONFIG_PC8736x_GPIO=y
 # CONFIG_PCENGINES_APU2 is not set
 CONFIG_PCI_MMCONFIG=y
 # CONFIG_PCWATCHDOG is not set
-CONFIG_PINCTRL=y
-# CONFIG_PINCTRL_ALDERLAKE is not set
-# CONFIG_PINCTRL_BAYTRAIL is not set
-# CONFIG_PINCTRL_BROXTON is not set
-# CONFIG_PINCTRL_CANNONLAKE is not set
-# CONFIG_PINCTRL_CHERRYVIEW is not set
-# CONFIG_PINCTRL_DENVERTON is not set
-# CONFIG_PINCTRL_ELKHARTLAKE is not set
-# CONFIG_PINCTRL_EMMITSBURG is not set
-# CONFIG_PINCTRL_GEMINILAKE is not set
-# CONFIG_PINCTRL_JASPERLAKE is not set
-# CONFIG_PINCTRL_LAKEFIELD is not set
-# CONFIG_PINCTRL_LEWISBURG is not set
-# CONFIG_PINCTRL_LYNXPOINT is not set
-# CONFIG_PINCTRL_SUNRISEPOINT is not set
-# CONFIG_PINCTRL_TIGERLAKE is not set
 # CONFIG_PMIC_OPREGION is not set
 CONFIG_PNP=y
 CONFIG_PNPACPI=y
@@ -138,7 +122,7 @@ CONFIG_X86_ALIGNMENT_16=y
 # CONFIG_X86_AMD_PLATFORM_DEVICE is not set
 CONFIG_X86_CPUID=y
 # CONFIG_X86_E_POWERSAVER is not set
-CONFIG_X86_INTEL_LPSS=y
+# CONFIG_X86_INTEL_LPSS is not set
 # CONFIG_X86_LONGHAUL is not set
 # CONFIG_X86_MCE is not set
 CONFIG_X86_MINIMUM_CPU_FAMILY=5
diff --git a/target/linux/x86/geode/config-6.1 b/target/linux/x86/geode/config-6.1
index cf02d2b9b0..e19cf7ea10 100644
--- a/target/linux/x86/geode/config-6.1
+++ b/target/linux/x86/geode/config-6.1
@@ -104,24 +104,6 @@ CONFIG_PC8736x_GPIO=y
 CONFIG_PCI_MMCONFIG=y
 # CONFIG_PCWATCHDOG is not set
 # CONFIG_PEAQ_WMI is not set
-CONFIG_PINCTRL=y
-# CONFIG_PINCTRL_ALDERLAKE is not set
-# CONFIG_PINCTRL_BAYTRAIL is not set
-# CONFIG_PINCTRL_BROXTON is not set
-# CONFIG_PINCTRL_CANNONLAKE is not set
-# CONFIG_PINCTRL_CHERRYVIEW is not set
-# CONFIG_PINCTRL_DENVERTON is not set
-# CONFIG_PINCTRL_ELKHARTLAKE is not set
-# CONFIG_PINCTRL_EMMITSBURG is not set
-# CONFIG_PINCTRL_GEMINILAKE is not set
-# CONFIG_PINCTRL_JASPERLAKE is not set
-# CONFIG_PINCTRL_LAKEFIELD is not set
-# CONFIG_PINCTRL_LEWISBURG is not set
-# CONFIG_PINCTRL_LYNXPOINT is not set
-# CONFIG_PINCTRL_METEORLAKE is not set
-# CONFIG_PINCTRL_SUNRISEPOINT is not set
-# CONFIG_PINCTRL_TIGERLAKE is not set
-# CONFIG_PMIC_OPREGION is not set
 CONFIG_PNP=y
 CONFIG_PNPACPI=y
 # CONFIG_PNPBIOS is not set
@@ -165,7 +147,7 @@ CONFIG_X86_ALIGNMENT_16=y
 # CONFIG_X86_AMD_PSTATE_UT is not set
 CONFIG_X86_CPUID=y
 # CONFIG_X86_E_POWERSAVER is not set
-CONFIG_X86_INTEL_LPSS=y
+# CONFIG_X86_INTEL_LPSS is not set
 # CONFIG_X86_LONGHAUL is not set
 # CONFIG_X86_MCE is not set
 CONFIG_X86_MINIMUM_CPU_FAMILY=5
-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |       ehem+openwrt at m5p.com     PGP 87145445       |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445





From ehem+openwrt at m5p.com  Tue Nov 14 17:08:53 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Tue, 14 Nov 2023 17:08:53 -0800
Subject: [PATCH 07/11] kernel/x86: move Geode HW random from generic to geode
In-Reply-To: <cover.1700010533.git.ehem+openwrt@m5p.com>
References: <cover.1700010533.git.ehem+openwrt@m5p.com>
Message-ID: <d141b6ed603c9a2bbc2b8619e90a0892181b9b44.1700010534.git.ehem+openwrt@m5p.com>

Date: Wed, 19 Apr 2023 14:07:47 -0700

Quite reasonable to have support for the Geode HW random number
generator.  On the Geode kernel.

Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>
---
 target/linux/x86/config-5.15       | 1 -
 target/linux/x86/config-6.1        | 1 -
 target/linux/x86/geode/config-5.15 | 1 +
 target/linux/x86/geode/config-6.1  | 1 +
 4 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/linux/x86/config-5.15 b/target/linux/x86/config-5.15
index 57941a53bf..e1efc44fbe 100644
--- a/target/linux/x86/config-5.15
+++ b/target/linux/x86/config-5.15
@@ -158,7 +158,6 @@ CONFIG_HPET_EMULATE_RTC=y
 CONFIG_HPET_TIMER=y
 # CONFIG_HP_WATCHDOG is not set
 CONFIG_HW_CONSOLE=y
-CONFIG_HW_RANDOM_GEODE=y
 CONFIG_HW_RANDOM_VIA=y
 # CONFIG_HYPERVISOR_GUEST is not set
 CONFIG_HZ_PERIODIC=y
diff --git a/target/linux/x86/config-6.1 b/target/linux/x86/config-6.1
index 979bb400c1..17dbb5310b 100644
--- a/target/linux/x86/config-6.1
+++ b/target/linux/x86/config-6.1
@@ -167,7 +167,6 @@ CONFIG_HIGHPTE=y
 CONFIG_HPET_EMULATE_RTC=y
 CONFIG_HPET_TIMER=y
 CONFIG_HW_CONSOLE=y
-CONFIG_HW_RANDOM_GEODE=y
 CONFIG_HW_RANDOM_VIA=y
 # CONFIG_HYPERVISOR_GUEST is not set
 CONFIG_HZ_PERIODIC=y
diff --git a/target/linux/x86/geode/config-5.15 b/target/linux/x86/geode/config-5.15
index 6463934b77..22c9c031e8 100644
--- a/target/linux/x86/geode/config-5.15
+++ b/target/linux/x86/geode/config-5.15
@@ -52,6 +52,7 @@ CONFIG_GPIO_CS5535=y
 # CONFIG_HPET is not set
 # CONFIG_HP_ACCEL is not set
 CONFIG_HWMON=y
+CONFIG_HW_RANDOM_GEODE=y
 CONFIG_I2C=y
 CONFIG_I2C_ALGOBIT=y
 CONFIG_I2C_ALGOPCA=y
diff --git a/target/linux/x86/geode/config-6.1 b/target/linux/x86/geode/config-6.1
index e19cf7ea10..d45a2aa170 100644
--- a/target/linux/x86/geode/config-6.1
+++ b/target/linux/x86/geode/config-6.1
@@ -56,6 +56,7 @@ CONFIG_GPIO_CS5535=y
 # CONFIG_HPET is not set
 # CONFIG_HP_ACCEL is not set
 CONFIG_HWMON=y
+CONFIG_HW_RANDOM_GEODE=y
 CONFIG_I2C=y
 CONFIG_I2C_ALGOBIT=y
 CONFIG_I2C_ALGOPCA=y
-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |       ehem+openwrt at m5p.com     PGP 87145445       |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445





From ehem+openwrt at m5p.com  Tue Nov 14 17:08:53 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Tue, 14 Nov 2023 17:08:53 -0800
Subject: [PATCH 08/11] kernel/x86: move SCx200 support from generic to geode
In-Reply-To: <cover.1700010533.git.ehem+openwrt@m5p.com>
References: <cover.1700010533.git.ehem+openwrt@m5p.com>
Message-ID: <bd74745edf1050d345cdebc81c0a86d15d299a01.1700010534.git.ehem+openwrt@m5p.com>

Date: Thu, 13 Apr 2023 17:07:20 -0700

The SCx200 is part of the Geode platform.  As such generic x86
doesn't need the driver, but Geode does.

Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>
Reviewed-by: Philip Prindeville <philipp at redfish-solutions.com> 04/2023
---
 target/linux/x86/config-5.15       | 5 +----
 target/linux/x86/config-6.1        | 5 +----
 target/linux/x86/geode/config-5.15 | 3 +++
 target/linux/x86/geode/config-6.1  | 3 +++
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/target/linux/x86/config-5.15 b/target/linux/x86/config-5.15
index e1efc44fbe..e4ec6520e5 100644
--- a/target/linux/x86/config-5.15
+++ b/target/linux/x86/config-5.15
@@ -309,10 +309,7 @@ CONFIG_SATA_HOST=y
 CONFIG_SCSI=y
 CONFIG_SCSI_COMMON=y
 CONFIG_SCSI_SPI_ATTRS=y
-CONFIG_SCx200=y
-CONFIG_SCx200HR_TIMER=y
-# CONFIG_SCx200_GPIO is not set
-# CONFIG_SCx200_WDT is not set
+# CONFIG_SCx200 is not set
 CONFIG_SERIAL_8250_PCI=y
 # CONFIG_SERIAL_LANTIQ is not set
 CONFIG_SERIO=y
diff --git a/target/linux/x86/config-6.1 b/target/linux/x86/config-6.1
index 17dbb5310b..95e88f210b 100644
--- a/target/linux/x86/config-6.1
+++ b/target/linux/x86/config-6.1
@@ -329,10 +329,7 @@ CONFIG_SATA_HOST=y
 CONFIG_SCSI=y
 CONFIG_SCSI_COMMON=y
 CONFIG_SCSI_SPI_ATTRS=y
-CONFIG_SCx200=y
-CONFIG_SCx200HR_TIMER=y
-# CONFIG_SCx200_GPIO is not set
-# CONFIG_SCx200_WDT is not set
+# CONFIG_SCx200 is not set
 CONFIG_SERIAL_8250_PCI=y
 # CONFIG_SERIAL_LANTIQ is not set
 CONFIG_SERIAL_MCTRL_GPIO=y
diff --git a/target/linux/x86/geode/config-5.15 b/target/linux/x86/geode/config-5.15
index 22c9c031e8..b5a1a641bb 100644
--- a/target/linux/x86/geode/config-5.15
+++ b/target/linux/x86/geode/config-5.15
@@ -104,7 +104,10 @@ CONFIG_RTC_I2C_AND_SPI=y
 # CONFIG_SAMSUNG_Q10 is not set
 CONFIG_SC1200_WDT=y
 # CONFIG_SCSI_FDOMAIN_ISA is not set
+CONFIG_SCx200=y
+CONFIG_SCx200HR_TIMER=y
 CONFIG_SCx200_ACB=y
+# CONFIG_SCx200_GPIO is not set
 CONFIG_SCx200_WDT=y
 CONFIG_SENSORS_LM90=y
 CONFIG_SERIAL_8250_PNP=y
diff --git a/target/linux/x86/geode/config-6.1 b/target/linux/x86/geode/config-6.1
index d45a2aa170..f459583c02 100644
--- a/target/linux/x86/geode/config-6.1
+++ b/target/linux/x86/geode/config-6.1
@@ -113,7 +113,10 @@ CONFIG_RTC_I2C_AND_SPI=y
 # CONFIG_SAMSUNG_Q10 is not set
 CONFIG_SC1200_WDT=y
 # CONFIG_SCSI_FDOMAIN_ISA is not set
+CONFIG_SCx200=y
+CONFIG_SCx200HR_TIMER=y
 CONFIG_SCx200_ACB=y
+# CONFIG_SCx200_GPIO is not set
 CONFIG_SCx200_WDT=y
 # CONFIG_SENSORS_ASUS_EC is not set
 # CONFIG_SENSORS_ASUS_WMI is not set
-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |       ehem+openwrt at m5p.com     PGP 87145445       |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445





From ehem+openwrt at m5p.com  Tue Nov 14 17:08:53 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Tue, 14 Nov 2023 17:08:53 -0800
Subject: [PATCH 09/11] kernel/x86: remove CONFIG_M686 from common
 configuration
In-Reply-To: <cover.1700010533.git.ehem+openwrt@m5p.com>
References: <cover.1700010533.git.ehem+openwrt@m5p.com>
Message-ID: <2791903ab6cef93d5b2408eb1779d3e7e2a472af.1700010534.git.ehem+openwrt@m5p.com>

Date: Mon, 17 Apr 2023 08:21:26 -0700

All of the sublevels choose their own values, so there is no point
in the common file having anything.  This also removes a warning from
the kernel build process.

Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>
Reviewed-by: Philip Prindeville <philipp at redfish-solutions.com> 04/2023
---
 target/linux/x86/config-5.15         | 2 +-
 target/linux/x86/config-6.1          | 2 +-
 target/linux/x86/generic/config-5.15 | 1 -
 target/linux/x86/generic/config-6.1  | 1 -
 target/linux/x86/geode/config-5.15   | 1 -
 target/linux/x86/geode/config-6.1    | 1 -
 target/linux/x86/legacy/config-5.15  | 1 -
 target/linux/x86/legacy/config-6.1   | 1 -
 8 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/target/linux/x86/config-5.15 b/target/linux/x86/config-5.15
index e4ec6520e5..71f06ad470 100644
--- a/target/linux/x86/config-5.15
+++ b/target/linux/x86/config-5.15
@@ -204,7 +204,7 @@ CONFIG_LOCK_DEBUGGING_SUPPORT=y
 # CONFIG_M586 is not set
 # CONFIG_M586MMX is not set
 # CONFIG_M586TSC is not set
-CONFIG_M686=y
+# CONFIG_M686 is not set
 # CONFIG_MACHZ_WDT is not set
 # CONFIG_MATOM is not set
 # CONFIG_MCORE2 is not set
diff --git a/target/linux/x86/config-6.1 b/target/linux/x86/config-6.1
index 95e88f210b..d6f8f6180b 100644
--- a/target/linux/x86/config-6.1
+++ b/target/linux/x86/config-6.1
@@ -215,7 +215,7 @@ CONFIG_LOCK_DEBUGGING_SUPPORT=y
 # CONFIG_M586 is not set
 # CONFIG_M586MMX is not set
 # CONFIG_M586TSC is not set
-CONFIG_M686=y
+# CONFIG_M686 is not set
 # CONFIG_MACHZ_WDT is not set
 # CONFIG_MATOM is not set
 # CONFIG_MCORE2 is not set
diff --git a/target/linux/x86/generic/config-5.15 b/target/linux/x86/generic/config-5.15
index a06175f33a..940a0b1da6 100644
--- a/target/linux/x86/generic/config-5.15
+++ b/target/linux/x86/generic/config-5.15
@@ -240,7 +240,6 @@ CONFIG_KVM_XFER_TO_GUEST_WORK=y
 # CONFIG_LANCE is not set
 CONFIG_LIBNVDIMM=y
 CONFIG_LOCK_SPIN_ON_OWNER=y
-# CONFIG_M686 is not set
 # CONFIG_MDA_CONSOLE is not set
 CONFIG_MEMORY_BALLOON=y
 CONFIG_MEMREGION=y
diff --git a/target/linux/x86/generic/config-6.1 b/target/linux/x86/generic/config-6.1
index e62dc6575e..746ae3f47d 100644
--- a/target/linux/x86/generic/config-6.1
+++ b/target/linux/x86/generic/config-6.1
@@ -254,7 +254,6 @@ CONFIG_KVM_XFER_TO_GUEST_WORK=y
 # CONFIG_LG_LAPTOP is not set
 CONFIG_LIBNVDIMM=y
 CONFIG_LOCK_SPIN_ON_OWNER=y
-# CONFIG_M686 is not set
 # CONFIG_MDA_CONSOLE is not set
 CONFIG_MEMORY_BALLOON=y
 CONFIG_MEMREGION=y
diff --git a/target/linux/x86/geode/config-5.15 b/target/linux/x86/geode/config-5.15
index b5a1a641bb..977cfbd4aa 100644
--- a/target/linux/x86/geode/config-5.15
+++ b/target/linux/x86/geode/config-5.15
@@ -75,7 +75,6 @@ CONFIG_ISA_BUS_API=y
 # CONFIG_ISCSI_IBFT is not set
 # CONFIG_LANCE is not set
 CONFIG_LEDS_GPIO=y
-# CONFIG_M686 is not set
 # CONFIG_MDA_CONSOLE is not set
 CONFIG_MFD_CORE=y
 CONFIG_MFD_CS5535=y
diff --git a/target/linux/x86/geode/config-6.1 b/target/linux/x86/geode/config-6.1
index f459583c02..08972ed5d0 100644
--- a/target/linux/x86/geode/config-6.1
+++ b/target/linux/x86/geode/config-6.1
@@ -81,7 +81,6 @@ CONFIG_ISA_BUS_API=y
 # CONFIG_ISCSI_IBFT is not set
 # CONFIG_LANCE is not set
 CONFIG_LEDS_GPIO=y
-# CONFIG_M686 is not set
 # CONFIG_MDA_CONSOLE is not set
 CONFIG_MFD_CORE=y
 CONFIG_MFD_CS5535=y
diff --git a/target/linux/x86/legacy/config-5.15 b/target/linux/x86/legacy/config-5.15
index b6a29d57c9..64af1fbf5a 100644
--- a/target/linux/x86/legacy/config-5.15
+++ b/target/linux/x86/legacy/config-5.15
@@ -146,7 +146,6 @@ CONFIG_ISO9660_FS=y
 CONFIG_KCMP=y
 # CONFIG_LANCE is not set
 CONFIG_M586MMX=y
-# CONFIG_M686 is not set
 # CONFIG_MDA_CONSOLE is not set
 CONFIG_MFD_CORE=y
 CONFIG_MFD_INTEL_LPSS=y
diff --git a/target/linux/x86/legacy/config-6.1 b/target/linux/x86/legacy/config-6.1
index c1b132d834..fbadad9d15 100644
--- a/target/linux/x86/legacy/config-6.1
+++ b/target/linux/x86/legacy/config-6.1
@@ -156,7 +156,6 @@ CONFIG_KCMP=y
 # CONFIG_LANCE is not set
 # CONFIG_LG_LAPTOP is not set
 CONFIG_M586MMX=y
-# CONFIG_M686 is not set
 # CONFIG_MDA_CONSOLE is not set
 CONFIG_MFD_CORE=y
 CONFIG_MFD_INTEL_LPSS=y
-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |       ehem+openwrt at m5p.com     PGP 87145445       |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445





From ehem+openwrt at m5p.com  Tue Nov 14 17:08:53 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Tue, 14 Nov 2023 17:08:53 -0800
Subject: [PATCH 10/11] packages/x86: detect architecture, not x86/64 target
In-Reply-To: <cover.1700010533.git.ehem+openwrt@m5p.com>
References: <cover.1700010533.git.ehem+openwrt@m5p.com>
Message-ID: <3ac699d44aeb0a783ba618f37da13d83a3c1d7f4.1700010534.git.ehem+openwrt@m5p.com>

Date: Mon, 27 Feb 2023 17:24:27 -0800

These spots should be detecting the amd64 architecture, not the
specific target name.  If additional amd64 targets were added, or
the target was renamed, these would fail to build.

Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>
---
 package/firmware/intel-microcode/Makefile | 2 +-
 package/kernel/linux/modules/crypto.mk    | 2 +-
 package/kernel/linux/modules/virt.mk      | 4 ++--
 package/libs/wolfssl/Makefile             | 2 +-
 target/linux/x86/modules.mk               | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/package/firmware/intel-microcode/Makefile b/package/firmware/intel-microcode/Makefile
index 9e87dccc12..f6e9c2def7 100644
--- a/package/firmware/intel-microcode/Makefile
+++ b/package/firmware/intel-microcode/Makefile
@@ -19,7 +19,7 @@ PKG_CPE_ID:=cpe:/a:intel:microcode
 
 PKG_BUILD_DEPENDS:=iucode-tool/host
 
-ifdef CONFIG_TARGET_x86_64
+ifdef CONFIG_x86_64
 	MICROCODE:="intel-microcode-64"
 else
 	MICROCODE:="intel-microcode"
diff --git a/package/kernel/linux/modules/crypto.mk b/package/kernel/linux/modules/crypto.mk
index dd17d868fa..5e6fed631a 100644
--- a/package/kernel/linux/modules/crypto.mk
+++ b/package/kernel/linux/modules/crypto.mk
@@ -777,7 +777,7 @@ define KernelPackage/crypto-misc
   $(call AddDepends/crypto)
 endef
 
-ifndef CONFIG_TARGET_x86_64
+ifndef CONFIG_x86_64
   define KernelPackage/crypto-misc/x86
     FILES+= \
 	$(LINUX_DIR)/arch/x86/crypto/twofish-i586.ko \
diff --git a/package/kernel/linux/modules/virt.mk b/package/kernel/linux/modules/virt.mk
index f45cb17614..82fb1af2de 100644
--- a/package/kernel/linux/modules/virt.mk
+++ b/package/kernel/linux/modules/virt.mk
@@ -77,7 +77,7 @@ $(eval $(call KernelPackage,kvm-amd))
 define KernelPackage/vfio
   SUBMENU:=Virtualization
   TITLE:=VFIO Non-Privileged userspace driver framework
-  DEPENDS:=@TARGET_x86_64||TARGET_armsr_armv8
+  DEPENDS:=@x86_64||TARGET_armsr_armv8
   KCONFIG:= \
 	CONFIG_VFIO \
 	CONFIG_VFIO_NOIOMMU=n \
@@ -99,7 +99,7 @@ $(eval $(call KernelPackage,vfio))
 define KernelPackage/vfio-pci
   SUBMENU:=Virtualization
   TITLE:=Generic VFIO support for any PCI device
-  DEPENDS:=@TARGET_x86_64||TARGET_armsr_armv8 @PCI_SUPPORT +kmod-vfio +kmod-irqbypass
+  DEPENDS:=@x86_64||TARGET_armsr_armv8 @PCI_SUPPORT +kmod-vfio +kmod-irqbypass
   KCONFIG:= \
 	CONFIG_VFIO_PCI \
 	CONFIG_VFIO_PCI_IGD=n
diff --git a/package/libs/wolfssl/Makefile b/package/libs/wolfssl/Makefile
index 6451dca68d..4326d1483e 100644
--- a/package/libs/wolfssl/Makefile
+++ b/package/libs/wolfssl/Makefile
@@ -185,7 +185,7 @@ else ifdef CONFIG_aarch64
     CONFIGURE_ARGS += --enable-armasm
     TARGET_CFLAGS:=$(TARGET_CFLAGS:-mcpu%=-mcpu%+crypto)
     Package/libwolfsslcpu-crypto/preinst=$(Package/libwolfsslcpu-crypto/preinst-aarch64)
-else ifdef CONFIG_TARGET_x86_64
+else ifdef CONFIG_x86_64
 	CONFIGURE_ARGS += --enable-intelasm
 endif
 
diff --git a/target/linux/x86/modules.mk b/target/linux/x86/modules.mk
index 511410d614..f5f225d06f 100644
--- a/target/linux/x86/modules.mk
+++ b/target/linux/x86/modules.mk
@@ -5,7 +5,7 @@
 define KernelPackage/amd-xgbe
   SUBMENU:=$(NETWORK_DEVICES_MENU)
   TITLE:=AMD Ethernet on SoC support
-  DEPENDS:=@PCI_SUPPORT @TARGET_x86_64 +kmod-lib-crc32c +kmod-ptp +kmod-libphy +kmod-mdio-devres
+  DEPENDS:=@PCI_SUPPORT @x86_64 +kmod-lib-crc32c +kmod-ptp +kmod-libphy +kmod-mdio-devres
   KCONFIG:=CONFIG_AMD_XGBE
   FILES:=$(LINUX_DIR)/drivers/net/ethernet/amd/xgbe/amd-xgbe.ko
   AUTOLOAD:=$(call AutoLoad,35,amd-xgbe)
-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |       ehem+openwrt at m5p.com     PGP 87145445       |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445





From ehem+openwrt at m5p.com  Tue Nov 14 17:08:53 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Tue, 14 Nov 2023 17:08:53 -0800
Subject: [PATCH 11/11] kernel/x86: enable x32 support for amd64
In-Reply-To: <cover.1700010533.git.ehem+openwrt@m5p.com>
References: <cover.1700010533.git.ehem+openwrt@m5p.com>
Message-ID: <4388a0c540026486264dfe35efc4909743f4d5cc.1700010534.git.ehem+openwrt@m5p.com>

Date: Thu, 30 Mar 2023 16:30:49 -0700

Full amd64 support isn't really appropriate for most situations
OpenWRT is deployed.  Whereas x86-x32 seems extremely appropriate for
these situations.  As such enable x86-x32 support.

CONFIG_ARCH_MMAP_RND_COMPAT_BITS is required to follow along,
otherwise the kernel build breaks.

Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>
---

I suggest OpenWRT should place some effort towards x86-x32.  x86-x32
seems a rather superior generic target for OpenWRT.  Only issue is
it could be valuable to have at least minimal amd64 userland support
alongside the x86-x32 version.

Note, this simply enables kernel support.  Until userspace building
is added, this does almost nothing.
---
 target/linux/x86/64/config-5.15 | 1 -
 target/linux/x86/64/config-6.1  | 2 --
 target/linux/x86/config-5.15    | 2 ++
 target/linux/x86/config-6.1     | 3 +++
 4 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/target/linux/x86/64/config-5.15 b/target/linux/x86/64/config-5.15
index 1db3180c84..ea0a51f251 100644
--- a/target/linux/x86/64/config-5.15
+++ b/target/linux/x86/64/config-5.15
@@ -502,7 +502,6 @@ CONFIG_X86_PM_TIMER=y
 # CONFIG_X86_POWERNOW_K8 is not set
 # CONFIG_X86_VSYSCALL_EMULATION is not set
 CONFIG_X86_X2APIC=y
-# CONFIG_X86_X32 is not set
 CONFIG_XEN=y
 CONFIG_XENFS=y
 CONFIG_XEN_512GB=y
diff --git a/target/linux/x86/64/config-6.1 b/target/linux/x86/64/config-6.1
index 6609f555ba..56ec0c56fd 100644
--- a/target/linux/x86/64/config-6.1
+++ b/target/linux/x86/64/config-6.1
@@ -557,8 +557,6 @@ CONFIG_X86_PM_TIMER=y
 # CONFIG_X86_POWERNOW_K8 is not set
 # CONFIG_X86_VSYSCALL_EMULATION is not set
 CONFIG_X86_X2APIC=y
-# CONFIG_X86_X32 is not set
-# CONFIG_X86_X32_ABI is not set
 CONFIG_XEN=y
 CONFIG_XENFS=y
 CONFIG_XEN_512GB=y
diff --git a/target/linux/x86/config-5.15 b/target/linux/x86/config-5.15
index 71f06ad470..e93e46414a 100644
--- a/target/linux/x86/config-5.15
+++ b/target/linux/x86/config-5.15
@@ -13,6 +13,7 @@ CONFIG_ARCH_MAY_HAVE_PC_FDC=y
 CONFIG_ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE=y
 CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
 CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y
+CONFIG_ARCH_MMAP_RND_COMPAT_BITS=8
 CONFIG_ARCH_NR_GPIO=512
 CONFIG_ARCH_RANDOM=y
 CONFIG_ARCH_SELECT_MEMORY_MODEL=y
@@ -429,6 +430,7 @@ CONFIG_X86_UP_IOAPIC=y
 CONFIG_X86_USE_PPRO_CHECKSUM=y
 CONFIG_X86_VERBOSE_BOOTUP=y
 CONFIG_X86_VMX_FEATURE_NAMES=y
+CONFIG_X86_X32=y
 CONFIG_XZ_DEC_BCJ=y
 CONFIG_XZ_DEC_X86=y
 CONFIG_ZLIB_INFLATE=y
diff --git a/target/linux/x86/config-6.1 b/target/linux/x86/config-6.1
index d6f8f6180b..a7affa9e56 100644
--- a/target/linux/x86/config-6.1
+++ b/target/linux/x86/config-6.1
@@ -14,6 +14,7 @@ CONFIG_ARCH_MAY_HAVE_PC_FDC=y
 CONFIG_ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE=y
 CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
 CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y
+CONFIG_ARCH_MMAP_RND_COMPAT_BITS=8
 CONFIG_ARCH_NR_GPIO=512
 CONFIG_ARCH_SELECT_MEMORY_MODEL=y
 CONFIG_ARCH_SPARSEMEM_ENABLE=y
@@ -451,6 +452,8 @@ CONFIG_X86_UP_IOAPIC=y
 CONFIG_X86_USE_PPRO_CHECKSUM=y
 CONFIG_X86_VERBOSE_BOOTUP=y
 CONFIG_X86_VMX_FEATURE_NAMES=y
+CONFIG_X86_X32=y
+CONFIG_X86_X32_ABI=y
 CONFIG_XZ_DEC_BCJ=y
 CONFIG_XZ_DEC_X86=y
 CONFIG_ZLIB_INFLATE=y
-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |       ehem+openwrt at m5p.com     PGP 87145445       |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445





From ehem+openwrt at m5p.com  Tue Nov 14 17:04:46 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Tue, 14 Nov 2023 17:04:46 -0800
Subject: [PATCH 00/20] Kernel build fixups, split object directory off (partial WIP)
Message-ID: <cover.1700010286.git.ehem+openwrt@m5p.com>

The first 3 are fixes for issues I uncovered during part of this work.
Two are simple cleanup.  The third is an outright bugfix, though I'm
uncertain of exactly how the commit should look.

The handling of kernel modules with OpenWRT means areas marked as modules
get built, but then lost.  In light of this, things marked as modules in
kernel configuration files should be removed.  Once they're removed, it
then seems reasonable to start copying unrecorded lost modules to the
image to make the feature useful in the future.

A long tradition with kernels is keeping source separate from object and
other compiled/interpretted files.  This is useful for doing multiple
distinct kernel builds from a single source tree.  This has gained value
as the size of the Linux kernel source has grown.  Most of the series is
attempting to head in the direction of separating these.


Patch #8 is the first step towards getting this operational.  Simply
introduce two variables which get propogated to the kernel build.

Patch #9 I found $(DTS_DIR) had a similar issue.  This gets a similar
solution, luckily this effects fewer spots.  Alas, this too may not be
fully covered.

Patches 10-19 cover the instances of where $(LINUX_DIR) used to be used.
The earlier ones are more likely to be right, the later ones I'm rather
unsure of.  These need a lot of checking.

Patch #20 is simply a test case for people to check things with.


Elliott Mitchell (20):
  ppp: make copy of compiler_types.h unconditional
  package/lantiq: use make -C instead of `cd;`
  bcm27xx: fix device-tree support patch for split source/build dirs
  patch: always backup files
  build: merge Kernel/Prepare steps together
  kernel: remove drivers marked as modules
  kernel: copy all built kernel modules to root filesystem image
  build: add make variables for kernel source and object directories
  [WIP] build: split $(DTB_DIR) off of $(DTS_DIR)
  [WIP] build: use dtc from $(LINUX_OBJ_DIR)
  [WIP] package/target: update to get modules from $(LINUX_OBJ_DIR)
  [WIP] build: adjust include paths to use LINUX_SRC_DIR/LINUX_OBJ_DIR
  [WIP] build: point user_headers at $(LINUX_OBJ_DIR)
  [WIP] build: update quilt references to use $(LINUX_SRC_DIR)
  [WIP] package: update packages with explicit make flags
  [WIP] build: point kernel build tasks at $(LINUX_OBJ_DIR)
  [WIP] build: split kernel object directory from kernel source
    directory
  [WIP] build: point remaining obvious cases at $(LINUX_SRC_DIR)
  [WIP] build: point remainder at $(LINUX_SRC_DIR)
  [TEST] TESTING: try separating build from sources

 include/autotools.mk                          |   2 +-
 include/image-commands.mk                     |   6 +-
 include/image.mk                              |   8 +-
 include/kernel-build.mk                       |  38 +--
 include/kernel-defaults.mk                    | 127 ++++----
 include/kernel.mk                             |  20 +-
 include/quilt.mk                              |  16 +-
 include/trusted-firmware-a.mk                 |   2 +-
 include/u-boot.mk                             |   2 +-
 package/devel/kselftests-bpf/Makefile         |   4 +-
 package/devel/perf/Makefile                   |   6 +-
 package/devel/strace/Makefile                 |   2 +-
 package/firmware/layerscape/ls-dpl/Makefile   |   2 +-
 package/kernel/bpf-headers/Makefile           |  10 +-
 package/kernel/broadcom-wl/Makefile           |   2 +-
 package/kernel/cryptodev-linux/Makefile       |   2 +-
 package/kernel/lantiq/ltq-adsl-mei/Makefile   |   5 +-
 package/kernel/lantiq/ltq-adsl/Makefile       |   4 +-
 package/kernel/lantiq/ltq-atm/Makefile        |   5 +-
 package/kernel/lantiq/ltq-deu/Makefile        |   5 +-
 package/kernel/lantiq/ltq-ifxos/Makefile      |   4 +-
 package/kernel/lantiq/ltq-ptm/Makefile        |   5 +-
 package/kernel/lantiq/ltq-tapi/Makefile       |   4 +-
 .../kernel/lantiq/ltq-vdsl-vr11-mei/Makefile  |   4 +-
 package/kernel/lantiq/ltq-vdsl-vr11/Makefile  |   4 +-
 .../kernel/lantiq/ltq-vdsl-vr9-mei/Makefile   |   4 +-
 package/kernel/lantiq/ltq-vdsl-vr9/Makefile   |   4 +-
 package/kernel/lantiq/ltq-vmmc/Makefile       |   4 +-
 package/kernel/linux/Makefile                 |   6 +-
 package/kernel/linux/modules/block.mk         | 106 +++----
 package/kernel/linux/modules/can.mk           |  36 +--
 package/kernel/linux/modules/crypto.mk        | 252 +++++++--------
 package/kernel/linux/modules/firewire.mk      |   8 +-
 package/kernel/linux/modules/fs.mk            | 100 +++---
 package/kernel/linux/modules/gpio-cascade.mk  |   2 +-
 package/kernel/linux/modules/hwmon.mk         |  98 +++---
 package/kernel/linux/modules/i2c.mk           |   2 +-
 package/kernel/linux/modules/iio.mk           |  80 ++---
 package/kernel/linux/modules/input.mk         |  26 +-
 package/kernel/linux/modules/leds.mk          |  20 +-
 package/kernel/linux/modules/lib.mk           |  76 ++---
 package/kernel/linux/modules/multiplexer.mk   |   4 +-
 package/kernel/linux/modules/netdevices.mk    | 214 ++++++-------
 package/kernel/linux/modules/netfilter.mk     | 168 +++++-----
 package/kernel/linux/modules/netsupport.mk    | 204 ++++++-------
 package/kernel/linux/modules/nls.mk           |  44 +--
 package/kernel/linux/modules/other.mk         | 202 ++++++------
 package/kernel/linux/modules/pcmcia.mk        |  14 +-
 package/kernel/linux/modules/sound.mk         |  98 +++---
 package/kernel/linux/modules/spi.mk           |  10 +-
 package/kernel/linux/modules/usb.mk           | 288 +++++++++---------
 package/kernel/linux/modules/video.mk         | 168 +++++-----
 package/kernel/linux/modules/virt.mk          |  24 +-
 package/kernel/linux/modules/w1.mk            |   6 +-
 package/kernel/linux/modules/wpan.mk          |  20 +-
 package/kernel/mac80211/Makefile              |  10 +-
 package/kernel/qca-nss-dp/Makefile            |   2 +-
 package/kernel/qca-ssdk/Makefile              |   2 +-
 package/network/config/ltq-adsl-app/Makefile  |   2 +-
 package/network/config/swconfig/Makefile      |   2 +-
 package/network/services/ppp/Makefile         |  10 +-
 package/network/utils/arptables/Makefile      |   2 +-
 package/network/utils/iproute2/Makefile       |   2 +-
 package/network/utils/ipset/Makefile          |   2 +-
 package/network/utils/iptables/Makefile       |  14 +-
 package/network/utils/linux-atm/Makefile      |   2 +-
 package/utils/spidev_test/Makefile            |   4 +-
 scripts/patch-kernel.sh                       |   2 +-
 target/imagebuilder/Makefile                  |  14 +-
 target/imagebuilder/files/Makefile            |   4 +-
 target/linux/apm821xx/modules.mk              |   4 +-
 target/linux/archs38/image/Makefile           |   6 +-
 target/linux/armsr/armv8/config-6.1           |   2 +-
 target/linux/armsr/modules.mk                 |  80 ++---
 target/linux/at91/modules.mk                  |  18 +-
 target/linux/ath79/modules.mk                 |   2 +-
 target/linux/bcm27xx/image/Makefile           |   6 +-
 target/linux/bcm27xx/modules/hwmon.mk         |   2 +-
 target/linux/bcm27xx/modules/other.mk         |   6 +-
 target/linux/bcm27xx/modules/sound.mk         | 206 ++++++-------
 target/linux/bcm27xx/modules/spi.mk           |   4 +-
 target/linux/bcm27xx/modules/video.mk         |  16 +-
 ...BCM2708-Add-core-Device-Tree-support.patch |   2 +-
 target/linux/bcm47xx/modules.mk               |   6 +-
 target/linux/bcm4908/image/Makefile           |   8 +-
 target/linux/bcm53xx/image/Makefile           |   6 +-
 target/linux/bcm53xx/modules.mk               |   6 +-
 target/linux/bcm63xx/modules.mk               |   4 +-
 target/linux/bmips/modules.mk                 |   6 +-
 target/linux/gemini/modules.mk                |   2 +-
 target/linux/imx/image/common.mk              |   2 +-
 target/linux/imx/image/cortexa9.mk            |   4 +-
 target/linux/ipq40xx/image/generic.mk         |   2 +-
 target/linux/ipq806x/modules.mk               |  14 +-
 target/linux/ixp4xx/config-6.1                |  12 +-
 target/linux/kirkwood/modules.mk              |   4 +-
 target/linux/layerscape/image/Makefile        |  10 +-
 target/linux/layerscape/image/armv7.mk        |   4 +-
 target/linux/layerscape/image/armv8_64b.mk    |  10 +-
 target/linux/layerscape/modules.mk            |   4 +-
 target/linux/mediatek/filogic/config-5.15     |   2 +-
 target/linux/mediatek/filogic/config-6.1      |   2 +-
 target/linux/mediatek/image/filogic.mk        |   2 +-
 target/linux/mediatek/image/mt7622.mk         |   4 +-
 target/linux/mediatek/image/mt7623.mk         |   4 +-
 target/linux/mediatek/modules.mk              |   8 +-
 target/linux/mediatek/mt7622/config-5.15      |   2 +-
 target/linux/mediatek/mt7622/config-6.1       |   2 +-
 target/linux/mvebu/modules.mk                 |   4 +-
 target/linux/mxs/image/Makefile               |   2 +-
 target/linux/omap/image/Makefile              |   2 +-
 target/linux/oxnas/modules.mk                 |   4 +-
 target/linux/pistachio/image/Makefile         |   2 +-
 target/linux/ramips/image/mt7621.mk           |   2 +-
 target/linux/ramips/modules.mk                |  20 +-
 target/linux/ramips/rt288x/config-5.15        |  14 +-
 target/linux/rockchip/image/Makefile          |   4 +-
 target/linux/sifiveu/config-6.1               |   4 +-
 target/linux/sifiveu/image/Makefile           |   2 +-
 target/linux/sunxi/image/Makefile             |   2 +-
 target/linux/sunxi/modules.mk                 |  16 +-
 target/linux/tegra/image/Makefile             |   4 +-
 target/linux/uml/config-5.15                  |   2 +-
 target/linux/uml/config-6.1                   |   2 +-
 target/linux/uml/image/Makefile               |   2 +-
 target/linux/x86/64/config-5.15               |   2 +-
 target/linux/x86/64/config-6.1                |   2 +-
 target/linux/x86/generic/config-5.15          |   2 +-
 target/linux/x86/generic/config-6.1           |   2 +-
 target/linux/x86/modules.mk                   |  22 +-
 target/linux/zynq/image/Makefile              |   2 +-
 target/sdk/Makefile                           |   6 +-
 toolchain/kernel-headers/Makefile             |   2 +-
 133 files changed, 1630 insertions(+), 1633 deletions(-)

-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |       ehem+openwrt at m5p.com     PGP 87145445       |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445





From ehem+openwrt at m5p.com  Sun Nov 12 10:22:28 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Sun, 12 Nov 2023 10:22:28 -0800
Subject: [PATCH 01/20] ppp: make copy of compiler_types.h unconditional
In-Reply-To: <cover.1700010286.git.ehem+openwrt@m5p.com>
References: <cover.1700010286.git.ehem+openwrt@m5p.com>
Message-ID: <af5c57f86477d2e2af9dbf86dd2eac5db3d8e823.1700010289.git.ehem+openwrt@m5p.com>

04cb1e0fd2 was implemented to avoid failures with kernels before
4.14.9.  At this point OpenWRT no longer supports earlier kernels,
so make the copy fail if compiler_types.h doesn't exist.

Updates: 04cb1e0fd2 ("ppp: fix build with kernel 4.14.9+")
Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>
---
 package/network/services/ppp/Makefile | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/package/network/services/ppp/Makefile b/package/network/services/ppp/Makefile
index 40ec5c5cf1..5f4b8ac02f 100644
--- a/package/network/services/ppp/Makefile
+++ b/package/network/services/ppp/Makefile
@@ -184,13 +184,9 @@ $(call Build/Configure/Default,, \
 	mkdir -p $(PKG_BUILD_DIR)/pppd/plugins/pppoatm/linux
 	$(CP) \
 		$(LINUX_DIR)/include/linux/compiler.h \
+		$(LINUX_DIR)/include/linux/compiler_types.h \
 		$(LINUX_DIR)/include/$(LINUX_UAPI_DIR)linux/atm*.h \
 		$(PKG_BUILD_DIR)/pppd/plugins/pppoatm/linux/
-
-	# Kernel 4.14.9+ only, ignore the exit status of cp in case the file
-	# doesn't exits
-	-$(CP) $(LINUX_DIR)/include/linux/compiler_types.h \
-		$(PKG_BUILD_DIR)/pppd/plugins/pppoatm/linux/
 endef
 
 MAKE_FLAGS += COPTS="$(TARGET_CFLAGS)" \
-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |       ehem+openwrt at m5p.com     PGP 87145445       |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445





From ehem+openwrt at m5p.com  Mon Nov 13 14:38:31 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Mon, 13 Nov 2023 14:38:31 -0800
Subject: [PATCH 02/20] package/lantiq: use make -C instead of `cd;`
In-Reply-To: <cover.1700010286.git.ehem+openwrt@m5p.com>
References: <cover.1700010286.git.ehem+openwrt@m5p.com>
Message-ID: <b13108024c88aca35681878762c17e16afbb8d6b.1700010289.git.ehem+openwrt@m5p.com>

The effect is the same, but this reduces work by the shell.  This
is generally preferred unless multiple commands need to be run in the
target directory.

Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>
---
 package/kernel/lantiq/ltq-adsl-mei/Makefile | 5 ++---
 package/kernel/lantiq/ltq-atm/Makefile      | 5 ++---
 package/kernel/lantiq/ltq-deu/Makefile      | 5 ++---
 package/kernel/lantiq/ltq-ptm/Makefile      | 5 ++---
 4 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/package/kernel/lantiq/ltq-adsl-mei/Makefile b/package/kernel/lantiq/ltq-adsl-mei/Makefile
index 31e671e53f..e9db785960 100644
--- a/package/kernel/lantiq/ltq-adsl-mei/Makefile
+++ b/package/kernel/lantiq/ltq-adsl-mei/Makefile
@@ -34,9 +34,8 @@ define Build/Configure
 endef
 
 define Build/Compile
-	cd $(LINUX_DIR); \
-		ARCH=mips CROSS_COMPILE="$(KERNEL_CROSS)" \
-		$(MAKE) BUILD_VARIANT=$(BUILD_VARIANT) M=$(PKG_BUILD_DIR)/ V=1 modules
+	ARCH=mips CROSS_COMPILE="$(KERNEL_CROSS)" \
+	$(MAKE) -C $(LINUX_DIR) BUILD_VARIANT=$(BUILD_VARIANT) M=$(PKG_BUILD_DIR)/ V=1 modules
 endef
 
 $(eval $(call KernelPackage,ltq-adsl-danube-mei))
diff --git a/package/kernel/lantiq/ltq-atm/Makefile b/package/kernel/lantiq/ltq-atm/Makefile
index b81f3bb293..af852e9a01 100644
--- a/package/kernel/lantiq/ltq-atm/Makefile
+++ b/package/kernel/lantiq/ltq-atm/Makefile
@@ -39,9 +39,8 @@ define Build/Configure
 endef
 
 define Build/Compile
-	cd $(LINUX_DIR); \
-		ARCH=mips CROSS_COMPILE="$(KERNEL_CROSS)" \
-		$(MAKE) $(KERNEL_MAKE_FLAGS) BUILD_VARIANT=$(BUILD_VARIANT) M=$(PKG_BUILD_DIR) V=1 modules
+	ARCH=mips CROSS_COMPILE="$(KERNEL_CROSS)" \
+	$(MAKE) -C $(LINUX_DIR) $(KERNEL_MAKE_FLAGS) BUILD_VARIANT=$(BUILD_VARIANT) M=$(PKG_BUILD_DIR) V=1 modules
 endef
 
 $(eval $(call KernelPackage,ltq-atm-danube))
diff --git a/package/kernel/lantiq/ltq-deu/Makefile b/package/kernel/lantiq/ltq-deu/Makefile
index 4e8127afab..4b8fae2766 100644
--- a/package/kernel/lantiq/ltq-deu/Makefile
+++ b/package/kernel/lantiq/ltq-deu/Makefile
@@ -34,9 +34,8 @@ define Build/Configure
 endef
 
 define Build/Compile
-	cd $(LINUX_DIR); \
-		ARCH=mips CROSS_COMPILE="$(KERNEL_CROSS)" \
-		$(MAKE) BUILD_VARIANT=$(BUILD_VARIANT) M=$(PKG_BUILD_DIR) V=1 modules
+	ARCH=mips CROSS_COMPILE="$(KERNEL_CROSS)" \
+	$(MAKE) -C $(LINUX_DIR) BUILD_VARIANT=$(BUILD_VARIANT) M=$(PKG_BUILD_DIR) V=1 modules
 endef
 
 $(eval $(call KernelPackage,ltq-deu-danube))
diff --git a/package/kernel/lantiq/ltq-ptm/Makefile b/package/kernel/lantiq/ltq-ptm/Makefile
index b726cb1560..a1fb2250d2 100644
--- a/package/kernel/lantiq/ltq-ptm/Makefile
+++ b/package/kernel/lantiq/ltq-ptm/Makefile
@@ -43,9 +43,8 @@ define Build/Configure
 endef
 
 define Build/Compile
-	cd $(LINUX_DIR); \
-		ARCH=mips CROSS_COMPILE="$(KERNEL_CROSS)" \
-		$(MAKE) $(KERNEL_MAKE_FLAGS) BUILD_VARIANT=$(BUILD_VARIANT) M=$(PKG_BUILD_DIR) V=1 modules
+	ARCH=mips CROSS_COMPILE="$(KERNEL_CROSS)" \
+	$(MAKE) -C $(LINUX_DIR) $(KERNEL_MAKE_FLAGS) BUILD_VARIANT=$(BUILD_VARIANT) M=$(PKG_BUILD_DIR) V=1 modules
 endef
 
 $(eval $(call KernelPackage,ltq-ptm-danube))
-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |       ehem+openwrt at m5p.com     PGP 87145445       |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445





From ehem+openwrt at m5p.com  Mon Nov 13 13:42:27 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Mon, 13 Nov 2023 13:42:27 -0800
Subject: [PATCH 03/20] bcm27xx: fix device-tree support patch for split
 source/build dirs
In-Reply-To: <cover.1700010286.git.ehem+openwrt@m5p.com>
References: <cover.1700010286.git.ehem+openwrt@m5p.com>
Message-ID: <3f1a6b89e036b814ae6fae07bee89910404dce24.1700010290.git.ehem+openwrt@m5p.com>

The kernel source directory needs to be in the include path for
compilation.  This fixes separated build snd source directory
functioning.

Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>
---
This is really meant as a PoC fix.  This works, but doesn't seem to
quite match the existing style.  I'm also unsure of where in the
arguments this addition should be.  Nonetheless, this is a bug.
---
 .../950-0061-BCM2708-Add-core-Device-Tree-support.patch         | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/linux/bcm27xx/patches-6.1/950-0061-BCM2708-Add-core-Device-Tree-support.patch b/target/linux/bcm27xx/patches-6.1/950-0061-BCM2708-Add-core-Device-Tree-support.patch
index 442abb456f..3856183a5b 100644
--- a/target/linux/bcm27xx/patches-6.1/950-0061-BCM2708-Add-core-Device-Tree-support.patch
+++ b/target/linux/bcm27xx/patches-6.1/950-0061-BCM2708-Add-core-Device-Tree-support.patch
@@ -37848,7 +37848,7 @@ index 3aa384cec76b..ed87353646bf 100644
  
 +quiet_cmd_dtco = DTCO    $@
 +cmd_dtco = mkdir -p $(dir ${dtc-tmp}) ; \
-+	$(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
++	$(CPP) $(dtc_cpp_flags) -I$(srctree)/include -x assembler-with-cpp -o $(dtc-tmp) $< ; \
 +	$(DTC) -@ -H epapr -O dtb -o $@ -b 0 \
 +		-i $(dir $<) $(DTC_FLAGS) \
 +		-Wno-interrupts_property \
-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |       ehem+openwrt at m5p.com     PGP 87145445       |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445





From ehem+openwrt at m5p.com  Tue Nov 14 17:04:46 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Tue, 14 Nov 2023 17:04:46 -0800
Subject: [PATCH 04/20] patch: always backup files
In-Reply-To: <cover.1700010286.git.ehem+openwrt@m5p.com>
References: <cover.1700010286.git.ehem+openwrt@m5p.com>
Message-ID: <f76141af430d49f702cd4d021c199ffa034fc458.1700010290.git.ehem+openwrt@m5p.com>

Date: Thu, 26 Oct 2023 18:44:33 -0700

Avoiding modification of the original files allows their reuse.
This is a first step towards being able to reuse unpacked kernel
(or other) source.

Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>
---
 include/autotools.mk    | 2 +-
 scripts/patch-kernel.sh | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/autotools.mk b/include/autotools.mk
index d0e4b3642f..53e8a0d6e6 100644
--- a/include/autotools.mk
+++ b/include/autotools.mk
@@ -61,7 +61,7 @@ define patch_libtool
 			lt_version="$$$$($$(STAGING_DIR_HOST)/bin/sed -ne 's,^[[:space:]]*VERSION="\?\([0-9]\.[0-9]\+\).*,\1,p' $$$$lt)"; \
 			case "$$$$lt_version" in \
 				1.5|2.2|2.4) echo "autotools.mk: Found libtool v$$$$lt_version - applying patch to $$$$lt"; \
-					(cd $$$$(dirname $$$$lt) && $$(PATCH) -N -s -p1 < $$(TOPDIR)/tools/libtool/files/libtool-v$$$$lt_version.patch || true) ;; \
+					(cd $$$$(dirname $$$$lt) && $$(PATCH) -b -N -s -p1 < $$(TOPDIR)/tools/libtool/files/libtool-v$$$$lt_version.patch || true) ;; \
 				*) echo "autotools.mk: error: Unsupported libtool version v$$$$lt_version - cannot patch $$$$lt"; exit 1 ;; \
 			esac; \
 		done; \
diff --git a/scripts/patch-kernel.sh b/scripts/patch-kernel.sh
index c2b7e72049..d3f1042343 100755
--- a/scripts/patch-kernel.sh
+++ b/scripts/patch-kernel.sh
@@ -37,7 +37,7 @@ for i in ${patchdir}/${patchpattern} ; do
     [ -d "${i}" ] && echo "Ignoring subdirectory ${i}" && continue	
     echo ""
     echo "Applying ${i} using ${type}: " 
-    ${uncomp} ${i} | ${PATCH:-patch} -f -p1 -d ${targetdir}
+    ${uncomp} ${i} | ${PATCH:-patch} -b -f -p1 -d ${targetdir}
     if [ $? != 0 ] ; then
         echo "Patch failed!  Please fix $i!"
 	exit 1
-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |       ehem+openwrt at m5p.com     PGP 87145445       |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445





From ehem+openwrt at m5p.com  Tue Nov 14 17:04:46 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Tue, 14 Nov 2023 17:04:46 -0800
Subject: [PATCH 05/20] build: merge Kernel/Prepare steps together
In-Reply-To: <cover.1700010286.git.ehem+openwrt@m5p.com>
References: <cover.1700010286.git.ehem+openwrt@m5p.com>
Message-ID: <708427ecc8fbba15cae98fb58a19985ed397e604.1700010290.git.ehem+openwrt@m5p.com>

Date: Mon, 30 Oct 2023 14:46:24 -0700

The two Kernel/Prepare/Default implementations had become identical.
As such merge the identical sections together, and only have the
extra piece be conditional.

Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>
---
 include/kernel-defaults.mk | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/include/kernel-defaults.mk b/include/kernel-defaults.mk
index d9842fd82a..05ec9afe09 100644
--- a/include/kernel-defaults.mk
+++ b/include/kernel-defaults.mk
@@ -21,17 +21,13 @@ else
 endif
 
 ifeq ($(strip $(CONFIG_EXTERNAL_KERNEL_TREE)),"")
-  ifeq ($(strip $(CONFIG_KERNEL_GIT_CLONE_URI)),"")
-    define Kernel/Prepare/Default
+  define Kernel/Prepare/Default
 	$(LINUX_CAT) $(DL_DIR)/$(LINUX_SOURCE) | $(TAR) -C $(KERNEL_BUILD_DIR) $(TAR_OPTIONS)
+    ifeq ($(strip $(CONFIG_KERNEL_GIT_CLONE_URI)),"")
 	$(Kernel/Patch)
 	$(if $(QUILT),touch $(LINUX_DIR)/.quilt_used)
-    endef
-  else
-    define Kernel/Prepare/Default
-	$(LINUX_CAT) $(DL_DIR)/$(LINUX_SOURCE) | $(TAR) -C $(KERNEL_BUILD_DIR) $(TAR_OPTIONS)
-    endef
-  endif
+    endif
+  endef
 else
   define Kernel/Prepare/Default
 	mkdir -p $(KERNEL_BUILD_DIR)
-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |       ehem+openwrt at m5p.com     PGP 87145445       |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445





From ehem+openwrt at m5p.com  Fri Nov 10 16:51:25 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Fri, 10 Nov 2023 16:51:25 -0800
Subject: [PATCH 06/20] kernel: remove drivers marked as modules
In-Reply-To: <cover.1700010286.git.ehem+openwrt@m5p.com>
References: <cover.1700010286.git.ehem+openwrt@m5p.com>
Message-ID: <afe0d6c0e51d0d6b7d41724a3a53e7fca6a8c7d1.1700010290.git.ehem+openwrt@m5p.com>

Previously these would get built, then simply omitted from the
resultant image.  This behavior is expected to change in the future, so
remove these to avoid changing installed modules.

Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>
---
 target/linux/armsr/armv8/config-6.1       |  2 +-
 target/linux/ixp4xx/config-6.1            | 12 ++++++------
 target/linux/mediatek/filogic/config-5.15 |  2 +-
 target/linux/mediatek/filogic/config-6.1  |  2 +-
 target/linux/mediatek/mt7622/config-5.15  |  2 +-
 target/linux/mediatek/mt7622/config-6.1   |  2 +-
 target/linux/ramips/rt288x/config-5.15    | 14 +++++++-------
 target/linux/sifiveu/config-6.1           |  4 ++--
 target/linux/uml/config-5.15              |  2 +-
 target/linux/uml/config-6.1               |  2 +-
 target/linux/x86/64/config-5.15           |  2 +-
 target/linux/x86/64/config-6.1            |  2 +-
 target/linux/x86/generic/config-5.15      |  2 +-
 target/linux/x86/generic/config-6.1       |  2 +-
 14 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/target/linux/armsr/armv8/config-6.1 b/target/linux/armsr/armv8/config-6.1
index a4c132df55..52f4283394 100644
--- a/target/linux/armsr/armv8/config-6.1
+++ b/target/linux/armsr/armv8/config-6.1
@@ -390,7 +390,7 @@ CONFIG_KCMP=y
 # CONFIG_KEYBOARD_SUN4I_LRADC is not set
 CONFIG_KSM=y
 CONFIG_KVM=y
-CONFIG_LCD_CLASS_DEVICE=m
+# CONFIG_LCD_CLASS_DEVICE is not set
 # CONFIG_LCD_PLATFORM is not set
 # CONFIG_MAILBOX_TEST is not set
 CONFIG_MARVELL_10G_PHY=y
diff --git a/target/linux/ixp4xx/config-6.1 b/target/linux/ixp4xx/config-6.1
index a7b14bfb66..deef4982d9 100644
--- a/target/linux/ixp4xx/config-6.1
+++ b/target/linux/ixp4xx/config-6.1
@@ -51,15 +51,15 @@ CONFIG_CPU_TLB_V4WBI=y
 CONFIG_CPU_USE_DOMAINS=y
 CONFIG_CPU_XSCALE=y
 CONFIG_CRC16=y
-CONFIG_CRYPTO_AUTHENC=m
-CONFIG_CRYPTO_CBC=m
+# CONFIG_CRYPTO_AUTHENC is not set
+# CONFIG_CRYPTO_CBC is not set
 CONFIG_CRYPTO_CRC32C=y
-CONFIG_CRYPTO_DES=m
-CONFIG_CRYPTO_DEV_IXP4XX=m
-CONFIG_CRYPTO_ECB=m
+# CONFIG_CRYPTO_DES is not set
+# CONFIG_CRYPTO_DEV_IXP4XX is not set
+# CONFIG_CRYPTO_ECB is not set
 CONFIG_CRYPTO_HW=y
 CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y
-CONFIG_CRYPTO_LIB_DES=m
+# CONFIG_CRYPTO_LIB_DES is not set
 CONFIG_CRYPTO_LIB_SHA1=y
 CONFIG_CRYPTO_LIB_UTILS=y
 CONFIG_CRYPTO_RNG2=y
diff --git a/target/linux/mediatek/filogic/config-5.15 b/target/linux/mediatek/filogic/config-5.15
index a8f117f2c4..fe7ce6a5cb 100644
--- a/target/linux/mediatek/filogic/config-5.15
+++ b/target/linux/mediatek/filogic/config-5.15
@@ -426,7 +426,7 @@ CONFIG_WATCHDOG_PRETIMEOUT_DEFAULT_GOV_PANIC=y
 CONFIG_WATCHDOG_PRETIMEOUT_GOV=y
 # CONFIG_WATCHDOG_PRETIMEOUT_GOV_NOOP is not set
 CONFIG_WATCHDOG_PRETIMEOUT_GOV_PANIC=y
-CONFIG_WATCHDOG_PRETIMEOUT_GOV_SEL=m
+# CONFIG_WATCHDOG_PRETIMEOUT_GOV_SEL is not set
 CONFIG_WATCHDOG_SYSFS=y
 CONFIG_XPS=y
 CONFIG_XXHASH=y
diff --git a/target/linux/mediatek/filogic/config-6.1 b/target/linux/mediatek/filogic/config-6.1
index b41e87e10b..1099673929 100644
--- a/target/linux/mediatek/filogic/config-6.1
+++ b/target/linux/mediatek/filogic/config-6.1
@@ -459,7 +459,7 @@ CONFIG_WATCHDOG_PRETIMEOUT_DEFAULT_GOV_PANIC=y
 CONFIG_WATCHDOG_PRETIMEOUT_GOV=y
 # CONFIG_WATCHDOG_PRETIMEOUT_GOV_NOOP is not set
 CONFIG_WATCHDOG_PRETIMEOUT_GOV_PANIC=y
-CONFIG_WATCHDOG_PRETIMEOUT_GOV_SEL=m
+# CONFIG_WATCHDOG_PRETIMEOUT_GOV_SEL is not set
 CONFIG_WATCHDOG_SYSFS=y
 CONFIG_XPS=y
 CONFIG_XXHASH=y
diff --git a/target/linux/mediatek/mt7622/config-5.15 b/target/linux/mediatek/mt7622/config-5.15
index 99a170a2a8..eca08f1c54 100644
--- a/target/linux/mediatek/mt7622/config-5.15
+++ b/target/linux/mediatek/mt7622/config-5.15
@@ -444,7 +444,7 @@ CONFIG_WATCHDOG_PRETIMEOUT_DEFAULT_GOV_PANIC=y
 CONFIG_WATCHDOG_PRETIMEOUT_GOV=y
 # CONFIG_WATCHDOG_PRETIMEOUT_GOV_NOOP is not set
 CONFIG_WATCHDOG_PRETIMEOUT_GOV_PANIC=y
-CONFIG_WATCHDOG_PRETIMEOUT_GOV_SEL=m
+# CONFIG_WATCHDOG_PRETIMEOUT_GOV_SEL is not set
 CONFIG_WATCHDOG_SYSFS=y
 CONFIG_XPS=y
 CONFIG_XXHASH=y
diff --git a/target/linux/mediatek/mt7622/config-6.1 b/target/linux/mediatek/mt7622/config-6.1
index 26f6d8a1b1..a055617075 100644
--- a/target/linux/mediatek/mt7622/config-6.1
+++ b/target/linux/mediatek/mt7622/config-6.1
@@ -458,7 +458,7 @@ CONFIG_WATCHDOG_PRETIMEOUT_DEFAULT_GOV_PANIC=y
 CONFIG_WATCHDOG_PRETIMEOUT_GOV=y
 # CONFIG_WATCHDOG_PRETIMEOUT_GOV_NOOP is not set
 CONFIG_WATCHDOG_PRETIMEOUT_GOV_PANIC=y
-CONFIG_WATCHDOG_PRETIMEOUT_GOV_SEL=m
+# CONFIG_WATCHDOG_PRETIMEOUT_GOV_SEL is not set
 CONFIG_WATCHDOG_SYSFS=y
 CONFIG_XPS=y
 CONFIG_XXHASH=y
diff --git a/target/linux/ramips/rt288x/config-5.15 b/target/linux/ramips/rt288x/config-5.15
index 3f9014796a..af647ca129 100644
--- a/target/linux/ramips/rt288x/config-5.15
+++ b/target/linux/ramips/rt288x/config-5.15
@@ -118,7 +118,7 @@ CONFIG_NET_RALINK_RT2880=y
 CONFIG_NET_RALINK_SOC=y
 CONFIG_NET_SELFTESTS=y
 CONFIG_NET_VENDOR_RALINK=y
-CONFIG_NLS=m
+# CONFIG_NLS is not set
 CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y
 CONFIG_NVMEM=y
 CONFIG_OF=y
@@ -177,12 +177,12 @@ CONFIG_SYS_SUPPORTS_ZBOOT=y
 CONFIG_TARGET_ISA_REV=2
 CONFIG_TICK_CPU_ACCOUNTING=y
 CONFIG_TINY_SRCU=y
-CONFIG_USB=m
-CONFIG_USB_COMMON=m
-CONFIG_USB_EHCI_HCD=m
-CONFIG_USB_EHCI_HCD_PLATFORM=m
-CONFIG_USB_OHCI_HCD=m
-CONFIG_USB_OHCI_HCD_PLATFORM=m
+# CONFIG_USB is not set
+# CONFIG_USB_COMMON is not set
+# CONFIG_USB_EHCI_HCD is not set
+# CONFIG_USB_EHCI_HCD_PLATFORM is not set
+# CONFIG_USB_OHCI_HCD is not set
+# CONFIG_USB_OHCI_HCD_PLATFORM is not set
 CONFIG_USB_SUPPORT=y
 CONFIG_USE_OF=y
 CONFIG_WATCHDOG_CORE=y
diff --git a/target/linux/sifiveu/config-6.1 b/target/linux/sifiveu/config-6.1
index 51ff357db4..fa8ec4b331 100644
--- a/target/linux/sifiveu/config-6.1
+++ b/target/linux/sifiveu/config-6.1
@@ -79,7 +79,7 @@ CONFIG_EDAC_LEGACY_SYSFS=y
 CONFIG_EDAC_SIFIVE=y
 CONFIG_EDAC_SUPPORT=y
 CONFIG_EFI=y
-CONFIG_EFIVAR_FS=m
+# CONFIG_EFIVAR_FS is not set
 # CONFIG_EFI_BOOTLOADER_CONTROL is not set
 # CONFIG_EFI_CAPSULE_LOADER is not set
 # CONFIG_EFI_COCO_SECRET is not set
@@ -243,7 +243,7 @@ CONFIG_PAGE_SIZE_LESS_THAN_256KB=y
 CONFIG_PAGE_SIZE_LESS_THAN_64KB=y
 CONFIG_PCI=y
 CONFIG_PCIEAER=y
-CONFIG_PCIEAER_INJECT=m
+# CONFIG_PCIEAER_INJECT is not set
 CONFIG_PCIEASPM=y
 CONFIG_PCIEASPM_DEFAULT=y
 # CONFIG_PCIEASPM_PERFORMANCE is not set
diff --git a/target/linux/uml/config-5.15 b/target/linux/uml/config-5.15
index 32154633a4..1ba5daf7e3 100644
--- a/target/linux/uml/config-5.15
+++ b/target/linux/uml/config-5.15
@@ -89,7 +89,7 @@ CONFIG_RD_BZIP2=y
 CONFIG_RD_GZIP=y
 CONFIG_RELAY=y
 CONFIG_SG_POOL=y
-CONFIG_SOFT_WATCHDOG=m
+# CONFIG_SOFT_WATCHDOG is not set
 CONFIG_SRCU=y
 CONFIG_SSL=y
 CONFIG_SSL_CHAN="pty"
diff --git a/target/linux/uml/config-6.1 b/target/linux/uml/config-6.1
index 1c2dd5faae..2598069099 100644
--- a/target/linux/uml/config-6.1
+++ b/target/linux/uml/config-6.1
@@ -96,7 +96,7 @@ CONFIG_RD_BZIP2=y
 CONFIG_RD_GZIP=y
 CONFIG_RELAY=y
 CONFIG_SG_POOL=y
-CONFIG_SOFT_WATCHDOG=m
+# CONFIG_SOFT_WATCHDOG is not set
 CONFIG_SRCU=y
 CONFIG_SSL=y
 CONFIG_SSL_CHAN="pty"
diff --git a/target/linux/x86/64/config-5.15 b/target/linux/x86/64/config-5.15
index ea0a51f251..1b99692d69 100644
--- a/target/linux/x86/64/config-5.15
+++ b/target/linux/x86/64/config-5.15
@@ -151,7 +151,7 @@ CONFIG_DRM_TTM_HELPER=y
 CONFIG_DRM_VIRTIO_GPU=y
 CONFIG_DRM_VRAM_HELPER=y
 CONFIG_EFI=y
-CONFIG_EFIVAR_FS=m
+# CONFIG_EFIVAR_FS is not set
 # CONFIG_EFI_BOOTLOADER_CONTROL is not set
 # CONFIG_EFI_CAPSULE_LOADER is not set
 # CONFIG_EFI_CUSTOM_SSDT_OVERLAYS is not set
diff --git a/target/linux/x86/64/config-6.1 b/target/linux/x86/64/config-6.1
index 56ec0c56fd..9add8a4c40 100644
--- a/target/linux/x86/64/config-6.1
+++ b/target/linux/x86/64/config-6.1
@@ -166,7 +166,7 @@ CONFIG_DRM_TTM_HELPER=y
 CONFIG_DRM_VIRTIO_GPU=y
 CONFIG_DRM_VRAM_HELPER=y
 CONFIG_EFI=y
-CONFIG_EFIVAR_FS=m
+# CONFIG_EFIVAR_FS is not set
 # CONFIG_EFI_BOOTLOADER_CONTROL is not set
 # CONFIG_EFI_CAPSULE_LOADER is not set
 # CONFIG_EFI_COCO_SECRET is not set
diff --git a/target/linux/x86/generic/config-5.15 b/target/linux/x86/generic/config-5.15
index 940a0b1da6..dffd3d27eb 100644
--- a/target/linux/x86/generic/config-5.15
+++ b/target/linux/x86/generic/config-5.15
@@ -106,7 +106,7 @@ CONFIG_DRM_TTM_HELPER=y
 CONFIG_DRM_VIRTIO_GPU=y
 CONFIG_DRM_VRAM_HELPER=y
 CONFIG_EFI=y
-CONFIG_EFIVAR_FS=m
+# CONFIG_EFIVAR_FS is not set
 # CONFIG_EFI_BOOTLOADER_CONTROL is not set
 # CONFIG_EFI_CAPSULE_LOADER is not set
 # CONFIG_EFI_CAPSULE_QUIRK_QUARK_CSH is not set
diff --git a/target/linux/x86/generic/config-6.1 b/target/linux/x86/generic/config-6.1
index 746ae3f47d..ea602676b0 100644
--- a/target/linux/x86/generic/config-6.1
+++ b/target/linux/x86/generic/config-6.1
@@ -111,7 +111,7 @@ CONFIG_DRM_TTM_HELPER=y
 CONFIG_DRM_VIRTIO_GPU=y
 CONFIG_DRM_VRAM_HELPER=y
 CONFIG_EFI=y
-CONFIG_EFIVAR_FS=m
+# CONFIG_EFIVAR_FS is not set
 # CONFIG_EFI_BOOTLOADER_CONTROL is not set
 # CONFIG_EFI_CAPSULE_LOADER is not set
 # CONFIG_EFI_CAPSULE_QUIRK_QUARK_CSH is not set
-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |       ehem+openwrt at m5p.com     PGP 87145445       |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445





From ehem+openwrt at m5p.com  Fri Nov 10 16:21:22 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Fri, 10 Nov 2023 16:21:22 -0800
Subject: [PATCH 07/20] kernel: copy all built kernel modules to root
 filesystem image
In-Reply-To: <cover.1700010286.git.ehem+openwrt@m5p.com>
References: <cover.1700010286.git.ehem+openwrt@m5p.com>
Message-ID: <ee3fb185b494b4de05ca65725e0a96cffa307acb.1700010291.git.ehem+openwrt@m5p.com>

This removes the requirement for to create a package for all modules.
Now devices can simply specify in-tree drivers/other to be built as
modules and they will be present in the resultant image.

Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>
---
I'm pretty sure this is the right general approach.  Why build
modules and simply dump them in the garbage.  I have an odd suspicion
a particular sort of adjustment will be requested.  Issue there is
the OpenWRT use of Make is quite something, I'm unsure about which
timestamp files to use.
---
 include/kernel-defaults.mk | 2 ++
 include/kernel.mk          | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/kernel-defaults.mk b/include/kernel-defaults.mk
index 05ec9afe09..0b421d2cc3 100644
--- a/include/kernel-defaults.mk
+++ b/include/kernel-defaults.mk
@@ -151,6 +151,8 @@ define Kernel/CompileImage/Default
 	rm -f $(TARGET_DIR)/init
 	+$(KERNEL_MAKE) $(KERNEL_MAKEOPTS_IMAGE) $(if $(KERNELNAME),$(KERNELNAME),all)
 	$(call Kernel/CopyImage)
+	+$(KERNEL_MAKE) $(KERNEL_MAKEOPTS_IMAGE) modules
+	find $(LINUX_DIR) -name \*.ko -a -links 1 -print0 | xargs -0 -r cp -lf -t $(TARGET_DIR)/lib/modules/$(LINUX_VERSION)
 endef
 
 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
diff --git a/include/kernel.mk b/include/kernel.mk
index 8236416132..82d87e8491 100644
--- a/include/kernel.mk
+++ b/include/kernel.mk
@@ -247,7 +247,7 @@ $(call KernelPackage/$(1)/config)
 				echo "NOTICE: module '$$$$$$$$mod' is built-in."; \
 			elif [ -e $$$$$$$$mod ]; then \
 				mkdir -p $$(1)/$(MODULES_SUBDIR) ; \
-				$(CP) -L $$$$$$$$mod $$(1)/$(MODULES_SUBDIR)/ ; \
+				$(CP) -L -l $$$$$$$$mod $$(1)/$(MODULES_SUBDIR)/ ; \
 			else \
 				echo "ERROR: module '$$$$$$$$mod' is missing." >&2; \
 				exit 1; \
-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |       ehem+openwrt at m5p.com     PGP 87145445       |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445





From ehem+openwrt at m5p.com  Sat Nov 11 22:51:08 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Sat, 11 Nov 2023 22:51:08 -0800
Subject: [PATCH 08/20] build: add make variables for kernel source and object
 directories
In-Reply-To: <cover.1700010286.git.ehem+openwrt@m5p.com>
References: <cover.1700010286.git.ehem+openwrt@m5p.com>
Message-ID: <cebd82bf00fa4108de4a7742a7bfbd931b82de69.1700010291.git.ehem+openwrt@m5p.com>

Precursor to splitting the two apart.  Linux kernel sources can be
reused for multiple kernel builds with different configurations.
The object directory cannot be reused.

Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>
---
 include/kernel.mk | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/kernel.mk b/include/kernel.mk
index 82d87e8491..ff34f74bed 100644
--- a/include/kernel.mk
+++ b/include/kernel.mk
@@ -45,6 +45,10 @@ else
   endif
   KERNEL_BUILD_DIR ?= $(BUILD_DIR)/linux-$(BOARD)$(if $(SUBTARGET),_$(SUBTARGET))
   LINUX_DIR ?= $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)
+  # Location of kernel source files
+  LINUX_SRC_DIR ?= $(LINUX_DIR)
+  # Location of kernel object files
+  LINUX_OBJ_DIR ?= $(LINUX_DIR)
   LINUX_UAPI_DIR=uapi/
   LINUX_VERMAGIC:=$(strip $(shell cat $(LINUX_DIR)/.vermagic 2>/dev/null))
   LINUX_VERMAGIC:=$(if $(LINUX_VERMAGIC),$(LINUX_VERMAGIC),unknown)
@@ -107,6 +111,7 @@ KERNEL_MAKE_FLAGS = \
 	HOSTCFLAGS="$(HOST_CFLAGS) -Wall -Wmissing-prototypes -Wstrict-prototypes" \
 	CROSS_COMPILE="$(KERNEL_CROSS)" \
 	ARCH="$(LINUX_KARCH)" \
+	O="$(LINUX_OBJ_DIR)" \
 	KBUILD_HAVE_NLS=no \
 	KBUILD_BUILD_USER="$(call qstrip,$(CONFIG_KERNEL_BUILD_USER))" \
 	KBUILD_BUILD_HOST="$(call qstrip,$(CONFIG_KERNEL_BUILD_DOMAIN))" \
@@ -136,7 +141,7 @@ ifneq ($(HOST_OS),Linux)
   export SKIP_STACK_VALIDATION:=1
 endif
 
-KERNEL_MAKEOPTS = -C $(LINUX_DIR) $(KERNEL_MAKE_FLAGS)
+KERNEL_MAKEOPTS = -C $(LINUX_SRC_DIR) $(KERNEL_MAKE_FLAGS)
 
 ifdef CONFIG_USE_SPARSE
   KERNEL_MAKEOPTS += C=1 CHECK=$(STAGING_DIR_HOST)/bin/sparse
-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |       ehem+openwrt at m5p.com     PGP 87145445       |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445





From ehem+openwrt at m5p.com  Mon Nov 13 22:46:48 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Mon, 13 Nov 2023 22:46:48 -0800
Subject: [PATCH 09/20] [WIP] build: split $(DTB_DIR) off of $(DTS_DIR)
In-Reply-To: <cover.1700010286.git.ehem+openwrt@m5p.com>
References: <cover.1700010286.git.ehem+openwrt@m5p.com>
Message-ID: <a395678548ccf07e71eaf47614d5916f7dc940ca.1700010291.git.ehem+openwrt@m5p.com>

This has an issue similar to $(LINUX_DIR), $(DTS_DIR) was being used
for both source and compiled.  Create $(DTB_DIR) for the compiled
binaries.

Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>
---
Issue with this commit is I'm unsure I've gotten everything and
unsure I've gotten the ones I found correct.
---
 include/image.mk                           |  3 ++-
 target/linux/archs38/image/Makefile        |  6 +++---
 target/linux/bcm27xx/image/Makefile        |  4 ++--
 target/linux/bcm4908/image/Makefile        |  2 +-
 target/linux/bcm53xx/image/Makefile        |  6 +++---
 target/linux/imx/image/common.mk           |  2 +-
 target/linux/imx/image/cortexa9.mk         |  4 ++--
 target/linux/layerscape/image/Makefile     |  8 ++++----
 target/linux/layerscape/image/armv7.mk     |  4 ++--
 target/linux/layerscape/image/armv8_64b.mk | 10 +++++-----
 target/linux/mediatek/image/mt7622.mk      |  4 ++--
 target/linux/mediatek/image/mt7623.mk      |  4 ++--
 target/linux/mxs/image/Makefile            |  2 +-
 target/linux/omap/image/Makefile           |  2 +-
 target/linux/pistachio/image/Makefile      |  2 +-
 target/linux/rockchip/image/Makefile       |  2 +-
 target/linux/sifiveu/image/Makefile        |  2 +-
 target/linux/sunxi/image/Makefile          |  2 +-
 target/linux/tegra/image/Makefile          |  4 ++--
 target/linux/zynq/image/Makefile           |  2 +-
 20 files changed, 38 insertions(+), 37 deletions(-)

diff --git a/include/image.mk b/include/image.mk
index 4ebff2e9ae..635fad3584 100644
--- a/include/image.mk
+++ b/include/image.mk
@@ -31,7 +31,8 @@ mkfs_target_dir = $(if $(call param_get,pkg,$(1)),$(KDIR)/target-dir-$(call para
 
 KDIR=$(KERNEL_BUILD_DIR)
 KDIR_TMP=$(KDIR)/tmp
-DTS_DIR:=$(LINUX_DIR)/arch/$(LINUX_KARCH)/boot/dts
+DTS_DIR:=$(LINUX_SRC_DIR)/arch/$(LINUX_KARCH)/boot/dts
+DTB_DIR:=$(LINUX_OBJ_DIR)/arch/$(LINUX_KARCH)/boot/dts
 
 IMG_PREFIX_EXTRA:=$(if $(EXTRA_IMAGE_NAME),$(call sanitize,$(EXTRA_IMAGE_NAME))-)
 IMG_PREFIX_VERNUM:=$(if $(CONFIG_VERSION_FILENAMES),$(call sanitize,$(VERSION_NUMBER))-)
diff --git a/target/linux/archs38/image/Makefile b/target/linux/archs38/image/Makefile
index 55e16c37fc..42cff1c951 100644
--- a/target/linux/archs38/image/Makefile
+++ b/target/linux/archs38/image/Makefile
@@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/image.mk
 kernel_ep = `$(KERNEL_CROSS)readelf -h $(1) | grep "Entry point address" | grep -o 0x.*`
 
 define Build/patch-dtb
-	$(STAGING_DIR_HOST)/bin/patch-dtb $@ $(DTS_DIR)/$(DEVICE_DTS).dtb
+	$(STAGING_DIR_HOST)/bin/patch-dtb $@ $(DTB_DIR)/$(DEVICE_DTS).dtb
 endef
 
 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
@@ -41,7 +41,7 @@ FAT32_BLOCKS=$(shell echo $$(($(CONFIG_AXS10X_SD_BOOT_PARTSIZE)*1024*1024/$(FAT3
 define Image/Prepare
 	# Build .dtb for all boards we may run on
 	$(foreach dts,$(DEVICE_DTS_LIST),
-		$(call Image/BuildDTB,$(DTS_DIR)/$(dts).dts,$(DTS_DIR)/$(dts).dtb)
+		$(call Image/BuildDTB,$(DTS_DIR)/$(dts).dts,$(DTB_DIR)/$(dts).dtb)
 	)
 endef
 
@@ -51,7 +51,7 @@ define Image/Build/SDCard
 	mkimage -C none -A arc -T script -d uEnv.txt $(BIN_DIR)/uEnv.scr
 	mkenvimage -s 0x4000 -o $(BIN_DIR)/uboot.env ./uboot.env.txt
 	mcopy -i $(KDIR_TMP)/$(IMG_PREFIX)-$(PROFILE)-boot.img $(BIN_DIR)/uEnv.scr ::boot.scr
-	mcopy -i $(KDIR_TMP)/$(IMG_PREFIX)-$(PROFILE)-boot.img $(DTS_DIR)/*.dtb ::
+	mcopy -i $(KDIR_TMP)/$(IMG_PREFIX)-$(PROFILE)-boot.img $(DTB_DIR)/*.dtb ::
 	mcopy -i $(KDIR_TMP)/$(IMG_PREFIX)-$(PROFILE)-boot.img $(BIN_DIR)/$(IMG_PREFIX)-uImage ::uImage
 	mcopy -i $(KDIR_TMP)/$(IMG_PREFIX)-$(PROFILE)-boot.img $(BIN_DIR)/uboot.env ::uboot.env
 
diff --git a/target/linux/bcm27xx/image/Makefile b/target/linux/bcm27xx/image/Makefile
index ad79ac7d0c..7fcb78c8f7 100644
--- a/target/linux/bcm27xx/image/Makefile
+++ b/target/linux/bcm27xx/image/Makefile
@@ -23,9 +23,9 @@ define Build/boot-common
 	mcopy -i $@.boot config.txt ::
 	mcopy -i $@.boot distroconfig.txt ::
 	mcopy -i $@.boot $(IMAGE_KERNEL) ::$(KERNEL_IMG)
-	$(foreach dts,$(shell echo $(DEVICE_DTS)),mcopy -i $@.boot $(DTS_DIR)/$(dts).dtb ::;)
+	$(foreach dts,$(shell echo $(DEVICE_DTS)),mcopy -i $@.boot $(DTB_DIR)/$(dts).dtb ::;)
 	mmd -i $@.boot ::/overlays
-	mcopy -i $@.boot $(DTS_DIR)/overlays/*.dtbo ::/overlays/
+	mcopy -i $@.boot $(DTB_DIR)/overlays/*.dtbo ::/overlays/
 	mcopy -i $@.boot $(DTS_DIR)/overlays/README ::/overlays/
 endef
 
diff --git a/target/linux/bcm4908/image/Makefile b/target/linux/bcm4908/image/Makefile
index 658ec810d1..5d113919e8 100644
--- a/target/linux/bcm4908/image/Makefile
+++ b/target/linux/bcm4908/image/Makefile
@@ -32,7 +32,7 @@ define Build/bcm4908img
 	mkdir -p $@-bootfs
 	cp -r $(DEVICE_NAME)/* $@-bootfs/
 	touch $@-bootfs/1-openwrt
-	cp $(DTS_DIR)/$(firstword $(DEVICE_DTS)).dtb $@-bootfs/94908.dtb
+	cp $(DTB_DIR)/$(firstword $(DEVICE_DTS)).dtb $@-bootfs/94908.dtb
 	cp $(KDIR)/bcm63xx-cfe/$(subst _,$(comma),$(DEVICE_NAME))/cferam.000 $@-bootfs/
 	cp $(IMAGE_KERNEL) $@-bootfs/vmlinux.lz
 
diff --git a/target/linux/bcm53xx/image/Makefile b/target/linux/bcm53xx/image/Makefile
index 8799f50057..75040e40e5 100644
--- a/target/linux/bcm53xx/image/Makefile
+++ b/target/linux/bcm53xx/image/Makefile
@@ -146,7 +146,7 @@ define Device/Default
   PROFILES = Generic $$(DEVICE_NAME)
   # .dtb files are prefixed by SoC type, e.g. bcm4708- which is not included in device/image names
   # extract the full dtb name based on the device info
-  DEVICE_DTS := $(patsubst %.dtb,%,$(notdir $(wildcard $(if $(IB),$(KDIR),$(DTS_DIR))/*-$(subst _,-,$(1)).dtb)))
+  DEVICE_DTS := $(patsubst %.dtb,%,$(notdir $(wildcard $(if $(IB),$(KDIR),$(DTB_DIR))/*-$(subst _,-,$(1)).dtb)))
   KERNEL := kernel-bin | append-dtb | lzma-d16
   KERNEL_DEPENDS = $$(wildcard $(DTS_DIR)/$$(DEVICE_DTS).dts)
   KERNEL_INITRAMFS_SUFFIX := .trx
@@ -407,9 +407,9 @@ define Device/meraki_mr32
   KERNEL_INITRAMFS_SUFFIX := .bin
   DEVICE_DTS_DELIMITER := @
   DEVICE_DTS_CONFIG := config at 1
-  KERNEL_INITRAMFS := kernel-bin | fit none $$(DTS_DIR)/$$(DEVICE_DTS).dtb | \
+  KERNEL_INITRAMFS := kernel-bin | fit none $$(DTB_DIR)/$$(DEVICE_DTS).dtb | \
 	pad-to 10362880
-  KERNEL := kernel-bin | fit none $$(DTS_DIR)/$$(DEVICE_DTS).dtb
+  KERNEL := kernel-bin | fit none $$(DTB_DIR)/$$(DEVICE_DTS).dtb
   IMAGES += sysupgrade.bin
   IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
 
diff --git a/target/linux/imx/image/common.mk b/target/linux/imx/image/common.mk
index 3b528a02b1..1399ef8517 100644
--- a/target/linux/imx/image/common.mk
+++ b/target/linux/imx/image/common.mk
@@ -12,7 +12,7 @@ define Build/imx-combined-image
 
 	$(foreach dts,$(DEVICE_DTS), \
 		$(CP) \
-			$(DTS_DIR)/$(dts).dtb \
+			$(DTB_DIR)/$(dts).dtb \
 			$@.boot/;
 	)
 
diff --git a/target/linux/imx/image/cortexa9.mk b/target/linux/imx/image/cortexa9.mk
index 2edbbaac47..6720576270 100644
--- a/target/linux/imx/image/cortexa9.mk
+++ b/target/linux/imx/image/cortexa9.mk
@@ -11,7 +11,7 @@ define Build/boot-overlay
 
 	$(foreach dts,$(DEVICE_DTS), \
 		$(CP) \
-			$(DTS_DIR)/$(dts).dtb \
+			$(DTB_DIR)/$(dts).dtb \
 			$@.boot/$(IMG_PREFIX)-$(dts).dtb; \
 		ln -sf \
 			$(IMG_PREFIX)-$(dts).dtb \
@@ -58,7 +58,7 @@ define Build/ventana-img
 	$(CP) $(IMAGE_KERNEL) $@.boot/boot/uImage
 	$(foreach dts,$(DEVICE_DTS), \
 		$(CP) \
-			$(DTS_DIR)/$(dts).dtb \
+			$(DTB_DIR)/$(dts).dtb \
 			$@.boot/boot/;
 	)
 	mkimage -A arm -O linux -T script -C none -a 0 -e 0 \
diff --git a/target/linux/layerscape/image/Makefile b/target/linux/layerscape/image/Makefile
index f2ac9b6f04..27d64c81a0 100644
--- a/target/linux/layerscape/image/Makefile
+++ b/target/linux/layerscape/image/Makefile
@@ -20,7 +20,7 @@ LS_SYSUPGRADE_IMAGE_SIZE = 49m
 define Image/Prepare
 	# Build .dtb for all boards we may run on
 	$(foreach dts,$(DEVICE_DTS_LIST),
-		$(call Image/BuildDTB,$(DTS_DIR)/$(dts).dts,$(DTS_DIR)/$(dts).dtb)
+		$(call Image/BuildDTB,$(DTS_DIR)/$(dts).dts,$(DTB_DIR)/$(dts).dtb)
 	)
 endef
 
@@ -33,7 +33,7 @@ define Build/ls-append
 endef
 
 define Build/ls-append-dtb
-	dd if=$(DTS_DIR)/$(1).dtb >> $@
+	dd if=$(DTB_DIR)/$(1).dtb >> $@
 endef
 
 define Build/ls-append-kernel
@@ -59,9 +59,9 @@ define Build/traverse-fit-ls1088
 	-v $(LINUX_VERSION) -k $@ -a $(KERNEL_LOADADDR) \
 	-e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
 	-C gzip -c 1 -c 2 \
-	-d $(DTS_DIR)/freescale/fsl-ls1088a-ten64.dtb \
+	-d $(DTB_DIR)/freescale/fsl-ls1088a-ten64.dtb \
 	-D "TEN64" -n "ten64" -a $(FDT_LOADADDR) -c 1 \
-	-d $(DTS_DIR)/freescale/fsl-ls1088a-rdb.dtb \
+	-d $(DTB_DIR)/freescale/fsl-ls1088a-rdb.dtb \
 	-D "LS1088ARDB" -n "ls1088ardb" -a $(FDT_LOADADDR) -c 2
 	PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new
 	@mv -f $@.new $@
diff --git a/target/linux/layerscape/image/armv7.mk b/target/linux/layerscape/image/armv7.mk
index fe396212e7..9c9ec426a4 100644
--- a/target/linux/layerscape/image/armv7.mk
+++ b/target/linux/layerscape/image/armv7.mk
@@ -7,7 +7,7 @@ define Device/Default
   FILESYSTEMS := squashfs
   IMAGES := firmware.bin sysupgrade.bin
   KERNEL := kernel-bin | uImage none
-  KERNEL_INITRAMFS = kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb
+  KERNEL_INITRAMFS = kernel-bin | gzip | fit gzip $$(DTB_DIR)/$$(DEVICE_DTS).dtb
   KERNEL_NAME := zImage
   KERNEL_LOADADDR := 0x80008000
   DEVICE_DTS = $(lastword $(subst _, ,$(1)))
@@ -20,7 +20,7 @@ define Device/Default
 endef
 
 define Device/fsl-sdboot
-  KERNEL = kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb
+  KERNEL = kernel-bin | gzip | fit gzip $$(DTB_DIR)/$$(DEVICE_DTS).dtb
   IMAGES := sdcard.img.gz sysupgrade.bin
   IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
 endef
diff --git a/target/linux/layerscape/image/armv8_64b.mk b/target/linux/layerscape/image/armv8_64b.mk
index 259bacee31..77ff4984ff 100644
--- a/target/linux/layerscape/image/armv8_64b.mk
+++ b/target/linux/layerscape/image/armv8_64b.mk
@@ -7,7 +7,7 @@ define Device/Default
   IMAGES := firmware.bin sysupgrade.bin
   FILESYSTEMS := squashfs
   KERNEL := kernel-bin | gzip | uImage gzip
-  KERNEL_INITRAMFS = kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb
+  KERNEL_INITRAMFS = kernel-bin | gzip | fit gzip $$(DTB_DIR)/$$(DEVICE_DTS).dtb
   KERNEL_LOADADDR := 0x80000000
   DEVICE_DTS = freescale/$(subst _,-,$(1))
   IMAGE_SIZE := 64m
@@ -19,7 +19,7 @@ define Device/Default
 endef
 
 define Device/fsl-sdboot
-  KERNEL = kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb
+  KERNEL = kernel-bin | gzip | fit gzip $$(DTB_DIR)/$$(DEVICE_DTS).dtb
   IMAGES := sdcard.img.gz sysupgrade.bin
   IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
 endef
@@ -45,7 +45,7 @@ define Device/fsl_ls1012a-frdm
     append-kernel | pad-to $$(BLOCKSIZE) | \
     append-rootfs | pad-rootfs | \
     check-size $(LS_SYSUPGRADE_IMAGE_SIZE) | append-metadata
-  KERNEL := kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb
+  KERNEL := kernel-bin | gzip | fit gzip $$(DTB_DIR)/$$(DEVICE_DTS).dtb
 endef
 TARGET_DEVICES += fsl_ls1012a-frdm
 
@@ -103,7 +103,7 @@ define Device/fsl_ls1028a-rdb
   DEVICE_MODEL := LS1028A-RDB
   DEVICE_VARIANT := Default
   DEVICE_DTS := freescale/fsl-ls1028a-rdb
-  KERNEL = kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb
+  KERNEL = kernel-bin | gzip | fit gzip $$(DTB_DIR)/$$(DEVICE_DTS).dtb
   DEVICE_PACKAGES += \
     trusted-firmware-a-ls1028a-rdb \
     kmod-hwmon-ina2xx \
@@ -440,7 +440,7 @@ define Device/traverse_ten64_mtd
   KERNEL_SUFFIX := -kernel.itb
   DEVICE_DTS := freescale/fsl-ls1088a-ten64
   IMAGES := nand.ubi sysupgrade.bin
-  KERNEL := kernel-bin | gzip | traverse-fit-ls1088 gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb $$(FDT_LOADADDR)
+  KERNEL := kernel-bin | gzip | traverse-fit-ls1088 gzip $$(DTB_DIR)/$$(DEVICE_DTS).dtb $$(FDT_LOADADDR)
   IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
   IMAGE/nand.ubi := append-ubi
   KERNEL_IN_UBI := 1
diff --git a/target/linux/mediatek/image/mt7622.mk b/target/linux/mediatek/image/mt7622.mk
index e362e7428b..755b3d1a49 100644
--- a/target/linux/mediatek/image/mt7622.mk
+++ b/target/linux/mediatek/image/mt7622.mk
@@ -111,8 +111,8 @@ ifeq ($(DUMP),)
   IMAGE_SIZE := $$(shell expr 45 + $$(CONFIG_TARGET_ROOTFS_PARTSIZE))m
 endif
   KERNEL			:= kernel-bin | gzip
-  KERNEL_INITRAMFS		:= kernel-bin | lzma | fit lzma $$(DTS_DIR)/$$(DEVICE_DTS).dtb with-initrd | pad-to 128k
-  IMAGE/sysupgrade.itb		:= append-kernel | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb external-static-with-rootfs | append-metadata
+  KERNEL_INITRAMFS		:= kernel-bin | lzma | fit lzma $$(DTB_DIR)/$$(DEVICE_DTS).dtb with-initrd | pad-to 128k
+  IMAGE/sysupgrade.itb		:= append-kernel | fit gzip $$(DTB_DIR)/$$(DEVICE_DTS).dtb external-static-with-rootfs | append-metadata
   DEVICE_COMPAT_VERSION := 1.1
   DEVICE_COMPAT_MESSAGE := Device tree overlay mechanism needs bootloader update
 endef
diff --git a/target/linux/mediatek/image/mt7623.mk b/target/linux/mediatek/image/mt7623.mk
index 2c4402da66..d9f7d19f53 100644
--- a/target/linux/mediatek/image/mt7623.mk
+++ b/target/linux/mediatek/image/mt7623.mk
@@ -95,11 +95,11 @@ define Device/bananapi_bpi-r2
   IMAGES := sysupgrade.itb
   KERNEL := kernel-bin | gzip
   KERNEL_INITRAMFS_SUFFIX := -recovery.itb
-  KERNEL_INITRAMFS := kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb with-initrd
+  KERNEL_INITRAMFS := kernel-bin | gzip | fit gzip $$(DTB_DIR)/$$(DEVICE_DTS).dtb with-initrd
 ifeq ($(DUMP),)
   IMAGE_SIZE := $$(shell expr 48 + $$(CONFIG_TARGET_ROOTFS_PARTSIZE))m
 endif
-  IMAGE/sysupgrade.itb := append-kernel | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb external-static-with-rootfs | append-metadata
+  IMAGE/sysupgrade.itb := append-kernel | fit gzip $$(DTB_DIR)/$$(DEVICE_DTS).dtb external-static-with-rootfs | append-metadata
   ARTIFACT/preloader.bin := mt7623-mbr emmc |\
 			    pad-to 2k | append-preloader $$(UBOOT_TARGET)
   ARTIFACT/u-boot.bin := append-uboot
diff --git a/target/linux/mxs/image/Makefile b/target/linux/mxs/image/Makefile
index f1847dec1e..620765c2ed 100644
--- a/target/linux/mxs/image/Makefile
+++ b/target/linux/mxs/image/Makefile
@@ -22,7 +22,7 @@ define Build/mxs-sdcard-vfat-ext4
 	rm -f $@.boot
 	mkfs.fat $@.boot -C $(FAT32_BLOCKS)
 
-	mcopy -i $@.boot $(DTS_DIR)/$(DEVICE_DTS).dtb ::$(DEVICE_DTS).dtb
+	mcopy -i $@.boot $(DTB_DIR)/$(DEVICE_DTS).dtb ::$(DEVICE_DTS).dtb
 	mcopy -i $@.boot $(IMAGE_KERNEL) ::uImage
 
 	./gen_sdcard_vfat_ext4.sh \
diff --git a/target/linux/omap/image/Makefile b/target/linux/omap/image/Makefile
index 507c91b2cc..44796c6eff 100644
--- a/target/linux/omap/image/Makefile
+++ b/target/linux/omap/image/Makefile
@@ -19,7 +19,7 @@ define Build/omap-sdcard
 	mcopy -i $@.boot $(STAGING_DIR_IMAGE)/$(DEVICE_NAME)/u-boot.img ::u-boot.img
 	mcopy -i $@.boot $(STAGING_DIR_IMAGE)/$(DEVICE_NAME)/boot.scr ::boot.scr
 	mmd -i $@.boot ::/dtbs
-	mcopy -i $@.boot $(DTS_DIR)/$(DEVICE_DTS).dtb ::/dtbs/$(DEVICE_DTS).dtb
+	mcopy -i $@.boot $(DTB_DIR)/$(DEVICE_DTS).dtb ::/dtbs/$(DEVICE_DTS).dtb
 	mcopy -i $@.boot $(IMAGE_KERNEL) ::/zImage
 	./gen_omap_sdcard_img.sh $@ \
 		$@.boot \
diff --git a/target/linux/pistachio/image/Makefile b/target/linux/pistachio/image/Makefile
index 64898b46e0..8f6c82799a 100644
--- a/target/linux/pistachio/image/Makefile
+++ b/target/linux/pistachio/image/Makefile
@@ -11,7 +11,7 @@ define Device/Default
   PROFILES := Default
   FILESYSTEMS := squashfs
   KERNEL_DEPENDS = $$(wildcard $$(DTS_DIR)/$$(DEVICE_DTS).dts)
-  KERNEL = kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb
+  KERNEL = kernel-bin | gzip | fit gzip $$(DTB_DIR)/$$(DEVICE_DTS).dtb
   KERNEL_SUFFIX := -kernel.itb
   KERNEL_INSTALL := 1
   KERNEL_IN_UBI := 1
diff --git a/target/linux/rockchip/image/Makefile b/target/linux/rockchip/image/Makefile
index 3b118201b6..e7fe7178a6 100644
--- a/target/linux/rockchip/image/Makefile
+++ b/target/linux/rockchip/image/Makefile
@@ -47,7 +47,7 @@ endef
 ### Devices ###
 define Device/Default
   PROFILES := Default
-  KERNEL = kernel-bin | lzma | fit lzma $$(DTS_DIR)/$$(DEVICE_DTS).dtb
+  KERNEL = kernel-bin | lzma | fit lzma $$(DTB_DIR)/$$(DEVICE_DTS).dtb
   IMAGES := sysupgrade.img.gz
   DEVICE_DTS = rockchip/$$(SOC)-$(lastword $(subst _, ,$(1)))
   UBOOT_DEVICE_NAME = $(lastword $(subst _, ,$(1)))-$$(SOC)
diff --git a/target/linux/sifiveu/image/Makefile b/target/linux/sifiveu/image/Makefile
index ef3b13eeec..86839c3118 100644
--- a/target/linux/sifiveu/image/Makefile
+++ b/target/linux/sifiveu/image/Makefile
@@ -15,7 +15,7 @@ define Build/riscv-sdcard
 	mkfs.fat $@.boot  -C $(FAT32_BLOCKS)
 
 	mcopy -i $@.boot $(STAGING_DIR_IMAGE)/$(DEVICE_NAME)-boot.scr ::boot.scr
-	mcopy -i $@.boot $(DTS_DIR)/$(DEVICE_DTS).dtb ::dtb
+	mcopy -i $@.boot $(DTB_DIR)/$(DEVICE_DTS).dtb ::dtb
 	mcopy -i $@.boot $(IMAGE_KERNEL) ::Image
 
 	./gen_sifiveu_sdcard_img.sh \
diff --git a/target/linux/sunxi/image/Makefile b/target/linux/sunxi/image/Makefile
index 738585accc..8dd98cd7af 100644
--- a/target/linux/sunxi/image/Makefile
+++ b/target/linux/sunxi/image/Makefile
@@ -17,7 +17,7 @@ define Build/sunxi-sdcard
 	mkfs.fat $@.boot -C $(FAT32_BLOCKS)
 
 	mcopy -i $@.boot $(STAGING_DIR_IMAGE)/$(DEVICE_NAME)-boot.scr ::boot.scr
-	mcopy -i $@.boot $(DTS_DIR)/$(SUNXI_DTS).dtb ::dtb
+	mcopy -i $@.boot $(DTB_DIR)/$(SUNXI_DTS).dtb ::dtb
 	mcopy -i $@.boot $(IMAGE_KERNEL) ::uImage
 	./gen_sunxi_sdcard_img.sh $@ \
 		$@.boot \
diff --git a/target/linux/tegra/image/Makefile b/target/linux/tegra/image/Makefile
index 82394f4ab6..a304a6ef07 100644
--- a/target/linux/tegra/image/Makefile
+++ b/target/linux/tegra/image/Makefile
@@ -10,8 +10,8 @@ define Build/tegra-sdcard
 	mkdir -p $@.boot
 	$(CP) $(KDIR)/$(KERNEL_NAME) $@.boot
 	$(if $(DEVICE_DTS),\
-		$(foreach dtb,$(DEVICE_DTS),$(CP) $(DTS_DIR)/$(dtb).dtb $@.boot), \
-		$(CP) $(DTS_DIR)/*.dtb $@.boot)
+		$(foreach dtb,$(DEVICE_DTS),$(CP) $(DTB_DIR)/$(dtb).dtb $@.boot), \
+		$(CP) $(DTB_DIR)/*.dtb $@.boot)
 	mkimage -A arm -O linux -T script -C none -a 0 -e 0 \
 		-n '$(DEVICE_TITLE) OpenWrt bootscript' \
 		-d $(BOOT_SCRIPT) \
diff --git a/target/linux/zynq/image/Makefile b/target/linux/zynq/image/Makefile
index 0931871624..3150072954 100644
--- a/target/linux/zynq/image/Makefile
+++ b/target/linux/zynq/image/Makefile
@@ -38,7 +38,7 @@ endef
 
 define Device/FitImageGzip
 	KERNEL_SUFFIX := -fit-uImage.itb
-	KERNEL = kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb
+	KERNEL = kernel-bin | gzip | fit gzip $$(DTB_DIR)/$$(DEVICE_DTS).dtb
 	KERNEL_NAME := Image
 endef
 
-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |       ehem+openwrt at m5p.com     PGP 87145445       |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445





From ehem+openwrt at m5p.com  Sat Nov 11 22:51:08 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Sat, 11 Nov 2023 22:51:08 -0800
Subject: [PATCH 10/20] [WIP] build: use dtc from $(LINUX_OBJ_DIR)
In-Reply-To: <cover.1700010286.git.ehem+openwrt@m5p.com>
References: <cover.1700010286.git.ehem+openwrt@m5p.com>
Message-ID: <f7d3a474b1300823915f9c7ef7e6d91e9de1d29f.1700010292.git.ehem+openwrt@m5p.com>

As an executable built from source, the Device-Tree Compiler lives
in the object directory.  Update references to point there.

Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>
---
 include/image-commands.mk                   |  6 +++---
 include/image.mk                            |  2 +-
 include/trusted-firmware-a.mk               |  2 +-
 include/u-boot.mk                           |  2 +-
 package/firmware/layerscape/ls-dpl/Makefile |  2 +-
 target/imagebuilder/Makefile                | 10 +++++-----
 target/linux/bcm4908/image/Makefile         |  6 +++---
 target/linux/ipq40xx/image/generic.mk       |  2 +-
 target/linux/layerscape/image/Makefile      |  2 +-
 target/linux/mediatek/image/filogic.mk      |  2 +-
 target/linux/ramips/image/mt7621.mk         |  2 +-
 11 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/include/image-commands.mk b/include/image-commands.mk
index d07c882761..b90881d001 100644
--- a/include/image-commands.mk
+++ b/include/image-commands.mk
@@ -315,7 +315,7 @@ define Build/fit
 		$(if $(DEVICE_DTS_OVERLAY),$(foreach dtso,$(DEVICE_DTS_OVERLAY), -O $(dtso):$(KERNEL_BUILD_DIR)/image-$(dtso).dtbo)) \
 		-c $(if $(DEVICE_DTS_CONFIG),$(DEVICE_DTS_CONFIG),"config-1") \
 		-A $(LINUX_KARCH) -v $(LINUX_VERSION)
-	PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage $(if $(findstring external,$(word 3,$(1))),\
+	PATH=$(LINUX_OBJ_DIR)/scripts/dtc:$(PATH) mkimage $(if $(findstring external,$(word 3,$(1))),\
 		-E -B 0x1000 $(if $(findstring static,$(word 3,$(1))),-p 0x1000)) -f $@.its $@.new
 	@mv $@.new $@
 endef
@@ -501,14 +501,14 @@ endef
 define Build/qsdk-ipq-factory-nand
 	$(TOPDIR)/scripts/mkits-qsdk-ipq-image.sh \
 		$@.its ubi $@
-	PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new
+	PATH=$(LINUX_OBJ_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new
 	@mv $@.new $@
 endef
 
 define Build/qsdk-ipq-factory-nor
 	$(TOPDIR)/scripts/mkits-qsdk-ipq-image.sh \
 		$@.its hlos $(IMAGE_KERNEL) rootfs $(IMAGE_ROOTFS)
-	PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new
+	PATH=$(LINUX_OBJ_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new
 	@mv $@.new $@
 endef
 
diff --git a/include/image.mk b/include/image.mk
index 635fad3584..794b32387d 100644
--- a/include/image.mk
+++ b/include/image.mk
@@ -190,7 +190,7 @@ define Image/BuildDTB/sub
 		-I$(LINUX_DIR)/include/ \
 		-undef -D__DTS__ $(3) \
 		-o $(2).tmp $(1)
-	$(LINUX_DIR)/scripts/dtc/dtc -O dtb \
+	$(LINUX_OBJ_DIR)/scripts/dtc/dtc -O dtb \
 		-i$(dir $(1)) $(4) \
 	$(if $(CONFIG_HAS_DT_OVERLAY_SUPPORT),-@) \
 		-o $(2) $(2).tmp
diff --git a/include/trusted-firmware-a.mk b/include/trusted-firmware-a.mk
index 0c0118e092..60acc5b255 100644
--- a/include/trusted-firmware-a.mk
+++ b/include/trusted-firmware-a.mk
@@ -72,7 +72,7 @@ define Build/Configure/Trusted-Firmware-A
 	$(INSTALL_DIR) $(STAGING_DIR)/usr/include
 endef
 
-DTC=$(wildcard $(LINUX_DIR)/scripts/dtc/dtc)
+DTC=$(wildcard $(LINUX_OBJ_DIR)/scripts/dtc/dtc)
 
 define Build/Compile/Trusted-Firmware-A
 	+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
diff --git a/include/u-boot.mk b/include/u-boot.mk
index 2b8106410f..8269e6c0ff 100644
--- a/include/u-boot.mk
+++ b/include/u-boot.mk
@@ -88,7 +88,7 @@ define Build/Configure/U-Boot
 		+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(UBOOT_CONFIGURE_VARS) oldconfig)
 endef
 
-DTC=$(wildcard $(LINUX_DIR)/scripts/dtc/dtc)
+DTC=$(wildcard $(LINUX_OBJ_DIR)/scripts/dtc/dtc)
 
 define Build/Compile/U-Boot
 	+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
diff --git a/package/firmware/layerscape/ls-dpl/Makefile b/package/firmware/layerscape/ls-dpl/Makefile
index 6c53b45417..5ef802e4f2 100644
--- a/package/firmware/layerscape/ls-dpl/Makefile
+++ b/package/firmware/layerscape/ls-dpl/Makefile
@@ -30,7 +30,7 @@ endef
 
 MAKE_PATH:=config
 MAKE_VARS+= \
-	PATH=$(LINUX_DIR)/scripts/dtc:$(PATH)
+	PATH=$(LINUX_OBJ_DIR)/scripts/dtc:$(PATH)
 
 define Build/InstallDev
 	$(INSTALL_DIR) $(STAGING_DIR_IMAGE)
diff --git a/target/imagebuilder/Makefile b/target/imagebuilder/Makefile
index 3bbadc7204..59698d868c 100644
--- a/target/imagebuilder/Makefile
+++ b/target/imagebuilder/Makefile
@@ -16,7 +16,7 @@ IB_NAME:=$(VERSION_DIST_SANITIZED)-imagebuilder-$(if $(CONFIG_VERSION_FILENAMES)
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(IB_NAME)
 IB_KDIR:=$(patsubst $(TOPDIR)/%,$(PKG_BUILD_DIR)/%,$(KERNEL_BUILD_DIR))
 IB_LDIR:=$(patsubst $(TOPDIR)/%,$(PKG_BUILD_DIR)/%,$(LINUX_DIR))
-IB_DTSDIR:=$(patsubst $(TOPDIR)/%,$(PKG_BUILD_DIR)/%,$(LINUX_DIR))/arch/$(LINUX_KARCH)/boot/dts/
+IB_DTSDIR:=$(patsubst $(TOPDIR)/%,$(PKG_BUILD_DIR)/%,$(LINUX_SRC_DIR))/arch/$(LINUX_KARCH)/boot/dts/
 IB_IDIR:=$(patsubst $(TOPDIR)/%,$(PKG_BUILD_DIR)/%,$(STAGING_DIR_IMAGE))
 
 BUNDLER_PATH := $(subst $(space),:,$(filter-out $(TOPDIR)/%,$(subst :,$(space),$(PATH))))
@@ -90,12 +90,12 @@ endif
 	-cp $(LINUX_DIR)/.config $(IB_LDIR)/
 	rm -f $(IB_KDIR)/root.*
 	rm -f $(IB_KDIR)/vmlinux.debug
-	if [ -x $(LINUX_DIR)/scripts/dtc/dtc ]; then \
+	if [ -x $(LINUX_OBJ_DIR)/scripts/dtc/dtc ]; then \
 		$(INSTALL_DIR) $(IB_LDIR)/scripts/dtc; \
-		$(INSTALL_BIN) $(LINUX_DIR)/scripts/dtc/dtc $(IB_LDIR)/scripts/dtc/dtc; \
+		$(INSTALL_BIN) $(LINUX_OBJ_DIR)/scripts/dtc/dtc $(IB_LDIR)/scripts/dtc/dtc; \
 	fi
-	if [ -d $(LINUX_DIR)/arch/$(LINUX_KARCH)/boot/dts ]; then \
-		$(CP) -L $(LINUX_DIR)/arch/$(LINUX_KARCH)/boot/dts/* $(IB_DTSDIR); \
+	if [ -d $(LINUX_SRC_DIR)/arch/$(LINUX_KARCH)/boot/dts ]; then \
+		$(CP) -L $(LINUX_SRC_DIR)/arch/$(LINUX_KARCH)/boot/dts/* $(IB_DTSDIR); \
 	fi
 	$(SED) 's,^# REVISION:=.*,REVISION:=$(REVISION),g' $(PKG_BUILD_DIR)/include/version.mk
 	$(SED) 's,^# SOURCE_DATE_EPOCH:=.*,SOURCE_DATE_EPOCH:=$(SOURCE_DATE_EPOCH),g' $(PKG_BUILD_DIR)/include/version.mk
diff --git a/target/linux/bcm4908/image/Makefile b/target/linux/bcm4908/image/Makefile
index 5d113919e8..87a3a6cb2e 100644
--- a/target/linux/bcm4908/image/Makefile
+++ b/target/linux/bcm4908/image/Makefile
@@ -17,8 +17,8 @@ define Build/bootfs
 	cat $@ | $(STAGING_DIR_HOST)/bin/lzma e -eos -si -so > $@.tmp
 	mv $@.tmp $@
 	sed -i "s=\$${kernel}=$@=" $(KDIR)/bootfs*.its*
-	PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $(KDIR)/bootfs-bcm4908.its $(KDIR)/bootfs-bcm4908.itb
-	PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $(KDIR)/bootfs-bcm4912.its $(KDIR)/bootfs-bcm4912.itb
+	PATH=$(LINUX_OBJ_DIR)/scripts/dtc:$(PATH) mkimage -f $(KDIR)/bootfs-bcm4908.its $(KDIR)/bootfs-bcm4908.itb
+	PATH=$(LINUX_OBJ_DIR)/scripts/dtc:$(PATH) mkimage -f $(KDIR)/bootfs-bcm4912.its $(KDIR)/bootfs-bcm4912.itb
 endef
 
 define Build/bcm4908asus
@@ -58,7 +58,7 @@ define Build/pkgtb
 	cp pkgtb-$(SOC).its $@.its
 	sed -i "s=\$${bootfs}=$(KDIR)/bootfs-$(SOC).itb=" $@.its
 	sed -i "s=\$${rootfs}=$@.rootfs=" $@.its
-	PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@
+	PATH=$(LINUX_OBJ_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@
 endef
 
 define Device/Default
diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk
index d79fda3156..2fe3371a6b 100644
--- a/target/linux/ipq40xx/image/generic.mk
+++ b/target/linux/ipq40xx/image/generic.mk
@@ -93,7 +93,7 @@ define Build/qsdk-ipq-factory-nand-askey
 		askey_kernel $@.$1 \
 		askey_fs $(IMAGE_ROOTFS) \
 		ubifs $@
-	PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new
+	PATH=$(LINUX_OBJ_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new
 	@mv $@.new $@
 endef
 
diff --git a/target/linux/layerscape/image/Makefile b/target/linux/layerscape/image/Makefile
index 27d64c81a0..f8525a1619 100644
--- a/target/linux/layerscape/image/Makefile
+++ b/target/linux/layerscape/image/Makefile
@@ -63,7 +63,7 @@ define Build/traverse-fit-ls1088
 	-D "TEN64" -n "ten64" -a $(FDT_LOADADDR) -c 1 \
 	-d $(DTB_DIR)/freescale/fsl-ls1088a-rdb.dtb \
 	-D "LS1088ARDB" -n "ls1088ardb" -a $(FDT_LOADADDR) -c 2
-	PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new
+	PATH=$(LINUX_OBJ_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new
 	@mv -f $@.new $@
 endef
 
diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk
index 0ef3e94575..9d3225f59f 100644
--- a/target/linux/mediatek/image/filogic.mk
+++ b/target/linux/mediatek/image/filogic.mk
@@ -86,7 +86,7 @@ endef
 define Build/zyxel-nwa-fit-filogic
 	$(TOPDIR)/scripts/mkits-zyxel-fit-filogic.sh \
 		$@.its $@ "80 e1 ff ff ff ff ff ff ff ff"
-	PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new
+	PATH=$(LINUX_OBJ_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new
 	@mv $@.new $@
 endef
 
diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
index 3dd6574bf1..ed6933ff70 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -170,7 +170,7 @@ endef
 define Build/zyxel-nwa-fit
 	$(TOPDIR)/scripts/mkits-zyxel-fit.sh \
 		$@.its $@ "6b e1 6f e1 ff ff ff ff ff ff"
-	PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new
+	PATH=$(LINUX_OBJ_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new
 	@mv $@.new $@
 endef
 
-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |       ehem+openwrt at m5p.com     PGP 87145445       |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445





From ehem+openwrt at m5p.com  Sat Nov 11 22:51:08 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Sat, 11 Nov 2023 22:51:08 -0800
Subject: [PATCH 11/20] [WIP] package/target: update to get modules from
 $(LINUX_OBJ_DIR)
In-Reply-To: <cover.1700010286.git.ehem+openwrt@m5p.com>
References: <cover.1700010286.git.ehem+openwrt@m5p.com>
Message-ID: <652e94875c4be20b04855917a9f8b556cd59c71f.1700010292.git.ehem+openwrt@m5p.com>

Modules built from kernel source will now be in $(LINUX_OBJ_DIR).

Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>
---
 package/kernel/linux/modules/block.mk        | 106 +++----
 package/kernel/linux/modules/can.mk          |  36 +--
 package/kernel/linux/modules/crypto.mk       | 252 ++++++++--------
 package/kernel/linux/modules/firewire.mk     |   8 +-
 package/kernel/linux/modules/fs.mk           | 100 +++----
 package/kernel/linux/modules/gpio-cascade.mk |   2 +-
 package/kernel/linux/modules/hwmon.mk        |  98 +++----
 package/kernel/linux/modules/i2c.mk          |   2 +-
 package/kernel/linux/modules/iio.mk          |  80 +++---
 package/kernel/linux/modules/input.mk        |  26 +-
 package/kernel/linux/modules/leds.mk         |  20 +-
 package/kernel/linux/modules/lib.mk          |  76 ++---
 package/kernel/linux/modules/multiplexer.mk  |   4 +-
 package/kernel/linux/modules/netdevices.mk   | 214 +++++++-------
 package/kernel/linux/modules/netfilter.mk    | 168 +++++------
 package/kernel/linux/modules/netsupport.mk   | 204 ++++++-------
 package/kernel/linux/modules/nls.mk          |  44 +--
 package/kernel/linux/modules/other.mk        | 202 ++++++-------
 package/kernel/linux/modules/pcmcia.mk       |  14 +-
 package/kernel/linux/modules/sound.mk        |  98 +++----
 package/kernel/linux/modules/spi.mk          |  10 +-
 package/kernel/linux/modules/usb.mk          | 288 +++++++++----------
 package/kernel/linux/modules/video.mk        | 168 +++++------
 package/kernel/linux/modules/virt.mk         |  24 +-
 package/kernel/linux/modules/w1.mk           |   2 +-
 package/kernel/linux/modules/wpan.mk         |  20 +-
 target/linux/apm821xx/modules.mk             |   4 +-
 target/linux/armsr/modules.mk                |  80 +++---
 target/linux/at91/modules.mk                 |  18 +-
 target/linux/ath79/modules.mk                |   2 +-
 target/linux/bcm27xx/modules/hwmon.mk        |   2 +-
 target/linux/bcm27xx/modules/other.mk        |   6 +-
 target/linux/bcm27xx/modules/sound.mk        | 206 ++++++-------
 target/linux/bcm27xx/modules/spi.mk          |   4 +-
 target/linux/bcm27xx/modules/video.mk        |  16 +-
 target/linux/bcm47xx/modules.mk              |   6 +-
 target/linux/bcm53xx/modules.mk              |   6 +-
 target/linux/bcm63xx/modules.mk              |   4 +-
 target/linux/bmips/modules.mk                |   6 +-
 target/linux/gemini/modules.mk               |   2 +-
 target/linux/ipq806x/modules.mk              |  14 +-
 target/linux/kirkwood/modules.mk             |   4 +-
 target/linux/layerscape/modules.mk           |   4 +-
 target/linux/mediatek/modules.mk             |   8 +-
 target/linux/mvebu/modules.mk                |   4 +-
 target/linux/oxnas/modules.mk                |   4 +-
 target/linux/ramips/modules.mk               |  20 +-
 target/linux/sunxi/modules.mk                |  16 +-
 target/linux/x86/modules.mk                  |  22 +-
 49 files changed, 1362 insertions(+), 1362 deletions(-)

diff --git a/package/kernel/linux/modules/block.mk b/package/kernel/linux/modules/block.mk
index 5e6eefa76a..efe87a879f 100644
--- a/package/kernel/linux/modules/block.mk
+++ b/package/kernel/linux/modules/block.mk
@@ -11,7 +11,7 @@ define KernelPackage/aoe
   SUBMENU:=$(BLOCK_MENU)
   TITLE:=ATA over Ethernet support
   KCONFIG:=CONFIG_ATA_OVER_ETH
-  FILES:=$(LINUX_DIR)/drivers/block/aoe/aoe.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/block/aoe/aoe.ko
   AUTOLOAD:=$(call AutoLoad,30,aoe)
 endef
 
@@ -27,9 +27,9 @@ define KernelPackage/ata-core
   TITLE:=Serial and Parallel ATA support
   DEPENDS:=@PCI_SUPPORT||TARGET_sunxi +kmod-scsi-core
   KCONFIG:=CONFIG_ATA
-  FILES:=$(LINUX_DIR)/drivers/ata/libata.ko
-ifneq ($(wildcard $(LINUX_DIR)/drivers/ata/libahci.ko),)
-  FILES+=$(LINUX_DIR)/drivers/ata/libahci.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/ata/libata.ko
+ifneq ($(wildcard $(LINUX_OBJ_DIR)/drivers/ata/libahci.ko),)
+  FILES+=$(LINUX_OBJ_DIR)/drivers/ata/libahci.ko
 endif
 endef
 
@@ -46,7 +46,7 @@ define KernelPackage/ata-ahci
   TITLE:=AHCI Serial ATA support
   KCONFIG:=CONFIG_SATA_AHCI
   FILES:= \
-    $(LINUX_DIR)/drivers/ata/ahci.ko
+    $(LINUX_OBJ_DIR)/drivers/ata/ahci.ko
   AUTOLOAD:=$(call AutoLoad,41,libahci ahci,1)
   $(call AddDepends/ata)
 endef
@@ -62,8 +62,8 @@ define KernelPackage/ata-ahci-platform
   TITLE:=AHCI Serial ATA Platform support
   KCONFIG:=CONFIG_SATA_AHCI_PLATFORM
   FILES:= \
-    $(LINUX_DIR)/drivers/ata/ahci_platform.ko \
-    $(LINUX_DIR)/drivers/ata/libahci_platform.ko
+    $(LINUX_OBJ_DIR)/drivers/ata/ahci_platform.ko \
+    $(LINUX_OBJ_DIR)/drivers/ata/libahci_platform.ko
   AUTOLOAD:=$(call AutoLoad,40,libahci libahci_platform ahci_platform,1)
   $(call AddDepends/ata, at TARGET_ipq806x||TARGET_layerscape||TARGET_sunxi)
 endef
@@ -78,7 +78,7 @@ $(eval $(call KernelPackage,ata-ahci-platform))
 define KernelPackage/ata-artop
   TITLE:=ARTOP 6210/6260 PATA support
   KCONFIG:=CONFIG_PATA_ARTOP
-  FILES:=$(LINUX_DIR)/drivers/ata/pata_artop.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/ata/pata_artop.ko
   AUTOLOAD:=$(call AutoLoad,41,pata_artop,1)
   $(call AddDepends/ata)
 endef
@@ -93,7 +93,7 @@ $(eval $(call KernelPackage,ata-artop))
 define KernelPackage/ata-nvidia-sata
   TITLE:=Nvidia Serial ATA support
   KCONFIG:=CONFIG_SATA_NV
-  FILES:=$(LINUX_DIR)/drivers/ata/sata_nv.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/ata/sata_nv.ko
   AUTOLOAD:=$(call AutoLoad,41,sata_nv,1)
   $(call AddDepends/ata)
 endef
@@ -106,7 +106,7 @@ define KernelPackage/ata-pdc202xx-old
   KCONFIG:= \
        CONFIG_ATA_SFF=y \
        CONFIG_PATA_PDC_OLD
-  FILES:=$(LINUX_DIR)/drivers/ata/pata_pdc202xx_old.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/ata/pata_pdc202xx_old.ko
   AUTOLOAD:=$(call AutoLoad,41,pata_pdc202xx_old,1)
   $(call AddDepends/ata)
 endef
@@ -122,7 +122,7 @@ $(eval $(call KernelPackage,ata-pdc202xx-old))
 define KernelPackage/ata-piix
   TITLE:=Intel PIIX PATA/SATA support
   KCONFIG:=CONFIG_ATA_PIIX
-  FILES:=$(LINUX_DIR)/drivers/ata/ata_piix.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/ata/ata_piix.ko
   AUTOLOAD:=$(call AutoLoad,41,ata_piix,1)
   $(call AddDepends/ata)
 endef
@@ -138,7 +138,7 @@ $(eval $(call KernelPackage,ata-piix))
 define KernelPackage/ata-sil
   TITLE:=Silicon Image SATA support
   KCONFIG:=CONFIG_SATA_SIL
-  FILES:=$(LINUX_DIR)/drivers/ata/sata_sil.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/ata/sata_sil.ko
   AUTOLOAD:=$(call AutoLoad,41,sata_sil,1)
   $(call AddDepends/ata)
 endef
@@ -153,7 +153,7 @@ $(eval $(call KernelPackage,ata-sil))
 define KernelPackage/ata-sil24
   TITLE:=Silicon Image 3124/3132 SATA support
   KCONFIG:=CONFIG_SATA_SIL24
-  FILES:=$(LINUX_DIR)/drivers/ata/sata_sil24.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/ata/sata_sil24.ko
   AUTOLOAD:=$(call AutoLoad,41,sata_sil24,1)
   $(call AddDepends/ata)
 endef
@@ -168,7 +168,7 @@ $(eval $(call KernelPackage,ata-sil24))
 define KernelPackage/ata-via-sata
   TITLE:=VIA SATA support
   KCONFIG:=CONFIG_SATA_VIA
-  FILES:=$(LINUX_DIR)/drivers/ata/sata_via.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/ata/sata_via.ko
   AUTOLOAD:=$(call AutoLoad,41,sata_via,1)
   $(call AddDepends/ata)
 endef
@@ -184,7 +184,7 @@ define KernelPackage/block2mtd
   SUBMENU:=$(BLOCK_MENU)
   TITLE:=Block device MTD emulation
   KCONFIG:=CONFIG_MTD_BLOCK2MTD
-  FILES:=$(LINUX_DIR)/drivers/mtd/devices/block2mtd.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/mtd/devices/block2mtd.ko
 endef
 
 $(eval $(call KernelPackage,block2mtd))
@@ -194,7 +194,7 @@ define KernelPackage/dax
   SUBMENU:=$(BLOCK_MENU)
   TITLE:=DAX: direct access to differentiated memory
   KCONFIG:=CONFIG_DAX
-  FILES:=$(LINUX_DIR)/drivers/dax/dax.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/dax/dax.ko
 endef
 
 $(eval $(call KernelPackage,dax))
@@ -223,11 +223,11 @@ define KernelPackage/dm
 	CONFIG_DM_CRYPT \
 	CONFIG_DM_MIRROR
   FILES:= \
-    $(LINUX_DIR)/drivers/md/dm-mod.ko \
-    $(LINUX_DIR)/drivers/md/dm-crypt.ko \
-    $(LINUX_DIR)/drivers/md/dm-log.ko \
-    $(LINUX_DIR)/drivers/md/dm-mirror.ko \
-    $(LINUX_DIR)/drivers/md/dm-region-hash.ko
+    $(LINUX_OBJ_DIR)/drivers/md/dm-mod.ko \
+    $(LINUX_OBJ_DIR)/drivers/md/dm-crypt.ko \
+    $(LINUX_OBJ_DIR)/drivers/md/dm-log.ko \
+    $(LINUX_OBJ_DIR)/drivers/md/dm-mirror.ko \
+    $(LINUX_OBJ_DIR)/drivers/md/dm-region-hash.ko
   AUTOLOAD:=$(call AutoLoad,30,dm-mod dm-log dm-region-hash dm-mirror dm-crypt,1)
 endef
 
@@ -244,7 +244,7 @@ define KernelPackage/dm-raid
            +kmod-md-raid0 +kmod-md-raid1 +kmod-md-raid10 +kmod-md-raid456
   KCONFIG:= \
 	CONFIG_DM_RAID
-  FILES:=$(LINUX_DIR)/drivers/md/dm-raid.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/md/dm-raid.ko
   AUTOLOAD:=$(call AutoLoad,31,dm-raid)
 endef
 
@@ -265,10 +265,10 @@ define KernelPackage/iscsi-initiator
 	CONFIG_ISCSI_TCP \
 	CONFIG_SCSI_ISCSI_ATTRS=y
   FILES:= \
-	$(LINUX_DIR)/drivers/scsi/iscsi_tcp.ko \
-	$(LINUX_DIR)/drivers/scsi/libiscsi.ko \
-	$(LINUX_DIR)/drivers/scsi/libiscsi_tcp.ko \
-	$(LINUX_DIR)/drivers/scsi/scsi_transport_iscsi.ko
+	$(LINUX_OBJ_DIR)/drivers/scsi/iscsi_tcp.ko \
+	$(LINUX_OBJ_DIR)/drivers/scsi/libiscsi.ko \
+	$(LINUX_OBJ_DIR)/drivers/scsi/libiscsi_tcp.ko \
+	$(LINUX_OBJ_DIR)/drivers/scsi/scsi_transport_iscsi.ko
   AUTOLOAD:=$(call AutoProbe,libiscsi libiscsi_tcp scsi_transport_iscsi iscsi_tcp)
 endef
 
@@ -289,7 +289,7 @@ define KernelPackage/md-mod
        CONFIG_BLK_DEV_MD=m \
        CONFIG_MD_AUTODETECT=y \
        CONFIG_MD_FAULTY=n
-  FILES:=$(LINUX_DIR)/drivers/md/md-mod.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/md/md-mod.ko
   AUTOLOAD:=$(call AutoLoad,27,md-mod)
 endef
 
@@ -311,7 +311,7 @@ define KernelPackage/md-linear
 $(call KernelPackage/md/Depends,)
   TITLE:=RAID Linear Module
   KCONFIG:=CONFIG_MD_LINEAR
-  FILES:=$(LINUX_DIR)/drivers/md/linear.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/md/linear.ko
   AUTOLOAD:=$(call AutoLoad,28,linear)
 endef
 
@@ -326,7 +326,7 @@ define KernelPackage/md-raid0
 $(call KernelPackage/md/Depends,)
   TITLE:=RAID0 Module
   KCONFIG:=CONFIG_MD_RAID0
-  FILES:=$(LINUX_DIR)/drivers/md/raid0.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/md/raid0.ko
   AUTOLOAD:=$(call AutoLoad,28,raid0)
 endef
 
@@ -341,7 +341,7 @@ define KernelPackage/md-raid1
 $(call KernelPackage/md/Depends,)
   TITLE:=RAID1 Module
   KCONFIG:=CONFIG_MD_RAID1
-  FILES:=$(LINUX_DIR)/drivers/md/raid1.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/md/raid1.ko
   AUTOLOAD:=$(call AutoLoad,28,raid1)
 endef
 
@@ -356,7 +356,7 @@ define KernelPackage/md-raid10
 $(call KernelPackage/md/Depends,)
   TITLE:=RAID10 Module
   KCONFIG:=CONFIG_MD_RAID10
-  FILES:=$(LINUX_DIR)/drivers/md/raid10.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/md/raid10.ko
   AUTOLOAD:=$(call AutoLoad,28,raid10)
 endef
 
@@ -380,12 +380,12 @@ $(call KernelPackage/md/Depends,+kmod-lib-raid6 +kmod-lib-xor +kmod-lib-crc32c)
        CONFIG_MD_RAID456 \
        CONFIG_MULTICORE_RAID456=n
   FILES:= \
-	$(LINUX_DIR)/crypto/async_tx/async_tx.ko \
-	$(LINUX_DIR)/crypto/async_tx/async_memcpy.ko \
-	$(LINUX_DIR)/crypto/async_tx/async_xor.ko \
-	$(LINUX_DIR)/crypto/async_tx/async_pq.ko \
-	$(LINUX_DIR)/crypto/async_tx/async_raid6_recov.ko \
-	$(LINUX_DIR)/drivers/md/raid456.ko
+	$(LINUX_OBJ_DIR)/crypto/async_tx/async_tx.ko \
+	$(LINUX_OBJ_DIR)/crypto/async_tx/async_memcpy.ko \
+	$(LINUX_OBJ_DIR)/crypto/async_tx/async_xor.ko \
+	$(LINUX_OBJ_DIR)/crypto/async_tx/async_pq.ko \
+	$(LINUX_OBJ_DIR)/crypto/async_tx/async_raid6_recov.ko \
+	$(LINUX_OBJ_DIR)/drivers/md/raid456.ko
   AUTOLOAD:=$(call AutoLoad,28, async_tx async_memcpy async_xor async_pq async_raid6_recov raid456)
 endef
 
@@ -410,7 +410,7 @@ define KernelPackage/md-multipath
 $(call KernelPackage/md/Depends,)
   TITLE:=MD Multipath Module
   KCONFIG:=CONFIG_MD_MULTIPATH
-  FILES:=$(LINUX_DIR)/drivers/md/multipath.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/md/multipath.ko
   AUTOLOAD:=$(call AutoLoad,29,multipath)
 endef
 
@@ -431,8 +431,8 @@ define KernelPackage/libsas
 	CONFIG_SCSI_SAS_HOST_SMP=y \
 	CONFIG_SCSI_SAS_LIBSAS_DEBUG=y
   FILES:= \
-	$(LINUX_DIR)/drivers/scsi/scsi_transport_sas.ko \
-	$(LINUX_DIR)/drivers/scsi/libsas/libsas.ko
+	$(LINUX_OBJ_DIR)/drivers/scsi/scsi_transport_sas.ko \
+	$(LINUX_OBJ_DIR)/drivers/scsi/libsas/libsas.ko
   AUTOLOAD:=$(call AutoLoad,29,scsi_transport_sas libsas,1)
 endef
 
@@ -449,7 +449,7 @@ define KernelPackage/loop
   KCONFIG:= \
 	CONFIG_BLK_DEV_LOOP \
 	CONFIG_BLK_DEV_CRYPTOLOOP=n
-  FILES:=$(LINUX_DIR)/drivers/block/loop.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/block/loop.ko
   AUTOLOAD:=$(call AutoLoad,30,loop,1)
 endef
 
@@ -467,7 +467,7 @@ define KernelPackage/mvsas
   KCONFIG:= \
 	CONFIG_SCSI_MVSAS \
 	CONFIG_SCSI_MVSAS_TASKLET=n
-  FILES:=$(LINUX_DIR)/drivers/scsi/mvsas/mvsas.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/scsi/mvsas/mvsas.ko
   AUTOLOAD:=$(call AutoLoad,40,mvsas,1)
 endef
 
@@ -482,7 +482,7 @@ define KernelPackage/nbd
   SUBMENU:=$(BLOCK_MENU)
   TITLE:=Network block device support
   KCONFIG:=CONFIG_BLK_DEV_NBD
-  FILES:=$(LINUX_DIR)/drivers/block/nbd.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/block/nbd.ko
   AUTOLOAD:=$(call AutoLoad,30,nbd)
 endef
 
@@ -503,8 +503,8 @@ define KernelPackage/nvme
 	CONFIG_NVME_MULTIPATH=n \
 	CONFIG_NVME_HWMON=y
   FILES:= \
-	$(LINUX_DIR)/drivers/nvme/host/nvme-core.ko \
-	$(LINUX_DIR)/drivers/nvme/host/nvme.ko
+	$(LINUX_OBJ_DIR)/drivers/nvme/host/nvme-core.ko \
+	$(LINUX_OBJ_DIR)/drivers/nvme/host/nvme.ko
   AUTOLOAD:=$(call AutoLoad,30,nvme-core nvme,1)
 endef
 
@@ -524,9 +524,9 @@ define KernelPackage/scsi-core
 	CONFIG_SCSI_COMMON \
 	CONFIG_BLK_DEV_SD
   FILES:= \
-	$(LINUX_DIR)/drivers/scsi/scsi_mod.ko \
-	$(LINUX_DIR)/drivers/scsi/scsi_common.ko \
-	$(LINUX_DIR)/drivers/scsi/sd_mod.ko
+	$(LINUX_OBJ_DIR)/drivers/scsi/scsi_mod.ko \
+	$(LINUX_OBJ_DIR)/drivers/scsi/scsi_common.ko \
+	$(LINUX_OBJ_DIR)/drivers/scsi/sd_mod.ko
   AUTOLOAD:=$(call AutoLoad,40,scsi_mod scsi_common sd_mod,1)
 endef
 
@@ -540,7 +540,7 @@ define KernelPackage/scsi-generic
   KCONFIG:= \
 	CONFIG_CHR_DEV_SG
   FILES:= \
-	$(LINUX_DIR)/drivers/scsi/sg.ko
+	$(LINUX_OBJ_DIR)/drivers/scsi/sg.ko
   AUTOLOAD:=$(call AutoLoad,65,sg)
 endef
 
@@ -551,7 +551,7 @@ define KernelPackage/cdrom
   TITLE:=Kernel library module for CD / DVD drives
   KCONFIG:=CONFIG_CDROM
   HIDDEN:=1
-  FILES:=$(LINUX_DIR)/drivers/cdrom/cdrom.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/cdrom/cdrom.ko
 endef
 
 $(eval $(call KernelPackage,cdrom))
@@ -564,7 +564,7 @@ define KernelPackage/scsi-cdrom
   KCONFIG:= \
     CONFIG_BLK_DEV_SR \
     CONFIG_BLK_DEV_SR_VENDOR=n
-  FILES:=$(LINUX_DIR)/drivers/scsi/sr_mod.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/scsi/sr_mod.ko
   AUTOLOAD:=$(call AutoLoad,45,sr_mod)
 endef
 
@@ -578,7 +578,7 @@ define KernelPackage/scsi-tape
   KCONFIG:= \
     CONFIG_CHR_DEV_ST
   FILES:= \
-    $(LINUX_DIR)/drivers/scsi/st.ko
+    $(LINUX_OBJ_DIR)/drivers/scsi/st.ko
   AUTOLOAD:=$(call AutoLoad,45,st)
 endef
 
@@ -592,7 +592,7 @@ define KernelPackage/iosched-bfq
     CONFIG_BFQ_GROUP_IOSCHED=y \
     CONFIG_BFQ_CGROUP_DEBUG=n
   FILES:= \
-    $(LINUX_DIR)/block/bfq.ko
+    $(LINUX_OBJ_DIR)/block/bfq.ko
   AUTOLOAD:=$(call AutoLoad,10,bfq)
 endef
 
diff --git a/package/kernel/linux/modules/can.mk b/package/kernel/linux/modules/can.mk
index 4ff85d1c01..27a3c64073 100644
--- a/package/kernel/linux/modules/can.mk
+++ b/package/kernel/linux/modules/can.mk
@@ -28,8 +28,8 @@ define KernelPackage/can
 	CONFIG_CAN_SOFTING=n \
 	CONFIG_NET_EMATCH_CANID=n \
 	CONFIG_CAN_DEBUG_DEVICES=n
-  FILES:=$(LINUX_DIR)/drivers/net/can/dev/can-dev.ko \
-	 $(LINUX_DIR)/net/can/can.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/can/dev/can-dev.ko \
+	 $(LINUX_OBJ_DIR)/net/can/can.ko
   AUTOLOAD:=$(call AutoProbe,can can-dev)
 endef
 
@@ -49,7 +49,7 @@ endef
 define KernelPackage/can-bcm
   TITLE:=Broadcast Manager CAN Protcol
   KCONFIG:=CONFIG_CAN_BCM
-  FILES:=$(LINUX_DIR)/net/can/can-bcm.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/can/can-bcm.ko
   AUTOLOAD:=$(call AutoProbe,can-bcm)
   $(call AddDepends/can)
 endef
@@ -66,7 +66,7 @@ $(eval $(call KernelPackage,can-bcm))
 define KernelPackage/can-c-can
   TITLE:=BOSCH C_CAN/D_CAN drivers
   KCONFIG:=CONFIG_CAN_C_CAN
-  FILES:=$(LINUX_DIR)/drivers/net/can/c_can/c_can.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/can/c_can/c_can.ko
   AUTOLOAD:=$(call AutoProbe,c_can)
   $(call AddDepends/can)
 endef
@@ -82,7 +82,7 @@ define KernelPackage/can-c-can-pci
   TITLE:=PCI Bus based BOSCH C_CAN/D_CAN driver
   KCONFIG:=CONFIG_CAN_C_CAN_PCI
   DEPENDS:=kmod-can-c-can @PCI_SUPPORT
-  FILES:=$(LINUX_DIR)/drivers/net/can/c_can/c_can_pci.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/can/c_can/c_can_pci.ko
   AUTOLOAD:=$(call AutoProbe,c_can_pci)
   $(call AddDepends/can)
 endef
@@ -99,7 +99,7 @@ define KernelPackage/can-c-can-platform
   TITLE:=Platform Bus based BOSCH C_CAN/D_CAN driver
   KCONFIG:=CONFIG_CAN_C_CAN_PLATFORM
   DEPENDS:=kmod-can-c-can +kmod-regmap-core
-  FILES:=$(LINUX_DIR)/drivers/net/can/c_can/c_can_platform.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/can/c_can/c_can_platform.ko
   AUTOLOAD:=$(call AutoProbe,c_can_platform)
   $(call AddDepends/can)
 endef
@@ -119,7 +119,7 @@ $(eval $(call KernelPackage,can-c-can-platform))
 define KernelPackage/can-flexcan
   TITLE:=Support for Freescale FLEXCAN based chips
   KCONFIG:=CONFIG_CAN_FLEXCAN
-  FILES:=$(LINUX_DIR)/drivers/net/can/flexcan.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/can/flexcan.ko
   AUTOLOAD:=$(call AutoProbe,flexcan)
   $(call AddDepends/can, at TARGET_imx)
 endef
@@ -134,7 +134,7 @@ $(eval $(call KernelPackage,can-flexcan))
 define KernelPackage/can-gw
   TITLE:=CAN Gateway/Router
   KCONFIG:=CONFIG_CAN_GW
-  FILES:=$(LINUX_DIR)/net/can/can-gw.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/can/can-gw.ko
   AUTOLOAD:=$(call AutoProbe,can-gw)
   $(call AddDepends/can)
 endef
@@ -151,7 +151,7 @@ define KernelPackage/can-mcp251x
   KCONFIG:=\
 	CONFIG_SPI=y \
 	CONFIG_CAN_MCP251X
-  FILES:=$(LINUX_DIR)/drivers/net/can/spi/mcp251x.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/can/spi/mcp251x.ko
   AUTOLOAD:=$(call AutoProbe,mcp251x)
   $(call AddDepends/can)
 endef
@@ -166,7 +166,7 @@ $(eval $(call KernelPackage,can-mcp251x))
 define KernelPackage/can-raw
   TITLE:=Raw CAN Protcol
   KCONFIG:=CONFIG_CAN_RAW
-  FILES:=$(LINUX_DIR)/net/can/can-raw.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/can/can-raw.ko
   AUTOLOAD:=$(call AutoProbe,can-raw)
   $(call AddDepends/can)
 endef
@@ -182,7 +182,7 @@ $(eval $(call KernelPackage,can-raw))
 define KernelPackage/can-slcan
   TITLE:=Serial / USB serial CAN Adaptors (slcan)
   KCONFIG:=CONFIG_CAN_SLCAN
-  FILES:=$(LINUX_DIR)/drivers/net/can/slcan.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/can/slcan.ko
   AUTOLOAD:=$(call AutoProbe,slcan)
   $(call AddDepends/can)
 endef
@@ -199,7 +199,7 @@ $(eval $(call KernelPackage,can-slcan))
 define KernelPackage/can-usb-8dev
   TITLE:=8 devices USB2CAN interface
   KCONFIG:=CONFIG_CAN_8DEV_USB
-  FILES:=$(LINUX_DIR)/drivers/net/can/usb/usb_8dev.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/can/usb/usb_8dev.ko
   AUTOLOAD:=$(call AutoProbe,usb_8dev)
   $(call AddDepends/can,+kmod-usb-core)
 endef
@@ -215,7 +215,7 @@ $(eval $(call KernelPackage,can-usb-8dev))
 define KernelPackage/can-usb-ems
   TITLE:=EMS CPC-USB/ARM7 CAN/USB interface
   KCONFIG:=CONFIG_CAN_EMS_USB
-  FILES:=$(LINUX_DIR)/drivers/net/can/usb/ems_usb.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/can/usb/ems_usb.ko
   AUTOLOAD:=$(call AutoProbe,ems_usb)
   $(call AddDepends/can,+kmod-usb-core)
 endef
@@ -231,7 +231,7 @@ $(eval $(call KernelPackage,can-usb-ems))
 define KernelPackage/can-usb-esd
   TITLE:=ESD USB/2 CAN/USB interface
   KCONFIG:=CONFIG_CAN_ESD_USB2
-  FILES:=$(LINUX_DIR)/drivers/net/can/usb/esd_usb2.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/can/usb/esd_usb2.ko
   AUTOLOAD:=$(call AutoProbe,esd_usb2)
   $(call AddDepends/can,+kmod-usb-core)
 endef
@@ -248,7 +248,7 @@ define KernelPackage/can-usb-kvaser
   TITLE:=Kvaser CAN/USB interface
   KCONFIG:=CONFIG_CAN_KVASER_USB
   FILES:= \
-	$(LINUX_DIR)/drivers/net/can/usb/kvaser_usb/kvaser_usb.ko
+	$(LINUX_OBJ_DIR)/drivers/net/can/usb/kvaser_usb/kvaser_usb.ko
   AUTOLOAD:=$(call AutoProbe,kvaser_usb)
   $(call AddDepends/can,+kmod-usb-core)
 endef
@@ -264,7 +264,7 @@ $(eval $(call KernelPackage,can-usb-kvaser))
 define KernelPackage/can-usb-peak
   TITLE:=PEAK PCAN-USB/USB Pro interfaces
   KCONFIG:=CONFIG_CAN_PEAK_USB
-  FILES:=$(LINUX_DIR)/drivers/net/can/usb/peak_usb/peak_usb.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/can/usb/peak_usb/peak_usb.ko
   AUTOLOAD:=$(call AutoProbe,peak_usb)
   $(call AddDepends/can,+kmod-usb-core)
 endef
@@ -280,7 +280,7 @@ $(eval $(call KernelPackage,can-usb-peak))
 define KernelPackage/can-vcan
   TITLE:=Virtual Local CAN Interface (vcan)
   KCONFIG:=CONFIG_CAN_VCAN
-  FILES:=$(LINUX_DIR)/drivers/net/can/vcan.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/can/vcan.ko
   AUTOLOAD:=$(call AutoProbe,vcan)
   $(call AddDepends/can)
 endef
@@ -295,7 +295,7 @@ $(eval $(call KernelPackage,can-vcan))
 define KernelPackage/can-xilinx-can
   TITLE:=Xilinx CAN IP
   KCONFIG:=CONFIG_CAN_XILINXCAN
-  FILES:=$(LINUX_DIR)/drivers/net/can/xilinx_can.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/can/xilinx_can.ko
   AUTOLOAD:=$(call AutoProbe,xilinx_can)
   $(call AddDepends/can, at TARGET_zynq)
 endef
diff --git a/package/kernel/linux/modules/crypto.mk b/package/kernel/linux/modules/crypto.mk
index 5e6fed631a..f87214eaa1 100644
--- a/package/kernel/linux/modules/crypto.mk
+++ b/package/kernel/linux/modules/crypto.mk
@@ -14,7 +14,7 @@ CRYPTO_MODULES = \
 CRYPTO_TARGET = $(BOARD)/$(if $(SUBTARGET),$(SUBTARGET),generic)
 
 crypto_confvar=CONFIG_CRYPTO_$(word 1,$(subst =,$(space),$(1)))
-crypto_file=$(LINUX_DIR)/crypto/$(word 2,$(subst =,$(space),$(1))).ko
+crypto_file=$(LINUX_OBJ_DIR)/crypto/$(word 2,$(subst =,$(space),$(1))).ko
 crypto_name=$(if $(findstring y,$($(call crypto_confvar,$(1)))),,$(word 2,$(subst =,$(space),$(1))))
 
 define AddDepends/crypto
@@ -27,7 +27,7 @@ define KernelPackage/crypto-acompress
   TITLE:=Asynchronous Compression operations
   HIDDEN:=1
   KCONFIG:=CONFIG_CRYPTO_ACOMP2
-  FILES:=$(LINUX_DIR)/crypto/crypto_acompress.ko
+  FILES:=$(LINUX_OBJ_DIR)/crypto/crypto_acompress.ko
   AUTOLOAD:=$(call AutoLoad,09,crypto_acompress)
   $(call AddDepends/crypto)
 endef
@@ -41,8 +41,8 @@ define KernelPackage/crypto-aead
 	CONFIG_CRYPTO_AEAD \
 	CONFIG_CRYPTO_AEAD2
   FILES:= \
-	  $(LINUX_DIR)/crypto/aead.ko \
-	  $(LINUX_DIR)/crypto/geniv.ko
+	  $(LINUX_OBJ_DIR)/crypto/aead.ko \
+	  $(LINUX_OBJ_DIR)/crypto/geniv.ko
   AUTOLOAD:=$(call AutoLoad,09,aead,1)
   $(call AddDepends/crypto, +kmod-crypto-null)
 endef
@@ -57,8 +57,8 @@ define KernelPackage/crypto-arc4
 	  CONFIG_CRYPTO_ARC4 \
 	  CONFIG_CRYPTO_USER_API_ENABLE_OBSOLETE=y
   FILES:= \
-	  $(LINUX_DIR)/crypto/arc4.ko \
-	  $(LINUX_DIR)/lib/crypto/libarc4.ko
+	  $(LINUX_OBJ_DIR)/crypto/arc4.ko \
+	  $(LINUX_OBJ_DIR)/lib/crypto/libarc4.ko
   AUTOLOAD:=$(call AutoLoad,09,arc4)
   $(call AddDepends/crypto)
 endef
@@ -71,8 +71,8 @@ define KernelPackage/crypto-authenc
   DEPENDS:=+kmod-crypto-manager +kmod-crypto-null
   KCONFIG:=CONFIG_CRYPTO_AUTHENC
   FILES:= \
-	$(LINUX_DIR)/crypto/authenc.ko \
-	$(LINUX_DIR)/crypto/authencesn.ko
+	$(LINUX_OBJ_DIR)/crypto/authenc.ko \
+	$(LINUX_OBJ_DIR)/crypto/authencesn.ko
   AUTOLOAD:=$(call AutoLoad,09,authenc authencesn)
   $(call AddDepends/crypto)
 endef
@@ -84,7 +84,7 @@ define KernelPackage/crypto-cbc
   TITLE:=Cipher Block Chaining CryptoAPI module
   DEPENDS:=+kmod-crypto-manager
   KCONFIG:=CONFIG_CRYPTO_CBC
-  FILES:=$(LINUX_DIR)/crypto/cbc.ko
+  FILES:=$(LINUX_OBJ_DIR)/crypto/cbc.ko
   AUTOLOAD:=$(call AutoLoad,09,cbc)
   $(call AddDepends/crypto)
 endef
@@ -96,7 +96,7 @@ define KernelPackage/crypto-ccm
  TITLE:=Support for Counter with CBC MAC (CCM)
  DEPENDS:=+kmod-crypto-ctr +kmod-crypto-aead
  KCONFIG:=CONFIG_CRYPTO_CCM
- FILES:=$(LINUX_DIR)/crypto/ccm.ko
+ FILES:=$(LINUX_OBJ_DIR)/crypto/ccm.ko
  AUTOLOAD:=$(call AutoLoad,09,ccm)
  $(call AddDepends/crypto)
 endef
@@ -108,7 +108,7 @@ define KernelPackage/crypto-chacha20poly1305
   TITLE:=ChaCha20-Poly1305 AEAD support, RFC7539 (used by strongSwan IPsec VPN)
   DEPENDS:=+kmod-crypto-aead +kmod-crypto-manager
   KCONFIG:=CONFIG_CRYPTO_CHACHA20POLY1305
-  FILES:=$(LINUX_DIR)/crypto/chacha20poly1305.ko
+  FILES:=$(LINUX_OBJ_DIR)/crypto/chacha20poly1305.ko
   AUTOLOAD:=$(call AutoLoad,09,chacha20poly1305)
   $(call AddDepends/crypto)
 endef
@@ -120,7 +120,7 @@ define KernelPackage/crypto-cmac
   TITLE:=Support for Cipher-based Message Authentication Code (CMAC)
   DEPENDS:=+kmod-crypto-hash
   KCONFIG:=CONFIG_CRYPTO_CMAC
-  FILES:=$(LINUX_DIR)/crypto/cmac.ko
+  FILES:=$(LINUX_OBJ_DIR)/crypto/cmac.ko
   AUTOLOAD:=$(call AutoLoad,09,cmac)
   $(call AddDepends/crypto)
 endef
@@ -133,7 +133,7 @@ define KernelPackage/crypto-crc32
   DEPENDS:=+kmod-crypto-hash
   KCONFIG:=CONFIG_CRYPTO_CRC32
   HIDDEN:=1
-  FILES:=$(LINUX_DIR)/crypto/crc32_generic.ko
+  FILES:=$(LINUX_OBJ_DIR)/crypto/crc32_generic.ko
   AUTOLOAD:=$(call AutoLoad,04,crc32_generic,1)
   $(call AddDepends/crypto)
 endef
@@ -145,7 +145,7 @@ define KernelPackage/crypto-crc32c
   TITLE:=CRC32c CRC module
   DEPENDS:=+kmod-crypto-hash
   KCONFIG:=CONFIG_CRYPTO_CRC32C
-  FILES:=$(LINUX_DIR)/crypto/crc32c_generic.ko
+  FILES:=$(LINUX_OBJ_DIR)/crypto/crc32c_generic.ko
   AUTOLOAD:=$(call AutoLoad,04,crc32c_generic,1)
   $(call AddDepends/crypto)
 endef
@@ -157,7 +157,7 @@ define KernelPackage/crypto-ctr
   TITLE:=Counter Mode CryptoAPI module
   DEPENDS:=+kmod-crypto-manager +kmod-crypto-seqiv
   KCONFIG:=CONFIG_CRYPTO_CTR
-  FILES:=$(LINUX_DIR)/crypto/ctr.ko
+  FILES:=$(LINUX_OBJ_DIR)/crypto/ctr.ko
   AUTOLOAD:=$(call AutoLoad,09,ctr)
   $(call AddDepends/crypto)
 endef
@@ -169,7 +169,7 @@ define KernelPackage/crypto-cts
   TITLE:=Cipher Text Stealing CryptoAPI module
   DEPENDS:=+kmod-crypto-manager
   KCONFIG:=CONFIG_CRYPTO_CTS
-  FILES:=$(LINUX_DIR)/crypto/cts.ko
+  FILES:=$(LINUX_OBJ_DIR)/crypto/cts.ko
   AUTOLOAD:=$(call AutoLoad,09,cts)
   $(call AddDepends/crypto)
 endef
@@ -181,7 +181,7 @@ define KernelPackage/crypto-deflate
   TITLE:=Deflate compression CryptoAPI module
   DEPENDS:=+kmod-lib-zlib-inflate +kmod-lib-zlib-deflate +kmod-crypto-acompress
   KCONFIG:=CONFIG_CRYPTO_DEFLATE
-  FILES:=$(LINUX_DIR)/crypto/deflate.ko
+  FILES:=$(LINUX_OBJ_DIR)/crypto/deflate.ko
   AUTOLOAD:=$(call AutoLoad,09,deflate)
   $(call AddDepends/crypto)
 endef
@@ -193,8 +193,8 @@ define KernelPackage/crypto-des
   TITLE:=DES/3DES cipher CryptoAPI module
   KCONFIG:=CONFIG_CRYPTO_DES
   FILES:= \
-	$(LINUX_DIR)/crypto/des_generic.ko \
-	$(LINUX_DIR)/lib/crypto/libdes.ko
+	$(LINUX_OBJ_DIR)/crypto/des_generic.ko \
+	$(LINUX_OBJ_DIR)/lib/crypto/libdes.ko
   AUTOLOAD:=$(call AutoLoad,09,des_generic)
   $(call AddDepends/crypto)
 endef
@@ -206,7 +206,7 @@ define KernelPackage/crypto-ecb
   TITLE:=Electronic CodeBook CryptoAPI module
   DEPENDS:=+kmod-crypto-manager
   KCONFIG:=CONFIG_CRYPTO_ECB
-  FILES:=$(LINUX_DIR)/crypto/ecb.ko
+  FILES:=$(LINUX_OBJ_DIR)/crypto/ecb.ko
   AUTOLOAD:=$(call AutoLoad,09,ecb)
   $(call AddDepends/crypto)
 endef
@@ -219,8 +219,8 @@ define KernelPackage/crypto-ecdh
   DEPENDS:=+kmod-crypto-kpp
   KCONFIG:= CONFIG_CRYPTO_ECDH
   FILES:= \
-	$(LINUX_DIR)/crypto/ecdh_generic.ko \
-	$(LINUX_DIR)/crypto/ecc.ko
+	$(LINUX_OBJ_DIR)/crypto/ecdh_generic.ko \
+	$(LINUX_OBJ_DIR)/crypto/ecc.ko
   AUTOLOAD:=$(call AutoLoad,10,ecdh_generic)
   $(call AddDepends/crypto)
 endef
@@ -232,7 +232,7 @@ define KernelPackage/crypto-echainiv
   TITLE:=Encrypted Chain IV Generator
   DEPENDS:=+kmod-crypto-aead
   KCONFIG:=CONFIG_CRYPTO_ECHAINIV
-  FILES:=$(LINUX_DIR)/crypto/echainiv.ko
+  FILES:=$(LINUX_OBJ_DIR)/crypto/echainiv.ko
   AUTOLOAD:=$(call AutoLoad,09,echainiv)
   $(call AddDepends/crypto)
 endef
@@ -244,7 +244,7 @@ define KernelPackage/crypto-essiv
   TITLE:=ESSIV support for block encryption
   DEPENDS:=+kmod-crypto-authenc
   KCONFIG:=CONFIG_CRYPTO_ESSIV
-  FILES:= $(LINUX_DIR)/crypto/essiv.ko
+  FILES:= $(LINUX_OBJ_DIR)/crypto/essiv.ko
   AUTOLOAD:=$(call AutoLoad,10,essiv)
   $(call AddDepends/crypto)
 endef
@@ -255,7 +255,7 @@ $(eval $(call KernelPackage,crypto-essiv))
 define KernelPackage/crypto-fcrypt
   TITLE:=FCRYPT cipher CryptoAPI module
   KCONFIG:=CONFIG_CRYPTO_FCRYPT
-  FILES:=$(LINUX_DIR)/crypto/fcrypt.ko
+  FILES:=$(LINUX_OBJ_DIR)/crypto/fcrypt.ko
   AUTOLOAD:=$(call AutoLoad,09,fcrypt)
   $(call AddDepends/crypto)
 endef
@@ -267,7 +267,7 @@ define KernelPackage/crypto-gcm
   TITLE:=GCM/GMAC CryptoAPI module
   DEPENDS:=+kmod-crypto-ctr +kmod-crypto-ghash +kmod-crypto-null
   KCONFIG:=CONFIG_CRYPTO_GCM
-  FILES:=$(LINUX_DIR)/crypto/gcm.ko
+  FILES:=$(LINUX_OBJ_DIR)/crypto/gcm.ko
   AUTOLOAD:=$(call AutoLoad,09,gcm)
   $(call AddDepends/crypto)
 endef
@@ -279,7 +279,7 @@ define KernelPackage/crypto-xcbc
   TITLE:=XCBC CryptoAPI module
   DEPENDS:=+kmod-crypto-hash +kmod-crypto-manager
   KCONFIG:=CONFIG_CRYPTO_XCBC
-  FILES:=$(LINUX_DIR)/crypto/xcbc.ko
+  FILES:=$(LINUX_OBJ_DIR)/crypto/xcbc.ko
   AUTOLOAD:=$(call AutoLoad,09,xcbc)
   $(call AddDepends/crypto)
 endef
@@ -290,7 +290,7 @@ $(eval $(call KernelPackage,crypto-xcbc))
 define KernelPackage/crypto-gf128
   TITLE:=GF(2^128) multiplication functions CryptoAPI module
   KCONFIG:=CONFIG_CRYPTO_GF128MUL
-  FILES:=$(LINUX_DIR)/crypto/gf128mul.ko
+  FILES:=$(LINUX_OBJ_DIR)/crypto/gf128mul.ko
   AUTOLOAD:=$(call AutoLoad,09,gf128mul)
   $(call AddDepends/crypto)
 endef
@@ -304,13 +304,13 @@ define KernelPackage/crypto-ghash
   KCONFIG:= \
 	CONFIG_CRYPTO_GHASH \
 	CONFIG_CRYPTO_GHASH_ARM_CE
-  FILES:=$(LINUX_DIR)/crypto/ghash-generic.ko
+  FILES:=$(LINUX_OBJ_DIR)/crypto/ghash-generic.ko
   AUTOLOAD:=$(call AutoLoad,09,ghash-generic)
   $(call AddDepends/crypto)
 endef
 
 define KernelPackage/crypto-ghash/arm-ce
-  FILES+= $(LINUX_DIR)/arch/arm/crypto/ghash-arm-ce.ko
+  FILES+= $(LINUX_OBJ_DIR)/arch/arm/crypto/ghash-arm-ce.ko
   AUTOLOAD+=$(call AutoLoad,09,ghash-arm-ce)
 endef
 
@@ -324,7 +324,7 @@ $(eval $(call KernelPackage,crypto-ghash))
 define KernelPackage/crypto-hash
   TITLE:=CryptoAPI hash support
   KCONFIG:=CONFIG_CRYPTO_HASH
-  FILES:=$(LINUX_DIR)/crypto/crypto_hash.ko
+  FILES:=$(LINUX_OBJ_DIR)/crypto/crypto_hash.ko
   AUTOLOAD:=$(call AutoLoad,02,crypto_hash,1)
   $(call AddDepends/crypto)
 endef
@@ -336,7 +336,7 @@ define KernelPackage/crypto-hmac
   TITLE:=HMAC digest CryptoAPI module
   DEPENDS:=+kmod-crypto-hash +kmod-crypto-manager
   KCONFIG:=CONFIG_CRYPTO_HMAC
-  FILES:=$(LINUX_DIR)/crypto/hmac.ko
+  FILES:=$(LINUX_OBJ_DIR)/crypto/hmac.ko
   AUTOLOAD:=$(call AutoLoad,09,hmac)
   $(call AddDepends/crypto)
 endef
@@ -362,8 +362,8 @@ define KernelPackage/crypto-hw-ccp
 	CONFIG_CRYPTO_DEV_CCP_DD \
 	CONFIG_CRYPTO_DEV_SP_CCP=y
   FILES:= \
-	$(LINUX_DIR)/drivers/crypto/ccp/ccp.ko \
-	$(LINUX_DIR)/drivers/crypto/ccp/ccp-crypto.ko
+	$(LINUX_OBJ_DIR)/drivers/crypto/ccp/ccp.ko \
+	$(LINUX_OBJ_DIR)/drivers/crypto/ccp/ccp-crypto.ko
   AUTOLOAD:=$(call AutoLoad,09,ccp ccp-crypto)
   $(call AddDepends/crypto)
 endef
@@ -377,7 +377,7 @@ define KernelPackage/crypto-hw-geode
   KCONFIG:= \
 	CONFIG_CRYPTO_HW=y \
 	CONFIG_CRYPTO_DEV_GEODE
-  FILES:=$(LINUX_DIR)/drivers/crypto/geode-aes.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/crypto/geode-aes.ko
   AUTOLOAD:=$(call AutoLoad,09,geode-aes)
   $(call AddDepends/crypto)
 endef
@@ -392,7 +392,7 @@ define KernelPackage/crypto-hw-hifn-795x
 	CONFIG_CRYPTO_HW=y \
 	CONFIG_CRYPTO_DEV_HIFN_795X \
 	CONFIG_CRYPTO_DEV_HIFN_795X_RNG=y
-  FILES:=$(LINUX_DIR)/drivers/crypto/hifn_795x.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/crypto/hifn_795x.ko
   AUTOLOAD:=$(call AutoLoad,09,hifn_795x)
   $(call AddDepends/crypto,+kmod-crypto-des)
 endef
@@ -405,7 +405,7 @@ define KernelPackage/crypto-hw-ixp4xx
   KCONFIG:= \
 	CONFIG_CRYPTO_HW=y \
 	CONFIG_CRYPTO_DEV_IXP4XX
-  FILES:=$(LINUX_DIR)/drivers/crypto/ixp4xx_crypto.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/crypto/ixp4xx_crypto.ko
   AUTOLOAD:=$(call AutoProbe,ixp4xx_crypto)
   $(call AddDepends/crypto)
 endef
@@ -422,8 +422,8 @@ define KernelPackage/crypto-hw-padlock
 	CONFIG_CRYPTO_DEV_PADLOCK_AES \
 	CONFIG_CRYPTO_DEV_PADLOCK_SHA
   FILES:= \
-	$(LINUX_DIR)/drivers/crypto/padlock-aes.ko \
-	$(LINUX_DIR)/drivers/crypto/padlock-sha.ko
+	$(LINUX_OBJ_DIR)/drivers/crypto/padlock-aes.ko \
+	$(LINUX_OBJ_DIR)/drivers/crypto/padlock-sha.ko
   AUTOLOAD:=$(call AutoLoad,09,padlock-aes padlock-sha)
   $(call AddDepends/crypto)
 endef
@@ -439,7 +439,7 @@ define KernelPackage/crypto-hw-safexcel
   KCONFIG:= \
 	CONFIG_CRYPTO_HW=y \
 	CONFIG_CRYPTO_DEV_SAFEXCEL
-  FILES:=$(LINUX_DIR)/drivers/crypto/inside-secure/crypto_safexcel.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/crypto/inside-secure/crypto_safexcel.ko
   AUTOLOAD:=$(call AutoLoad,90,crypto_safexcel)
   $(call AddDepends/crypto)
 endef
@@ -469,7 +469,7 @@ define KernelPackage/crypto-hw-talitos
 	CONFIG_CRYPTO_DEV_TALITOS1=y \
 	CONFIG_CRYPTO_DEV_TALITOS2=y
   FILES:= \
-	$(LINUX_DIR)/drivers/crypto/talitos.ko
+	$(LINUX_OBJ_DIR)/drivers/crypto/talitos.ko
   AUTOLOAD:=$(call AutoLoad,09,talitos)
   $(call AddDepends/crypto)
 endef
@@ -492,7 +492,7 @@ define KernelPackage/crypto-hw-eip93
 	CONFIG_CRYPTO_DEV_EIP93_AEAD=y \
 	CONFIG_CRYPTO_DEV_EIP93_GENERIC_SW_MAX_LEN=256 \
 	CONFIG_CRYPTO_DEV_EIP93_AES_128_SW_MAX_LEN=512
-  FILES:=$(LINUX_DIR)/drivers/crypto/mtk-eip93/crypto-hw-eip93.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/crypto/mtk-eip93/crypto-hw-eip93.ko
   AUTOLOAD:=$(call AutoLoad,09,crypto-hw-eip93)
   $(call AddDepends/crypto)
 endef
@@ -509,7 +509,7 @@ $(eval $(call KernelPackage,crypto-hw-eip93))
 define KernelPackage/crypto-kpp
   TITLE:=Key-agreement Protocol Primitives
   KCONFIG:=CONFIG_CRYPTO_KPP
-  FILES:=$(LINUX_DIR)/crypto/kpp.ko
+  FILES:=$(LINUX_OBJ_DIR)/crypto/kpp.ko
   AUTOLOAD:=$(call AutoLoad,09,kpp)
   $(call AddDepends/crypto)
 endef
@@ -520,32 +520,32 @@ define KernelPackage/crypto-lib-chacha20
   TITLE:=ChaCha library interface
   KCONFIG:=CONFIG_CRYPTO_LIB_CHACHA
   HIDDEN:=1
-  FILES:=$(LINUX_DIR)/lib/crypto/libchacha.ko
+  FILES:=$(LINUX_OBJ_DIR)/lib/crypto/libchacha.ko
   $(call AddDepends/crypto)
 endef
 
 define KernelPackage/crypto-lib-chacha20/x86_64
   KCONFIG+=CONFIG_CRYPTO_CHACHA20_X86_64
-  FILES+=$(LINUX_DIR)/arch/x86/crypto/chacha-x86_64.ko
+  FILES+=$(LINUX_OBJ_DIR)/arch/x86/crypto/chacha-x86_64.ko
 endef
 
 # Note that a non-neon fallback implementation is available on arm32 when
 # NEON is not supported, hence all arm targets can utilize lib-chacha20/arm
 define KernelPackage/crypto-lib-chacha20/arm
   KCONFIG+=CONFIG_CRYPTO_CHACHA20_NEON
-  FILES:=$(LINUX_DIR)/arch/arm/crypto/chacha-neon.ko
+  FILES:=$(LINUX_OBJ_DIR)/arch/arm/crypto/chacha-neon.ko
 endef
 
 KernelPackage/crypto-lib-chacha20/armeb=$(KernelPackage/crypto-lib-chacha20/arm)
 
 define KernelPackage/crypto-lib-chacha20/aarch64
   KCONFIG+=CONFIG_CRYPTO_CHACHA20_NEON
-  FILES+=$(LINUX_DIR)/arch/arm64/crypto/chacha-neon.ko
+  FILES+=$(LINUX_OBJ_DIR)/arch/arm64/crypto/chacha-neon.ko
 endef
 
 define KernelPackage/crypto-lib-chacha20/mips32r2
   KCONFIG+=CONFIG_CRYPTO_CHACHA_MIPS
-  FILES:=$(LINUX_DIR)/arch/mips/crypto/chacha-mips.ko
+  FILES:=$(LINUX_OBJ_DIR)/arch/mips/crypto/chacha-mips.ko
 endef
 
 ifeq ($(CONFIG_CPU_MIPS32_R2),y)
@@ -565,7 +565,7 @@ define KernelPackage/crypto-lib-chacha20poly1305
   TITLE:=ChaCha20-Poly1305 AEAD support (8-byte nonce library version)
   KCONFIG:=CONFIG_CRYPTO_LIB_CHACHA20POLY1305
   HIDDEN:=1
-  FILES:=$(LINUX_DIR)/lib/crypto/libchacha20poly1305.ko
+  FILES:=$(LINUX_OBJ_DIR)/lib/crypto/libchacha20poly1305.ko
   $(call AddDepends/crypto, +kmod-crypto-lib-chacha20 +kmod-crypto-lib-poly1305)
 endef
 
@@ -577,8 +577,8 @@ define KernelPackage/crypto-lib-curve25519
   KCONFIG:=CONFIG_CRYPTO_LIB_CURVE25519
   HIDDEN:=1
   FILES:= \
-	$(LINUX_DIR)/lib/crypto/libcurve25519.ko \
-	$(LINUX_DIR)/lib/crypto/libcurve25519-generic.ko
+	$(LINUX_OBJ_DIR)/lib/crypto/libcurve25519.ko \
+	$(LINUX_OBJ_DIR)/lib/crypto/libcurve25519-generic.ko
   $(call AddDepends/crypto,+PACKAGE_kmod-crypto-kpp:kmod-crypto-kpp)
 endef
 
@@ -588,12 +588,12 @@ endef
 
 define KernelPackage/crypto-lib-curve25519/x86_64
   KCONFIG+=CONFIG_CRYPTO_CURVE25519_X86
-  FILES+=$(LINUX_DIR)/arch/x86/crypto/curve25519-x86_64.ko
+  FILES+=$(LINUX_OBJ_DIR)/arch/x86/crypto/curve25519-x86_64.ko
 endef
 
 define KernelPackage/crypto-lib-curve25519/arm-neon
   KCONFIG+=CONFIG_CRYPTO_CURVE25519_NEON
-  FILES+=$(LINUX_DIR)/arch/arm/crypto/curve25519-neon.ko
+  FILES+=$(LINUX_OBJ_DIR)/arch/arm/crypto/curve25519-neon.ko
 endef
 
 ifeq ($(ARCH)-$(CONFIG_KERNEL_MODE_NEON),arm-y)
@@ -613,7 +613,7 @@ define KernelPackage/crypto-lib-poly1305
   TITLE:=Poly1305 library interface
   KCONFIG:=CONFIG_CRYPTO_LIB_POLY1305
   HIDDEN:=1
-  FILES:=$(LINUX_DIR)/lib/crypto/libpoly1305.ko
+  FILES:=$(LINUX_OBJ_DIR)/lib/crypto/libpoly1305.ko
   $(call AddDepends/crypto,+PACKAGE_kmod-crypto-hash:kmod-crypto-hash)
 endef
 
@@ -623,24 +623,24 @@ endef
 
 define KernelPackage/crypto-lib-poly1305/x86_64
   KCONFIG+=CONFIG_CRYPTO_POLY1305_X86_64
-  FILES+=$(LINUX_DIR)/arch/x86/crypto/poly1305-x86_64.ko
+  FILES+=$(LINUX_OBJ_DIR)/arch/x86/crypto/poly1305-x86_64.ko
 endef
 
 define KernelPackage/crypto-lib-poly1305/arm
   KCONFIG+=CONFIG_CRYPTO_POLY1305_ARM
-  FILES:=$(LINUX_DIR)/arch/arm/crypto/poly1305-arm.ko
+  FILES:=$(LINUX_OBJ_DIR)/arch/arm/crypto/poly1305-arm.ko
 endef
 
 KernelPackage/crypto-lib-poly1305/armeb=$(KernelPackage/crypto-lib-poly1305/arm)
 
 define KernelPackage/crypto-lib-poly1305/aarch64
   KCONFIG+=CONFIG_CRYPTO_POLY1305_NEON
-  FILES:=$(LINUX_DIR)/arch/arm64/crypto/poly1305-neon.ko
+  FILES:=$(LINUX_OBJ_DIR)/arch/arm64/crypto/poly1305-neon.ko
 endef
 
 define KernelPackage/crypto-lib-poly1305/mips
   KCONFIG+=CONFIG_CRYPTO_POLY1305_MIPS
-  FILES:=$(LINUX_DIR)/arch/mips/crypto/poly1305-mips.ko
+  FILES:=$(LINUX_OBJ_DIR)/arch/mips/crypto/poly1305-mips.ko
 endef
 
 KernelPackage/crypto-lib-poly1305/mipsel=$(KernelPackage/crypto-lib-poly1305/mips)
@@ -661,7 +661,7 @@ define KernelPackage/crypto-manager
   KCONFIG:= \
 	CONFIG_CRYPTO_MANAGER \
 	CONFIG_CRYPTO_MANAGER2
-  FILES:=$(LINUX_DIR)/crypto/cryptomgr.ko
+  FILES:=$(LINUX_OBJ_DIR)/crypto/cryptomgr.ko
   AUTOLOAD:=$(call AutoLoad,09,cryptomgr,1)
   $(call AddDepends/crypto)
 endef
@@ -673,7 +673,7 @@ define KernelPackage/crypto-md4
   TITLE:=MD4 digest CryptoAPI module
   DEPENDS:=+kmod-crypto-hash
   KCONFIG:=CONFIG_CRYPTO_MD4
-  FILES:=$(LINUX_DIR)/crypto/md4.ko
+  FILES:=$(LINUX_OBJ_DIR)/crypto/md4.ko
   AUTOLOAD:=$(call AutoLoad,09,md4)
   $(call AddDepends/crypto)
 endef
@@ -688,18 +688,18 @@ define KernelPackage/crypto-md5
 	CONFIG_CRYPTO_MD5 \
 	CONFIG_CRYPTO_MD5_OCTEON \
 	CONFIG_CRYPTO_MD5_PPC
-  FILES:=$(LINUX_DIR)/crypto/md5.ko
+  FILES:=$(LINUX_OBJ_DIR)/crypto/md5.ko
   AUTOLOAD:=$(call AutoLoad,09,md5)
   $(call AddDepends/crypto)
 endef
 
 define KernelPackage/crypto-md5/octeon
-  FILES+=$(LINUX_DIR)/arch/mips/cavium-octeon/crypto/octeon-md5.ko
+  FILES+=$(LINUX_OBJ_DIR)/arch/mips/cavium-octeon/crypto/octeon-md5.ko
   AUTOLOAD+=$(call AutoLoad,09,octeon-md5)
 endef
 
 define KernelPackage/crypto-md5/powerpc
-  FILES+=$(LINUX_DIR)/arch/powerpc/crypto/md5-ppc.ko
+  FILES+=$(LINUX_OBJ_DIR)/arch/powerpc/crypto/md5-ppc.ko
   AUTOLOAD+=$(call AutoLoad,09,md5-ppc)
 endef
 
@@ -715,7 +715,7 @@ define KernelPackage/crypto-michael-mic
   TITLE:=Michael MIC keyed digest CryptoAPI module
   DEPENDS:=+kmod-crypto-hash
   KCONFIG:=CONFIG_CRYPTO_MICHAEL_MIC
-  FILES:=$(LINUX_DIR)/crypto/michael_mic.ko
+  FILES:=$(LINUX_OBJ_DIR)/crypto/michael_mic.ko
   AUTOLOAD:=$(call AutoLoad,09,michael_mic)
   $(call AddDepends/crypto)
 endef
@@ -755,19 +755,19 @@ define KernelPackage/crypto-misc
 	CONFIG_CRYPTO_TWOFISH_586 \
 	CONFIG_CRYPTO_WP512
   FILES:= \
-	$(LINUX_DIR)/crypto/anubis.ko \
-	$(LINUX_DIR)/crypto/camellia_generic.ko \
-	$(LINUX_DIR)/crypto/cast_common.ko \
-	$(LINUX_DIR)/crypto/cast5_generic.ko \
-	$(LINUX_DIR)/crypto/cast6_generic.ko \
-	$(LINUX_DIR)/crypto/khazad.ko \
-	$(LINUX_DIR)/crypto/tea.ko \
-	$(LINUX_DIR)/crypto/twofish_common.ko \
-	$(LINUX_DIR)/crypto/wp512.ko \
-	$(LINUX_DIR)/crypto/twofish_generic.ko \
-	$(LINUX_DIR)/crypto/blowfish_common.ko \
-	$(LINUX_DIR)/crypto/blowfish_generic.ko \
-	$(LINUX_DIR)/crypto/serpent_generic.ko
+	$(LINUX_OBJ_DIR)/crypto/anubis.ko \
+	$(LINUX_OBJ_DIR)/crypto/camellia_generic.ko \
+	$(LINUX_OBJ_DIR)/crypto/cast_common.ko \
+	$(LINUX_OBJ_DIR)/crypto/cast5_generic.ko \
+	$(LINUX_OBJ_DIR)/crypto/cast6_generic.ko \
+	$(LINUX_OBJ_DIR)/crypto/khazad.ko \
+	$(LINUX_OBJ_DIR)/crypto/tea.ko \
+	$(LINUX_OBJ_DIR)/crypto/twofish_common.ko \
+	$(LINUX_OBJ_DIR)/crypto/wp512.ko \
+	$(LINUX_OBJ_DIR)/crypto/twofish_generic.ko \
+	$(LINUX_OBJ_DIR)/crypto/blowfish_common.ko \
+	$(LINUX_OBJ_DIR)/crypto/blowfish_generic.ko \
+	$(LINUX_OBJ_DIR)/crypto/serpent_generic.ko
   AUTOLOAD:=$(call AutoLoad,10,anubis camellia_generic cast_common \
 	cast5_generic cast6_generic khazad tea twofish_common \
 	wp512 blowfish_common serpent_generic)
@@ -780,10 +780,10 @@ endef
 ifndef CONFIG_x86_64
   define KernelPackage/crypto-misc/x86
     FILES+= \
-	$(LINUX_DIR)/arch/x86/crypto/twofish-i586.ko \
-	$(LINUX_DIR)/arch/x86/crypto/serpent-sse2-i586.ko \
-	$(LINUX_DIR)/crypto/cryptd.ko \
-	$(LINUX_DIR)/crypto/crypto_simd.ko
+	$(LINUX_OBJ_DIR)/arch/x86/crypto/twofish-i586.ko \
+	$(LINUX_OBJ_DIR)/arch/x86/crypto/serpent-sse2-i586.ko \
+	$(LINUX_OBJ_DIR)/crypto/cryptd.ko \
+	$(LINUX_OBJ_DIR)/crypto/crypto_simd.ko
     AUTOLOAD+= $(call AutoLoad,10,cryptd \
 	serpent-sse2-i586 twofish-i586 blowfish_generic)
   endef
@@ -791,18 +791,18 @@ endif
 
 define KernelPackage/crypto-misc/x86_64
   FILES+= \
-	$(LINUX_DIR)/arch/x86/crypto/camellia-x86_64.ko \
-	$(LINUX_DIR)/arch/x86/crypto/blowfish-x86_64.ko \
-	$(LINUX_DIR)/arch/x86/crypto/twofish-x86_64.ko \
-	$(LINUX_DIR)/arch/x86/crypto/twofish-x86_64-3way.ko \
-	$(LINUX_DIR)/arch/x86/crypto/serpent-sse2-x86_64.ko \
-	$(LINUX_DIR)/arch/x86/crypto/camellia-aesni-avx-x86_64.ko \
-	$(LINUX_DIR)/arch/x86/crypto/cast5-avx-x86_64.ko \
-	$(LINUX_DIR)/arch/x86/crypto/cast6-avx-x86_64.ko \
-	$(LINUX_DIR)/arch/x86/crypto/twofish-avx-x86_64.ko \
-	$(LINUX_DIR)/arch/x86/crypto/serpent-avx-x86_64.ko \
-	$(LINUX_DIR)/arch/x86/crypto/camellia-aesni-avx2.ko \
-	$(LINUX_DIR)/arch/x86/crypto/serpent-avx2.ko
+	$(LINUX_OBJ_DIR)/arch/x86/crypto/camellia-x86_64.ko \
+	$(LINUX_OBJ_DIR)/arch/x86/crypto/blowfish-x86_64.ko \
+	$(LINUX_OBJ_DIR)/arch/x86/crypto/twofish-x86_64.ko \
+	$(LINUX_OBJ_DIR)/arch/x86/crypto/twofish-x86_64-3way.ko \
+	$(LINUX_OBJ_DIR)/arch/x86/crypto/serpent-sse2-x86_64.ko \
+	$(LINUX_OBJ_DIR)/arch/x86/crypto/camellia-aesni-avx-x86_64.ko \
+	$(LINUX_OBJ_DIR)/arch/x86/crypto/cast5-avx-x86_64.ko \
+	$(LINUX_OBJ_DIR)/arch/x86/crypto/cast6-avx-x86_64.ko \
+	$(LINUX_OBJ_DIR)/arch/x86/crypto/twofish-avx-x86_64.ko \
+	$(LINUX_OBJ_DIR)/arch/x86/crypto/serpent-avx-x86_64.ko \
+	$(LINUX_OBJ_DIR)/arch/x86/crypto/camellia-aesni-avx2.ko \
+	$(LINUX_OBJ_DIR)/arch/x86/crypto/serpent-avx2.ko
   AUTOLOAD+= $(call AutoLoad,10,camellia-x86_64 \
 	camellia-aesni-avx-x86_64 camellia-aesni-avx2 cast5-avx-x86_64 \
 	cast6-avx-x86_64 twofish-x86_64 twofish-x86_64-3way \
@@ -820,7 +820,7 @@ $(eval $(call KernelPackage,crypto-misc))
 define KernelPackage/crypto-null
   TITLE:=Null CryptoAPI module
   KCONFIG:=CONFIG_CRYPTO_NULL
-  FILES:=$(LINUX_DIR)/crypto/crypto_null.ko
+  FILES:=$(LINUX_OBJ_DIR)/crypto/crypto_null.ko
   AUTOLOAD:=$(call AutoLoad,09,crypto_null)
   $(call AddDepends/crypto, +kmod-crypto-hash)
 endef
@@ -832,7 +832,7 @@ define KernelPackage/crypto-pcbc
   TITLE:=Propagating Cipher Block Chaining CryptoAPI module
   DEPENDS:=+kmod-crypto-manager
   KCONFIG:=CONFIG_CRYPTO_PCBC
-  FILES:=$(LINUX_DIR)/crypto/pcbc.ko
+  FILES:=$(LINUX_OBJ_DIR)/crypto/pcbc.ko
   AUTOLOAD:=$(call AutoLoad,09,pcbc)
   $(call AddDepends/crypto)
 endef
@@ -846,9 +846,9 @@ define KernelPackage/crypto-rsa
   KCONFIG:= CONFIG_CRYPTO_RSA
   HIDDEN:=1
   FILES:= \
-	$(LINUX_DIR)/lib/mpi/mpi.ko \
-	$(LINUX_DIR)/crypto/akcipher.ko \
-	$(LINUX_DIR)/crypto/rsa_generic.ko
+	$(LINUX_OBJ_DIR)/lib/mpi/mpi.ko \
+	$(LINUX_OBJ_DIR)/crypto/akcipher.ko \
+	$(LINUX_OBJ_DIR)/crypto/rsa_generic.ko
   AUTOLOAD:=$(call AutoLoad,10,rsa_generic)
   $(call AddDepends/crypto)
 endef
@@ -860,7 +860,7 @@ define KernelPackage/crypto-rmd160
   TITLE:=RIPEMD160 digest CryptoAPI module
   DEPENDS:=+kmod-crypto-hash
   KCONFIG:=CONFIG_CRYPTO_RMD160
-  FILES:=$(LINUX_DIR)/crypto/rmd160.ko
+  FILES:=$(LINUX_OBJ_DIR)/crypto/rmd160.ko
   AUTOLOAD:=$(call AutoLoad,09,rmd160)
   $(call AddDepends/crypto)
 endef
@@ -879,9 +879,9 @@ define KernelPackage/crypto-rng
 	CONFIG_CRYPTO_JITTERENTROPY \
 	CONFIG_CRYPTO_RNG2
   FILES:= \
-	$(LINUX_DIR)/crypto/drbg.ko \
-	$(LINUX_DIR)/crypto/jitterentropy_rng.ko \
-	$(LINUX_DIR)/crypto/rng.ko
+	$(LINUX_OBJ_DIR)/crypto/drbg.ko \
+	$(LINUX_OBJ_DIR)/crypto/jitterentropy_rng.ko \
+	$(LINUX_OBJ_DIR)/crypto/rng.ko
   AUTOLOAD:=$(call AutoLoad,09,drbg jitterentropy_rng rng)
   $(call AddDepends/crypto)
 endef
@@ -893,7 +893,7 @@ define KernelPackage/crypto-seqiv
   TITLE:=CryptoAPI Sequence Number IV Generator
   DEPENDS:=+kmod-crypto-aead +kmod-crypto-rng
   KCONFIG:=CONFIG_CRYPTO_SEQIV
-  FILES:=$(LINUX_DIR)/crypto/seqiv.ko
+  FILES:=$(LINUX_OBJ_DIR)/crypto/seqiv.ko
   AUTOLOAD:=$(call AutoLoad,09,seqiv)
   $(call AddDepends/crypto)
 endef
@@ -911,19 +911,19 @@ define KernelPackage/crypto-sha1
 	CONFIG_CRYPTO_SHA1_OCTEON \
 	CONFIG_CRYPTO_SHA1_PPC_SPE \
 	CONFIG_CRYPTO_SHA1_SSSE3
-  FILES:=$(LINUX_DIR)/crypto/sha1_generic.ko
+  FILES:=$(LINUX_OBJ_DIR)/crypto/sha1_generic.ko
   AUTOLOAD:=$(call AutoLoad,09,sha1_generic)
   $(call AddDepends/crypto)
 endef
 
 define KernelPackage/crypto-sha1/arm
-  FILES+=$(LINUX_DIR)/arch/arm/crypto/sha1-arm.ko
+  FILES+=$(LINUX_OBJ_DIR)/arch/arm/crypto/sha1-arm.ko
   AUTOLOAD+=$(call AutoLoad,09,sha1-arm)
 endef
 
 define KernelPackage/crypto-sha1/arm-neon
   $(call KernelPackage/crypto-sha1/arm)
-  FILES+=$(LINUX_DIR)/arch/arm/crypto/sha1-arm-neon.ko
+  FILES+=$(LINUX_OBJ_DIR)/arch/arm/crypto/sha1-arm-neon.ko
   AUTOLOAD+=$(call AutoLoad,09,sha1-arm-neon)
 endef
 
@@ -932,20 +932,20 @@ KernelPackage/crypto-sha1/ipq40xx=$(KernelPackage/crypto-sha1/arm-neon)
 KernelPackage/crypto-sha1/mvebu/cortexa9=$(KernelPackage/crypto-sha1/arm-neon)
 
 define KernelPackage/crypto-sha1/octeon
-  FILES+=$(LINUX_DIR)/arch/mips/cavium-octeon/crypto/octeon-sha1.ko
+  FILES+=$(LINUX_OBJ_DIR)/arch/mips/cavium-octeon/crypto/octeon-sha1.ko
   AUTOLOAD+=$(call AutoLoad,09,octeon-sha1)
 endef
 
 KernelPackage/crypto-sha1/tegra=$(KernelPackage/crypto-sha1/arm)
 
 define KernelPackage/crypto-sha1/mpc85xx
-  FILES+=$(LINUX_DIR)/arch/powerpc/crypto/sha1-ppc-spe.ko
+  FILES+=$(LINUX_OBJ_DIR)/arch/powerpc/crypto/sha1-ppc-spe.ko
   AUTOLOAD+=$(call AutoLoad,09,sha1-ppc-spe)
 endef
 
 ifndef CONFIG_TARGET_uml
 define KernelPackage/crypto-sha1/x86_64
-  FILES+=$(LINUX_DIR)/arch/x86/crypto/sha1-ssse3.ko
+  FILES+=$(LINUX_OBJ_DIR)/arch/x86/crypto/sha1-ssse3.ko
   AUTOLOAD+=$(call AutoLoad,09,sha1-ssse3)
 endef
 endif
@@ -967,25 +967,25 @@ define KernelPackage/crypto-sha256
 	CONFIG_CRYPTO_SHA256_PPC_SPE \
 	CONFIG_CRYPTO_SHA256_SSSE3
   FILES:= \
-	$(LINUX_DIR)/crypto/sha256_generic.ko \
-	$(LINUX_DIR)/lib/crypto/libsha256.ko
+	$(LINUX_OBJ_DIR)/crypto/sha256_generic.ko \
+	$(LINUX_OBJ_DIR)/lib/crypto/libsha256.ko
   AUTOLOAD:=$(call AutoLoad,09,sha256_generic)
   $(call AddDepends/crypto)
 endef
 
 define KernelPackage/crypto-sha256/octeon
-  FILES+=$(LINUX_DIR)/arch/mips/cavium-octeon/crypto/octeon-sha256.ko
+  FILES+=$(LINUX_OBJ_DIR)/arch/mips/cavium-octeon/crypto/octeon-sha256.ko
   AUTOLOAD+=$(call AutoLoad,09,octeon-sha256)
 endef
 
 define KernelPackage/crypto-sha256/mpc85xx
-  FILES+=$(LINUX_DIR)/arch/powerpc/crypto/sha256-ppc-spe.ko
+  FILES+=$(LINUX_OBJ_DIR)/arch/powerpc/crypto/sha256-ppc-spe.ko
   AUTOLOAD+=$(call AutoLoad,09,sha256-ppc-spe)
 endef
 
 ifndef CONFIG_TARGET_uml
 define KernelPackage/crypto-sha256/x86_64
-  FILES+=$(LINUX_DIR)/arch/x86/crypto/sha256-ssse3.ko
+  FILES+=$(LINUX_OBJ_DIR)/arch/x86/crypto/sha256-ssse3.ko
   AUTOLOAD+=$(call AutoLoad,09,sha256-ssse3)
 endef
 endif
@@ -1006,13 +1006,13 @@ define KernelPackage/crypto-sha512
 	CONFIG_CRYPTO_SHA512_ARM \
 	CONFIG_CRYPTO_SHA512_OCTEON \
 	CONFIG_CRYPTO_SHA512_SSSE3
-  FILES:=$(LINUX_DIR)/crypto/sha512_generic.ko
+  FILES:=$(LINUX_OBJ_DIR)/crypto/sha512_generic.ko
   AUTOLOAD:=$(call AutoLoad,09,sha512_generic)
   $(call AddDepends/crypto)
 endef
 
 define KernelPackage/crypto-sha512/arm
-  FILES+=$(LINUX_DIR)/arch/arm/crypto/sha512-arm.ko
+  FILES+=$(LINUX_OBJ_DIR)/arch/arm/crypto/sha512-arm.ko
   AUTOLOAD+=$(call AutoLoad,09,sha512-arm)
 endef
 
@@ -1021,7 +1021,7 @@ KernelPackage/crypto-sha512/ipq40xx=$(KernelPackage/crypto-sha512/arm)
 KernelPackage/crypto-sha512/mvebu/cortexa9=$(KernelPackage/crypto-sha512/arm)
 
 define KernelPackage/crypto-sha512/octeon
-  FILES+=$(LINUX_DIR)/arch/mips/cavium-octeon/crypto/octeon-sha512.ko
+  FILES+=$(LINUX_OBJ_DIR)/arch/mips/cavium-octeon/crypto/octeon-sha512.ko
   AUTOLOAD+=$(call AutoLoad,09,octeon-sha512)
 endef
 
@@ -1029,7 +1029,7 @@ KernelPackage/crypto-sha512/tegra=$(KernelPackage/crypto-sha512/arm)
 
 ifndef CONFIG_TARGET_uml
 define KernelPackage/crypto-sha512/x86_64
-  FILES+=$(LINUX_DIR)/arch/x86/crypto/sha512-ssse3.ko
+  FILES+=$(LINUX_OBJ_DIR)/arch/x86/crypto/sha512-ssse3.ko
   AUTOLOAD+=$(call AutoLoad,09,sha512-ssse3)
 endef
 endif
@@ -1045,7 +1045,7 @@ $(eval $(call KernelPackage,crypto-sha512))
 define KernelPackage/crypto-test
   TITLE:=Test CryptoAPI module
   KCONFIG:=CONFIG_CRYPTO_TEST
-  FILES:=$(LINUX_DIR)/crypto/tcrypt.ko
+  FILES:=$(LINUX_OBJ_DIR)/crypto/tcrypt.ko
   $(call AddDepends/crypto,+kmod-crypto-manager)
 endef
 
@@ -1063,12 +1063,12 @@ define KernelPackage/crypto-user
 	CONFIG_CRYPTO_USER_API_RNG \
 	CONFIG_CRYPTO_USER_API_SKCIPHER
   FILES:= \
-	$(LINUX_DIR)/crypto/af_alg.ko \
-	$(LINUX_DIR)/crypto/algif_aead.ko \
-	$(LINUX_DIR)/crypto/algif_hash.ko \
-	$(LINUX_DIR)/crypto/algif_rng.ko \
-	$(LINUX_DIR)/crypto/algif_skcipher.ko \
-	$(LINUX_DIR)/crypto/crypto_user.ko
+	$(LINUX_OBJ_DIR)/crypto/af_alg.ko \
+	$(LINUX_OBJ_DIR)/crypto/algif_aead.ko \
+	$(LINUX_OBJ_DIR)/crypto/algif_hash.ko \
+	$(LINUX_OBJ_DIR)/crypto/algif_rng.ko \
+	$(LINUX_OBJ_DIR)/crypto/algif_skcipher.ko \
+	$(LINUX_OBJ_DIR)/crypto/crypto_user.ko
   AUTOLOAD:=$(call AutoLoad,09,af_alg algif_aead algif_hash algif_rng algif_skcipher crypto_user)
   $(call AddDepends/crypto)
 endef
@@ -1080,7 +1080,7 @@ define KernelPackage/crypto-xts
   TITLE:=XTS cipher CryptoAPI module
   DEPENDS:=+kmod-crypto-gf128 +kmod-crypto-manager
   KCONFIG:=CONFIG_CRYPTO_XTS
-  FILES:=$(LINUX_DIR)/crypto/xts.ko
+  FILES:=$(LINUX_OBJ_DIR)/crypto/xts.ko
   AUTOLOAD:=$(call AutoLoad,09,xts)
   $(call AddDepends/crypto)
 endef
diff --git a/package/kernel/linux/modules/firewire.mk b/package/kernel/linux/modules/firewire.mk
index 1e2d94272a..5da3793ebe 100644
--- a/package/kernel/linux/modules/firewire.mk
+++ b/package/kernel/linux/modules/firewire.mk
@@ -12,7 +12,7 @@ define KernelPackage/firewire
   TITLE:=Support for FireWire (new stack)
   DEPENDS:=@PCI_SUPPORT +kmod-lib-crc-itu-t
   KCONFIG:=CONFIG_FIREWIRE
-  FILES:=$(LINUX_DIR)/drivers/firewire/firewire-core.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/firewire/firewire-core.ko
 endef
 
 define KernelPackage/firewire/description
@@ -27,7 +27,7 @@ define KernelPackage/firewire-net
   TITLE:=Support for IP networking over FireWire
   DEPENDS:=kmod-firewire
   KCONFIG:=CONFIG_FIREWIRE_NET
-  FILES:=$(LINUX_DIR)/drivers/firewire/firewire-net.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/firewire/firewire-net.ko
   AUTOLOAD:=$(call AutoProbe,firewire-net)
 endef
 
@@ -46,7 +46,7 @@ define KernelPackage/firewire-ohci
 	CONFIG_FIREWIRE_OHCI \
 	CONFIG_FIREWIRE_OHCI_DEBUG=n \
 	CONFIG_FIREWIRE_OHCI_REMOTE_DMA=n
-  FILES:=$(LINUX_DIR)/drivers/firewire/firewire-ohci.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/firewire/firewire-ohci.ko
   AUTOLOAD:=$(call AutoProbe,firewire-ohci)
 endef
 
@@ -63,7 +63,7 @@ define KernelPackage/firewire-sbp2
   TITLE:=Support for SBP-2 devices over FireWire
   DEPENDS:=kmod-firewire +kmod-scsi-core
   KCONFIG:=CONFIG_FIREWIRE_SBP2
-  FILES:=$(LINUX_DIR)/drivers/firewire/firewire-sbp2.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/firewire/firewire-sbp2.ko
   AUTOLOAD:=$(call AutoProbe,firewire-sbp2)
 endef
 
diff --git a/package/kernel/linux/modules/fs.mk b/package/kernel/linux/modules/fs.mk
index f2acaa7439..3fdd403e62 100644
--- a/package/kernel/linux/modules/fs.mk
+++ b/package/kernel/linux/modules/fs.mk
@@ -16,7 +16,7 @@ define KernelPackage/fs-9p
 	CONFIG_9P_FS_POSIX_ACL=n \
 	CONFIG_9P_FS_SECURITY=n \
 	CONFIG_9P_FSCACHE=n
-  FILES:=$(LINUX_DIR)/fs/9p/9p.ko
+  FILES:=$(LINUX_OBJ_DIR)/fs/9p/9p.ko
   AUTOLOAD:=$(call AutoLoad,30,9p)
 endef
 
@@ -36,7 +36,7 @@ define KernelPackage/fs-afs
 	CONFIG_AFS_FS=m \
 	CONFIG_AFS_DEBUG=n \
 	CONFIG_AFS_FSCACHE=y
-  FILES:=$(LINUX_DIR)/fs/afs/kafs.ko
+  FILES:=$(LINUX_OBJ_DIR)/fs/afs/kafs.ko
   AUTOLOAD:=$(call AutoLoad,30,kafs)
 endef
 
@@ -53,7 +53,7 @@ define KernelPackage/fs-autofs4
 	CONFIG_AUTOFS4_FS \
 	CONFIG_AUTOFS_FS
   FILES:= \
-	$(LINUX_DIR)/fs/autofs/autofs4.ko
+	$(LINUX_OBJ_DIR)/fs/autofs/autofs4.ko
   AUTOLOAD:=$(call AutoLoad,30,autofs4)
 endef
 
@@ -72,7 +72,7 @@ define KernelPackage/fs-btrfs
 	CONFIG_BTRFS_FS \
 	CONFIG_BTRFS_FS_CHECK_INTEGRITY=n
   FILES:=\
-	$(LINUX_DIR)/fs/btrfs/btrfs.ko
+	$(LINUX_OBJ_DIR)/fs/btrfs/btrfs.ko
   AUTOLOAD:=$(call AutoLoad,30,btrfs,1)
 endef
 
@@ -91,10 +91,10 @@ define KernelPackage/fs-smbfs-common
 	CONFIG_SMBFS_COMMON at lt6.1 \
 	CONFIG_SMBFS at ge6.1
   FILES:= \
-	$(LINUX_DIR)/fs/smbfs_common/cifs_arc4.ko at lt6.1 \
-	$(LINUX_DIR)/fs/smbfs_common/cifs_md4.ko at lt6.1 \
-	$(LINUX_DIR)/fs/smb/common/cifs_arc4.ko at ge6.1 \
-	$(LINUX_DIR)/fs/smb/common/cifs_md4.ko at ge6.1
+	$(LINUX_OBJ_DIR)/fs/smbfs_common/cifs_arc4.ko at lt6.1 \
+	$(LINUX_OBJ_DIR)/fs/smbfs_common/cifs_md4.ko at lt6.1 \
+	$(LINUX_OBJ_DIR)/fs/smb/common/cifs_arc4.ko at ge6.1 \
+	$(LINUX_OBJ_DIR)/fs/smb/common/cifs_md4.ko at ge6.1
 endef
 
 define KernelPackage/fs-smbfs-common/description
@@ -112,8 +112,8 @@ define KernelPackage/fs-cifs
 	CONFIG_CIFS_DFS_UPCALL=n \
 	CONFIG_CIFS_UPCALL=n
   FILES:= \
-	$(LINUX_DIR)/fs/cifs/cifs.ko at lt6.1 \
-	$(LINUX_DIR)/fs/smb/client/cifs.ko at ge6.1
+	$(LINUX_OBJ_DIR)/fs/cifs/cifs.ko at lt6.1 \
+	$(LINUX_OBJ_DIR)/fs/smb/client/cifs.ko at ge6.1
   AUTOLOAD:=$(call AutoLoad,30,cifs)
   $(call AddDepends/nls)
   DEPENDS+= \
@@ -144,7 +144,7 @@ define KernelPackage/fs-configfs
   TITLE:=Configuration filesystem support
   KCONFIG:= \
 	CONFIG_CONFIGFS_FS
-  FILES:=$(LINUX_DIR)/fs/configfs/configfs.ko
+  FILES:=$(LINUX_OBJ_DIR)/fs/configfs/configfs.ko
   AUTOLOAD:=$(call AutoLoad,30,configfs)
 endef
 
@@ -161,7 +161,7 @@ define KernelPackage/fs-cramfs
   DEPENDS:=+kmod-lib-zlib-inflate
   KCONFIG:= \
 	CONFIG_CRAMFS
-  FILES:=$(LINUX_DIR)/fs/cramfs/cramfs.ko
+  FILES:=$(LINUX_OBJ_DIR)/fs/cramfs/cramfs.ko
   AUTOLOAD:=$(call AutoLoad,30,cramfs)
 endef
 
@@ -176,7 +176,7 @@ define KernelPackage/fs-efivarfs
   SUBMENU:=$(FS_MENU)
   TITLE:=efivar filesystem support
   KCONFIG:=CONFIG_EFIVAR_FS
-  FILES:=$(LINUX_DIR)/fs/efivarfs/efivarfs.ko
+  FILES:=$(LINUX_OBJ_DIR)/fs/efivarfs/efivarfs.ko
   DEPENDS:=@(x86_64||x86)
   AUTOLOAD:=$(call Autoload,90,efivarfs)
 endef
@@ -194,7 +194,7 @@ define KernelPackage/fs-exfat
   KCONFIG:= \
 	CONFIG_EXFAT_FS \
 	CONFIG_EXFAT_DEFAULT_IOCHARSET="utf8"
-  FILES:= $(LINUX_DIR)/fs/exfat/exfat.ko
+  FILES:= $(LINUX_OBJ_DIR)/fs/exfat/exfat.ko
   AUTOLOAD:=$(call AutoLoad,30,exfat,1)
   DEPENDS:=+kmod-nls-base
 endef
@@ -210,7 +210,7 @@ define KernelPackage/fs-exportfs
   SUBMENU:=$(FS_MENU)
   TITLE:=exportfs kernel server support
   KCONFIG:=CONFIG_EXPORTFS
-  FILES=$(LINUX_DIR)/fs/exportfs/exportfs.ko
+  FILES=$(LINUX_OBJ_DIR)/fs/exportfs/exportfs.ko
   AUTOLOAD:=$(call AutoLoad,20,exportfs,1)
 endef
 
@@ -233,9 +233,9 @@ define KernelPackage/fs-ext4
 	CONFIG_EXT4_ENCRYPTION=n \
 	CONFIG_JBD2
   FILES:= \
-	$(LINUX_DIR)/fs/ext4/ext4.ko \
-	$(LINUX_DIR)/fs/jbd2/jbd2.ko \
-	$(LINUX_DIR)/fs/mbcache.ko
+	$(LINUX_OBJ_DIR)/fs/ext4/ext4.ko \
+	$(LINUX_OBJ_DIR)/fs/jbd2/jbd2.ko \
+	$(LINUX_OBJ_DIR)/fs/mbcache.ko
   AUTOLOAD:=$(call AutoLoad,30,mbcache jbd2 ext4,1)
 endef
 
@@ -251,7 +251,7 @@ define KernelPackage/fs-f2fs
   TITLE:=F2FS filesystem support
   DEPENDS:= +kmod-crypto-hash +kmod-crypto-crc32 +kmod-nls-base
   KCONFIG:=CONFIG_F2FS_FS
-  FILES:=$(LINUX_DIR)/fs/f2fs/f2fs.ko
+  FILES:=$(LINUX_OBJ_DIR)/fs/f2fs/f2fs.ko
   AUTOLOAD:=$(call AutoLoad,30,f2fs,1)
 endef
 
@@ -278,8 +278,8 @@ define KernelPackage/fs-fscache
 	CONFIG_CACHEFILES_ERROR_INJECTION=n at ge5.17 \
 	CONFIG_CACHEFILES_ONDEMAND=n at ge5.19
   FILES:= \
-	$(LINUX_DIR)/fs/fscache/fscache.ko \
-	$(LINUX_DIR)/fs/cachefiles/cachefiles.ko
+	$(LINUX_OBJ_DIR)/fs/fscache/fscache.ko \
+	$(LINUX_OBJ_DIR)/fs/cachefiles/cachefiles.ko
   AUTOLOAD:=$(call AutoLoad,29,fscache cachefiles)
 endef
 
@@ -291,7 +291,7 @@ define KernelPackage/fs-hfs
   TITLE:=HFS filesystem support
   DEPENDS:=+kmod-cdrom
   KCONFIG:=CONFIG_HFS_FS
-  FILES:=$(LINUX_DIR)/fs/hfs/hfs.ko
+  FILES:=$(LINUX_OBJ_DIR)/fs/hfs/hfs.ko
   AUTOLOAD:=$(call AutoLoad,30,hfs)
   $(call AddDepends/nls)
 endef
@@ -308,7 +308,7 @@ define KernelPackage/fs-hfsplus
   TITLE:=HFS+ filesystem support
   DEPENDS:=+kmod-cdrom
   KCONFIG:=CONFIG_HFSPLUS_FS
-  FILES:=$(LINUX_DIR)/fs/hfsplus/hfsplus.ko
+  FILES:=$(LINUX_OBJ_DIR)/fs/hfsplus/hfsplus.ko
   AUTOLOAD:=$(call AutoLoad,30,hfsplus)
   $(call AddDepends/nls,utf8)
 endef
@@ -325,7 +325,7 @@ define KernelPackage/fs-isofs
   TITLE:=ISO9660 filesystem support
   DEPENDS:=+kmod-lib-zlib-inflate +kmod-cdrom
   KCONFIG:=CONFIG_ISO9660_FS CONFIG_JOLIET=y CONFIG_ZISOFS=n
-  FILES:=$(LINUX_DIR)/fs/isofs/isofs.ko
+  FILES:=$(LINUX_OBJ_DIR)/fs/isofs/isofs.ko
   AUTOLOAD:=$(call AutoLoad,30,isofs)
   $(call AddDepends/nls)
 endef
@@ -341,7 +341,7 @@ define KernelPackage/fs-jfs
   SUBMENU:=$(FS_MENU)
   TITLE:=JFS filesystem support
   KCONFIG:=CONFIG_JFS_FS
-  FILES:=$(LINUX_DIR)/fs/jfs/jfs.ko
+  FILES:=$(LINUX_OBJ_DIR)/fs/jfs/jfs.ko
   AUTOLOAD:=$(call AutoLoad,30,jfs,1)
   $(call AddDepends/nls)
 endef
@@ -379,8 +379,8 @@ define KernelPackage/fs-ksmbd
 	CONFIG_SMB_SERVER_CHECK_CAP_NET_ADMIN=n \
 	CONFIG_SMB_SERVER_KERBEROS5=n
   FILES:= \
-	 $(LINUX_DIR)/fs/ksmbd/ksmbd.ko at lt6.1 \
-	 $(LINUX_DIR)/fs/smb/server/ksmbd.ko at ge6.1
+	 $(LINUX_OBJ_DIR)/fs/ksmbd/ksmbd.ko at lt6.1 \
+	 $(LINUX_OBJ_DIR)/fs/smb/server/ksmbd.ko at ge6.1
   AUTOLOAD:=$(call AutoLoad,41,ksmbd)
 endef
 
@@ -395,7 +395,7 @@ define KernelPackage/fs-minix
   SUBMENU:=$(FS_MENU)
   TITLE:=Minix filesystem support
   KCONFIG:=CONFIG_MINIX_FS
-  FILES:=$(LINUX_DIR)/fs/minix/minix.ko
+  FILES:=$(LINUX_OBJ_DIR)/fs/minix/minix.ko
   AUTOLOAD:=$(call AutoLoad,30,minix)
 endef
 
@@ -411,7 +411,7 @@ define KernelPackage/fs-msdos
   TITLE:=MSDOS filesystem support
   DEPENDS:=+kmod-fs-vfat
   KCONFIG:=CONFIG_MSDOS_FS
-  FILES:=$(LINUX_DIR)/fs/fat/msdos.ko
+  FILES:=$(LINUX_OBJ_DIR)/fs/fat/msdos.ko
   AUTOLOAD:=$(call AutoLoad,40,msdos)
   $(call AddDepends/nls)
 endef
@@ -427,7 +427,7 @@ define KernelPackage/fs-netfs
   SUBMENU:=$(FS_MENU)
   TITLE:=Network Filesystems support
   KCONFIG:= CONFIG_NETFS_SUPPORT
-  FILES:=$(LINUX_DIR)/fs/netfs/netfs.ko
+  FILES:=$(LINUX_OBJ_DIR)/fs/netfs/netfs.ko
   AUTOLOAD:=$(call AutoLoad,28,netfs)
 endef
 
@@ -443,7 +443,7 @@ define KernelPackage/fs-nfs
 	CONFIG_NFS_USE_LEGACY_DNS=n \
 	CONFIG_NFS_USE_NEW_IDMAPPER=n
   FILES:= \
-	$(LINUX_DIR)/fs/nfs/nfs.ko
+	$(LINUX_OBJ_DIR)/fs/nfs/nfs.ko
   AUTOLOAD:=$(call AutoLoad,40,nfs)
 endef
 
@@ -469,10 +469,10 @@ define KernelPackage/fs-nfs-common
 	CONFIG_NFS_V4_2=y \
 	CONFIG_NFS_V4_2_READ_PLUS=n
   FILES:= \
-	$(LINUX_DIR)/fs/lockd/lockd.ko \
-	$(LINUX_DIR)/net/sunrpc/sunrpc.ko \
-	$(LINUX_DIR)/fs/nfs_common/grace.ko \
-	$(LINUX_DIR)/fs/nfs_common/nfs_ssc.ko
+	$(LINUX_OBJ_DIR)/fs/lockd/lockd.ko \
+	$(LINUX_OBJ_DIR)/net/sunrpc/sunrpc.ko \
+	$(LINUX_OBJ_DIR)/fs/nfs_common/grace.ko \
+	$(LINUX_OBJ_DIR)/fs/nfs_common/nfs_ssc.ko
   AUTOLOAD:=$(call AutoLoad,30,grace sunrpc lockd)
 endef
 
@@ -496,8 +496,8 @@ define KernelPackage/fs-nfs-common-rpcsec
 	CONFIG_SUNRPC_GSS \
 	CONFIG_RPCSEC_GSS_KRB5
   FILES:= \
-	$(LINUX_DIR)/net/sunrpc/auth_gss/auth_rpcgss.ko \
-	$(LINUX_DIR)/net/sunrpc/auth_gss/rpcsec_gss_krb5.ko
+	$(LINUX_OBJ_DIR)/net/sunrpc/auth_gss/auth_rpcgss.ko \
+	$(LINUX_OBJ_DIR)/net/sunrpc/auth_gss/rpcsec_gss_krb5.ko
   AUTOLOAD:=$(call AutoLoad,31,auth_rpcgss rpcsec_gss_krb5)
 endef
 
@@ -513,7 +513,7 @@ define KernelPackage/fs-nfs-v3
   TITLE:=NFS3 filesystem client support
   DEPENDS:=+kmod-fs-nfs
   FILES:= \
-	$(LINUX_DIR)/fs/nfs/nfsv3.ko
+	$(LINUX_OBJ_DIR)/fs/nfs/nfsv3.ko
   AUTOLOAD:=$(call AutoLoad,41,nfsv3)
 endef
 
@@ -531,7 +531,7 @@ define KernelPackage/fs-nfs-v4
   KCONFIG:= \
 	CONFIG_NFS_V4=y
   FILES:= \
-	$(LINUX_DIR)/fs/nfs/nfsv4.ko
+	$(LINUX_OBJ_DIR)/fs/nfs/nfsv4.ko
   AUTOLOAD:=$(call AutoLoad,41,nfsv4)
 endef
 
@@ -555,7 +555,7 @@ define KernelPackage/fs-nfsd
 	CONFIG_NFSD_FLEXFILELAYOUT=n \
 	CONFIG_NFSD_FAULT_INJECTION=n \
 	CONFIG_NFSD_V4_2_INTER_SSC=n
-  FILES:=$(LINUX_DIR)/fs/nfsd/nfsd.ko
+  FILES:=$(LINUX_OBJ_DIR)/fs/nfsd/nfsd.ko
   AUTOLOAD:=$(call AutoLoad,40,nfsd)
 endef
 
@@ -570,7 +570,7 @@ define KernelPackage/fs-ntfs
   SUBMENU:=$(FS_MENU)
   TITLE:=NTFS filesystem read-only (old driver) support
   KCONFIG:=CONFIG_NTFS_FS
-  FILES:=$(LINUX_DIR)/fs/ntfs/ntfs.ko
+  FILES:=$(LINUX_OBJ_DIR)/fs/ntfs/ntfs.ko
   AUTOLOAD:=$(call AutoLoad,30,ntfs)
   $(call AddDepends/nls)
 endef
@@ -587,7 +587,7 @@ define KernelPackage/fs-ntfs3
   SUBMENU:=$(FS_MENU)
   TITLE:=NTFS filesystem read & write (new driver) support
   KCONFIG:= CONFIG_NTFS3_FS CONFIG_NTFS3_FS_POSIX_ACL=y
-  FILES:=$(LINUX_DIR)/fs/ntfs3/ntfs3.ko
+  FILES:=$(LINUX_OBJ_DIR)/fs/ntfs3/ntfs3.ko
   $(call AddDepends/nls)
   AUTOLOAD:=$(call AutoLoad,80,ntfs3)
 endef
@@ -606,7 +606,7 @@ define KernelPackage/fs-reiserfs
   SUBMENU:=$(FS_MENU)
   TITLE:=ReiserFS filesystem support
   KCONFIG:=CONFIG_REISERFS_FS
-  FILES:=$(LINUX_DIR)/fs/reiserfs/reiserfs.ko
+  FILES:=$(LINUX_OBJ_DIR)/fs/reiserfs/reiserfs.ko
   AUTOLOAD:=$(call AutoLoad,30,reiserfs,1)
 endef
 
@@ -622,7 +622,7 @@ define KernelPackage/fs-squashfs
   TITLE:=SquashFS 4.0 filesystem support
   KCONFIG:=CONFIG_SQUASHFS \
 	CONFIG_SQUASHFS_XZ=y
-  FILES:=$(LINUX_DIR)/fs/squashfs/squashfs.ko
+  FILES:=$(LINUX_OBJ_DIR)/fs/squashfs/squashfs.ko
   AUTOLOAD:=$(call AutoLoad,30,squashfs,1)
 endef
 
@@ -637,7 +637,7 @@ define KernelPackage/fs-udf
   SUBMENU:=$(FS_MENU)
   TITLE:=UDF filesystem support
   KCONFIG:=CONFIG_UDF_FS
-  FILES:=$(LINUX_DIR)/fs/udf/udf.ko
+  FILES:=$(LINUX_OBJ_DIR)/fs/udf/udf.ko
   AUTOLOAD:=$(call AutoLoad,30,udf)
   DEPENDS:=+kmod-lib-crc-itu-t +kmod-cdrom
   $(call AddDepends/nls)
@@ -657,8 +657,8 @@ define KernelPackage/fs-vfat
 	CONFIG_FAT_FS \
 	CONFIG_VFAT_FS
   FILES:= \
-	$(LINUX_DIR)/fs/fat/fat.ko \
-	$(LINUX_DIR)/fs/fat/vfat.ko
+	$(LINUX_OBJ_DIR)/fs/fat/fat.ko \
+	$(LINUX_OBJ_DIR)/fs/fat/vfat.ko
   AUTOLOAD:=$(call AutoLoad,30,fat vfat,1)
   $(call AddDepends/nls,cp437 iso8859-1 utf8)
 endef
@@ -675,7 +675,7 @@ define KernelPackage/fs-xfs
   TITLE:=XFS filesystem support
   KCONFIG:=CONFIG_XFS_FS
   DEPENDS:= +kmod-fs-exportfs +kmod-lib-crc32c
-  FILES:=$(LINUX_DIR)/fs/xfs/xfs.ko
+  FILES:=$(LINUX_OBJ_DIR)/fs/xfs/xfs.ko
   AUTOLOAD:=$(call AutoLoad,30,xfs,1)
 endef
 
@@ -690,7 +690,7 @@ define KernelPackage/fuse
   SUBMENU:=$(FS_MENU)
   TITLE:=FUSE (Filesystem in Userspace) support
   KCONFIG:= CONFIG_FUSE_FS
-  FILES:=$(LINUX_DIR)/fs/fuse/fuse.ko
+  FILES:=$(LINUX_OBJ_DIR)/fs/fuse/fuse.ko
   AUTOLOAD:=$(call AutoLoad,80,fuse)
 endef
 
@@ -711,7 +711,7 @@ define KernelPackage/pstore
 	CONFIG_PSTORE_COMPRESS_DEFAULT="deflate" \
 	CONFIG_PSTORE_DEFLATE_COMPRESS=y \
 	CONFIG_PSTORE_DEFLATE_COMPRESS_DEFAULT=y
-  FILES:= $(LINUX_DIR)/fs/pstore/pstore.ko
+  FILES:= $(LINUX_OBJ_DIR)/fs/pstore/pstore.ko
   AUTOLOAD:=$(call AutoLoad,30,pstore,1)
 endef
 
diff --git a/package/kernel/linux/modules/gpio-cascade.mk b/package/kernel/linux/modules/gpio-cascade.mk
index 3a559f19ef..a72e980062 100644
--- a/package/kernel/linux/modules/gpio-cascade.mk
+++ b/package/kernel/linux/modules/gpio-cascade.mk
@@ -9,7 +9,7 @@ define KernelPackage/gpio-cascade
   TITLE:=Generic GPIO cascade
   KCONFIG:=CONFIG_GPIO_CASCADE
   DEPENDS:=@GPIO_SUPPORT +kmod-mux-core
-  FILES:=$(LINUX_DIR)/drivers/gpio/gpio-cascade.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/gpio/gpio-cascade.ko
   AUTOLOAD:=$(call AutoLoad,29,gpio-cascade,1)
 endef
 
diff --git a/package/kernel/linux/modules/hwmon.mk b/package/kernel/linux/modules/hwmon.mk
index 8638d50823..6611b9226d 100644
--- a/package/kernel/linux/modules/hwmon.mk
+++ b/package/kernel/linux/modules/hwmon.mk
@@ -14,7 +14,7 @@ define KernelPackage/hwmon-core
 	CONFIG_HWMON \
 	CONFIG_HWMON_DEBUG_CHIP=n
   FILES:= \
-	$(LINUX_DIR)/drivers/hwmon/hwmon.ko
+	$(LINUX_OBJ_DIR)/drivers/hwmon/hwmon.ko
 endef
 
 define KernelPackage/hwmon-core/description
@@ -32,7 +32,7 @@ endef
 define KernelPackage/hwmon-ad7418
   TITLE:=AD741x monitoring support
   KCONFIG:=CONFIG_SENSORS_AD7418
-  FILES:=$(LINUX_DIR)/drivers/hwmon/ad7418.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/hwmon/ad7418.ko
   AUTOLOAD:=$(call AutoLoad,60,ad7418 ad7418)
   $(call AddDepends/hwmon,+kmod-i2c-core)
 endef
@@ -49,8 +49,8 @@ define KernelPackage/hwmon-adt7410
 	CONFIG_SENSORS_ADT7X10 \
 	CONFIG_SENSORS_ADT7410
   FILES:= \
-	$(LINUX_DIR)/drivers/hwmon/adt7x10.ko \
-	$(LINUX_DIR)/drivers/hwmon/adt7410.ko
+	$(LINUX_OBJ_DIR)/drivers/hwmon/adt7x10.ko \
+	$(LINUX_OBJ_DIR)/drivers/hwmon/adt7410.ko
   AUTOLOAD:=$(call AutoLoad,60,adt7x10 adt7410)
   $(call AddDepends/hwmon,+kmod-i2c-core +LINUX_6_1:kmod-regmap-core)
 endef
@@ -65,7 +65,7 @@ $(eval $(call KernelPackage,hwmon-adt7410))
 define KernelPackage/hwmon-adt7475
   TITLE:=ADT7473/7475/7476/7490 monitoring support
   KCONFIG:=CONFIG_SENSORS_ADT7475
-  FILES:=$(LINUX_DIR)/drivers/hwmon/adt7475.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/hwmon/adt7475.ko
   AUTOLOAD:=$(call AutoProbe,adt7475)
   $(call AddDepends/hwmon,+kmod-i2c-core +kmod-hwmon-vid)
 endef
@@ -80,7 +80,7 @@ $(eval $(call KernelPackage,hwmon-adt7475))
 define KernelPackage/hwmon-coretemp
   TITLE:=Intel Core/Core2/Atom temperature sensor
   KCONFIG:=CONFIG_SENSORS_CORETEMP
-  FILES:=$(LINUX_DIR)/drivers/hwmon/coretemp.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/hwmon/coretemp.ko
   AUTOLOAD:=$(call AutoProbe,coretemp)
   $(call AddDepends/hwmon,)
 endef
@@ -98,7 +98,7 @@ define KernelPackage/hwmon-dme1737
   TITLE:=SMSC DME1737 and compatible monitoring support
   KCONFIG:=CONFIG_SENSORS_DME1737
   FILES:= \
-	$(LINUX_DIR)/drivers/hwmon/dme1737.ko
+	$(LINUX_OBJ_DIR)/drivers/hwmon/dme1737.ko
   AUTOLOAD:=$(call AutoProbe,dme1737)
   $(call AddDepends/hwmon,+kmod-i2c-core +kmod-hwmon-vid)
 endef
@@ -113,7 +113,7 @@ $(eval $(call KernelPackage,hwmon-dme1737))
 define KernelPackage/hwmon-drivetemp
   TITLE:=Hard disk drives with temperature sensor
   KCONFIG:=CONFIG_SENSORS_DRIVETEMP
-  FILES:=$(LINUX_DIR)/drivers/hwmon/drivetemp.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/hwmon/drivetemp.ko
   AUTOLOAD:=$(call AutoLoad,60,drivetemp)
   $(call AddDepends/hwmon,+kmod-ata-core +kmod-scsi-core)
 endef
@@ -130,8 +130,8 @@ define KernelPackage/hwmon-gsc
   KCONFIG:=CONFIG_MFD_GATEWORKS_GSC \
         CONFIG_SENSORS_GSC
   FILES:= \
-	$(LINUX_DIR)/drivers/mfd/gateworks-gsc.ko \
-	$(LINUX_DIR)/drivers/hwmon/gsc-hwmon.ko
+	$(LINUX_OBJ_DIR)/drivers/mfd/gateworks-gsc.ko \
+	$(LINUX_OBJ_DIR)/drivers/hwmon/gsc-hwmon.ko
   AUTOLOAD:=$(call AutoLoad,20,gsc-hwmon,1)
   $(call AddDepends/hwmon,+kmod-i2c-core)
 endef
@@ -147,7 +147,7 @@ $(eval $(call KernelPackage,hwmon-gsc))
 define KernelPackage/hwmon-gpiofan
   TITLE:=Generic GPIO FAN support
   KCONFIG:=CONFIG_SENSORS_GPIO_FAN
-  FILES:=$(LINUX_DIR)/drivers/hwmon/gpio-fan.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/hwmon/gpio-fan.ko
   AUTOLOAD:=$(call AutoLoad,60,gpio-fan)
   $(call AddDepends/hwmon,+kmod-i2c-core +PACKAGE_kmod-thermal:kmod-thermal)
 endef
@@ -162,7 +162,7 @@ $(eval $(call KernelPackage,hwmon-gpiofan))
 define KernelPackage/hwmon-f71882fg
   TITLE:=F71882FG compatible monitoring support
   KCONFIG:=CONFIG_SENSORS_F71882FG
-  FILES:=$(LINUX_DIR)/drivers/hwmon/f71882fg.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/hwmon/f71882fg.ko
   AUTOLOAD:=$(call AutoProbe,f71882fg)
   $(call AddDepends/hwmon, at TARGET_x86)
 endef
@@ -177,7 +177,7 @@ $(eval $(call KernelPackage,hwmon-f71882fg))
 define KernelPackage/hwmon-g762
   TITLE:=G762/G763 fan speed PWM controller support
   KCONFIG:=CONFIG_SENSORS_G762
-  FILES:=$(LINUX_DIR)/drivers/hwmon/g762.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/hwmon/g762.ko
   AUTOLOAD:=$(call AutoProbe,g762)
   $(call AddDepends/hwmon,+kmod-i2c-core)
 endef
@@ -192,7 +192,7 @@ $(eval $(call KernelPackage,hwmon-g762))
 define KernelPackage/hwmon-ina209
   TITLE:=INA209 monitoring support
   KCONFIG:=CONFIG_SENSORS_INA209
-  FILES:=$(LINUX_DIR)/drivers/hwmon/ina209.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/hwmon/ina209.ko
   AUTOLOAD:=$(call AutoProbe,ina209)
   $(call AddDepends/hwmon,+kmod-i2c-core)
 endef
@@ -207,7 +207,7 @@ $(eval $(call KernelPackage,hwmon-ina209))
 define KernelPackage/hwmon-ina2xx
   TITLE:=INA2XX monitoring support
   KCONFIG:=CONFIG_SENSORS_INA2XX
-  FILES:=$(LINUX_DIR)/drivers/hwmon/ina2xx.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/hwmon/ina2xx.ko
   AUTOLOAD:=$(call AutoProbe,ina2xx)
   $(call AddDepends/hwmon,+kmod-i2c-core +kmod-regmap-i2c)
 endef
@@ -222,7 +222,7 @@ $(eval $(call KernelPackage,hwmon-ina2xx))
 define KernelPackage/hwmon-it87
   TITLE:=IT87 monitoring support
   KCONFIG:=CONFIG_SENSORS_IT87
-  FILES:=$(LINUX_DIR)/drivers/hwmon/it87.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/hwmon/it87.ko
   AUTOLOAD:=$(call AutoProbe,it87)
   $(call AddDepends/hwmon,+kmod-i2c-core +kmod-hwmon-vid +PACKAGE_kmod-thermal:kmod-thermal)
 endef
@@ -237,7 +237,7 @@ $(eval $(call KernelPackage,hwmon-it87))
 define KernelPackage/hwmon-jc42
   TITLE:=Jedec JC42.4 compliant temperature sensors support
   KCONFIG:=CONFIG_SENSORS_JC42
-  FILES:=$(LINUX_DIR)/drivers/hwmon/jc42.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/hwmon/jc42.ko
   AUTOLOAD:=$(call AutoProbe,jc42)
   $(call AddDepends/hwmon,+kmod-i2c-core +kmod-regmap-i2c)
 endef
@@ -252,7 +252,7 @@ $(eval $(call KernelPackage,hwmon-jc42))
 define KernelPackage/hwmon-lm63
   TITLE:=LM63/64 monitoring support
   KCONFIG:=CONFIG_SENSORS_LM63
-  FILES:=$(LINUX_DIR)/drivers/hwmon/lm63.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/hwmon/lm63.ko
   AUTOLOAD:=$(call AutoProbe,lm63)
   $(call AddDepends/hwmon,+kmod-i2c-core +kmod-regmap-i2c)
 endef
@@ -269,7 +269,7 @@ define KernelPackage/hwmon-lm70
   KCONFIG:=CONFIG_SENSORS_LM70 \
         CONFIG_SPI=y \
         CONFIG_SPI_MASTER=y
-  FILES:=$(LINUX_DIR)/drivers/hwmon/lm70.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/hwmon/lm70.ko
   AUTOLOAD:=$(call AutoProbe,lm70)
   $(call AddDepends/hwmon)
 endef
@@ -284,7 +284,7 @@ $(eval $(call KernelPackage,hwmon-lm70))
 define KernelPackage/hwmon-lm75
   TITLE:=LM75 monitoring support
   KCONFIG:=CONFIG_SENSORS_LM75
-  FILES:=$(LINUX_DIR)/drivers/hwmon/lm75.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/hwmon/lm75.ko
   AUTOLOAD:=$(call AutoProbe,lm75)
   $(call AddDepends/hwmon,+kmod-i2c-core +PACKAGE_kmod-thermal:kmod-thermal +kmod-regmap-i2c)
 endef
@@ -299,7 +299,7 @@ $(eval $(call KernelPackage,hwmon-lm75))
 define KernelPackage/hwmon-lm77
   TITLE:=LM77 monitoring support
   KCONFIG:=CONFIG_SENSORS_LM77
-  FILES:=$(LINUX_DIR)/drivers/hwmon/lm77.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/hwmon/lm77.ko
   AUTOLOAD:=$(call AutoProbe,lm77)
   $(call AddDepends/hwmon,+kmod-i2c-core)
 endef
@@ -314,7 +314,7 @@ $(eval $(call KernelPackage,hwmon-lm77))
 define KernelPackage/hwmon-lm85
   TITLE:=LM85 monitoring support
   KCONFIG:=CONFIG_SENSORS_LM85
-  FILES:=$(LINUX_DIR)/drivers/hwmon/lm85.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/hwmon/lm85.ko
   AUTOLOAD:=$(call AutoProbe,lm85)
   $(call AddDepends/hwmon,+kmod-i2c-core +kmod-hwmon-vid)
 endef
@@ -329,7 +329,7 @@ $(eval $(call KernelPackage,hwmon-lm85))
 define KernelPackage/hwmon-lm90
   TITLE:=LM90 monitoring support
   KCONFIG:=CONFIG_SENSORS_LM90
-  FILES:=$(LINUX_DIR)/drivers/hwmon/lm90.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/hwmon/lm90.ko
   AUTOLOAD:=$(call AutoProbe,lm90)
   $(call AddDepends/hwmon,+kmod-i2c-core)
 endef
@@ -344,7 +344,7 @@ $(eval $(call KernelPackage,hwmon-lm90))
 define KernelPackage/hwmon-lm92
   TITLE:=LM92 monitoring support
   KCONFIG:=CONFIG_SENSORS_LM92
-  FILES:=$(LINUX_DIR)/drivers/hwmon/lm92.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/hwmon/lm92.ko
   AUTOLOAD:=$(call AutoProbe,lm92)
   $(call AddDepends/hwmon,+kmod-i2c-core)
 endef
@@ -359,7 +359,7 @@ $(eval $(call KernelPackage,hwmon-lm92))
 define KernelPackage/hwmon-lm95241
   TITLE:=LM95241 monitoring support
   KCONFIG:=CONFIG_SENSORS_LM95241
-  FILES:=$(LINUX_DIR)/drivers/hwmon/lm95241.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/hwmon/lm95241.ko
   AUTOLOAD:=$(call AutoProbe,lm95241)
   $(call AddDepends/hwmon,+kmod-i2c-core)
 endef
@@ -374,7 +374,7 @@ $(eval $(call KernelPackage,hwmon-lm95241))
 define KernelPackage/hwmon-ltc4151
   TITLE:=LTC4151 monitoring support
   KCONFIG:=CONFIG_SENSORS_LTC4151
-  FILES:=$(LINUX_DIR)/drivers/hwmon/ltc4151.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/hwmon/ltc4151.ko
   AUTOLOAD:=$(call AutoProbe,ltc4151)
   $(call AddDepends/hwmon,+kmod-i2c-core)
 endef
@@ -389,7 +389,7 @@ $(eval $(call KernelPackage,hwmon-ltc4151))
 define KernelPackage/hwmon-max6642
   TITLE:=MAX6642 monitoring support
   KCONFIG:=CONFIG_SENSORS_MAX6642
-  FILES:=$(LINUX_DIR)/drivers/hwmon/max6642.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/hwmon/max6642.ko
   AUTOLOAD:=$(call AutoLoad,60,max6642 max6642)
   $(call AddDepends/hwmon,+kmod-i2c-core)
 endef
@@ -404,7 +404,7 @@ $(eval $(call KernelPackage,hwmon-max6642))
 define KernelPackage/hwmon-max6697
   TITLE:=MAX6697 monitoring support
   KCONFIG:=CONFIG_SENSORS_MAX6697
-  FILES:=$(LINUX_DIR)/drivers/hwmon/max6697.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/hwmon/max6697.ko
   AUTOLOAD:=$(call AutoProbe,max6697)
   $(call AddDepends/hwmon,+kmod-i2c-core)
 endef
@@ -419,7 +419,7 @@ $(eval $(call KernelPackage,hwmon-max6697))
 define KernelPackage/hwmon-mcp3021
   TITLE:=MCP3021/3221 monitoring support
   KCONFIG:=CONFIG_SENSORS_MCP3021
-  FILES:=$(LINUX_DIR)/drivers/hwmon/mcp3021.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/hwmon/mcp3021.ko
   AUTOLOAD:=$(call AutoProbe,mcp3021)
   $(call AddDepends/hwmon,+kmod-i2c-core)
 endef
@@ -435,8 +435,8 @@ define KernelPackage/hwmon-nct6775
   TITLE:=NCT6106D/6775F/6776F/6779D/6791D/6792D/6793D and compatibles monitoring support
   KCONFIG:=CONFIG_SENSORS_NCT6775
   FILES:= \
-	$(LINUX_DIR)/drivers/hwmon/nct6775.ko \
-	$(LINUX_DIR)/drivers/hwmon/nct6775-core.ko at ge5.19
+	$(LINUX_OBJ_DIR)/drivers/hwmon/nct6775.ko \
+	$(LINUX_OBJ_DIR)/drivers/hwmon/nct6775-core.ko at ge5.19
   AUTOLOAD:=$(call AutoProbe,nct6775)
   $(call AddDepends/hwmon, at PCI_SUPPORT @TARGET_x86 +kmod-hwmon-vid +LINUX_6_1:kmod-regmap-core)
 endef
@@ -451,7 +451,7 @@ $(eval $(call KernelPackage,hwmon-nct6775))
 define KernelPackage/hwmon-nct7802
   TITLE:=NCT7802Y and compatibles monitoring support
   KCONFIG:=CONFIG_SENSORS_NCT7802
-  FILES:=$(LINUX_DIR)/drivers/hwmon/nct7802.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/hwmon/nct7802.ko
   AUTOLOAD:=$(call AutoProbe,nct7802)
   $(call AddDepends/hwmon,+kmod-regmap-i2c)
 endef
@@ -466,7 +466,7 @@ $(eval $(call KernelPackage,hwmon-nct7802))
 define KernelPackage/hwmon-pc87360
   TITLE:=PC87360 monitoring support
   KCONFIG:=CONFIG_SENSORS_PC87360
-  FILES:=$(LINUX_DIR)/drivers/hwmon/pc87360.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/hwmon/pc87360.ko
   AUTOLOAD:=$(call AutoProbe,pc87360)
   $(call AddDepends/hwmon, at TARGET_x86 +kmod-hwmon-vid)
 endef
@@ -481,7 +481,7 @@ $(eval $(call KernelPackage,hwmon-pc87360))
 define KernelPackage/pmbus-core
   TITLE:=PMBus support
   KCONFIG:= CONFIG_PMBUS
-  FILES:=$(LINUX_DIR)/drivers/hwmon/pmbus/pmbus_core.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/hwmon/pmbus/pmbus_core.ko
   $(call AddDepends/hwmon,+kmod-i2c-core)
 endef
 
@@ -495,7 +495,7 @@ $(eval $(call KernelPackage,pmbus-core))
 define KernelPackage/pmbus-zl6100
   TITLE:=Intersil / Zilker Labs ZL6100 hardware monitoring
   KCONFIG:=CONFIG_SENSORS_ZL6100
-  FILES:=$(LINUX_DIR)/drivers/hwmon/pmbus/zl6100.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/hwmon/pmbus/zl6100.ko
   AUTOLOAD:=$(call AutoProbe,zl6100)
   $(call AddDepends/hwmon, +kmod-pmbus-core)
 endef
@@ -511,7 +511,7 @@ $(eval $(call KernelPackage,pmbus-zl6100))
 define KernelPackage/hwmon-pwmfan
   TITLE:=Generic PWM FAN support
   KCONFIG:=CONFIG_SENSORS_PWM_FAN
-  FILES:=$(LINUX_DIR)/drivers/hwmon/pwm-fan.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/hwmon/pwm-fan.ko
   AUTOLOAD:=$(call AutoLoad,60,pwm-fan)
   $(call AddDepends/hwmon, +PACKAGE_kmod-thermal:kmod-thermal)
 endef
@@ -529,8 +529,8 @@ define KernelPackage/hwmon-sch5627
 	CONFIG_SENSORS_SCH5627 \
 	CONFIG_WATCHDOG_CORE=y
   FILES:= \
-	$(LINUX_DIR)/drivers/hwmon/sch5627.ko \
-	$(LINUX_DIR)/drivers/hwmon/sch56xx-common.ko
+	$(LINUX_OBJ_DIR)/drivers/hwmon/sch5627.ko \
+	$(LINUX_OBJ_DIR)/drivers/hwmon/sch56xx-common.ko
   AUTOLOAD:=$(call AutoProbe,sch5627)
   $(call AddDepends/hwmon,+kmod-i2c-core)
 endef
@@ -545,7 +545,7 @@ $(eval $(call KernelPackage,hwmon-sch5627))
 define KernelPackage/hwmon-sht21
   TITLE:=Sensiron SHT21 and compat. monitoring support
   KCONFIG:=CONFIG_SENSORS_SHT21
-  FILES:=$(LINUX_DIR)/drivers/hwmon/sht21.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/hwmon/sht21.ko
   AUTOLOAD:=$(call AutoProbe,sht21)
   $(call AddDepends/hwmon,+kmod-i2c-core)
 endef
@@ -560,7 +560,7 @@ $(eval $(call KernelPackage,hwmon-sht21))
 define KernelPackage/hwmon-sht3x
   TITLE:=Sensiron SHT3x and compat. monitoring support
   KCONFIG:=CONFIG_SENSORS_SHT3x
-  FILES:=$(LINUX_DIR)/drivers/hwmon/sht3x.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/hwmon/sht3x.ko
   AUTOLOAD:=$(call AutoProbe,sht3x)
   $(call AddDepends/hwmon,+kmod-i2c-core +kmod-lib-crc8)
 endef
@@ -575,7 +575,7 @@ $(eval $(call KernelPackage,hwmon-sht3x))
 define KernelPackage/hwmon-tmp102
   TITLE:=Texas Instruments TMP102 monitoring support
   KCONFIG:=CONFIG_SENSORS_TMP102
-  FILES:=$(LINUX_DIR)/drivers/hwmon/tmp102.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/hwmon/tmp102.ko
   AUTOLOAD:=$(call AutoProbe,tmp102)
   $(call AddDepends/hwmon,+kmod-i2c-core +PACKAGE_kmod-thermal:kmod-thermal +kmod-regmap-i2c)
 endef
@@ -590,7 +590,7 @@ $(eval $(call KernelPackage,hwmon-tmp102))
 define KernelPackage/hwmon-tmp103
   TITLE:=Texas Instruments TMP103 monitoring support
   KCONFIG:=CONFIG_SENSORS_TMP103
-  FILES:=$(LINUX_DIR)/drivers/hwmon/tmp103.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/hwmon/tmp103.ko
   AUTOLOAD:=$(call AutoProbe,tmp103)
   $(call AddDepends/hwmon,+kmod-i2c-core +kmod-regmap-i2c)
 endef
@@ -605,7 +605,7 @@ $(eval $(call KernelPackage,hwmon-tmp103))
 define KernelPackage/hwmon-tmp421
   TITLE:=TI TMP421 and compatible monitoring support
   KCONFIG:=CONFIG_SENSORS_TMP421
-  FILES:=$(LINUX_DIR)/drivers/hwmon/tmp421.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/hwmon/tmp421.ko
   AUTOLOAD:=$(call AutoLoad,60,tmp421)
   $(call AddDepends/hwmon,+kmod-i2c-core)
 endef
@@ -620,7 +620,7 @@ $(eval $(call KernelPackage,hwmon-tmp421))
 define KernelPackage/hwmon-tps23861
   TITLE:=Texas Instruments TPS23861 PoE PSE
   KCONFIG:=CONFIG_SENSORS_TPS23861
-  FILES:=$(LINUX_DIR)/drivers/hwmon/tps23861.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/hwmon/tps23861.ko
   AUTOLOAD:=$(call AutoProbe,tps23861)
   $(call AddDepends/hwmon,+kmod-i2c-core +kmod-regmap-i2c)
 endef
@@ -634,7 +634,7 @@ $(eval $(call KernelPackage,hwmon-tps23861))
 define KernelPackage/hwmon-vid
   TITLE:=VID/VRM/VRD voltage conversion module.
   KCONFIG:=CONFIG_HWMON_VID
-  FILES:=$(LINUX_DIR)/drivers/hwmon/hwmon-vid.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/hwmon/hwmon-vid.ko
   AUTOLOAD:=$(call AutoLoad,41,hwmon-vid)
   $(call AddDepends/hwmon,)
 endef
@@ -649,7 +649,7 @@ $(eval $(call KernelPackage,hwmon-vid))
 define KernelPackage/hwmon-w83627ehf
   TITLE:=Winbond W83627EHF/EHG/DHG/UHG, W83667HG monitoring support
   KCONFIG:=CONFIG_SENSORS_W83627EHF
-  FILES:=$(LINUX_DIR)/drivers/hwmon/w83627ehf.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/hwmon/w83627ehf.ko
   AUTOLOAD:=$(call AutoProbe,w83627ehf)
   $(call AddDepends/hwmon, at TARGET_x86 +kmod-hwmon-vid)
 endef
@@ -666,7 +666,7 @@ $(eval $(call KernelPackage,hwmon-w83627ehf))
 define KernelPackage/hwmon-w83627hf
   TITLE:=Winbond W83627HF monitoring support
   KCONFIG:=CONFIG_SENSORS_W83627HF
-  FILES:=$(LINUX_DIR)/drivers/hwmon/w83627hf.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/hwmon/w83627hf.ko
   AUTOLOAD:=$(call AutoLoad,50,w83627hf)
   $(call AddDepends/hwmon, at TARGET_x86 +kmod-hwmon-vid)
 endef
@@ -681,7 +681,7 @@ $(eval $(call KernelPackage,hwmon-w83627hf))
 define KernelPackage/hwmon-w83793
   TITLE:=Winbond W83793G/R monitoring support
   KCONFIG:=CONFIG_SENSORS_W83793
-  FILES:=$(LINUX_DIR)/drivers/hwmon/w83793.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/hwmon/w83793.ko
   AUTOLOAD:=$(call AutoProbe,w83793)
   $(call AddDepends/hwmon,+kmod-i2c-core +kmod-hwmon-vid)
 endef
@@ -696,7 +696,7 @@ $(eval $(call KernelPackage,hwmon-w83793))
 define KernelPackage/hwmon-adcxx
   TITLE:=ADCxx monitoring support
   KCONFIG:=CONFIG_SENSORS_ADCXX
-  FILES:=$(LINUX_DIR)/drivers/hwmon/adcxx.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/hwmon/adcxx.ko
   AUTOLOAD:=$(call AutoLoad,60,adcxx)
   $(call AddDepends/hwmon,)
 endef
diff --git a/package/kernel/linux/modules/i2c.mk b/package/kernel/linux/modules/i2c.mk
index 7cd69dbb95..c9f7918ae6 100644
--- a/package/kernel/linux/modules/i2c.mk
+++ b/package/kernel/linux/modules/i2c.mk
@@ -8,7 +8,7 @@
 I2C_MENU:=I2C support
 
 ModuleConfVar=$(word 1,$(subst :,$(space),$(1)))
-ModuleFullPath=$(LINUX_DIR)/$(word 2,$(subst :,$(space),$(1))).ko
+ModuleFullPath=$(LINUX_OBJ_DIR)/$(word 2,$(subst :,$(space),$(1))).ko
 ModuleKconfig=$(foreach mod,$(1),$(call ModuleConfVar,$(mod)))
 ModuleFiles=$(foreach mod,$(1),$(call ModuleFullPath,$(mod)))
 ModuleAuto=$(call AutoLoad,$(1),$(foreach mod,$(2),$(basename $(notdir $(call ModuleFullPath,$(mod))))),$(3))
diff --git a/package/kernel/linux/modules/iio.mk b/package/kernel/linux/modules/iio.mk
index f901f87ddd..c1456a132a 100644
--- a/package/kernel/linux/modules/iio.mk
+++ b/package/kernel/linux/modules/iio.mk
@@ -13,7 +13,7 @@ define KernelPackage/iio-core
 	CONFIG_IIO \
 	CONFIG_IIO_BUFFER=y \
 	CONFIG_IIO_TRIGGER=y
-  FILES:=$(LINUX_DIR)/drivers/iio/industrialio.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/iio/industrialio.ko
   AUTOLOAD:=$(call AutoLoad,55,industrialio)
 endef
 
@@ -33,7 +33,7 @@ endef
 define KernelPackage/iio-kfifo-buf
   TITLE:=Industrial I/O buffering based on kfifo
   KCONFIG:=CONFIG_IIO_KFIFO_BUF
-  FILES:=$(LINUX_DIR)/drivers/iio/buffer/kfifo_buf.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/iio/buffer/kfifo_buf.ko
   AUTOLOAD:=$(call AutoLoad,55,kfifo_buf)
   $(call AddDepends/iio)
 endef
@@ -50,7 +50,7 @@ define KernelPackage/industrialio-triggered-buffer
   TITLE:=Provides helper functions for setting up triggered buffers.
   DEPENDS:=+kmod-iio-kfifo-buf
   KCONFIG:=CONFIG_IIO_TRIGGERED_BUFFER
-  FILES:=$(LINUX_DIR)/drivers/iio/buffer/industrialio-triggered-buffer.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/iio/buffer/industrialio-triggered-buffer.ko
   AUTOLOAD:=$(call AutoLoad,55,industrialio-triggered-buffer)
   $(call AddDepends/iio)
 endef
@@ -68,7 +68,7 @@ define KernelPackage/iio-ad799x
   KCONFIG:= \
 	CONFIG_AD799X_RING_BUFFER=y \
 	CONFIG_AD799X
-  FILES:=$(LINUX_DIR)/drivers/iio/adc/ad799x.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/iio/adc/ad799x.ko
   AUTOLOAD:=$(call AutoLoad,56,ad799x)
   $(call AddDepends/iio)
 endef
@@ -85,7 +85,7 @@ define KernelPackage/iio-ads1015
   DEPENDS:=+kmod-i2c-core +kmod-regmap-i2c +kmod-industrialio-triggered-buffer
   TITLE:=Texas Instruments ADS1015 ADC driver
   KCONFIG:= CONFIG_TI_ADS1015
-  FILES:=$(LINUX_DIR)/drivers/iio/adc/ti-ads1015.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/iio/adc/ti-ads1015.ko
   AUTOLOAD:=$(call AutoLoad,56,ti-ads1015)
   $(call AddDepends/iio)
 endef
@@ -101,8 +101,8 @@ define KernelPackage/iio-hmc5843
   TITLE:=Honeywell HMC58x3 Magnetometer
   KCONFIG:= CONFIG_SENSORS_HMC5843_I2C
   FILES:= \
-      $(LINUX_DIR)/drivers/iio/magnetometer/hmc5843_i2c.ko \
-      $(LINUX_DIR)/drivers/iio/magnetometer/hmc5843_core.ko
+      $(LINUX_OBJ_DIR)/drivers/iio/magnetometer/hmc5843_i2c.ko \
+      $(LINUX_OBJ_DIR)/drivers/iio/magnetometer/hmc5843_core.ko
   AUTOLOAD:=$(call AutoLoad,56,hmc5843)
   $(call AddDepends/iio)
 endef
@@ -117,7 +117,7 @@ define KernelPackage/iio-bh1750
   DEPENDS:=+kmod-i2c-core
   TITLE:=ROHM BH1750 ambient light sensor
   KCONFIG:= CONFIG_BH1750
-  FILES:=$(LINUX_DIR)/drivers/iio/light/bh1750.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/iio/light/bh1750.ko
   AUTOLOAD:=$(call AutoLoad,56,bh1750)
   $(call AddDepends/iio)
 endef
@@ -130,7 +130,7 @@ define KernelPackage/iio-am2315
   DEPENDS:=+kmod-i2c-core +kmod-industrialio-triggered-buffer
   TITLE:=Asong AM2315 humidity/temperature sensor
   KCONFIG:= CONFIG_AM2315
-  FILES:=$(LINUX_DIR)/drivers/iio/humidity/am2315.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/iio/humidity/am2315.ko
   AUTOLOAD:=$(call AutoLoad,56,am2315)
   $(call AddDepends/iio)
 endef
@@ -144,7 +144,7 @@ define KernelPackage/iio-mxs-lradc
   TITLE:=Freescale i.MX23/i.MX28 LRADC ADC driver
   KCONFIG:= \
 	CONFIG_MXS_LRADC_ADC
-  FILES:=$(LINUX_DIR)/drivers/iio/adc/mxs-lradc-adc.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/iio/adc/mxs-lradc-adc.ko
   AUTOLOAD:=$(call AutoLoad,56,mxs-lradc-adc)
   $(call AddDepends/iio)
 endef
@@ -160,7 +160,7 @@ define KernelPackage/iio-dht11
   TITLE:=DHT11 (and compatible) humidity and temperature sensors
   KCONFIG:= \
 	CONFIG_DHT11
-  FILES:=$(LINUX_DIR)/drivers/iio/humidity/dht11.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/iio/humidity/dht11.ko
   AUTOLOAD:=$(call AutoLoad,56,dht11)
   $(call AddDepends/iio)
 endef
@@ -178,7 +178,7 @@ define KernelPackage/iio-bme680
   TITLE:=BME680 gas/humidity/pressure/temperature sensor
   DEPENDS:=+kmod-regmap-core
   KCONFIG:=CONFIG_BME680
-  FILES:=$(LINUX_DIR)/drivers/iio/chemical/bme680_core.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/iio/chemical/bme680_core.ko
   $(call AddDepends/iio)
 endef
 
@@ -193,7 +193,7 @@ define KernelPackage/iio-bme680-i2c
   TITLE:=BME680 gas/humidity/pressure/temperature sensor (I2C)
   DEPENDS:=+kmod-iio-bme680 +kmod-regmap-i2c
   KCONFIG:=CONFIG_BME680_I2C
-  FILES:=$(LINUX_DIR)/drivers/iio/chemical/bme680_i2c.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/iio/chemical/bme680_i2c.ko
   AUTOLOAD:=$(call AutoProbe,bme680-i2c)
   $(call AddDepends/iio)
 endef
@@ -207,7 +207,7 @@ define KernelPackage/iio-bme680-spi
   TITLE:=BME680 gas/humidity/pressure/temperature sensor (SPI)
   DEPENDS:=+kmod-iio-bme680 +kmod-regmap-spi
   KCONFIG:=CONFIG_BME680_SPI
-  FILES:=$(LINUX_DIR)/drivers/iio/chemical/bme680_spi.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/iio/chemical/bme680_spi.ko
   AUTOLOAD:=$(call AutoProbe,bme680-spi)
   $(call AddDepends/iio)
 endef
@@ -222,7 +222,7 @@ define KernelPackage/iio-bmp280
   TITLE:=BMP180/BMP280/BME280 pressure/temperatur sensor
   DEPENDS:=+kmod-regmap-core
   KCONFIG:=CONFIG_BMP280
-  FILES:=$(LINUX_DIR)/drivers/iio/pressure/bmp280.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/iio/pressure/bmp280.ko
   $(call AddDepends/iio)
 endef
 
@@ -239,7 +239,7 @@ define KernelPackage/iio-bmp280-i2c
   TITLE:=BMP180/BMP280/BME280 pressure/temperatur sensor (I2C)
   DEPENDS:=+kmod-iio-bmp280 +kmod-i2c-core +kmod-regmap-i2c
   KCONFIG:=CONFIG_BMP280_I2C
-  FILES:=$(LINUX_DIR)/drivers/iio/pressure/bmp280-i2c.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/iio/pressure/bmp280-i2c.ko
   AUTOLOAD:=$(call AutoProbe,bmp280-i2c)
   $(call AddDepends/iio)
 endef
@@ -255,7 +255,7 @@ define KernelPackage/iio-bmp280-spi
   TITLE:=BMP180/BMP280/BME280 pressure/temperatur sensor (SPI)
   DEPENDS:=+kmod-iio-bmp280 +kmod-spi-bitbang
   KCONFIG:=CONFIG_BMP280_SPI
-  FILES:=$(LINUX_DIR)/drivers/iio/pressure/bmp280-spi.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/iio/pressure/bmp280-spi.ko
   AUTOLOAD:=$(call AutoProbe,bmp280-spi)
   $(call AddDepends/iio)
 endef
@@ -273,8 +273,8 @@ define KernelPackage/iio-htu21
        CONFIG_HTU21 \
        CONFIG_IIO_MS_SENSORS_I2C
   FILES:= \
-       $(LINUX_DIR)/drivers/iio/humidity/htu21.ko \
-       $(LINUX_DIR)/drivers/iio/common/ms_sensors/ms_sensors_i2c.ko
+       $(LINUX_OBJ_DIR)/drivers/iio/humidity/htu21.ko \
+       $(LINUX_OBJ_DIR)/drivers/iio/common/ms_sensors/ms_sensors_i2c.ko
   AUTOLOAD:=$(call AutoLoad,56,htu21)
   $(call AddDepends/iio)
 endef
@@ -294,7 +294,7 @@ define KernelPackage/iio-ccs811
   TITLE:=AMS CCS811 VOC sensor
   KCONFIG:= \
 	CONFIG_CCS811
-  FILES:= $(LINUX_DIR)/drivers/iio/chemical/ccs811.ko
+  FILES:= $(LINUX_OBJ_DIR)/drivers/iio/chemical/ccs811.ko
   AUTOLOAD:=$(call AutoLoad,56,ccs811)
   $(call AddDepends/iio)
 endef
@@ -310,7 +310,7 @@ define KernelPackage/iio-si7020
   DEPENDS:=+kmod-i2c-core
   TITLE:=Silicon Labs Si7020 sensor
   KCONFIG:= CONFIG_SI7020
-  FILES:=$(LINUX_DIR)/drivers/iio/humidity/si7020.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/iio/humidity/si7020.ko
   AUTOLOAD:=$(call AutoLoad,56,si7020)
   $(call AddDepends/iio)
 endef
@@ -331,8 +331,8 @@ define KernelPackage/iio-st_accel
 	CONFIG_IIO_ST_ACCEL_3AXIS \
 	CONFIG_IIO_ST_SENSORS_CORE
   FILES:= \
-	$(LINUX_DIR)/drivers/iio/accel/st_accel.ko \
-	$(LINUX_DIR)/drivers/iio/common/st_sensors/st_sensors.ko
+	$(LINUX_OBJ_DIR)/drivers/iio/accel/st_accel.ko \
+	$(LINUX_OBJ_DIR)/drivers/iio/common/st_sensors/st_sensors.ko
   $(call AddDepends/iio)
 endef
 
@@ -351,8 +351,8 @@ define KernelPackage/iio-st_accel-i2c
   DEPENDS:=+kmod-iio-st_accel +kmod-i2c-core +kmod-regmap-i2c
   KCONFIG:= CONFIG_IIO_ST_ACCEL_I2C_3AXIS
   FILES:= \
-	$(LINUX_DIR)/drivers/iio/accel/st_accel_i2c.ko \
-	$(LINUX_DIR)/drivers/iio/common/st_sensors/st_sensors_i2c.ko
+	$(LINUX_OBJ_DIR)/drivers/iio/accel/st_accel_i2c.ko \
+	$(LINUX_OBJ_DIR)/drivers/iio/common/st_sensors/st_sensors_i2c.ko
   AUTOLOAD:=$(call AutoLoad,56,st_accel_i2c)
   $(call AddDepends/iio)
 endef
@@ -369,8 +369,8 @@ define KernelPackage/iio-st_accel-spi
   DEPENDS:=+kmod-iio-st_accel +kmod-regmap-spi
   KCONFIG:= CONFIG_IIO_ST_ACCEL_SPI_3AXIS
   FILES:= \
-	$(LINUX_DIR)/drivers/iio/accel/st_accel_spi.ko \
-	$(LINUX_DIR)/drivers/iio/common/st_sensors/st_sensors_spi.ko
+	$(LINUX_OBJ_DIR)/drivers/iio/accel/st_accel_spi.ko \
+	$(LINUX_OBJ_DIR)/drivers/iio/common/st_sensors/st_sensors_spi.ko
   AUTOLOAD:=$(call AutoLoad,56,st_accel_spi)
   $(call AddDepends/iio)
 endef
@@ -386,7 +386,7 @@ define KernelPackage/iio-lsm6dsx
   DEPENDS:=+kmod-iio-kfifo-buf +kmod-regmap-core
   TITLE:=ST LSM6DSx driver for IMU MEMS sensors
   KCONFIG:=CONFIG_IIO_ST_LSM6DSX
-  FILES:=$(LINUX_DIR)/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.ko
   AUTOLOAD:=$(call AutoProbe,st_lsm6dsx)
   $(call AddDepends/iio)
 endef
@@ -402,7 +402,7 @@ define KernelPackage/iio-lsm6dsx-i2c
   DEPENDS:=+kmod-iio-lsm6dsx +kmod-i2c-core +kmod-regmap-i2c
   TITLE:=ST LSM6DSx driver for IMU MEMS sensors (I2C)
   KCONFIG:=CONFIG_IIO_ST_LSM6DSX
-  FILES:=$(LINUX_DIR)/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.ko
   AUTOLOAD:=$(call AutoProbe,st_lsm6dsx-i2c)
   $(call AddDepends/iio)
 endef
@@ -418,7 +418,7 @@ define KernelPackage/iio-lsm6dsx-spi
   DEPENDS:=+kmod-iio-lsm6dsx +kmod-regmap-spi
   TITLE:=ST LSM6DSx driver for IMU MEMS sensors (SPI)
   KCONFIG:=CONFIG_IIO_ST_LSM6DSX
-  FILES:=$(LINUX_DIR)/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_spi.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_spi.ko
   AUTOLOAD:=$(call AutoProbe,st_lsm6dsx-spi)
   $(call AddDepends/iio)
 endef
@@ -437,8 +437,8 @@ define KernelPackage/iio-sps30
 	CONFIG_SPS30 \
 	CONFIG_SPS30_I2C
   FILES:= \
-	$(LINUX_DIR)/drivers/iio/chemical/sps30.ko \
-	$(LINUX_DIR)/drivers/iio/chemical/sps30_i2c.ko
+	$(LINUX_OBJ_DIR)/drivers/iio/chemical/sps30.ko \
+	$(LINUX_OBJ_DIR)/drivers/iio/chemical/sps30_i2c.ko
   AUTOLOAD:=$(call AutoProbe,sps30 sps30_i2c)
   $(call AddDepends/iio)
 endef
@@ -454,7 +454,7 @@ define KernelPackage/iio-tsl4531
   DEPENDS:=+kmod-i2c-core
   TITLE:=TAOS TSL4531 ambient light sensor
   KCONFIG:= CONFIG_TSL4531
-  FILES:=$(LINUX_DIR)/drivers/iio/light/tsl4531.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/iio/light/tsl4531.ko
   AUTOLOAD:=$(call AutoLoad,56,tsl4531)
   $(call AddDepends/iio)
 endef
@@ -472,7 +472,7 @@ define KernelPackage/iio-fxas21002c
   TITLE:=Freescale FXAS21002C 3-axis gyro driver
   DEPENDS:=+kmod-regmap-core +kmod-industrialio-triggered-buffer
   KCONFIG:= CONFIG_FXAS21002C
-  FILES:=$(LINUX_DIR)/drivers/iio/gyro/fxas21002c_core.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/iio/gyro/fxas21002c_core.ko
   AUTOLOAD:=$(call AutoLoad,56,fxas21002c)
   $(call AddDepends/iio)
 endef
@@ -488,7 +488,7 @@ define KernelPackage/iio-fxas21002c-i2c
   TITLE:=Freescale FXAS21002C 3-axis gyro driver (I2C)
   DEPENDS:=+kmod-iio-fxas21002c +kmod-i2c-core +kmod-regmap-i2c
   KCONFIG:= CONFIG_FXAS21002C_I2C
-  FILES:=$(LINUX_DIR)/drivers/iio/gyro/fxas21002c_i2c.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/iio/gyro/fxas21002c_i2c.ko
   AUTOLOAD:=$(call AutoLoad,56,fxas21002c_i2c)
   $(call AddDepends/iio)
 endef
@@ -505,7 +505,7 @@ define KernelPackage/iio-fxas21002c-spi
   DEPENDS:=+kmod-iio-fxas21002c +kmod-regmap-spi
   TITLE:=Freescale FXAS21002C 3-axis gyro driver (SPI)
   KCONFIG:= CONFIG_FXAS21002C_SPI
-  FILES:=$(LINUX_DIR)/drivers/iio/gyro/fxas21002c_spi.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/iio/gyro/fxas21002c_spi.ko
   AUTOLOAD:=$(call AutoLoad,56,fxas21002c_spi)
   $(call AddDepends/iio)
 endef
@@ -522,7 +522,7 @@ define KernelPackage/iio-fxos8700
   TITLE:=Freescale FXOS8700 3-axis accelerometer driver
   DEPENDS:=+kmod-regmap-core
   KCONFIG:= CONFIG_FXOS8700
-  FILES:=$(LINUX_DIR)/drivers/iio/imu/fxos8700_core.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/iio/imu/fxos8700_core.ko
   AUTOLOAD:=$(call AutoLoad,56,fxos8700)
   $(call AddDepends/iio)
 endef
@@ -538,7 +538,7 @@ define KernelPackage/iio-fxos8700-i2c
   TITLE:=Freescale FXOS8700 3-axis acceleromter driver (I2C)
   DEPENDS:=+kmod-iio-fxos8700 +kmod-i2c-core +kmod-regmap-i2c
   KCONFIG:= CONFIG_FXOS8700_I2C
-  FILES:=$(LINUX_DIR)/drivers/iio/imu/fxos8700_i2c.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/iio/imu/fxos8700_i2c.ko
   AUTOLOAD:=$(call AutoLoad,56,fxos8700_i2c)
   $(call AddDepends/iio)
 endef
@@ -555,7 +555,7 @@ define KernelPackage/iio-fxos8700-spi
   DEPENDS:=+kmod-iio-fxos8700 +kmod-regmap-spi
   TITLE:=Freescale FXOS8700 3-axis accelerometer driver (SPI)
   KCONFIG:= CONFIG_FXOS8700_SPI
-  FILES:=$(LINUX_DIR)/drivers/iio/imu/fxos8700_spi.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/iio/imu/fxos8700_spi.ko
   AUTOLOAD:=$(call AutoLoad,56,fxos8700_spi)
   $(call AddDepends/iio)
 endef
@@ -571,7 +571,7 @@ define KernelPackage/iio-ti-am335x-adc
   TITLE:= TI Sitara AM335x ADC driver
   DEPENDS:=@TARGET_omap
   KCONFIG:=CONFIG_TI_AM335X_ADC
-  FILES:=$(LINUX_DIR)/drivers/iio/adc/ti_am335x_adc.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/iio/adc/ti_am335x_adc.ko
   AUTOLOAD:=$(call AutoProbe,ti_am335x_adc)
   $(call AddDepends/iio,+kmod-iio-kfifo-buf)
 endef
diff --git a/package/kernel/linux/modules/input.mk b/package/kernel/linux/modules/input.mk
index 92587b1874..79e3cf9f4a 100644
--- a/package/kernel/linux/modules/input.mk
+++ b/package/kernel/linux/modules/input.mk
@@ -12,7 +12,7 @@ define KernelPackage/hid
   TITLE:=HID Devices
   DEPENDS:=+kmod-input-core +kmod-input-evdev
   KCONFIG:=CONFIG_HID CONFIG_HIDRAW=y CONFIG_HID_BATTERY_STRENGTH=y
-  FILES:=$(LINUX_DIR)/drivers/hid/hid.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/hid/hid.ko
   AUTOLOAD:=$(call AutoLoad,61,hid)
 endef
 
@@ -27,7 +27,7 @@ define KernelPackage/hid-generic
   TITLE:=Generic HID device support
   DEPENDS:=+kmod-hid
   KCONFIG:=CONFIG_HID_GENERIC
-  FILES:=$(LINUX_DIR)/drivers/hid/hid-generic.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/hid/hid-generic.ko
   AUTOLOAD:=$(call AutoProbe,hid-generic)
 endef
 
@@ -41,7 +41,7 @@ define KernelPackage/input-core
   SUBMENU:=$(INPUT_MODULES_MENU)
   TITLE:=Input device core
   KCONFIG:=CONFIG_INPUT
-  FILES:=$(LINUX_DIR)/drivers/input/input-core.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/input/input-core.ko
 endef
 
 define KernelPackage/input-core/description
@@ -56,7 +56,7 @@ define KernelPackage/input-evdev
   TITLE:=Input event device
   DEPENDS:=+kmod-input-core
   KCONFIG:=CONFIG_INPUT_EVDEV
-  FILES:=$(LINUX_DIR)/drivers/input/evdev.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/input/evdev.ko
   AUTOLOAD:=$(call AutoLoad,60,evdev)
 endef
 
@@ -74,7 +74,7 @@ define KernelPackage/input-gpio-keys
   KCONFIG:= \
 	CONFIG_KEYBOARD_GPIO \
 	CONFIG_INPUT_KEYBOARD=y
-  FILES:=$(LINUX_DIR)/drivers/input/keyboard/gpio_keys.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/input/keyboard/gpio_keys.ko
   AUTOLOAD:=$(call AutoProbe,gpio_keys,1)
 endef
 
@@ -96,7 +96,7 @@ define KernelPackage/input-gpio-keys-polled
   KCONFIG:= \
 	CONFIG_KEYBOARD_GPIO_POLLED \
 	CONFIG_INPUT_KEYBOARD=y
-  FILES:=$(LINUX_DIR)/drivers/input/keyboard/gpio_keys_polled.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/input/keyboard/gpio_keys_polled.ko
   AUTOLOAD:=$(call AutoProbe,gpio_keys_polled,1)
 endef
 
@@ -115,7 +115,7 @@ define KernelPackage/input-gpio-encoder
   TITLE:=GPIO rotary encoder
   DEPENDS:=@GPIO_SUPPORT +kmod-input-core
   KCONFIG:=CONFIG_INPUT_GPIO_ROTARY_ENCODER
-  FILES:=$(LINUX_DIR)/drivers/input/misc/rotary_encoder.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/input/misc/rotary_encoder.ko
   AUTOLOAD:=$(call AutoProbe,rotary_encoder)
 endef
 
@@ -131,7 +131,7 @@ define KernelPackage/input-joydev
   TITLE:=Joystick device support
   DEPENDS:=+kmod-input-core
   KCONFIG:=CONFIG_INPUT_JOYDEV
-  FILES:=$(LINUX_DIR)/drivers/input/joydev.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/input/joydev.ko
   AUTOLOAD:=$(call AutoProbe,joydev)
 endef
 
@@ -147,7 +147,7 @@ define KernelPackage/input-matrixkmap
   TITLE:=Input matrix devices support
   DEPENDS:=+kmod-input-core
   KCONFIG:=CONFIG_INPUT_MATRIXKMAP
-  FILES:=$(LINUX_DIR)/drivers/input/matrix-keymap.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/input/matrix-keymap.ko
   AUTOLOAD:=$(call AutoProbe,matrix-keymap)
 endef
 
@@ -165,7 +165,7 @@ define KernelPackage/input-touchscreen-ads7846
   KCONFIG:= \
 	CONFIG_INPUT_TOUCHSCREEN=y \
 	CONFIG_TOUCHSCREEN_ADS7846
-  FILES:=$(LINUX_DIR)/drivers/input/touchscreen/ads7846.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/input/touchscreen/ads7846.ko
   AUTOLOAD:=$(call AutoProbe,ads7846)
 endef
 
@@ -183,7 +183,7 @@ define KernelPackage/input-touchscreen-edt-ft5x06
   KCONFIG:= \
 	CONFIG_INPUT_TOUCHSCREEN=y \
 	CONFIG_TOUCHSCREEN_EDT_FT5X06
-  FILES:=$(LINUX_DIR)/drivers/input/touchscreen/edt-ft5x06.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/input/touchscreen/edt-ft5x06.ko
   AUTOLOAD:=$(call AutoProbe,edt-ft5x06)
 endef
 
@@ -202,7 +202,7 @@ define KernelPackage/keyboard-imx
   KCONFIG:= \
 	CONFIG_KEYBOARD_IMX \
 	CONFIG_INPUT_KEYBOARD=y
-  FILES:=$(LINUX_DIR)/drivers/input/keyboard/imx_keypad.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/input/keyboard/imx_keypad.ko
   AUTOLOAD:=$(call AutoProbe,imx_keypad)
 endef
 
@@ -220,7 +220,7 @@ define KernelPackage/input-uinput
   KCONFIG:= \
 	CONFIG_INPUT_MISC=y \
 	CONFIG_INPUT_UINPUT
-  FILES:=$(LINUX_DIR)/drivers/input/misc/uinput.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/input/misc/uinput.ko
   AUTOLOAD:=$(call AutoProbe,uinput)
 endef
 
diff --git a/package/kernel/linux/modules/leds.mk b/package/kernel/linux/modules/leds.mk
index 24af1b7f61..1904062fcb 100644
--- a/package/kernel/linux/modules/leds.mk
+++ b/package/kernel/linux/modules/leds.mk
@@ -12,7 +12,7 @@ define KernelPackage/leds-gpio
   TITLE:=GPIO LED support
   DEPENDS:= @GPIO_SUPPORT
   KCONFIG:=CONFIG_LEDS_GPIO
-  FILES:=$(LINUX_DIR)/drivers/leds/leds-gpio.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/leds/leds-gpio.ko
   AUTOLOAD:=$(call AutoLoad,60,leds-gpio,1)
 endef
 
@@ -22,7 +22,7 @@ endef
 
 $(eval $(call KernelPackage,leds-gpio))
 
-LED_TRIGGER_DIR=$(LINUX_DIR)/drivers/leds/trigger
+LED_TRIGGER_DIR=$(LINUX_OBJ_DIR)/drivers/leds/trigger
 
 define KernelPackage/ledtrig-activity
   SUBMENU:=$(LEDS_MENU)
@@ -136,7 +136,7 @@ define KernelPackage/leds-apu
   TITLE:=PC Engines APU1 LED support
   DEPENDS:= @GPIO_SUPPORT @TARGET_x86
   KCONFIG:=CONFIG_LEDS_APU
-  FILES:=$(LINUX_DIR)/drivers/leds/leds-apu.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/leds/leds-apu.ko
   AUTOLOAD:=$(call AutoLoad,60,leds-apu,1)
 endef
 
@@ -150,7 +150,7 @@ $(eval $(call KernelPackage,leds-apu))
 define KernelPackage/leds-mlxcpld
   SUBMENU:=$(LEDS_MENU)
   TITLE:=LED support for the Mellanox boards
-  FILES:=$(LINUX_DIR)/drivers/leds/leds-mlxcpld.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/leds/leds-mlxcpld.ko
   KCONFIG:=CONFIG_LEDS_MLXCPLD
   AUTOLOAD:=$(call AutoProbe,leds-mlxcpld)
 endef
@@ -169,7 +169,7 @@ define KernelPackage/leds-pca955x
   DEPENDS:=@GPIO_SUPPORT +kmod-i2c-core
   KCONFIG:=CONFIG_LEDS_PCA955X \
     CONFIG_LEDS_PCA955X_GPIO=y
-  FILES:=$(LINUX_DIR)/drivers/leds/leds-pca955x.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/leds/leds-pca955x.ko
   AUTOLOAD:=$(call AutoLoad,60,leds-pca955x,1)
 endef
 
@@ -187,7 +187,7 @@ define KernelPackage/leds-pca963x
   TITLE:=PCA963x LED support
   DEPENDS:=+kmod-i2c-core
   KCONFIG:=CONFIG_LEDS_PCA963X
-  FILES:=$(LINUX_DIR)/drivers/leds/leds-pca963x.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/leds/leds-pca963x.ko
   AUTOLOAD:=$(call AutoLoad,60,leds-pca963x,1)
 endef
 
@@ -203,7 +203,7 @@ define KernelPackage/leds-pwm
   TITLE:=PWM driven LED Support
   KCONFIG:=CONFIG_LEDS_PWM
   DEPENDS:= @PWM_SUPPORT
-  FILES:=$(LINUX_DIR)/drivers/leds/leds-pwm.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/leds/leds-pwm.ko
   AUTOLOAD:=$(call AutoLoad,60,leds-pwm,1)
 endef
 
@@ -219,7 +219,7 @@ define KernelPackage/leds-tlc591xx
   TITLE:=LED driver for TLC59108 and TLC59116 controllers
   DEPENDS:=+kmod-i2c-core +kmod-regmap-i2c
   KCONFIG:=CONFIG_LEDS_TLC591XX
-  FILES:=$(LINUX_DIR)/drivers/leds/leds-tlc591xx.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/leds/leds-tlc591xx.ko
   AUTOLOAD:=$(call AutoLoad,60,leds-tlc591xx,1)
 endef
 
@@ -235,7 +235,7 @@ define KernelPackage/leds-uleds
   SUBMENU:=$(LEDS_MENU)
   TITLE:=Userspace LEDs
   KCONFIG:=CONFIG_LEDS_USER
-  FILES:=$(LINUX_DIR)/drivers/leds/uleds.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/leds/uleds.ko
   AUTOLOAD:=$(call AutoLoad,60,uleds,1)
 endef
 
@@ -251,7 +251,7 @@ define KernelPackage/input-leds
   TITLE:=Input device LED support
   DEPENDS:=+kmod-input-core
   KCONFIG:=CONFIG_INPUT_LEDS
-  FILES:=$(LINUX_DIR)/drivers/input/input-leds.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/input/input-leds.ko
   AUTOLOAD:=$(call AutoLoad,50,input-leds,1)
 endef
 
diff --git a/package/kernel/linux/modules/lib.mk b/package/kernel/linux/modules/lib.mk
index 8d67a3187a..d83bddbd7a 100644
--- a/package/kernel/linux/modules/lib.mk
+++ b/package/kernel/linux/modules/lib.mk
@@ -11,7 +11,7 @@ define KernelPackage/lib-crc-ccitt
   SUBMENU:=$(LIB_MENU)
   TITLE:=CRC-CCITT support
   KCONFIG:=CONFIG_CRC_CCITT
-  FILES:=$(LINUX_DIR)/lib/crc-ccitt.ko
+  FILES:=$(LINUX_OBJ_DIR)/lib/crc-ccitt.ko
   AUTOLOAD:=$(call AutoProbe,crc-ccitt)
 endef
 
@@ -26,7 +26,7 @@ define KernelPackage/lib-crc-itu-t
   SUBMENU:=$(LIB_MENU)
   TITLE:=CRC ITU-T V.41 support
   KCONFIG:=CONFIG_CRC_ITU_T
-  FILES:=$(LINUX_DIR)/lib/crc-itu-t.ko
+  FILES:=$(LINUX_OBJ_DIR)/lib/crc-itu-t.ko
   AUTOLOAD:=$(call AutoProbe,crc-itu-t)
 endef
 
@@ -41,7 +41,7 @@ define KernelPackage/lib-crc7
   SUBMENU:=$(LIB_MENU)
   TITLE:=CRC7 support
   KCONFIG:=CONFIG_CRC7
-  FILES:=$(LINUX_DIR)/lib/crc7.ko
+  FILES:=$(LINUX_OBJ_DIR)/lib/crc7.ko
   AUTOLOAD:=$(call AutoProbe,crc7)
 endef
 
@@ -56,7 +56,7 @@ define KernelPackage/lib-crc8
   SUBMENU:=$(LIB_MENU)
   TITLE:=CRC8 support
   KCONFIG:=CONFIG_CRC8
-  FILES:=$(LINUX_DIR)/lib/crc8.ko
+  FILES:=$(LINUX_OBJ_DIR)/lib/crc8.ko
   AUTOLOAD:=$(call AutoProbe,crc8)
 endef
 
@@ -71,7 +71,7 @@ define KernelPackage/lib-crc16
   SUBMENU:=$(LIB_MENU)
   TITLE:=CRC16 support
   KCONFIG:=CONFIG_CRC16
-  FILES:=$(LINUX_DIR)/lib/crc16.ko
+  FILES:=$(LINUX_OBJ_DIR)/lib/crc16.ko
   AUTOLOAD:=$(call AutoLoad,20,crc16,1)
 endef
 
@@ -87,7 +87,7 @@ define KernelPackage/lib-crc32c
   TITLE:=CRC32 support
   KCONFIG:=CONFIG_LIBCRC32C
   DEPENDS:=+kmod-crypto-crc32c
-  FILES:=$(LINUX_DIR)/lib/libcrc32c.ko
+  FILES:=$(LINUX_OBJ_DIR)/lib/libcrc32c.ko
   AUTOLOAD:=$(call AutoProbe,libcrc32c)
 endef
 
@@ -108,10 +108,10 @@ define KernelPackage/lib-lzo
 	CONFIG_LZO_DECOMPRESS
   HIDDEN:=1
   FILES:= \
-	$(LINUX_DIR)/crypto/lzo.ko \
-	$(LINUX_DIR)/crypto/lzo-rle.ko \
-	$(LINUX_DIR)/lib/lzo/lzo_compress.ko \
-	$(LINUX_DIR)/lib/lzo/lzo_decompress.ko
+	$(LINUX_OBJ_DIR)/crypto/lzo.ko \
+	$(LINUX_OBJ_DIR)/crypto/lzo-rle.ko \
+	$(LINUX_OBJ_DIR)/lib/lzo/lzo_compress.ko \
+	$(LINUX_OBJ_DIR)/lib/lzo/lzo_decompress.ko
   AUTOLOAD:=$(call AutoProbe,lzo lzo-rle lzo_compress lzo_decompress)
 endef
 
@@ -132,11 +132,11 @@ define KernelPackage/lib-zstd
 	CONFIG_ZSTD_DECOMPRESS \
 	CONFIG_XXHASH
   FILES:= \
-	$(LINUX_DIR)/crypto/zstd.ko \
-	$(LINUX_DIR)/lib/xxhash.ko \
-	$(LINUX_DIR)/lib/zstd/zstd_common.ko at ge6.1 \
-	$(LINUX_DIR)/lib/zstd/zstd_compress.ko \
-	$(LINUX_DIR)/lib/zstd/zstd_decompress.ko
+	$(LINUX_OBJ_DIR)/crypto/zstd.ko \
+	$(LINUX_OBJ_DIR)/lib/xxhash.ko \
+	$(LINUX_OBJ_DIR)/lib/zstd/zstd_common.ko at ge6.1 \
+	$(LINUX_OBJ_DIR)/lib/zstd/zstd_compress.ko \
+	$(LINUX_OBJ_DIR)/lib/zstd/zstd_decompress.ko
   AUTOLOAD:=$(call AutoProbe,xxhash zstd zstd_compress zstd_decompress)
 endef
 
@@ -157,10 +157,10 @@ define KernelPackage/lib-lz4
 	CONFIG_LZ4_COMPRESS \
 	CONFIG_LZ4_DECOMPRESS
   FILES:= \
-	$(LINUX_DIR)/crypto/lz4.ko \
-	$(LINUX_DIR)/lib/lz4/lz4_compress.ko \
-	$(LINUX_DIR)/lib/lz4/lz4hc_compress.ko \
-	$(LINUX_DIR)/lib/lz4/lz4_decompress.ko
+	$(LINUX_OBJ_DIR)/crypto/lz4.ko \
+	$(LINUX_OBJ_DIR)/lib/lz4/lz4_compress.ko \
+	$(LINUX_OBJ_DIR)/lib/lz4/lz4hc_compress.ko \
+	$(LINUX_OBJ_DIR)/lib/lz4/lz4_decompress.ko
   AUTOLOAD:=$(call AutoProbe,lz4 lz4_compress lz4hc_compress lz4_decompress)
 endef
 
@@ -180,9 +180,9 @@ define KernelPackage/lib-842
 	CONFIG_842_COMPRESS \
 	CONFIG_842_DECOMPRESS
   FILES:= \
-	$(LINUX_DIR)/crypto/842.ko \
-	$(LINUX_DIR)/lib/842/842_compress.ko \
-	$(LINUX_DIR)/lib/842/842_decompress.ko
+	$(LINUX_OBJ_DIR)/crypto/842.ko \
+	$(LINUX_OBJ_DIR)/lib/842/842_compress.ko \
+	$(LINUX_OBJ_DIR)/lib/842/842_decompress.ko
   AUTOLOAD:=$(call AutoProbe,842 842_compress 842_decompress)
 endef
 
@@ -198,7 +198,7 @@ define KernelPackage/lib-raid6
   TITLE:=RAID6 algorithm support
   HIDDEN:=1
   KCONFIG:=CONFIG_RAID6_PQ
-  FILES:=$(LINUX_DIR)/lib/raid6/raid6_pq.ko
+  FILES:=$(LINUX_OBJ_DIR)/lib/raid6/raid6_pq.ko
   AUTOLOAD:=$(call AutoProbe,raid6_pq)
 endef
 
@@ -214,13 +214,13 @@ define KernelPackage/lib-xor
   TITLE:=XOR blocks algorithm support
   HIDDEN:=1
   KCONFIG:=CONFIG_XOR_BLOCKS
-ifneq ($(wildcard $(LINUX_DIR)/arch/$(LINUX_KARCH)/lib/xor-neon.ko),)
+ifneq ($(wildcard $(LINUX_OBJ_DIR)/arch/$(LINUX_KARCH)/lib/xor-neon.ko),)
   FILES:= \
-    $(LINUX_DIR)/crypto/xor.ko \
-    $(LINUX_DIR)/arch/$(LINUX_KARCH)/lib/xor-neon.ko
+    $(LINUX_OBJ_DIR)/crypto/xor.ko \
+    $(LINUX_OBJ_DIR)/arch/$(LINUX_KARCH)/lib/xor-neon.ko
   AUTOLOAD:=$(call AutoProbe,xor-neon xor)
 else
-  FILES:=$(LINUX_DIR)/crypto/xor.ko
+  FILES:=$(LINUX_OBJ_DIR)/crypto/xor.ko
   AUTOLOAD:=$(call AutoProbe,xor)
 endif
 endef
@@ -241,9 +241,9 @@ SUBMENU:=$(LIB_MENU)
     CONFIG_TEXTSEARCH_BM \
     CONFIG_TEXTSEARCH_FSM
   FILES:= \
-    $(LINUX_DIR)/lib/ts_kmp.ko \
-    $(LINUX_DIR)/lib/ts_bm.ko \
-    $(LINUX_DIR)/lib/ts_fsm.ko
+    $(LINUX_OBJ_DIR)/lib/ts_kmp.ko \
+    $(LINUX_OBJ_DIR)/lib/ts_bm.ko \
+    $(LINUX_OBJ_DIR)/lib/ts_fsm.ko
   AUTOLOAD:=$(call AutoProbe,ts_kmp ts_bm ts_fsm)
 endef
 
@@ -255,7 +255,7 @@ define KernelPackage/lib-zlib-inflate
   TITLE:=Zlib support
   HIDDEN:=1
   KCONFIG:=CONFIG_ZLIB_INFLATE
-  FILES:=$(LINUX_DIR)/lib/zlib_inflate/zlib_inflate.ko
+  FILES:=$(LINUX_OBJ_DIR)/lib/zlib_inflate/zlib_inflate.ko
   AUTOLOAD:=$(call AutoProbe,zlib_inflate)
 endef
 
@@ -267,7 +267,7 @@ define KernelPackage/lib-zlib-deflate
   TITLE:=Zlib support
   HIDDEN:=1
   KCONFIG:=CONFIG_ZLIB_DEFLATE
-  FILES:=$(LINUX_DIR)/lib/zlib_deflate/zlib_deflate.ko
+  FILES:=$(LINUX_OBJ_DIR)/lib/zlib_deflate/zlib_deflate.ko
   AUTOLOAD:=$(call AutoProbe,zlib_deflate)
 endef
 
@@ -278,7 +278,7 @@ define KernelPackage/lib-cordic
   SUBMENU:=$(LIB_MENU)
   TITLE:=Cordic function support
   KCONFIG:=CONFIG_CORDIC
-  FILES:=$(LINUX_DIR)/lib/math/cordic.ko
+  FILES:=$(LINUX_OBJ_DIR)/lib/math/cordic.ko
   AUTOLOAD:=$(call AutoProbe,cordic)
 endef
 
@@ -294,7 +294,7 @@ define KernelPackage/asn1-decoder
   TITLE:=Simple ASN1 decoder
   KCONFIG:= CONFIG_ASN1
   HIDDEN:=1
-  FILES:=$(LINUX_DIR)/lib/asn1_decoder.ko
+  FILES:=$(LINUX_OBJ_DIR)/lib/asn1_decoder.ko
 endef
 
 $(eval $(call KernelPackage,asn1-decoder))
@@ -304,7 +304,7 @@ define KernelPackage/asn1-encoder
   TITLE:=Simple ASN1 encoder
   KCONFIG:= CONFIG_ASN1_ENCODER
   HIDDEN:=1
-  FILES:=$(LINUX_DIR)/lib/asn1_encoder.ko
+  FILES:=$(LINUX_OBJ_DIR)/lib/asn1_encoder.ko
 endef
 
 $(eval $(call KernelPackage,asn1-encoder))
@@ -313,7 +313,7 @@ define KernelPackage/oid-registry
   SUBMENU:=$(LIB_MENU)
   TITLE:=Object identifier registry
   KCONFIG:= CONFIG_OID_REGISTRY
-  FILES:=$(LINUX_DIR)/lib/oid_registry.ko
+  FILES:=$(LINUX_OBJ_DIR)/lib/oid_registry.ko
   AUTOLOAD:=$(call AutoLoad,31,oid_registry)
 endef
 
@@ -323,7 +323,7 @@ $(eval $(call KernelPackage,oid-registry))
 define KernelPackage/lib-objagg
   SUBMENU:=$(LIB_MENU)
   TITLE:=objagg support
-  FILES:=$(LINUX_DIR)/lib/objagg.ko
+  FILES:=$(LINUX_OBJ_DIR)/lib/objagg.ko
   KCONFIG:= \
   CONFIG_OBJAGG \
   CONFIG_TEST_OBJAGG=n
@@ -336,7 +336,7 @@ $(eval $(call KernelPackage,lib-objagg))
 define KernelPackage/lib-parman
   SUBMENU:=$(LIB_MENU)
   TITLE:=parman support
-  FILES:=$(LINUX_DIR)/lib/parman.ko
+  FILES:=$(LINUX_OBJ_DIR)/lib/parman.ko
   KCONFIG:= \
   CONFIG_PARMAN \
   CONFIG_TEST_PARMAN=n
diff --git a/package/kernel/linux/modules/multiplexer.mk b/package/kernel/linux/modules/multiplexer.mk
index 135fc62c6d..da427fe529 100644
--- a/package/kernel/linux/modules/multiplexer.mk
+++ b/package/kernel/linux/modules/multiplexer.mk
@@ -8,7 +8,7 @@ define KernelPackage/mux-core
   SUBMENU:=$(MENU_TITLE)
   TITLE:=Multiplexer Support
   KCONFIG:=CONFIG_MULTIPLEXER
-  FILES:=$(LINUX_DIR)/drivers/mux/mux-core.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/mux/mux-core.ko
   AUTOLOAD:=$(call AutoLoad,25,mux-core,1)
 endef
 
@@ -23,7 +23,7 @@ define KernelPackage/mux-gpio
   TITLE:=GPIO-controlled Multiplexer controller
   KCONFIG:=CONFIG_MUX_GPIO
   DEPENDS:=@GPIO_SUPPORT kmod-mux-core
-  FILES:=$(LINUX_DIR)/drivers/mux/mux-gpio.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/mux/mux-gpio.ko
   AUTOLOAD:=$(call AutoLoad,25,mux-gpio,1)
 endef
 
diff --git a/package/kernel/linux/modules/netdevices.mk b/package/kernel/linux/modules/netdevices.mk
index 74ea07e261..8f7141427d 100644
--- a/package/kernel/linux/modules/netdevices.mk
+++ b/package/kernel/linux/modules/netdevices.mk
@@ -12,7 +12,7 @@ define KernelPackage/sis190
   TITLE:=SiS 190 Fast/Gigabit Ethernet support
   DEPENDS:=@PCI_SUPPORT +kmod-mii
   KCONFIG:=CONFIG_SIS190
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/sis/sis190.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/sis/sis190.ko
   AUTOLOAD:=$(call AutoProbe,sis190)
 endef
 
@@ -26,7 +26,7 @@ define KernelPackage/skge
   KCONFIG:=CONFIG_SKGE \
 	CONFIG_SKGE_DEBUG=n \
 	CONFIG_SKGE_GENESIS=n
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/marvell/skge.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/marvell/skge.ko
   AUTOLOAD:=$(call AutoProbe,skge)
 endef
 
@@ -38,7 +38,7 @@ define KernelPackage/alx
   TITLE:=Qualcomm Atheros AR816x/AR817x PCI-E Ethernet Network Driver
   DEPENDS:=@PCI_SUPPORT +kmod-mdio
   KCONFIG:=CONFIG_ALX
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/atheros/alx/alx.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/atheros/alx/alx.ko
   AUTOLOAD:=$(call AutoProbe,alx)
 endef
 
@@ -50,7 +50,7 @@ define KernelPackage/atl2
   TITLE:=Atheros L2 Fast Ethernet support
   DEPENDS:=@PCI_SUPPORT
   KCONFIG:=CONFIG_ATL2
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/atheros/atlx/atl2.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/atheros/atlx/atl2.ko
   AUTOLOAD:=$(call AutoProbe,atl2)
 endef
 
@@ -62,7 +62,7 @@ define KernelPackage/atl1
   TITLE:=Atheros L1 Gigabit Ethernet support
   DEPENDS:=@PCI_SUPPORT +kmod-mii
   KCONFIG:=CONFIG_ATL1
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/atheros/atlx/atl1.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/atheros/atlx/atl1.ko
   AUTOLOAD:=$(call AutoProbe,atl1)
 endef
 
@@ -74,7 +74,7 @@ define KernelPackage/atl1c
   TITLE:=Atheros L1C
   DEPENDS:=@PCI_SUPPORT
   KCONFIG:=CONFIG_ATL1C
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/atheros/atl1c/atl1c.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/atheros/atl1c/atl1c.ko
   AUTOLOAD:=$(call AutoProbe,atl1c)
 endef
 
@@ -86,7 +86,7 @@ define KernelPackage/atl1e
   TITLE:=Atheros L1E
   DEPENDS:=@PCI_SUPPORT
   KCONFIG:=CONFIG_ATL1E
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/atheros/atl1e/atl1e.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/atheros/atl1e/atl1e.ko
   AUTOLOAD:=$(call AutoProbe,atl1e)
 endef
 
@@ -97,7 +97,7 @@ define KernelPackage/libphy
   SUBMENU:=$(NETWORK_DEVICES_MENU)
   TITLE:=PHY library
   KCONFIG:=CONFIG_PHYLIB
-  FILES:=$(LINUX_DIR)/drivers/net/phy/libphy.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/phy/libphy.ko
   AUTOLOAD:=$(call AutoLoad,15,libphy,1)
 endef
 
@@ -113,7 +113,7 @@ define KernelPackage/phylink
   TITLE:=Model for MAC to optional PHY connection
   DEPENDS:=+kmod-libphy
   KCONFIG:=CONFIG_PHYLINK
-  FILES:=$(LINUX_DIR)/drivers/net/phy/phylink.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/phy/phylink.ko
   AUTOLOAD:=$(call AutoLoad,15,phylink,1)
 endef
 
@@ -128,7 +128,7 @@ define KernelPackage/mii
   SUBMENU:=$(NETWORK_DEVICES_MENU)
   TITLE:=MII library
   KCONFIG:=CONFIG_MII
-  FILES:=$(LINUX_DIR)/drivers/net/mii.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/mii.ko
   AUTOLOAD:=$(call AutoLoad,15,mii,1)
 endef
 
@@ -145,7 +145,7 @@ define KernelPackage/mdio-devres
   DEPENDS:=+kmod-libphy +(TARGET_armsr||TARGET_bcm27xx_bcm2708||TARGET_malta||TARGET_tegra):kmod-of-mdio
   KCONFIG:=CONFIG_MDIO_DEVRES
   HIDDEN:=1
-  FILES:=$(LINUX_DIR)/drivers/net/phy/mdio_devres.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/phy/mdio_devres.ko
   AUTOLOAD:=$(call AutoProbe,mdio-devres)
 endef
 
@@ -164,8 +164,8 @@ define KernelPackage/mdio-gpio
 	CONFIG_MDIO_BITBANG \
 	CONFIG_MDIO_GPIO
   FILES:= \
-	$(LINUX_DIR)/drivers/net/mdio/mdio-gpio.ko \
-	$(LINUX_DIR)/drivers/net/mdio/mdio-bitbang.ko
+	$(LINUX_OBJ_DIR)/drivers/net/mdio/mdio-gpio.ko \
+	$(LINUX_OBJ_DIR)/drivers/net/mdio/mdio-bitbang.ko
   AUTOLOAD:=$(call AutoProbe,mdio-gpio)
 endef
 
@@ -181,7 +181,7 @@ define KernelPackage/et131x
   TITLE:=Agere ET131x Gigabit Ethernet driver
   URL:=http://sourceforge.net/projects/et131x
   FILES:= \
-	$(LINUX_DIR)/drivers/net/ethernet/agere/et131x.ko
+	$(LINUX_OBJ_DIR)/drivers/net/ethernet/agere/et131x.ko
   KCONFIG:= \
 	CONFIG_ET131X \
 	CONFIG_ET131X_DEBUG=n
@@ -200,7 +200,7 @@ define KernelPackage/phy-microchip
    TITLE:=Microchip Ethernet PHY driver
    KCONFIG:=CONFIG_MICROCHIP_PHY
    DEPENDS:=+kmod-libphy
-   FILES:=$(LINUX_DIR)/drivers/net/phy/microchip.ko
+   FILES:=$(LINUX_OBJ_DIR)/drivers/net/phy/microchip.ko
    AUTOLOAD:=$(call AutoLoad,18,microchip,1)
 endef
 
@@ -217,7 +217,7 @@ define KernelPackage/phylib-broadcom
    KCONFIG:=CONFIG_BCM_NET_PHYLIB
    HIDDEN:=1
    DEPENDS:=+kmod-libphy
-   FILES:=$(LINUX_DIR)/drivers/net/phy/bcm-phy-lib.ko
+   FILES:=$(LINUX_OBJ_DIR)/drivers/net/phy/bcm-phy-lib.ko
    AUTOLOAD:=$(call AutoLoad,17,bcm-phy-lib)
 endef
 
@@ -229,7 +229,7 @@ define KernelPackage/phy-amd
    TITLE:=AMD PHY driver
    KCONFIG:=CONFIG_AMD_PHY
    DEPENDS:=+kmod-libphy
-   FILES:=$(LINUX_DIR)/drivers/net/phy/amd.ko
+   FILES:=$(LINUX_OBJ_DIR)/drivers/net/phy/amd.ko
    AUTOLOAD:=$(call AutoProbe,amd,1)
 endef
 
@@ -245,7 +245,7 @@ define KernelPackage/phy-ax88796b
    TITLE:=Asix PHY driver
    KCONFIG:=CONFIG_AX88796B_PHY
    DEPENDS:=+kmod-libphy
-   FILES:=$(LINUX_DIR)/drivers/net/phy/ax88796b.ko
+   FILES:=$(LINUX_OBJ_DIR)/drivers/net/phy/ax88796b.ko
    AUTOLOAD:=$(call AutoProbe,ax88796b)
 endef
 
@@ -262,7 +262,7 @@ define KernelPackage/phy-broadcom
    TITLE:=Broadcom Ethernet PHY driver
    KCONFIG:=CONFIG_BROADCOM_PHY
    DEPENDS:=+kmod-libphy +kmod-phylib-broadcom
-   FILES:=$(LINUX_DIR)/drivers/net/phy/broadcom.ko
+   FILES:=$(LINUX_OBJ_DIR)/drivers/net/phy/broadcom.ko
    AUTOLOAD:=$(call AutoLoad,18,broadcom,1)
 endef
 
@@ -279,7 +279,7 @@ define KernelPackage/phy-bcm84881
    TITLE:=Broadcom BCM84881 PHY driver
    KCONFIG:=CONFIG_BCM84881_PHY
    DEPENDS:=+kmod-libphy
-   FILES:=$(LINUX_DIR)/drivers/net/phy/bcm84881.ko
+   FILES:=$(LINUX_OBJ_DIR)/drivers/net/phy/bcm84881.ko
    AUTOLOAD:=$(call AutoLoad,18,bcm84881,1)
 endef
 
@@ -295,7 +295,7 @@ define KernelPackage/phy-marvell
    TITLE:=Marvell Gigabit Ethernet PHY driver
    KCONFIG:=CONFIG_MARVELL_PHY
    DEPENDS:=+kmod-libphy
-   FILES:=$(LINUX_DIR)/drivers/net/phy/marvell.ko
+   FILES:=$(LINUX_OBJ_DIR)/drivers/net/phy/marvell.ko
    AUTOLOAD:=$(call AutoLoad,18,marvell)
 endef
 
@@ -329,7 +329,7 @@ define KernelPackage/phy-marvell-10g
    TITLE:=Marvell 10 Gigabit Ethernet PHY driver
    KCONFIG:=CONFIG_MARVELL_10G_PHY
    DEPENDS:=+kmod-libphy
-   FILES:=$(LINUX_DIR)/drivers/net/phy/marvell10g.ko
+   FILES:=$(LINUX_OBJ_DIR)/drivers/net/phy/marvell10g.ko
    AUTOLOAD:=$(call AutoLoad,18,marvell10g)
 endef
 
@@ -348,7 +348,7 @@ define KernelPackage/phy-realtek
    TITLE:=Realtek Ethernet PHY driver
    KCONFIG:=CONFIG_REALTEK_PHY
    DEPENDS:=+kmod-libphy
-   FILES:=$(LINUX_DIR)/drivers/net/phy/realtek.ko
+   FILES:=$(LINUX_OBJ_DIR)/drivers/net/phy/realtek.ko
    AUTOLOAD:=$(call AutoLoad,18,realtek,1)
 endef
 
@@ -364,7 +364,7 @@ define KernelPackage/phy-smsc
    TITLE:=SMSC PHY driver
    KCONFIG:=CONFIG_SMSC_PHY
    DEPENDS:=+kmod-libphy
-   FILES:=$(LINUX_DIR)/drivers/net/phy/smsc.ko
+   FILES:=$(LINUX_OBJ_DIR)/drivers/net/phy/smsc.ko
    AUTOLOAD:=$(call AutoProbe,smsc)
 endef
 
@@ -380,7 +380,7 @@ define KernelPackage/phy-aquantia
   TITLE:=Aquantia Ethernet PHYs
   DEPENDS:=+kmod-libphy +kmod-hwmon-core
   KCONFIG:=CONFIG_AQUANTIA_PHY
-  FILES:=$(LINUX_DIR)/drivers/net/phy/aquantia.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/phy/aquantia.ko
   AUTOLOAD:=$(call AutoLoad,18,aquantia,1)
 endef
 
@@ -396,7 +396,7 @@ define KernelPackage/swconfig
   TITLE:=switch configuration API
   DEPENDS:=+kmod-libphy
   KCONFIG:=CONFIG_SWCONFIG
-  FILES:=$(LINUX_DIR)/drivers/net/phy/swconfig.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/phy/swconfig.ko
   AUTOLOAD:=$(call AutoLoad,41,swconfig)
 endef
 
@@ -411,7 +411,7 @@ define KernelPackage/switch-bcm53xx
   TITLE:=Broadcom bcm53xx switch support
   DEPENDS:=+kmod-swconfig
   KCONFIG:=CONFIG_SWCONFIG_B53
-  FILES:=$(LINUX_DIR)/drivers/net/phy/b53/b53_common.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/phy/b53/b53_common.ko
   AUTOLOAD:=$(call AutoLoad,42,b53_common)
 endef
 
@@ -426,7 +426,7 @@ define KernelPackage/switch-bcm53xx-mdio
   TITLE:=Broadcom bcm53xx switch MDIO support
   DEPENDS:=+kmod-switch-bcm53xx
   KCONFIG:=CONFIG_SWCONFIG_B53_PHY_DRIVER
-  FILES:=$(LINUX_DIR)/drivers/net/phy/b53/b53_mdio.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/phy/b53/b53_mdio.ko
   AUTOLOAD:=$(call AutoLoad,42,b53_mdio)
 endef
 
@@ -442,7 +442,7 @@ define KernelPackage/switch-ip17xx
   TITLE:=IC+ IP17XX switch support
   DEPENDS:=+kmod-swconfig
   KCONFIG:=CONFIG_IP17XX_PHY
-  FILES:=$(LINUX_DIR)/drivers/net/phy/ip17xx.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/phy/ip17xx.ko
   AUTOLOAD:=$(call AutoLoad,42,ip17xx)
 endef
 
@@ -458,7 +458,7 @@ define KernelPackage/switch-rtl8306
   TITLE:=Realtek RTL8306S switch support
   DEPENDS:=+kmod-swconfig
   KCONFIG:=CONFIG_RTL8306_PHY
-  FILES:=$(LINUX_DIR)/drivers/net/phy/rtl8306.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/phy/rtl8306.ko
   AUTOLOAD:=$(call AutoLoad,43,rtl8306)
 endef
 
@@ -474,7 +474,7 @@ define KernelPackage/switch-rtl8366-smi
   TITLE:=Realtek RTL8366 SMI switch interface support
   DEPENDS:=@GPIO_SUPPORT +kmod-swconfig +(TARGET_armsr||TARGET_bcm27xx_bcm2708||TARGET_malta||TARGET_tegra):kmod-of-mdio
   KCONFIG:=CONFIG_RTL8366_SMI
-  FILES:=$(LINUX_DIR)/drivers/net/phy/rtl8366_smi.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/phy/rtl8366_smi.ko
   AUTOLOAD:=$(call AutoLoad,42,rtl8366_smi,1)
 endef
 
@@ -490,7 +490,7 @@ define KernelPackage/switch-rtl8366rb
   TITLE:=Realtek RTL8366RB switch support
   DEPENDS:=+kmod-switch-rtl8366-smi
   KCONFIG:=CONFIG_RTL8366RB_PHY
-  FILES:=$(LINUX_DIR)/drivers/net/phy/rtl8366rb.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/phy/rtl8366rb.ko
   AUTOLOAD:=$(call AutoLoad,43,rtl8366rb,1)
 endef
 
@@ -506,7 +506,7 @@ define KernelPackage/switch-rtl8366s
   TITLE:=Realtek RTL8366S switch support
   DEPENDS:=+kmod-switch-rtl8366-smi
   KCONFIG:=CONFIG_RTL8366S_PHY
-  FILES:=$(LINUX_DIR)/drivers/net/phy/rtl8366s.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/phy/rtl8366s.ko
   AUTOLOAD:=$(call AutoLoad,43,rtl8366s,1)
 endef
 
@@ -522,7 +522,7 @@ define KernelPackage/switch-rtl8367
   TITLE:=Realtek RTL8367 switch support
   DEPENDS:=+kmod-switch-rtl8366-smi
   KCONFIG:=CONFIG_RTL8367_PHY
-  FILES:=$(LINUX_DIR)/drivers/net/phy/rtl8367.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/phy/rtl8367.ko
   AUTOLOAD:=$(call AutoLoad,43,rtl8367,1)
 endef
 
@@ -538,7 +538,7 @@ define KernelPackage/switch-rtl8367b
   TITLE:=Realtek RTL8367R/B switch support
   DEPENDS:=+kmod-switch-rtl8366-smi
   KCONFIG:=CONFIG_RTL8367B_PHY
-  FILES:=$(LINUX_DIR)/drivers/net/phy/rtl8367b.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/phy/rtl8367b.ko
   AUTOLOAD:=$(call AutoLoad,43,rtl8367b,1)
 endef
 
@@ -554,7 +554,7 @@ define KernelPackage/switch-ar8xxx
   TITLE:=Atheros AR8216/8327 switch support
   DEPENDS:=+kmod-swconfig +kmod-mdio-devres
   KCONFIG:=CONFIG_AR8216_PHY
-  FILES:=$(LINUX_DIR)/drivers/net/phy/ar8xxx.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/phy/ar8xxx.ko
   AUTOLOAD:=$(call AutoLoad,43,ar8xxx,1)
 endef
 
@@ -570,7 +570,7 @@ define KernelPackage/natsemi
   TITLE:=National Semiconductor DP8381x series
   DEPENDS:=@PCI_SUPPORT
   KCONFIG:=CONFIG_NATSEMI
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/natsemi/natsemi.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/natsemi/natsemi.ko
   AUTOLOAD:=$(call AutoLoad,20,natsemi)
 endef
 
@@ -588,7 +588,7 @@ define KernelPackage/r6040
   DEPENDS:=@PCI_SUPPORT +kmod-libphy
   KCONFIG:=CONFIG_R6040 \
 		CONFIG_R6040_NAPI=y
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/rdc/r6040.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/rdc/r6040.ko
   AUTOLOAD:=$(call AutoProbe,r6040)
 endef
 
@@ -604,7 +604,7 @@ define KernelPackage/niu
   TITLE:=Sun Neptune 10Gbit Ethernet support
   DEPENDS:=@PCI_SUPPORT
   KCONFIG:=CONFIG_NIU
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/sun/niu.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/sun/niu.ko
   AUTOLOAD:=$(call AutoProbe,niu)
 endef
 
@@ -620,7 +620,7 @@ define KernelPackage/sis900
   TITLE:=SiS 900 Ethernet support
   DEPENDS:=@PCI_SUPPORT +kmod-mii
   KCONFIG:=CONFIG_SIS900
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/sis/sis900.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/sis/sis900.ko
   AUTOLOAD:=$(call AutoProbe,sis900)
 endef
 
@@ -636,7 +636,7 @@ define KernelPackage/sky2
   TITLE:=SysKonnect Yukon2 support
   DEPENDS:=@PCI_SUPPORT
   KCONFIG:=CONFIG_SKY2
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/marvell/sky2.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/marvell/sky2.ko
   AUTOLOAD:=$(call AutoProbe,sky2)
 endef
 
@@ -659,7 +659,7 @@ define KernelPackage/via-rhine
   DEPENDS:=@PCI_SUPPORT +kmod-mii
   KCONFIG:=CONFIG_VIA_RHINE \
     CONFIG_VIA_RHINE_MMIO=y
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/via/via-rhine.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/via/via-rhine.ko
   AUTOLOAD:=$(call AutoProbe,via-rhine)
 endef
 
@@ -675,7 +675,7 @@ define KernelPackage/via-velocity
   TITLE:=VIA Velocity Gigabit Ethernet Adapter kernel support
   DEPENDS:=@PCI_SUPPORT +kmod-lib-crc-ccitt
   KCONFIG:=CONFIG_VIA_VELOCITY
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/via/via-velocity.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/via/via-velocity.ko
   AUTOLOAD:=$(call AutoProbe,via-velocity)
 endef
 
@@ -695,7 +695,7 @@ define KernelPackage/8139too
     CONFIG_8139TOO_TUNE_TWISTER=n \
     CONFIG_8139TOO_8129=n \
     CONFIG_8139_OLD_RX_RESET=n
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/realtek/8139too.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/realtek/8139too.ko
   AUTOLOAD:=$(call AutoProbe,8139too)
 endef
 
@@ -711,7 +711,7 @@ define KernelPackage/8139cp
   TITLE:=RealTek RTL-8139C+ PCI Fast Ethernet Adapter kernel support
   DEPENDS:=@PCI_SUPPORT +kmod-mii
   KCONFIG:=CONFIG_8139CP
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/realtek/8139cp.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/realtek/8139cp.ko
   AUTOLOAD:=$(call AutoProbe,8139cp)
 endef
 
@@ -730,7 +730,7 @@ define KernelPackage/r8169
     CONFIG_R8169 \
     CONFIG_R8169_NAPI=y \
     CONFIG_R8169_VLAN=n
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/realtek/r8169.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/realtek/r8169.ko
   AUTOLOAD:=$(call AutoProbe,r8169)
 endef
 
@@ -747,8 +747,8 @@ define KernelPackage/ne2k-pci
   DEPENDS:=@PCI_SUPPORT
   KCONFIG:=CONFIG_NE2K_PCI
   FILES:= \
-	$(LINUX_DIR)/drivers/net/ethernet/8390/ne2k-pci.ko \
-	$(LINUX_DIR)/drivers/net/ethernet/8390/8390.ko
+	$(LINUX_OBJ_DIR)/drivers/net/ethernet/8390/ne2k-pci.ko \
+	$(LINUX_OBJ_DIR)/drivers/net/ethernet/8390/8390.ko
   AUTOLOAD:=$(call AutoProbe,8390 ne2k-pci)
 endef
 
@@ -764,7 +764,7 @@ define KernelPackage/e100
   TITLE:=Intel(R) PRO/100+ cards kernel support
   DEPENDS:=@PCI_SUPPORT +kmod-mii +e100-firmware
   KCONFIG:=CONFIG_E100
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/intel/e100.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/intel/e100.ko
   AUTOLOAD:=$(call AutoProbe,e100)
 endef
 
@@ -782,7 +782,7 @@ define KernelPackage/e1000
   KCONFIG:=CONFIG_E1000 \
     CONFIG_E1000_DISABLE_PACKET_SPLIT=n \
     CONFIG_E1000_NAPI=y
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/intel/e1000/e1000.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/intel/e1000/e1000.ko
   AUTOLOAD:=$(call AutoLoad,35,e1000)
 endef
 
@@ -798,7 +798,7 @@ define KernelPackage/e1000e
   TITLE:=Intel(R) PRO/1000 PCIe cards kernel support
   DEPENDS:=@PCIE_SUPPORT +kmod-ptp
   KCONFIG:=CONFIG_E1000E
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/intel/e1000e/e1000e.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/intel/e1000e/e1000e.ko
   AUTOLOAD:=$(call AutoProbe,e1000e)
   MODPARAMS.e1000e:= \
     IntMode=1 \
@@ -819,7 +819,7 @@ define KernelPackage/igb
   KCONFIG:=CONFIG_IGB \
     CONFIG_IGB_HWMON=y \
     CONFIG_IGB_DCA=n
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/intel/igb/igb.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/intel/igb/igb.ko
   AUTOLOAD:=$(call AutoLoad,35,igb,1)
 endef
 
@@ -837,7 +837,7 @@ define KernelPackage/igbvf
   KCONFIG:=CONFIG_IGBVF \
     CONFIG_IGB_HWMON=y \
     CONFIG_IGB_DCA=n
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/intel/igbvf/igbvf.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/intel/igbvf/igbvf.ko
   AUTOLOAD:=$(call AutoLoad,35,igbvf)
 endef
 
@@ -856,7 +856,7 @@ define KernelPackage/ixgbe
     CONFIG_IXGBE_VXLAN=n \
     CONFIG_IXGBE_HWMON=y \
     CONFIG_IXGBE_DCA=n
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/intel/ixgbe/ixgbe.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/intel/ixgbe/ixgbe.ko
   AUTOLOAD:=$(call AutoLoad,35,ixgbe)
 endef
 
@@ -875,7 +875,7 @@ define KernelPackage/ixgbevf
     CONFIG_IXGBE_VXLAN=n \
     CONFIG_IXGBE_HWMON=y \
     CONFIG_IXGBE_DCA=n
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/intel/ixgbevf/ixgbevf.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/intel/ixgbevf/ixgbevf.ko
   AUTOLOAD:=$(call AutoLoad,35,ixgbevf)
 endef
 
@@ -894,7 +894,7 @@ define KernelPackage/i40e
     CONFIG_I40E_VXLAN=n \
     CONFIG_I40E_HWMON=y \
     CONFIG_I40E_DCA=n
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/intel/i40e/i40e.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/intel/i40e/i40e.ko
   AUTOLOAD:=$(call AutoProbe,i40e)
 endef
 
@@ -913,7 +913,7 @@ define KernelPackage/iavf
        CONFIG_I40EVF \
        CONFIG_IAVF
   FILES:= \
-       $(LINUX_DIR)/drivers/net/ethernet/intel/iavf/iavf.ko
+       $(LINUX_OBJ_DIR)/drivers/net/ethernet/intel/iavf/iavf.ko
   AUTOLOAD:=$(call AutoProbe,i40evf iavf)
   AUTOLOAD:=$(call AutoProbe,iavf)
 endef
@@ -932,7 +932,7 @@ define KernelPackage/b44
   KCONFIG:=CONFIG_B44
   DEPENDS:=@PCI_SUPPORT @!TARGET_bcm47xx_mips74k +!TARGET_bcm47xx:kmod-ssb +kmod-mii +kmod-libphy
   SUBMENU:=$(NETWORK_DEVICES_MENU)
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/broadcom/b44.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/broadcom/b44.ko
   AUTOLOAD:=$(call AutoLoad,19,b44,1)
 endef
 
@@ -948,7 +948,7 @@ define KernelPackage/3c59x
   TITLE:=3Com 3c590/3c900 series (592/595/597) Vortex/Boomerang
   DEPENDS:=@PCI_SUPPORT +kmod-mii
   KCONFIG:=CONFIG_VORTEX
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/3com/3c59x.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/3com/3c59x.ko
   AUTOLOAD:=$(call AutoProbe,3c59x)
 endef
 
@@ -970,7 +970,7 @@ define KernelPackage/pcnet32
   TITLE:=AMD PCnet32 PCI support
   DEPENDS:=@(PCI_SUPPORT||TARGET_malta) +kmod-mii
   KCONFIG:=CONFIG_PCNET32
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/amd/pcnet32.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/amd/pcnet32.ko
   AUTOLOAD:=$(call AutoProbe,pcnet32)
 endef
 
@@ -987,7 +987,7 @@ define KernelPackage/tg3
 	CONFIG_TIGON3_HWMON=n
   DEPENDS:=@PCI_SUPPORT +!TARGET_bcm47xx:kmod-libphy +kmod-ptp
   SUBMENU:=$(NETWORK_DEVICES_MENU)
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/broadcom/tg3.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/broadcom/tg3.ko
   AUTOLOAD:=$(call AutoLoad,19,tg3,1)
 endef
 
@@ -1003,7 +1003,7 @@ define KernelPackage/hfcpci
   KCONFIG:=CONFIG_MISDN_HFCPCI
   DEPENDS:=@PCI_SUPPORT +kmod-misdn
   SUBMENU:=$(NETWORK_DEVICES_MENU)
-  FILES:=$(LINUX_DIR)/drivers/isdn/hardware/mISDN/hfcpci.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/isdn/hardware/mISDN/hfcpci.ko
   AUTOLOAD:=$(call AutoLoad,31,hfcpci)
 endef
 
@@ -1020,7 +1020,7 @@ define KernelPackage/hfcmulti
   KCONFIG:=CONFIG_MISDN_HFCMULTI
   DEPENDS:=@PCI_SUPPORT +kmod-misdn
   SUBMENU:=$(NETWORK_DEVICES_MENU)
-  FILES:=$(LINUX_DIR)/drivers/isdn/hardware/mISDN/hfcmulti.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/isdn/hardware/mISDN/hfcmulti.ko
   AUTOLOAD:=$(call AutoLoad,31,hfcmulti)
 endef
 
@@ -1036,7 +1036,7 @@ define KernelPackage/macvlan
   SUBMENU:=$(NETWORK_DEVICES_MENU)
   TITLE:=MAC-VLAN support
   KCONFIG:=CONFIG_MACVLAN
-  FILES:=$(LINUX_DIR)/drivers/net/macvlan.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/macvlan.ko
   AUTOLOAD:=$(call AutoProbe,macvlan)
 endef
 
@@ -1052,7 +1052,7 @@ define KernelPackage/ipvlan
   SUBMENU:=$(NETWORK_DEVICES_MENU)
   TITLE:=IP-VLAN support
   KCONFIG:=CONFIG_IPVLAN
-  FILES:=$(LINUX_DIR)/drivers/net/ipvlan/ipvlan.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ipvlan/ipvlan.ko
   AUTOLOAD:=$(call AutoProbe,ipvlan)
 endef
 
@@ -1082,11 +1082,11 @@ define KernelPackage/tulip
     CONFIG_DM9102 \
     CONFIG_ULI526X
   FILES:= \
-	$(LINUX_DIR)/drivers/net/ethernet/dec/tulip/tulip.ko \
-	$(LINUX_DIR)/drivers/net/ethernet/dec/tulip/de2104x.ko \
-	$(LINUX_DIR)/drivers/net/ethernet/dec/tulip/dmfe.ko \
-	$(LINUX_DIR)/drivers/net/ethernet/dec/tulip/uli526x.ko \
-	$(LINUX_DIR)/drivers/net/ethernet/dec/tulip/winbond-840.ko
+	$(LINUX_OBJ_DIR)/drivers/net/ethernet/dec/tulip/tulip.ko \
+	$(LINUX_OBJ_DIR)/drivers/net/ethernet/dec/tulip/de2104x.ko \
+	$(LINUX_OBJ_DIR)/drivers/net/ethernet/dec/tulip/dmfe.ko \
+	$(LINUX_OBJ_DIR)/drivers/net/ethernet/dec/tulip/uli526x.ko \
+	$(LINUX_OBJ_DIR)/drivers/net/ethernet/dec/tulip/winbond-840.ko
   AUTOLOAD:=$(call AutoProbe,tulip)
 endef
 
@@ -1104,7 +1104,7 @@ define KernelPackage/solos-pci
   TITLE:=Solos ADSL2+ multiport modem
   DEPENDS:=@PCI_SUPPORT +kmod-atm
   KCONFIG:=CONFIG_ATM_SOLOS
-  FILES:=$(LINUX_DIR)/drivers/atm/solos-pci.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/atm/solos-pci.ko
   AUTOLOAD:=$(call AutoProbe,solos-pci)
 endef
 
@@ -1120,7 +1120,7 @@ define KernelPackage/dummy
   SUBMENU:=$(NETWORK_DEVICES_MENU)
   TITLE:=Dummy network device
   KCONFIG:=CONFIG_DUMMY
-  FILES:=$(LINUX_DIR)/drivers/net/dummy.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/dummy.ko
   AUTOLOAD:=$(call AutoLoad,34,dummy)
 endef
 
@@ -1137,7 +1137,7 @@ define KernelPackage/ifb
   KCONFIG:= \
 	CONFIG_IFB \
 	CONFIG_NET_CLS=y
-  FILES:=$(LINUX_DIR)/drivers/net/ifb.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ifb.ko
   AUTOLOAD:=$(call AutoLoad,34,ifb)
   MODPARAMS.ifb:=numifbs=0
 endef
@@ -1156,7 +1156,7 @@ define KernelPackage/dm9000
   KCONFIG:=CONFIG_DM9000 \
     CONFIG_DM9000_DEBUGLEVEL=4 \
     CONFIG_DM9000_FORCE_SIMPLE_PHY_POLL=y
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/davicom/dm9000.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/davicom/dm9000.ko
   AUTOLOAD:=$(call AutoLoad,34,dm9000)
 endef
 
@@ -1172,7 +1172,7 @@ define KernelPackage/forcedeth
   TITLE:=nForce Ethernet support
   DEPENDS:=@PCI_SUPPORT
   KCONFIG:=CONFIG_FORCEDETH
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/nvidia/forcedeth.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/nvidia/forcedeth.ko
   AUTOLOAD:=$(call AutoProbe,forcedeth)
 endef
 
@@ -1187,7 +1187,7 @@ define KernelPackage/fixed-phy
   TITLE:=MDIO Bus/PHY emulation with fixed speed/link PHYs
   DEPENDS:=+kmod-libphy
   KCONFIG:=CONFIG_FIXED_PHY
-  FILES:=$(LINUX_DIR)/drivers/net/phy/fixed_phy.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/phy/fixed_phy.ko
   AUTOLOAD:=$(call AutoProbe,fixed_phy)
 endef
 
@@ -1204,8 +1204,8 @@ define KernelPackage/of-mdio
   DEPENDS:=+kmod-libphy +kmod-fixed-phy @!TARGET_x86
   KCONFIG:=CONFIG_OF_MDIO
   FILES:= \
-	$(LINUX_DIR)/drivers/net/mdio/of_mdio.ko \
-	$(LINUX_DIR)/drivers/net/mdio/fwnode_mdio.ko
+	$(LINUX_OBJ_DIR)/drivers/net/mdio/of_mdio.ko \
+	$(LINUX_OBJ_DIR)/drivers/net/mdio/fwnode_mdio.ko
   AUTOLOAD:=$(call AutoLoad,41,of_mdio)
 endef
 
@@ -1221,7 +1221,7 @@ define KernelPackage/vmxnet3
   TITLE:=VMware VMXNET3 ethernet driver
   DEPENDS:=@PCI_SUPPORT
   KCONFIG:=CONFIG_VMXNET3
-  FILES:=$(LINUX_DIR)/drivers/net/vmxnet3/vmxnet3.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/vmxnet3/vmxnet3.ko
   AUTOLOAD:=$(call AutoLoad,35,vmxnet3)
 endef
 
@@ -1235,7 +1235,7 @@ $(eval $(call KernelPackage,vmxnet3))
 define KernelPackage/spi-ks8995
   SUBMENU:=$(NETWORK_DEVICES_MENU)
   TITLE:=Micrel/Kendin KS8995 Ethernet switch control
-  FILES:=$(LINUX_DIR)/drivers/net/phy/spi_ks8995.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/phy/spi_ks8995.ko
   KCONFIG:=CONFIG_MICREL_KS8995MA \
 	CONFIG_SPI=y \
 	CONFIG_SPI_MASTER=y
@@ -1253,7 +1253,7 @@ define KernelPackage/ethoc
   SUBMENU:=$(NETWORK_DEVICES_MENU)
   TITLE:=Opencore.org ethoc driver
   DEPENDS:=+kmod-libphy
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/ethoc.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/ethoc.ko
   KCONFIG:=CONFIG_ETHOC
   AUTOLOAD:=$(call AutoProbe,ethoc)
 endef
@@ -1269,7 +1269,7 @@ define KernelPackage/bnx2
   SUBMENU:=$(NETWORK_DEVICES_MENU)
   TITLE:=BCM5706/5708/5709/5716 ethernet adapter driver
   DEPENDS:=@PCI_SUPPORT +bnx2-firmware
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/broadcom/bnx2.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/broadcom/bnx2.ko
   KCONFIG:=CONFIG_BNX2
   AUTOLOAD:=$(call AutoProbe,bnx2)
 endef
@@ -1285,7 +1285,7 @@ define KernelPackage/bnx2x
   SUBMENU:=$(NETWORK_DEVICES_MENU)
   TITLE:=QLogic 5771x/578xx 10/20-Gigabit ethernet adapter driver
   DEPENDS:=@PCI_SUPPORT +bnx2x-firmware +kmod-lib-crc32c +kmod-mdio +kmod-ptp +kmod-lib-zlib-inflate
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/broadcom/bnx2x/bnx2x.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/broadcom/bnx2x/bnx2x.ko
   KCONFIG:= \
 	CONFIG_BNX2X \
 	CONFIG_BNX2X_SRIOV=y
@@ -1302,7 +1302,7 @@ define KernelPackage/be2net
   SUBMENU:=$(NETWORK_DEVICES_MENU)
   TITLE:=Broadcom Emulex OneConnect 10Gbps NIC
   DEPENDS:=@PCI_SUPPORT +kmod-hwmon-core
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/emulex/benet/be2net.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/emulex/benet/be2net.ko
   KCONFIG:= \
 	CONFIG_BE2NET \
 	CONFIG_BE2NET_BE2=y \
@@ -1324,8 +1324,8 @@ define KernelPackage/mlx4-core
   TITLE:=Mellanox ConnectX(R) mlx4 core Network Driver
   DEPENDS:=@PCI_SUPPORT +kmod-ptp
   FILES:= \
-	$(LINUX_DIR)/drivers/net/ethernet/mellanox/mlx4/mlx4_core.ko \
-	$(LINUX_DIR)/drivers/net/ethernet/mellanox/mlx4/mlx4_en.ko
+	$(LINUX_OBJ_DIR)/drivers/net/ethernet/mellanox/mlx4/mlx4_core.ko \
+	$(LINUX_OBJ_DIR)/drivers/net/ethernet/mellanox/mlx4/mlx4_en.ko
   KCONFIG:= CONFIG_MLX4_EN \
 	CONFIG_MLX4_EN_DCB=n \
 	CONFIG_MLX4_CORE=y \
@@ -1344,7 +1344,7 @@ define KernelPackage/mlx5-core
   SUBMENU:=$(NETWORK_DEVICES_MENU)
   TITLE:=Mellanox ConnectX(R) mlx5 core Network Driver
   DEPENDS:=@PCI_SUPPORT +kmod-ptp +kmod-mlxfw
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.ko
   KCONFIG:= CONFIG_MLX5_CORE \
 	CONFIG_MLX5_CORE_EN=y \
 	CONFIG_MLX5_CORE_EN_DCB=n \
@@ -1375,7 +1375,7 @@ $(eval $(call KernelPackage,mlx5-core))
 define KernelPackage/mlxfw
   SUBMENU:=$(NETWORK_DEVICES_MENU)
   TITLE:=Mellanox Technologies firmware flash module
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/mellanox/mlxfw/mlxfw.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/mellanox/mlxfw/mlxfw.ko
   KCONFIG:=CONFIG_MLXFW
   AUTOLOAD:=$(call AutoProbe,mlxfw)
 endef
@@ -1392,7 +1392,7 @@ define KernelPackage/mlxsw-core
   SUBMENU:=$(NETWORK_DEVICES_MENU)
   TITLE:=Mellanox Technologies Switch ASICs support
   DEPENDS:=+kmod-mlxfw +kmod-hwmon-core
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/mellanox/mlxsw/mlxsw_core.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/mellanox/mlxsw/mlxsw_core.ko
   KCONFIG:= \
   CONFIG_MLXSW_CORE \
   CONFIG_MLXSW_CORE_HWMON=y \
@@ -1411,7 +1411,7 @@ define KernelPackage/mlxsw-i2c
   SUBMENU:=$(NETWORK_DEVICES_MENU)
   TITLE:=I2C bus implementation for Mellanox Technologies Switch ASICs
   DEPENDS:=+kmod-mlxsw-core +kmod-i2c-core
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/mellanox/mlxsw/mlxsw_i2c.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/mellanox/mlxsw/mlxsw_i2c.ko
   KCONFIG:=CONFIG_MLXSW_I2C
   AUTOLOAD:=$(call AutoProbe,mlxsw_i2c)
 endef
@@ -1427,7 +1427,7 @@ define KernelPackage/mlxsw-minimal
   SUBMENU:=$(NETWORK_DEVICES_MENU)
   TITLE:=Mellanox Technologies minimal I2C support
   DEPENDS:=+kmod-mlxsw-core +kmod-mlxsw-i2c
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/mellanox/mlxsw/mlxsw_minimal.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/mellanox/mlxsw/mlxsw_minimal.ko
   KCONFIG:=CONFIG_MLXSW_MINIMAL
   AUTOLOAD:=$(call AutoProbe,mlxsw_minimal)
 endef
@@ -1444,7 +1444,7 @@ define KernelPackage/mlxsw-pci
   SUBMENU:=$(NETWORK_DEVICES_MENU)
   TITLE:=PCI bus implementation for Mellanox Technologies Switch ASICs
   DEPENDS:=@PCI_SUPPORT +kmod-mlxsw-core
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/mellanox/mlxsw/mlxsw_pci.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/mellanox/mlxsw/mlxsw_pci.ko
   KCONFIG:=CONFIG_MLXSW_PCI
   AUTOLOAD:=$(call AutoProbe,mlxsw_pci)
 endef
@@ -1462,7 +1462,7 @@ define KernelPackage/mlxsw-spectrum
   DEPENDS:= \
   +kmod-mlxsw-core +kmod-mlxsw-pci +kmod-lib-objagg +kmod-lib-parman \
   +kmod-ip6-tunnel +kmod-ptp +kmod-sched-act-sample +kmod-vxlan
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/mellanox/mlxsw/mlxsw_spectrum.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/mellanox/mlxsw/mlxsw_spectrum.ko
   KCONFIG:= \
   CONFIG_MLXSW_SPECTRUM \
   CONFIG_NET_SWITCHDEV=y \
@@ -1490,7 +1490,7 @@ define KernelPackage/net-selftests
   DEPENDS:=+kmod-libphy
   TITLE:=Network generic selftest support
   KCONFIG:=CONFIG_NET_SELFTESTS
-  FILES:=$(LINUX_DIR)/net/core/selftests.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/core/selftests.ko
   AUTOLOAD:=$(call AutoLoad,99,selftests)
 endef
 
@@ -1509,7 +1509,7 @@ define KernelPackage/qlcnic
 	CONFIG_QLCNIC \
 	CONFIG_QLCNIC_HWMON=y \
 	CONFIG_QLCNIC_SRIOV=y
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/qlogic/qlcnic/qlcnic.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/qlogic/qlcnic/qlcnic.ko
   AUTOLOAD:=$(call AutoProbe,qlcnic)
 endef
 
@@ -1529,8 +1529,8 @@ define KernelPackage/sfp
 	CONFIG_SFP \
 	CONFIG_MDIO_I2C
   FILES:= \
-	$(LINUX_DIR)/drivers/net/phy/sfp.ko \
-	$(LINUX_DIR)/drivers/net/mdio/mdio-i2c.ko
+	$(LINUX_OBJ_DIR)/drivers/net/phy/sfp.ko \
+	$(LINUX_OBJ_DIR)/drivers/net/mdio/mdio-i2c.ko
   AUTOLOAD:=$(call AutoProbe,mdio-i2c sfp)
 endef
 
@@ -1545,7 +1545,7 @@ define KernelPackage/igc
   TITLE:=Intel(R) Ethernet Controller I225 Series support
   DEPENDS:=@PCI_SUPPORT +kmod-ptp
   KCONFIG:=CONFIG_IGC
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/intel/igc/igc.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/intel/igc/igc.ko
   AUTOLOAD:=$(call AutoProbe,igc)
 endef
 
@@ -1565,7 +1565,7 @@ define KernelPackage/sfc
 	CONFIG_SFC_MCDI_MON=y \
 	CONFIG_SFC_MCDI_LOGGING=y \
 	CONFIG_SFC_SRIOV=y
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/sfc/sfc.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/sfc/sfc.ko
   AUTOLOAD:=$(call AutoProbe,sfc)
 endef
 
@@ -1583,7 +1583,7 @@ define KernelPackage/sfc-falcon
   KCONFIG:= \
 	CONFIG_SFC_FALCON \
 	CONFIG_SFC_FALCON_MTD=y
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/sfc/falcon/sfc-falcon.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/sfc/falcon/sfc-falcon.ko
   AUTOLOAD:=$(call AutoProbe,sfc-falcon)
 endef
 
@@ -1600,7 +1600,7 @@ define KernelPackage/wwan
   KCONFIG:= \
   CONFIG_WWAN \
   CONFIG_WWAN_DEBUGFS=y at ge5.17
-  FILES:=$(LINUX_DIR)/drivers/net/wwan/wwan.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/wwan/wwan.ko
   AUTOLOAD:=$(call AutoProbe,wwan)
 endef
 
@@ -1616,7 +1616,7 @@ define KernelPackage/mhi-net
   TITLE:=MHI Network Device
   DEPENDS:=@PCI_SUPPORT +kmod-mhi-bus
   KCONFIG:=CONFIG_MHI_NET
-  FILES:=$(LINUX_DIR)/drivers/net/mhi_net.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/mhi_net.ko
   AUTOLOAD:=$(call AutoProbe,mhi_net)
 endef
 
@@ -1631,7 +1631,7 @@ define KernelPackage/mhi-wwan-ctrl
   TITLE:=MHI WWAN Control
   DEPENDS:=@PCI_SUPPORT +kmod-mhi-bus +kmod-wwan
   KCONFIG:=CONFIG_MHI_WWAN_CTRL
-  FILES:=$(LINUX_DIR)/drivers/net/wwan/mhi_wwan_ctrl.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/wwan/mhi_wwan_ctrl.ko
   AUTOLOAD:=$(call AutoProbe,mhi_wwan_ctrl)
 endef
 
@@ -1647,7 +1647,7 @@ define KernelPackage/mhi-wwan-mbim
   TITLE:=MHI MBIM
   DEPENDS:=@PCI_SUPPORT +kmod-mhi-bus +kmod-wwan
   KCONFIG:=CONFIG_MHI_WWAN_MBIM
-  FILES:=$(LINUX_DIR)/drivers/net/wwan/mhi_wwan_mbim.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/wwan/mhi_wwan_mbim.ko
   AUTOLOAD:=$(call AutoProbe,mhi_wwan_mbim)
 endef
 
@@ -1663,7 +1663,7 @@ define KernelPackage/atlantic
   TITLE:=Aquantia AQtion 10Gbps Ethernet NIC
   DEPENDS:=@PCI_SUPPORT +kmod-ptp +kmod-hwmon-core +kmod-macsec
   KCONFIG:=CONFIG_AQTION
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/aquantia/atlantic/atlantic.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/aquantia/atlantic/atlantic.ko
   AUTOLOAD:=$(call AutoProbe,atlantic)
 endef
 
@@ -1679,7 +1679,7 @@ define KernelPackage/lan743x
   TITLE:=Microchip LAN743x PCI Express Gigabit Ethernet NIC
   DEPENDS:=@PCI_SUPPORT +kmod-ptp +kmod-mdio-devres
   KCONFIG:=CONFIG_LAN743X
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/microchip/lan743x.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/microchip/lan743x.ko
   AUTOLOAD:=$(call AutoProbe,lan743x)
 endef
 
@@ -1694,7 +1694,7 @@ define KernelPackage/amazon-ena
   TITLE:=Elastic Network Adapter (for Amazon AWS)
   DEPENDS:=@TARGET_x86_64||TARGET_armsr_armv8
   KCONFIG:=CONFIG_ENA_ETHERNET
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/amazon/ena/ena.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/amazon/ena/ena.ko
   AUTOLOAD:=$(call AutoLoad,12,ena)
 endef
 
diff --git a/package/kernel/linux/modules/netfilter.mk b/package/kernel/linux/modules/netfilter.mk
index da3e69e49a..3765a77258 100644
--- a/package/kernel/linux/modules/netfilter.mk
+++ b/package/kernel/linux/modules/netfilter.mk
@@ -18,7 +18,7 @@ define KernelPackage/nf-reject
 	CONFIG_NETFILTER=y \
 	CONFIG_NETFILTER_ADVANCED=y \
 	$(KCONFIG_NF_REJECT)
-  FILES:=$(foreach mod,$(NF_REJECT-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(NF_REJECT-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(NF_REJECT-m)))
 endef
 
@@ -33,7 +33,7 @@ define KernelPackage/nf-reject6
 	CONFIG_NETFILTER_ADVANCED=y \
 	$(KCONFIG_NF_REJECT6)
   DEPENDS:=@IPV6
-  FILES:=$(foreach mod,$(NF_REJECT6-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(NF_REJECT6-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(NF_REJECT6-m)))
 endef
 
@@ -45,7 +45,7 @@ define KernelPackage/nf-conncount
   KCONFIG:=$(KCONFIG_NF_CONNCOUNT)
   HIDDEN:=1
   DEPENDS:=+kmod-nf-conntrack
-  FILES:=$(foreach mod,$(NF_CONNCOUNT-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(NF_CONNCOUNT-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(NF_CONNCOUNT-m)))
 endef
 
@@ -55,7 +55,7 @@ define KernelPackage/nf-ipt
   SUBMENU:=$(NF_MENU)
   TITLE:=Iptables core
   KCONFIG:=$(KCONFIG_NF_IPT)
-  FILES:=$(foreach mod,$(NF_IPT-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(NF_IPT-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(NF_IPT-m)))
 endef
 
@@ -66,7 +66,7 @@ define KernelPackage/nf-ipt6
   SUBMENU:=$(NF_MENU)
   TITLE:=Ip6tables core
   KCONFIG:=$(KCONFIG_NF_IPT6)
-  FILES:=$(foreach mod,$(NF_IPT6-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(NF_IPT6-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(NF_IPT6-m)))
   DEPENDS:=+kmod-nf-ipt +kmod-nf-log6
 endef
@@ -79,7 +79,7 @@ define KernelPackage/ipt-core
   SUBMENU:=$(NF_MENU)
   TITLE:=Iptables core
   KCONFIG:=$(KCONFIG_IPT_CORE)
-  FILES:=$(foreach mod,$(IPT_CORE-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(IPT_CORE-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(IPT_CORE-m)))
   DEPENDS:=+kmod-nf-reject +kmod-nf-ipt +kmod-nf-log
 endef
@@ -108,7 +108,7 @@ define KernelPackage/nf-conntrack
         CONFIG_NF_CONNTRACK_MARK=y \
         CONFIG_NF_CONNTRACK_ZONES=y \
 	$(KCONFIG_NF_CONNTRACK)
-  FILES:=$(foreach mod,$(NF_CONNTRACK-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(NF_CONNTRACK-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(NF_CONNTRACK-m)))
 endef
 
@@ -125,7 +125,7 @@ define KernelPackage/nf-conntrack6
   TITLE:=Netfilter IPv6 connection tracking
   KCONFIG:=$(KCONFIG_NF_CONNTRACK6)
   DEPENDS:=@IPV6 +kmod-nf-conntrack
-  FILES:=$(foreach mod,$(NF_CONNTRACK6-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(NF_CONNTRACK6-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(NF_CONNTRACK6-m)))
 endef
 
@@ -136,7 +136,7 @@ define KernelPackage/nf-log
   SUBMENU:=$(NF_MENU)
   TITLE:=Netfilter Logging
   KCONFIG:=$(KCONFIG_NF_LOG)
-  FILES:=$(foreach mod,$(NF_LOG-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(NF_LOG-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(NF_LOG-m)))
 endef
 
@@ -148,7 +148,7 @@ define KernelPackage/nf-log6
   TITLE:=Netfilter IPV6 Logging
   KCONFIG:=$(KCONFIG_NF_LOG6)
   DEPENDS:=@IPV6 +kmod-nf-log
-  FILES:=$(foreach mod,$(NF_LOG6-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(NF_LOG6-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(NF_LOG6-m)))
 endef
 
@@ -160,7 +160,7 @@ define KernelPackage/nf-nat
   TITLE:=Netfilter NAT
   KCONFIG:=$(KCONFIG_NF_NAT)
   DEPENDS:=+kmod-nf-conntrack
-  FILES:=$(foreach mod,$(NF_NAT-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(NF_NAT-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(NF_NAT-m)))
 endef
 
@@ -172,7 +172,7 @@ define KernelPackage/nf-nat6
   TITLE:=Netfilter IPV6-NAT
   KCONFIG:=$(KCONFIG_NF_NAT6)
   DEPENDS:=@IPV6 +kmod-nf-conntrack6 +kmod-nf-nat
-  FILES:=$(foreach mod,$(NF_NAT6-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(NF_NAT6-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(NF_NAT6-m)))
 endef
 
@@ -187,7 +187,7 @@ define KernelPackage/nf-flow
 	CONFIG_NF_FLOW_TABLE \
 	CONFIG_NF_FLOW_TABLE_HW
   DEPENDS:=+kmod-nf-conntrack
-  FILES:= $(LINUX_DIR)/net/netfilter/nf_flow_table.ko
+  FILES:= $(LINUX_OBJ_DIR)/net/netfilter/nf_flow_table.ko
   AUTOLOAD:=$(call AutoProbe,nf_flow_table nf_flow_table_hw)
 endef
 
@@ -198,7 +198,7 @@ define KernelPackage/nf-socket
   SUBMENU:=$(NF_MENU)
   TITLE:=Netfilter socket lookup support
   KCONFIG:= $(KCONFIG_NF_SOCKET)
-  FILES:=$(foreach mod,$(NF_SOCKET-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(NF_SOCKET-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(NF_SOCKET-m)))
 endef
 
@@ -209,7 +209,7 @@ define KernelPackage/nf-tproxy
   SUBMENU:=$(NF_MENU)
   TITLE:=Netfilter tproxy support
   KCONFIG:= $(KCONFIG_NF_TPROXY)
-  FILES:=$(foreach mod,$(NF_TPROXY-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(NF_TPROXY-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(NF_TPROXY-m)))
 endef
 
@@ -225,7 +225,7 @@ endef
 define KernelPackage/ipt-conntrack
   TITLE:=Basic connection tracking modules
   KCONFIG:=$(KCONFIG_IPT_CONNTRACK)
-  FILES:=$(foreach mod,$(IPT_CONNTRACK-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(IPT_CONNTRACK-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(IPT_CONNTRACK-m)))
   $(call AddDepends/ipt,+kmod-nf-conntrack)
 endef
@@ -247,7 +247,7 @@ define KernelPackage/ipt-conntrack-extra
   TITLE:=Extra connection tracking modules
   DEPENDS:=+kmod-nf-conncount
   KCONFIG:=$(KCONFIG_IPT_CONNTRACK_EXTRA)
-  FILES:=$(foreach mod,$(IPT_CONNTRACK_EXTRA-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(IPT_CONNTRACK_EXTRA-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(IPT_CONNTRACK_EXTRA-m)))
   $(call AddDepends/ipt,+kmod-ipt-conntrack)
 endef
@@ -267,7 +267,7 @@ $(eval $(call KernelPackage,ipt-conntrack-extra))
 define KernelPackage/ipt-conntrack-label
   TITLE:=Module for handling connection tracking labels
   KCONFIG:=$(KCONFIG_IPT_CONNTRACK_LABEL)
-  FILES:=$(foreach mod,$(IPT_CONNTRACK_LABEL-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(IPT_CONNTRACK_LABEL-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(IPT_CONNTRACK_LABEL-m)))
   $(call AddDepends/ipt,+kmod-ipt-conntrack)
 endef
@@ -283,7 +283,7 @@ $(eval $(call KernelPackage,ipt-conntrack-label))
 define KernelPackage/ipt-filter
   TITLE:=Modules for packet content inspection
   KCONFIG:=$(KCONFIG_IPT_FILTER)
-  FILES:=$(foreach mod,$(IPT_FILTER-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(IPT_FILTER-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(IPT_FILTER-m)))
   $(call AddDepends/ipt,+kmod-lib-textsearch +kmod-ipt-conntrack)
 endef
@@ -301,7 +301,7 @@ $(eval $(call KernelPackage,ipt-filter))
 define KernelPackage/ipt-offload
   TITLE:=Netfilter routing/NAT offload support
   KCONFIG:=$(KCONFIG_IPT_FLOW)
-  FILES:=$(foreach mod,$(IPT_FLOW-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(IPT_FLOW-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(IPT_FLOW-m)))
   $(call AddDepends/ipt,+kmod-nf-flow)
 endef
@@ -312,7 +312,7 @@ $(eval $(call KernelPackage,ipt-offload))
 define KernelPackage/ipt-ipopt
   TITLE:=Modules for matching/changing IP packet options
   KCONFIG:=$(KCONFIG_IPT_IPOPT)
-  FILES:=$(foreach mod,$(IPT_IPOPT-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(IPT_IPOPT-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(IPT_IPOPT-m)))
   $(call AddDepends/ipt)
 endef
@@ -339,7 +339,7 @@ $(eval $(call KernelPackage,ipt-ipopt))
 define KernelPackage/ipt-ipsec
   TITLE:=Modules for matching IPSec packets
   KCONFIG:=$(KCONFIG_IPT_IPSEC)
-  FILES:=$(foreach mod,$(IPT_IPSEC-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(IPT_IPSEC-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(IPT_IPSEC-m)))
   $(call AddDepends/ipt)
 endef
@@ -399,7 +399,7 @@ define KernelPackage/ipt-ipset
 	CONFIG_IP_SET_HASH_NETPORTNET \
 	CONFIG_IP_SET_LIST_SET \
 	CONFIG_NET_EMATCH_IPSET=n
-  FILES:=$(foreach mod,$(IPSET_MODULES),$(LINUX_DIR)/net/netfilter/$(mod).ko)
+  FILES:=$(foreach mod,$(IPSET_MODULES),$(LINUX_OBJ_DIR)/net/netfilter/$(mod).ko)
   AUTOLOAD:=$(call AutoLoad,49,$(notdir $(IPSET_MODULES)))
 endef
 $(eval $(call KernelPackage,ipt-ipset))
@@ -451,7 +451,7 @@ define KernelPackage/nf-ipvs
 	CONFIG_IP_VS_SH_TAB_BITS=8 \
 	CONFIG_IP_VS_NFCT=y \
 	CONFIG_NETFILTER_XT_MATCH_IPVS
-  FILES:=$(foreach mod,$(IPVS_MODULES),$(LINUX_DIR)/net/netfilter/$(mod).ko)
+  FILES:=$(foreach mod,$(IPVS_MODULES),$(LINUX_OBJ_DIR)/net/netfilter/$(mod).ko)
   $(call AddDepends/ipt,+kmod-ipt-conntrack,+kmod-nf-conntrack)
 endef
 
@@ -468,7 +468,7 @@ define KernelPackage/nf-ipvs-ftp
   TITLE:=Virtual Server FTP protocol support
   KCONFIG:=CONFIG_IP_VS_FTP
   DEPENDS:=kmod-nf-ipvs +kmod-nf-nat +kmod-nf-nathelper
-  FILES:=$(LINUX_DIR)/net/netfilter/ipvs/ip_vs_ftp.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/netfilter/ipvs/ip_vs_ftp.ko
 endef
 
 define KernelPackage/nf-ipvs-ftp/description
@@ -487,7 +487,7 @@ define KernelPackage/nf-ipvs-sip
   TITLE:=Virtual Server SIP protocol support
   KCONFIG:=CONFIG_IP_VS_PE_SIP
   DEPENDS:=kmod-nf-ipvs +kmod-nf-nathelper-extra
-  FILES:=$(LINUX_DIR)/net/netfilter/ipvs/ip_vs_pe_sip.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/netfilter/ipvs/ip_vs_pe_sip.ko
 endef
 
 define KernelPackage/nf-ipvs-sip/description
@@ -500,7 +500,7 @@ $(eval $(call KernelPackage,nf-ipvs-sip))
 define KernelPackage/ipt-nat
   TITLE:=Basic NAT targets
   KCONFIG:=$(KCONFIG_IPT_NAT)
-  FILES:=$(foreach mod,$(IPT_NAT-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(IPT_NAT-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(IPT_NAT-m)))
   $(call AddDepends/ipt,+kmod-nf-nat)
 endef
@@ -517,7 +517,7 @@ $(eval $(call KernelPackage,ipt-nat))
 define KernelPackage/ipt-raw
   TITLE:=Netfilter IPv4 raw table support
   KCONFIG:=CONFIG_IP_NF_RAW
-  FILES:=$(LINUX_DIR)/net/ipv4/netfilter/iptable_raw.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/ipv4/netfilter/iptable_raw.ko
   AUTOLOAD:=$(call AutoProbe,iptable_raw)
   $(call AddDepends/ipt)
 endef
@@ -529,7 +529,7 @@ define KernelPackage/ipt-raw6
   TITLE:=Netfilter IPv6 raw table support
   DEPENDS:=@IPV6
   KCONFIG:=CONFIG_IP6_NF_RAW
-  FILES:=$(LINUX_DIR)/net/ipv6/netfilter/ip6table_raw.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/ipv6/netfilter/ip6table_raw.ko
   AUTOLOAD:=$(call AutoProbe,ip6table_raw)
   $(call AddDepends/ipt,+kmod-ip6tables)
 endef
@@ -541,7 +541,7 @@ define KernelPackage/ipt-nat6
   TITLE:=IPv6 NAT targets
   DEPENDS:=@IPV6
   KCONFIG:=$(KCONFIG_IPT_NAT6)
-  FILES:=$(foreach mod,$(IPT_NAT6-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(IPT_NAT6-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoLoad,43,$(notdir $(IPT_NAT6-m)))
   $(call AddDepends/ipt,+kmod-nf-nat6)
   $(call AddDepends/ipt,+kmod-ipt-conntrack)
@@ -559,7 +559,7 @@ $(eval $(call KernelPackage,ipt-nat6))
 define KernelPackage/ipt-nat-extra
   TITLE:=Extra NAT targets
   KCONFIG:=$(KCONFIG_IPT_NAT_EXTRA)
-  FILES:=$(foreach mod,$(IPT_NAT_EXTRA-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(IPT_NAT_EXTRA-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(IPT_NAT_EXTRA-m)))
   $(call AddDepends/ipt,+kmod-ipt-nat)
 endef
@@ -578,7 +578,7 @@ define KernelPackage/nf-nathelper
   SUBMENU:=$(NF_MENU)
   TITLE:=Basic Conntrack and NAT helpers
   KCONFIG:=$(KCONFIG_NF_NATHELPER)
-  FILES:=$(foreach mod,$(NF_NATHELPER-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(NF_NATHELPER-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(NF_NATHELPER-m)))
   DEPENDS:=+kmod-nf-nat
 endef
@@ -596,7 +596,7 @@ define KernelPackage/nf-nathelper-extra
   SUBMENU:=$(NF_MENU)
   TITLE:=Extra Conntrack and NAT helpers
   KCONFIG:=$(KCONFIG_NF_NATHELPER_EXTRA)
-  FILES:=$(foreach mod,$(NF_NATHELPER_EXTRA-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(NF_NATHELPER_EXTRA-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(NF_NATHELPER_EXTRA-m)))
   DEPENDS:=+kmod-nf-nat +kmod-lib-textsearch +kmod-asn1-decoder
 endef
@@ -622,7 +622,7 @@ $(eval $(call KernelPackage,nf-nathelper-extra))
 define KernelPackage/ipt-nflog
   TITLE:=Module for user-space packet logging
   KCONFIG:=$(KCONFIG_IPT_NFLOG)
-  FILES:=$(foreach mod,$(IPT_NFLOG-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(IPT_NFLOG-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(IPT_NFLOG-m)))
   $(call AddDepends/ipt,+kmod-nfnetlink-log)
 endef
@@ -639,7 +639,7 @@ $(eval $(call KernelPackage,ipt-nflog))
 define KernelPackage/ipt-nfqueue
   TITLE:=Module for user-space packet queuing
   KCONFIG:=$(KCONFIG_IPT_NFQUEUE)
-  FILES:=$(foreach mod,$(IPT_NFQUEUE-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(IPT_NFQUEUE-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(IPT_NFQUEUE-m)))
   $(call AddDepends/ipt,+kmod-nfnetlink-queue)
 endef
@@ -656,7 +656,7 @@ $(eval $(call KernelPackage,ipt-nfqueue))
 define KernelPackage/ipt-debug
   TITLE:=Module for debugging/development
   KCONFIG:=$(KCONFIG_IPT_DEBUG)
-  FILES:=$(foreach mod,$(IPT_DEBUG-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(IPT_DEBUG-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(IPT_DEBUG-m)))
   $(call AddDepends/ipt,+kmod-ipt-raw +IPV6:kmod-ipt-raw6)
 endef
@@ -673,7 +673,7 @@ $(eval $(call KernelPackage,ipt-debug))
 define KernelPackage/ipt-led
   TITLE:=Module to trigger a LED with a Netfilter rule
   KCONFIG:=$(KCONFIG_IPT_LED)
-  FILES:=$(foreach mod,$(IPT_LED-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(IPT_LED-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(IPT_LED-m)))
   $(call AddDepends/ipt)
 endef
@@ -688,7 +688,7 @@ define KernelPackage/ipt-socket
   TITLE:=Iptables socket matching support
   DEPENDS+=+kmod-nf-socket +kmod-nf-conntrack
   KCONFIG:=$(KCONFIG_IPT_SOCKET)
-  FILES:=$(foreach mod,$(IPT_SOCKET-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(IPT_SOCKET-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(IPT_SOCKET-m)))
   $(call AddDepends/ipt)
 endef
@@ -703,7 +703,7 @@ define KernelPackage/ipt-tproxy
   TITLE:=Transparent proxying support
   DEPENDS+=+kmod-nf-tproxy +kmod-nf-conntrack
   KCONFIG:=$(KCONFIG_IPT_TPROXY)
-  FILES:=$(foreach mod,$(IPT_TPROXY-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(IPT_TPROXY-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(IPT_TPROXY-m)))
   $(call AddDepends/ipt)
 endef
@@ -718,7 +718,7 @@ define KernelPackage/ipt-tee
   TITLE:=TEE support
   DEPENDS:=+kmod-ipt-conntrack
   KCONFIG:=$(KCONFIG_IPT_TEE)
-  FILES:=$(foreach mod,$(IPT_TEE-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(IPT_TEE-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir nf_tee $(IPT_TEE-m)))
   $(call AddDepends/ipt)
 endef
@@ -733,7 +733,7 @@ $(eval $(call KernelPackage,ipt-tee))
 define KernelPackage/ipt-u32
   TITLE:=U32 support
   KCONFIG:=$(KCONFIG_IPT_U32)
-  FILES:=$(foreach mod,$(IPT_U32-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(IPT_U32-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir nf_tee $(IPT_U32-m)))
   $(call AddDepends/ipt)
 endef
@@ -747,7 +747,7 @@ $(eval $(call KernelPackage,ipt-u32))
 define KernelPackage/ipt-checksum
   TITLE:=CHECKSUM support
   KCONFIG:=$(KCONFIG_IPT_CHECKSUM)
-  FILES:=$(foreach mod,$(IPT_CHECKSUM-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(IPT_CHECKSUM-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(IPT_CHECKSUM-m)))
   $(call AddDepends/ipt)
 endef
@@ -762,7 +762,7 @@ $(eval $(call KernelPackage,ipt-checksum))
 define KernelPackage/ipt-iprange
   TITLE:=Module for matching ip ranges
   KCONFIG:=$(KCONFIG_IPT_IPRANGE)
-  FILES:=$(foreach mod,$(IPT_IPRANGE-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(IPT_IPRANGE-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(IPT_IPRANGE-m)))
   $(call AddDepends/ipt)
 endef
@@ -778,7 +778,7 @@ $(eval $(call KernelPackage,ipt-iprange))
 define KernelPackage/ipt-cluster
   TITLE:=Module for matching cluster
   KCONFIG:=$(KCONFIG_IPT_CLUSTER)
-  FILES:=$(foreach mod,$(IPT_CLUSTER-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(IPT_CLUSTER-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(IPT_CLUSTER-m)))
   $(call AddDepends/ipt,+kmod-nf-conntrack)
 endef
@@ -805,7 +805,7 @@ $(eval $(call KernelPackage,ipt-cluster))
 define KernelPackage/ipt-clusterip
   TITLE:=Module for CLUSTERIP
   KCONFIG:=$(KCONFIG_IPT_CLUSTERIP)
-  FILES:=$(foreach mod,$(IPT_CLUSTERIP-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(IPT_CLUSTERIP-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(IPT_CLUSTERIP-m)))
   $(call AddDepends/ipt,+kmod-nf-conntrack)
 endef
@@ -827,7 +827,7 @@ $(eval $(call KernelPackage,ipt-clusterip))
 define KernelPackage/ipt-extra
   TITLE:=Extra modules
   KCONFIG:=$(KCONFIG_IPT_EXTRA)
-  FILES:=$(foreach mod,$(IPT_EXTRA-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(IPT_EXTRA-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(IPT_EXTRA-m)))
   $(call AddDepends/ipt)
 endef
@@ -847,7 +847,7 @@ $(eval $(call KernelPackage,ipt-extra))
 define KernelPackage/ipt-physdev
   TITLE:=physdev module
   KCONFIG:=$(KCONFIG_IPT_PHYSDEV)
-  FILES:=$(foreach mod,$(IPT_PHYSDEV-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(IPT_PHYSDEV-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(IPT_PHYSDEV-m)))
   $(call AddDepends/ipt,+kmod-br-netfilter)
 endef
@@ -864,7 +864,7 @@ define KernelPackage/ip6tables
   TITLE:=IPv6 modules
   DEPENDS:=@IPV6 +kmod-nf-reject6 +kmod-nf-ipt6 +kmod-ipt-core
   KCONFIG:=$(KCONFIG_IPT_IPV6)
-  FILES:=$(foreach mod,$(IPT_IPV6-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(IPT_IPV6-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoLoad,42,$(notdir $(IPT_IPV6-m)))
 endef
 
@@ -879,7 +879,7 @@ define KernelPackage/ip6tables-extra
   TITLE:=Extra IPv6 modules
   DEPENDS:=@IPV6 +kmod-ip6tables
   KCONFIG:=$(KCONFIG_IPT_IPV6_EXTRA)
-  FILES:=$(foreach mod,$(IPT_IPV6_EXTRA-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(IPT_IPV6_EXTRA-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoLoad,43,$(notdir $(IPT_IPV6_EXTRA-m)))
 endef
 
@@ -894,7 +894,7 @@ define KernelPackage/arptables
   SUBMENU:=$(NF_MENU)
   TITLE:=ARP firewalling modules
   DEPENDS:=+kmod-ipt-core
-  FILES:=$(LINUX_DIR)/net/ipv4/netfilter/arp*.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/ipv4/netfilter/arp*.ko
   KCONFIG:=CONFIG_IP_NF_ARPTABLES \
     CONFIG_IP_NF_ARPFILTER \
     CONFIG_IP_NF_ARP_MANGLE
@@ -912,7 +912,7 @@ define KernelPackage/br-netfilter
   SUBMENU:=$(NF_MENU)
   TITLE:=Bridge netfilter support modules
   DEPENDS:=+kmod-ipt-core
-  FILES:=$(LINUX_DIR)/net/bridge/br_netfilter.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/bridge/br_netfilter.ko
   KCONFIG:=CONFIG_BRIDGE_NETFILTER
   AUTOLOAD:=$(call AutoProbe,br_netfilter)
 endef
@@ -929,7 +929,7 @@ define KernelPackage/ebtables
   SUBMENU:=$(NF_MENU)
   TITLE:=Bridge firewalling modules
   DEPENDS:=+kmod-ipt-core
-  FILES:=$(foreach mod,$(EBTABLES-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(EBTABLES-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   KCONFIG:=$(KCONFIG_EBTABLES)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(EBTABLES-m)))
 endef
@@ -951,7 +951,7 @@ endef
 
 define KernelPackage/ebtables-ipv4
   TITLE:=ebtables: IPv4 support
-  FILES:=$(foreach mod,$(EBTABLES_IP4-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(EBTABLES_IP4-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   KCONFIG:=$(KCONFIG_EBTABLES_IP4)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(EBTABLES_IP4-m)))
   $(call AddDepends/ebtables)
@@ -968,7 +968,7 @@ $(eval $(call KernelPackage,ebtables-ipv4))
 define KernelPackage/ebtables-ipv6
   TITLE:=ebtables: IPv6 support
   DEPENDS:=@IPV6
-  FILES:=$(foreach mod,$(EBTABLES_IP6-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(EBTABLES_IP6-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   KCONFIG:=$(KCONFIG_EBTABLES_IP6)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(EBTABLES_IP6-m)))
   $(call AddDepends/ebtables)
@@ -984,7 +984,7 @@ $(eval $(call KernelPackage,ebtables-ipv6))
 
 define KernelPackage/ebtables-watchers
   TITLE:=ebtables: watchers support
-  FILES:=$(foreach mod,$(EBTABLES_WATCHERS-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(EBTABLES_WATCHERS-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   KCONFIG:=$(KCONFIG_EBTABLES_WATCHERS)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(EBTABLES_WATCHERS-m)))
   $(call AddDepends/ebtables)
@@ -1001,7 +1001,7 @@ $(eval $(call KernelPackage,ebtables-watchers))
 define KernelPackage/nfnetlink
   SUBMENU:=$(NF_MENU)
   TITLE:=Netlink-based userspace interface
-  FILES:=$(foreach mod,$(NFNETLINK-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(NFNETLINK-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   KCONFIG:=$(KCONFIG_NFNETLINK)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(NFNETLINK-m)))
 endef
@@ -1021,7 +1021,7 @@ endef
 
 define KernelPackage/nfnetlink-log
   TITLE:=Netfilter LOG over NFNETLINK interface
-  FILES:=$(foreach mod,$(NFNETLINK_LOG-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(NFNETLINK_LOG-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   KCONFIG:=$(KCONFIG_NFNETLINK_LOG)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(NFNETLINK_LOG-m)))
   $(call AddDepends/nfnetlink)
@@ -1038,7 +1038,7 @@ $(eval $(call KernelPackage,nfnetlink-log))
 
 define KernelPackage/nfnetlink-queue
   TITLE:=Netfilter QUEUE over NFNETLINK interface
-  FILES:=$(foreach mod,$(NFNETLINK_QUEUE-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(NFNETLINK_QUEUE-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   KCONFIG:=$(KCONFIG_NFNETLINK_QUEUE)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(NFNETLINK_QUEUE-m)))
   $(call AddDepends/nfnetlink)
@@ -1055,7 +1055,7 @@ $(eval $(call KernelPackage,nfnetlink-queue))
 
 define KernelPackage/nf-conntrack-netlink
   TITLE:=Connection tracking netlink interface
-  FILES:=$(LINUX_DIR)/net/netfilter/nf_conntrack_netlink.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/netfilter/nf_conntrack_netlink.ko
   KCONFIG:=CONFIG_NF_CT_NETLINK CONFIG_NF_CONNTRACK_EVENTS=y CONFIG_NETFILTER_NETLINK_GLUE_CT=y
   AUTOLOAD:=$(call AutoProbe,nf_conntrack_netlink)
   $(call AddDepends/nfnetlink,+kmod-nf-conntrack)
@@ -1073,7 +1073,7 @@ define KernelPackage/ipt-hashlimit
   TITLE:=Netfilter hashlimit match
   DEPENDS:=+kmod-ipt-core
   KCONFIG:=$(KCONFIG_IPT_HASHLIMIT)
-  FILES:=$(LINUX_DIR)/net/netfilter/xt_hashlimit.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/netfilter/xt_hashlimit.ko
   AUTOLOAD:=$(call AutoProbe,xt_hashlimit)
   $(call KernelPackage/ipt)
 endef
@@ -1090,8 +1090,8 @@ define KernelPackage/ipt-rpfilter
   DEPENDS:=+kmod-ipt-core
   KCONFIG:=$(KCONFIG_IPT_RPFILTER)
   FILES:=$(realpath \
-	$(LINUX_DIR)/net/ipv4/netfilter/ipt_rpfilter.ko \
-	$(LINUX_DIR)/net/ipv6/netfilter/ip6t_rpfilter.ko)
+	$(LINUX_OBJ_DIR)/net/ipv4/netfilter/ipt_rpfilter.ko \
+	$(LINUX_OBJ_DIR)/net/ipv6/netfilter/ip6t_rpfilter.ko)
   AUTOLOAD:=$(call AutoProbe,ipt_rpfilter ip6t_rpfilter)
   $(call KernelPackage/ipt)
 endef
@@ -1107,7 +1107,7 @@ define KernelPackage/nft-core
   SUBMENU:=$(NF_MENU)
   TITLE:=Netfilter nf_tables support
   DEPENDS:=+kmod-nfnetlink +kmod-nf-reject +IPV6:kmod-nf-reject6 +IPV6:kmod-nf-conntrack6 +kmod-nf-nat +kmod-nf-log +IPV6:kmod-nf-log6 +kmod-lib-crc32c
-  FILES:=$(foreach mod,$(NFT_CORE-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(NFT_CORE-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(NFT_CORE-m)))
   KCONFIG:= \
 	CONFIG_NFT_COMPAT=n \
@@ -1126,7 +1126,7 @@ define KernelPackage/nft-arp
   SUBMENU:=$(NF_MENU)
   TITLE:=Netfilter nf_tables ARP table support
   DEPENDS:=+kmod-nft-core
-  FILES:=$(foreach mod,$(NFT_ARP-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(NFT_ARP-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(NFT_ARP-m)))
   KCONFIG:=$(KCONFIG_NFT_ARP)
 endef
@@ -1138,7 +1138,7 @@ define KernelPackage/nft-bridge
   SUBMENU:=$(NF_MENU)
   TITLE:=Netfilter nf_tables bridge table support
   DEPENDS:=+kmod-nft-core
-  FILES:=$(foreach mod,$(NFT_BRIDGE-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(NFT_BRIDGE-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(NFT_BRIDGE-m)))
   KCONFIG:= \
 	$(KCONFIG_NFT_BRIDGE)
@@ -1157,10 +1157,10 @@ define KernelPackage/nft-dup-inet
 	CONFIG_NFT_DUP_IPV4 \
 	CONFIG_NFT_DUP_IPV6
   FILES:= \
-	$(LINUX_DIR)/net/ipv4/netfilter/nf_dup_ipv4.ko \
-	$(LINUX_DIR)/net/ipv6/netfilter/nf_dup_ipv6.ko \
-	$(LINUX_DIR)/net/ipv4/netfilter/nft_dup_ipv4.ko \
-	$(LINUX_DIR)/net/ipv6/netfilter/nft_dup_ipv6.ko
+	$(LINUX_OBJ_DIR)/net/ipv4/netfilter/nf_dup_ipv4.ko \
+	$(LINUX_OBJ_DIR)/net/ipv6/netfilter/nf_dup_ipv6.ko \
+	$(LINUX_OBJ_DIR)/net/ipv4/netfilter/nft_dup_ipv4.ko \
+	$(LINUX_OBJ_DIR)/net/ipv6/netfilter/nft_dup_ipv6.ko
   AUTOLOAD:=$(call AutoProbe,nf_dup_ipv4 nf_dup_ipv6 nft_dup_ipv4 nft_dup_ipv6)
 endef
 
@@ -1171,7 +1171,7 @@ define KernelPackage/nft-nat
   SUBMENU:=$(NF_MENU)
   TITLE:=Netfilter nf_tables NAT support
   DEPENDS:=+kmod-nft-core +kmod-nf-nat
-  FILES:=$(foreach mod,$(NFT_NAT-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(NFT_NAT-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(NFT_NAT-m)))
   KCONFIG:=$(KCONFIG_NFT_NAT)
 endef
@@ -1189,10 +1189,10 @@ define KernelPackage/nft-offload
 	CONFIG_NF_FLOW_TABLE_IPV6 at lt5.17 \
 	CONFIG_NFT_FLOW_OFFLOAD
   FILES:= \
-	$(LINUX_DIR)/net/netfilter/nf_flow_table_inet.ko \
-	$(LINUX_DIR)/net/ipv4/netfilter/nf_flow_table_ipv4.ko at lt5.17 \
-	$(LINUX_DIR)/net/ipv6/netfilter/nf_flow_table_ipv6.ko at lt5.17 \
-	$(LINUX_DIR)/net/netfilter/nft_flow_offload.ko
+	$(LINUX_OBJ_DIR)/net/netfilter/nf_flow_table_inet.ko \
+	$(LINUX_OBJ_DIR)/net/ipv4/netfilter/nf_flow_table_ipv4.ko at lt5.17 \
+	$(LINUX_OBJ_DIR)/net/ipv6/netfilter/nf_flow_table_ipv6.ko at lt5.17 \
+	$(LINUX_OBJ_DIR)/net/netfilter/nft_flow_offload.ko
   AUTOLOAD:=$(call AutoProbe,nf_flow_table_inet nf_flow_table_ipv4 at lt5.17 nf_flow_table_ipv6 at lt5.17 nft_flow_offload)
 endef
 
@@ -1210,9 +1210,9 @@ define KernelPackage/nft-netdev
 	CONFIG_NFT_DUP_NETDEV \
 	CONFIG_NFT_FWD_NETDEV
   FILES:= \
-	$(LINUX_DIR)/net/netfilter/nf_dup_netdev.ko \
-	$(LINUX_DIR)/net/netfilter/nft_dup_netdev.ko \
-	$(LINUX_DIR)/net/netfilter/nft_fwd_netdev.ko
+	$(LINUX_OBJ_DIR)/net/netfilter/nf_dup_netdev.ko \
+	$(LINUX_OBJ_DIR)/net/netfilter/nft_dup_netdev.ko \
+	$(LINUX_OBJ_DIR)/net/netfilter/nft_fwd_netdev.ko
   AUTOLOAD:=$(call AutoProbe,nf_tables_netdev nf_dup_netdev nft_dup_netdev nft_fwd_netdev)
 endef
 
@@ -1223,7 +1223,7 @@ define KernelPackage/nft-fib
   SUBMENU:=$(NF_MENU)
   TITLE:=Netfilter nf_tables fib support
   DEPENDS:=+kmod-nft-core
-  FILES:=$(foreach mod,$(NFT_FIB-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(NFT_FIB-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(NFT_FIB-m)))
   KCONFIG:=$(KCONFIG_NFT_FIB)
 endef
@@ -1235,7 +1235,7 @@ define KernelPackage/nft-queue
   SUBMENU:=$(NF_MENU)
   TITLE:=Netfilter nf_tables queue support
   DEPENDS:=+kmod-nft-core +kmod-nfnetlink-queue
-  FILES:=$(foreach mod,$(NFT_QUEUE-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(NFT_QUEUE-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(NFT_QUEUE-m)))
   KCONFIG:=$(KCONFIG_NFT_QUEUE)
 endef
@@ -1246,7 +1246,7 @@ define KernelPackage/nft-socket
   SUBMENU:=$(NF_MENU)
   TITLE:=Netfilter nf_tables socket support
   DEPENDS:=+kmod-nft-core +kmod-nf-socket
-  FILES:=$(foreach mod,$(NFT_SOCKET-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(NFT_SOCKET-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(NFT_SOCKET-m)))
   KCONFIG:=$(KCONFIG_NFT_SOCKET)
 endef
@@ -1257,7 +1257,7 @@ define KernelPackage/nft-tproxy
   SUBMENU:=$(NF_MENU)
   TITLE:=Netfilter nf_tables tproxy support
   DEPENDS:=+kmod-nft-core +kmod-nf-tproxy +kmod-nf-conntrack
-  FILES:=$(foreach mod,$(NFT_TPROXY-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(NFT_TPROXY-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(NFT_TPROXY-m)))
   KCONFIG:=$(KCONFIG_NFT_TPROXY)
 endef
@@ -1268,7 +1268,7 @@ define KernelPackage/nft-compat
   SUBMENU:=$(NF_MENU)
   TITLE:=Netfilter nf_tables compat support
   DEPENDS:=+kmod-nft-core +kmod-nf-ipt
-  FILES:=$(foreach mod,$(NFT_COMPAT-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(NFT_COMPAT-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(NFT_COMPAT-m)))
   KCONFIG:=$(KCONFIG_NFT_COMPAT)
 endef
@@ -1279,7 +1279,7 @@ define KernelPackage/nft-xfrm
   SUBMENU:=$(NF_MENU)
   TITLE:=Netfilter nf_tables xfrm support (ipsec)
   DEPENDS:=+kmod-nft-core
-  FILES:=$(foreach mod,$(NFT_XFRM-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(NFT_XFRM-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(NFT_XFRM-m)))
   KCONFIG:=$(KCONFIG_NFT_XFRM)
 endef
@@ -1290,7 +1290,7 @@ define KernelPackage/nft-connlimit
   SUBMENU:=$(NF_MENU)
   TITLE:=Netfilter nf_tables connlimit support
   DEPENDS:=+kmod-nft-core +kmod-nf-conncount
-  FILES:=$(foreach mod,$(NFT_CONNLIMIT-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(NFT_CONNLIMIT-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoProbe,$(notdir $(NFT_CONNLIMIT-m)))
   KCONFIG:=$(KCONFIG_NFT_CONNLIMIT)
 endef
diff --git a/package/kernel/linux/modules/netsupport.mk b/package/kernel/linux/modules/netsupport.mk
index fcf327b434..a71686725a 100644
--- a/package/kernel/linux/modules/netsupport.mk
+++ b/package/kernel/linux/modules/netsupport.mk
@@ -14,8 +14,8 @@ define KernelPackage/atm
 	CONFIG_ATM \
 	CONFIG_ATM_BR2684
   FILES:= \
-	$(LINUX_DIR)/net/atm/atm.ko \
-	$(LINUX_DIR)/net/atm/br2684.ko
+	$(LINUX_OBJ_DIR)/net/atm/atm.ko \
+	$(LINUX_OBJ_DIR)/net/atm/br2684.ko
   AUTOLOAD:=$(call AutoLoad,30,atm br2684)
 endef
 
@@ -31,7 +31,7 @@ define KernelPackage/atmtcp
   TITLE:=ATM over TCP
   DEPENDS:=kmod-atm
   KCONFIG:=CONFIG_ATM_TCP CONFIG_ATM_DRIVERS=y
-  FILES:=$(LINUX_DIR)/drivers/atm/atmtcp.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/atm/atmtcp.ko
   AUTOLOAD:=$(call AutoLoad,40,atmtcp)
 endef
 
@@ -47,7 +47,7 @@ define KernelPackage/bonding
   TITLE:=Ethernet bonding driver
   KCONFIG:=CONFIG_BONDING
   DEPENDS:=PACKAGE_kmod-tls:kmod-tls
-  FILES:=$(LINUX_DIR)/drivers/net/bonding/bonding.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/bonding/bonding.ko
   AUTOLOAD:=$(call AutoLoad,40,bonding)
   MODPARAMS.bonding:=max_bonds=0
 endef
@@ -64,7 +64,7 @@ define KernelPackage/udptunnel4
   TITLE:=IPv4 UDP tunneling support
   KCONFIG:=CONFIG_NET_UDP_TUNNEL
   HIDDEN:=1
-  FILES:=$(LINUX_DIR)/net/ipv4/udp_tunnel.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/ipv4/udp_tunnel.ko
   AUTOLOAD:=$(call AutoLoad,32,udp_tunnel)
 endef
 
@@ -77,7 +77,7 @@ define KernelPackage/udptunnel6
   DEPENDS:=@IPV6
   KCONFIG:=CONFIG_NET_UDP_TUNNEL
   HIDDEN:=1
-  FILES:=$(LINUX_DIR)/net/ipv6/ip6_udp_tunnel.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/ipv6/ip6_udp_tunnel.ko
   AUTOLOAD:=$(call AutoLoad,32,ip6_udp_tunnel)
 endef
 
@@ -93,7 +93,7 @@ define KernelPackage/vxlan
 	+IPV6:kmod-udptunnel6
   KCONFIG:=CONFIG_VXLAN
   FILES:= \
-	$(LINUX_DIR)/drivers/net/vxlan/vxlan.ko
+	$(LINUX_OBJ_DIR)/drivers/net/vxlan/vxlan.ko
   AUTOLOAD:=$(call AutoLoad,13,vxlan)
 endef
 
@@ -114,7 +114,7 @@ define KernelPackage/geneve
 	+IPV6:kmod-udptunnel6
   KCONFIG:=CONFIG_GENEVE
   FILES:= \
-	$(LINUX_DIR)/drivers/net/geneve.ko
+	$(LINUX_OBJ_DIR)/drivers/net/geneve.ko
   AUTOLOAD:=$(call AutoLoad,13,geneve)
 endef
 
@@ -131,7 +131,7 @@ define KernelPackage/nsh
   TITLE:=Network Service Header (NSH) protocol
   DEPENDS:=
   KCONFIG:=CONFIG_NET_NSH
-  FILES:=$(LINUX_DIR)/net/nsh/nsh.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/nsh/nsh.ko
   AUTOLOAD:=$(call AutoLoad,13,nsh)
 endef
 
@@ -152,9 +152,9 @@ define KernelPackage/misdn
 	CONFIG_MISDN_DSP \
 	CONFIG_MISDN_L1OIP
   FILES:= \
-  	$(LINUX_DIR)/drivers/isdn/mISDN/mISDN_core.ko \
-	$(LINUX_DIR)/drivers/isdn/mISDN/mISDN_dsp.ko \
-	$(LINUX_DIR)/drivers/isdn/mISDN/l1oip.ko
+  	$(LINUX_OBJ_DIR)/drivers/isdn/mISDN/mISDN_core.ko \
+	$(LINUX_OBJ_DIR)/drivers/isdn/mISDN/mISDN_dsp.ko \
+	$(LINUX_OBJ_DIR)/drivers/isdn/mISDN/l1oip.ko
   AUTOLOAD:=$(call AutoLoad,30,mISDN_core mISDN_dsp l1oip)
 endef
 
@@ -170,7 +170,7 @@ define KernelPackage/ipip
   TITLE:=IP-in-IP encapsulation
   DEPENDS:=+kmod-iptunnel +kmod-iptunnel4
   KCONFIG:=CONFIG_NET_IPIP
-  FILES:=$(LINUX_DIR)/net/ipv4/ipip.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/ipv4/ipip.ko
   AUTOLOAD:=$(call AutoLoad,32,ipip)
 endef
 
@@ -199,7 +199,7 @@ define KernelPackage/ipsec
 	CONFIG_XFRM_USER \
 	CONFIG_INET_IPCOMP \
 	CONFIG_XFRM_IPCOMP
-  FILES:=$(foreach mod,$(IPSEC-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(IPSEC-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoLoad,30,$(notdir $(IPSEC-m)))
 endef
 
@@ -230,7 +230,7 @@ define KernelPackage/ipsec4
 	CONFIG_INET_IPCOMP \
 	CONFIG_INET_XFRM_TUNNEL \
 	CONFIG_INET_ESP_OFFLOAD=n
-  FILES:=$(foreach mod,$(IPSEC4-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(IPSEC4-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoLoad,32,$(notdir $(IPSEC4-m)))
 endef
 
@@ -262,7 +262,7 @@ define KernelPackage/ipsec6
 	CONFIG_INET6_IPCOMP \
 	CONFIG_INET6_XFRM_TUNNEL \
 	CONFIG_INET6_ESP_OFFLOAD=n
-  FILES:=$(foreach mod,$(IPSEC6-m),$(LINUX_DIR)/net/$(mod).ko)
+  FILES:=$(foreach mod,$(IPSEC6-m),$(LINUX_OBJ_DIR)/net/$(mod).ko)
   AUTOLOAD:=$(call AutoLoad,32,$(notdir $(IPSEC6-m)))
 endef
 
@@ -284,7 +284,7 @@ define KernelPackage/iptunnel
   HIDDEN:=1
   KCONFIG:= \
 	CONFIG_NET_IP_TUNNEL
-  FILES:=$(LINUX_DIR)/net/ipv4/ip_tunnel.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/ipv4/ip_tunnel.ko
   AUTOLOAD:=$(call AutoLoad,31,ip_tunnel)
 endef
 
@@ -300,7 +300,7 @@ define KernelPackage/ip-vti
   TITLE:=IP VTI (Virtual Tunnel Interface)
   DEPENDS:=+kmod-iptunnel +kmod-iptunnel4 +kmod-ipsec4
   KCONFIG:=CONFIG_NET_IPVTI
-  FILES:=$(LINUX_DIR)/net/ipv4/ip_vti.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/ipv4/ip_vti.ko
   AUTOLOAD:=$(call AutoLoad,33,ip_vti)
 endef
 
@@ -316,7 +316,7 @@ define KernelPackage/ip6-vti
   TITLE:=IPv6 VTI (Virtual Tunnel Interface)
   DEPENDS:=@IPV6 +kmod-iptunnel +kmod-ip6-tunnel +kmod-ipsec6
   KCONFIG:=CONFIG_IPV6_VTI
-  FILES:=$(LINUX_DIR)/net/ipv6/ip6_vti.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/ipv6/ip6_vti.ko
   AUTOLOAD:=$(call AutoLoad,33,ip6_vti)
 endef
 
@@ -332,7 +332,7 @@ define KernelPackage/xfrm-interface
   TITLE:=IPsec XFRM Interface
   DEPENDS:=@IPV6 +kmod-ipsec4 +kmod-ipsec6
   KCONFIG:=CONFIG_XFRM_INTERFACE
-  FILES:=$(LINUX_DIR)/net/xfrm/xfrm_interface.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/xfrm/xfrm_interface.ko
   AUTOLOAD:=$(call AutoProbe,xfrm_interface)
 endef
 
@@ -350,7 +350,7 @@ define KernelPackage/iptunnel4
   KCONFIG:= \
 	CONFIG_INET_TUNNEL \
 	CONFIG_NET_IPIP=m
-  FILES:=$(LINUX_DIR)/net/ipv4/tunnel4.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/ipv4/tunnel4.ko
   AUTOLOAD:=$(call AutoLoad,31,tunnel4)
 endef
 
@@ -367,7 +367,7 @@ define KernelPackage/iptunnel6
   DEPENDS:=@IPV6
   KCONFIG:= \
 	CONFIG_INET6_TUNNEL
-  FILES:=$(LINUX_DIR)/net/ipv6/tunnel6.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/ipv6/tunnel6.ko
   AUTOLOAD:=$(call AutoLoad,31,tunnel6)
 endef
 
@@ -384,7 +384,7 @@ define KernelPackage/sit
   TITLE:=IPv6-in-IPv4 tunnel
   KCONFIG:=CONFIG_IPV6_SIT \
 	CONFIG_IPV6_SIT_6RD=y
-  FILES:=$(LINUX_DIR)/net/ipv6/sit.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/ipv6/sit.ko
   AUTOLOAD:=$(call AutoLoad,32,sit)
 endef
 
@@ -405,7 +405,7 @@ define KernelPackage/fou
   KCONFIG:= \
 	CONFIG_NET_FOU \
 	CONFIG_NET_FOU_IP_TUNNELS=y
-  FILES:=$(LINUX_DIR)/net/ipv4/fou.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/ipv4/fou.ko
   AUTOLOAD:=$(call AutoProbe,fou)
 endef
 
@@ -426,7 +426,7 @@ define KernelPackage/fou6
   KCONFIG:= \
 	CONFIG_IPV6_FOU \
 	CONFIG_IPV6_FOU_TUNNEL
-  FILES:=$(LINUX_DIR)/net/ipv6/fou6.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/ipv6/fou6.ko
   AUTOLOAD:=$(call AutoProbe,fou6)
 endef
 
@@ -443,7 +443,7 @@ define KernelPackage/ip6-tunnel
   TITLE:=IP-in-IPv6 tunnelling
   DEPENDS:=@IPV6 +kmod-iptunnel6
   KCONFIG:= CONFIG_IPV6_TUNNEL
-  FILES:=$(LINUX_DIR)/net/ipv6/ip6_tunnel.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/ipv6/ip6_tunnel.ko
   AUTOLOAD:=$(call AutoLoad,32,ip6_tunnel)
 endef
 
@@ -459,7 +459,7 @@ define KernelPackage/gre
   TITLE:=GRE support
   DEPENDS:=+kmod-iptunnel
   KCONFIG:=CONFIG_NET_IPGRE CONFIG_NET_IPGRE_DEMUX
-  FILES:=$(LINUX_DIR)/net/ipv4/ip_gre.ko $(LINUX_DIR)/net/ipv4/gre.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/ipv4/ip_gre.ko $(LINUX_OBJ_DIR)/net/ipv4/gre.ko
   AUTOLOAD:=$(call AutoLoad,39,gre ip_gre)
 endef
 
@@ -475,7 +475,7 @@ define KernelPackage/gre6
   TITLE:=GRE support over IPV6
   DEPENDS:=@IPV6 +kmod-iptunnel +kmod-ip6-tunnel +kmod-gre
   KCONFIG:=CONFIG_IPV6_GRE
-  FILES:=$(LINUX_DIR)/net/ipv6/ip6_gre.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/ipv6/ip6_gre.ko
   AUTOLOAD:=$(call AutoLoad,39,ip6_gre)
 endef
 
@@ -490,7 +490,7 @@ define KernelPackage/tun
   SUBMENU:=$(NETWORK_SUPPORT_MENU)
   TITLE:=Universal TUN/TAP driver
   KCONFIG:=CONFIG_TUN
-  FILES:=$(LINUX_DIR)/drivers/net/tun.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/tun.ko
   AUTOLOAD:=$(call AutoLoad,30,tun)
 endef
 
@@ -505,7 +505,7 @@ define KernelPackage/veth
   SUBMENU:=$(NETWORK_SUPPORT_MENU)
   TITLE:=Virtual ethernet pair device
   KCONFIG:=CONFIG_VETH
-  FILES:=$(LINUX_DIR)/drivers/net/veth.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/veth.ko
   AUTOLOAD:=$(call AutoLoad,30,veth)
 endef
 
@@ -523,7 +523,7 @@ define KernelPackage/vrf
   TITLE:=Virtual Routing and Forwarding (Lite)
   DEPENDS:=@KERNEL_NET_L3_MASTER_DEV
   KCONFIG:=CONFIG_NET_VRF
-  FILES:=$(LINUX_DIR)/drivers/net/vrf.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/vrf.ko
   AUTOLOAD:=$(call AutoLoad,30,vrf)
 endef
 
@@ -541,7 +541,7 @@ define KernelPackage/slhc
   TITLE:=Serial Line Header Compression
   DEPENDS:=+kmod-lib-crc-ccitt
   KCONFIG:=CONFIG_SLHC
-  FILES:=$(LINUX_DIR)/drivers/net/slip/slhc.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/slip/slhc.ko
 endef
 
 $(eval $(call KernelPackage,slhc))
@@ -555,8 +555,8 @@ define KernelPackage/ppp
 	CONFIG_PPP \
 	CONFIG_PPP_ASYNC
   FILES:= \
-	$(LINUX_DIR)/drivers/net/ppp/ppp_async.ko \
-	$(LINUX_DIR)/drivers/net/ppp/ppp_generic.ko
+	$(LINUX_OBJ_DIR)/drivers/net/ppp/ppp_async.ko \
+	$(LINUX_OBJ_DIR)/drivers/net/ppp/ppp_generic.ko
   AUTOLOAD:=$(call AutoProbe,ppp_async)
 endef
 
@@ -572,7 +572,7 @@ define KernelPackage/ppp-synctty
   TITLE:=PPP sync tty support
   DEPENDS:=kmod-ppp
   KCONFIG:=CONFIG_PPP_SYNC_TTY
-  FILES:=$(LINUX_DIR)/drivers/net/ppp/ppp_synctty.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ppp/ppp_synctty.ko
   AUTOLOAD:=$(call AutoProbe,ppp_synctty)
 endef
 
@@ -588,7 +588,7 @@ define KernelPackage/pppox
   TITLE:=PPPoX helper
   DEPENDS:=kmod-ppp
   KCONFIG:=CONFIG_PPPOE
-  FILES:=$(LINUX_DIR)/drivers/net/ppp/pppox.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ppp/pppox.ko
 endef
 
 define KernelPackage/pppox/description
@@ -603,7 +603,7 @@ define KernelPackage/pppoe
   TITLE:=PPPoE support
   DEPENDS:=kmod-ppp +kmod-pppox
   KCONFIG:=CONFIG_PPPOE
-  FILES:=$(LINUX_DIR)/drivers/net/ppp/pppoe.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ppp/pppoe.ko
   AUTOLOAD:=$(call AutoProbe,pppoe)
 endef
 
@@ -619,7 +619,7 @@ define KernelPackage/pppoa
   TITLE:=PPPoA support
   DEPENDS:=kmod-ppp +kmod-atm
   KCONFIG:=CONFIG_PPPOATM CONFIG_ATM_DRIVERS=y
-  FILES:=$(LINUX_DIR)/net/atm/pppoatm.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/atm/pppoatm.ko
   AUTOLOAD:=$(call AutoLoad,40,pppoatm)
 endef
 
@@ -635,7 +635,7 @@ define KernelPackage/pptp
   TITLE:=PPtP support
   DEPENDS:=kmod-ppp +kmod-gre +kmod-pppox
   KCONFIG:=CONFIG_PPTP
-  FILES:=$(LINUX_DIR)/drivers/net/ppp/pptp.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ppp/pptp.ko
   AUTOLOAD:=$(call AutoProbe,pptp)
 endef
 
@@ -647,7 +647,7 @@ define KernelPackage/pppol2tp
   TITLE:=PPPoL2TP support
   DEPENDS:=kmod-ppp +kmod-pppox +kmod-l2tp
   KCONFIG:=CONFIG_PPPOL2TP
-  FILES:=$(LINUX_DIR)/net/l2tp/l2tp_ppp.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/l2tp/l2tp_ppp.ko
   AUTOLOAD:=$(call AutoProbe,l2tp_ppp)
 endef
 
@@ -663,7 +663,7 @@ define KernelPackage/ipoa
   TITLE:=IPoA support
   DEPENDS:=kmod-atm
   KCONFIG:=CONFIG_ATM_CLIP
-  FILES:=$(LINUX_DIR)/net/atm/clip.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/atm/clip.ko
   AUTOLOAD:=$(call AutoProbe,clip)
 endef
 
@@ -681,7 +681,7 @@ define KernelPackage/mppe
   KCONFIG:= \
 	CONFIG_PPP_MPPE_MPPC \
 	CONFIG_PPP_MPPE
-  FILES:=$(LINUX_DIR)/drivers/net/ppp/ppp_mppe.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ppp/ppp_mppe.ko
   AUTOLOAD:=$(call AutoProbe,ppp_mppe)
 endef
 
@@ -693,7 +693,7 @@ $(eval $(call KernelPackage,mppe))
 
 
 SCHED_MODULES_CORE = sch_ingress sch_hfsc sch_htb sch_tbf cls_basic cls_fw cls_route cls_flow cls_u32 em_u32 act_gact act_mirred act_skbedit cls_matchall
-SCHED_FILES_CORE = $(foreach mod,$(SCHED_MODULES_CORE),$(LINUX_DIR)/net/sched/$(mod).ko)
+SCHED_FILES_CORE = $(foreach mod,$(SCHED_MODULES_CORE),$(LINUX_OBJ_DIR)/net/sched/$(mod).ko)
 
 define KernelPackage/sched-core
   SUBMENU:=$(NETWORK_SUPPORT_MENU)
@@ -733,7 +733,7 @@ define KernelPackage/sched-act-police
   TITLE:=Traffic Policing
   DEPENDS:=+kmod-sched-core
   KCONFIG:=CONFIG_NET_ACT_POLICE
-  FILES:=$(LINUX_DIR)/net/sched/act_police.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/sched/act_police.ko
   AUTOLOAD:=$(call AutoProbe,act_police)
 endef
 
@@ -748,8 +748,8 @@ define KernelPackage/sched-act-sample
 	CONFIG_NET_ACT_SAMPLE \
 	CONFIG_PSAMPLE
   FILES:= \
-	$(LINUX_DIR)/net/psample/psample.ko \
-	$(LINUX_DIR)/net/sched/act_sample.ko
+	$(LINUX_OBJ_DIR)/net/psample/psample.ko \
+	$(LINUX_OBJ_DIR)/net/sched/act_sample.ko
   AUTOLOAD:=$(call AutoProbe,act_sample psample)
 endef
 
@@ -765,7 +765,7 @@ define KernelPackage/sched-act-ipt
   TITLE:=IPtables targets
   DEPENDS:=+kmod-ipt-core +kmod-sched-core
   KCONFIG:=CONFIG_NET_ACT_IPT
-  FILES:=$(LINUX_DIR)/net/sched/act_ipt.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/sched/act_ipt.ko
   AUTOLOAD:=$(call AutoProbe, act_ipt)
 endef
 
@@ -781,7 +781,7 @@ define KernelPackage/sched-act-vlan
   TITLE:=Traffic VLAN manipulation
   DEPENDS:=+kmod-sched-core
   KCONFIG:=CONFIG_NET_ACT_VLAN
-  FILES:=$(LINUX_DIR)/net/sched/act_vlan.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/sched/act_vlan.ko
   AUTOLOAD:=$(call AutoProbe, act_vlan)
 endef
 
@@ -799,8 +799,8 @@ define KernelPackage/sched-bpf
 	CONFIG_NET_CLS_BPF \
 	CONFIG_NET_ACT_BPF
   FILES:= \
-	$(LINUX_DIR)/net/sched/cls_bpf.ko \
-	$(LINUX_DIR)/net/sched/act_bpf.ko
+	$(LINUX_OBJ_DIR)/net/sched/cls_bpf.ko \
+	$(LINUX_OBJ_DIR)/net/sched/act_bpf.ko
   AUTOLOAD:=$(call AutoLoad,72,cls_bpf act_bpf)
 endef
 
@@ -812,7 +812,7 @@ define KernelPackage/sched-cake
   TITLE:=Cake fq_codel/blue derived shaper
   DEPENDS:=+kmod-sched-core
   KCONFIG:=CONFIG_NET_SCH_CAKE
-  FILES:=$(LINUX_DIR)/net/sched/sch_cake.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/sched/sch_cake.ko
   AUTOLOAD:=$(call AutoProbe,sch_cake)
 endef
 
@@ -828,7 +828,7 @@ define KernelPackage/sched-connmark
   TITLE:=Traffic shaper conntrack mark support
   DEPENDS:=+kmod-sched-core +kmod-ipt-core +kmod-ipt-conntrack-extra
   KCONFIG:=CONFIG_NET_ACT_CONNMARK
-  FILES:=$(LINUX_DIR)/net/sched/act_connmark.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/sched/act_connmark.ko
   AUTOLOAD:=$(call AutoLoad,71, act_connmark)
 endef
 $(eval $(call KernelPackage,sched-connmark))
@@ -839,7 +839,7 @@ define KernelPackage/sched-ctinfo
   TITLE:=Traffic shaper ctinfo support
   DEPENDS:=+kmod-sched-core +kmod-ipt-core +kmod-ipt-conntrack-extra
   KCONFIG:=CONFIG_NET_ACT_CTINFO
-  FILES:=$(LINUX_DIR)/net/sched/act_ctinfo.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/sched/act_ctinfo.ko
   AUTOLOAD:=$(call AutoLoad,71, act_ctinfo)
 endef
 $(eval $(call KernelPackage,sched-ctinfo))
@@ -850,7 +850,7 @@ define KernelPackage/sched-drr
   TITLE:=Deficit Round Robin scheduler (DRR)
   DEPENDS:=+kmod-sched-core
   KCONFIG:=CONFIG_NET_SCH_DRR
-  FILES:=$(LINUX_DIR)/net/sched/sch_drr.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/sched/sch_drr.ko
   AUTOLOAD:=$(call AutoProbe,sch_drr)
 endef
 
@@ -866,7 +866,7 @@ define KernelPackage/sched-flower
   TITLE:=Flower traffic classifier
   DEPENDS:=+kmod-sched-core
   KCONFIG:=CONFIG_NET_CLS_FLOWER
-  FILES:=$(LINUX_DIR)/net/sched/cls_flower.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/sched/cls_flower.ko
   AUTOLOAD:=$(call AutoProbe, cls_flower)
 endef
 
@@ -882,7 +882,7 @@ define KernelPackage/sched-fq-pie
   TITLE:=Flow Queue Proportional Integral Enhanced (FQ-PIE)
   DEPENDS:=+kmod-sched-core +kmod-sched-pie
   KCONFIG:=CONFIG_NET_SCH_FQ_PIE
-  FILES:=$(LINUX_DIR)/net/sched/sch_fq_pie.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/sched/sch_fq_pie.ko
   AUTOLOAD:=$(call AutoProbe, sch_fq_pie)
 endef
 
@@ -900,7 +900,7 @@ define KernelPackage/sched-ipset
   KCONFIG:= \
 	CONFIG_NET_EMATCH_IPSET
   FILES:= \
-	$(LINUX_DIR)/net/sched/em_ipset.ko
+	$(LINUX_OBJ_DIR)/net/sched/em_ipset.ko
   AUTOLOAD:=$(call AutoLoad,72,em_ipset)
 endef
 
@@ -912,7 +912,7 @@ define KernelPackage/sched-mqprio
   TITLE:=Multi-queue priority scheduler (MQPRIO)
   DEPENDS:=+kmod-sched-core
   KCONFIG:=CONFIG_NET_SCH_MQPRIO
-  FILES:=$(LINUX_DIR)/net/sched/sch_mqprio.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/sched/sch_mqprio.ko
   AUTOLOAD:=$(call AutoProbe, sch_mqprio)
 endef
 
@@ -928,7 +928,7 @@ define KernelPackage/sched-pie
   TITLE:=Proportional Integral controller-Enhanced AQM (PIE)
   DEPENDS:=+kmod-sched-core
   KCONFIG:=CONFIG_NET_SCH_PIE
-  FILES:=$(LINUX_DIR)/net/sched/sch_pie.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/sched/sch_pie.ko
   AUTOLOAD:=$(call AutoProbe, sch_pie)
 endef
 
@@ -944,7 +944,7 @@ define KernelPackage/sched-prio
   TITLE:=Multi Band Priority Queueing (PRIO)
   DEPENDS:=+kmod-sched-core
   KCONFIG:=CONFIG_NET_SCH_PRIO
-  FILES:=$(LINUX_DIR)/net/sched/sch_prio.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/sched/sch_prio.ko
   AUTOLOAD:=$(call AutoProbe,sch_prio)
 endef
 
@@ -960,7 +960,7 @@ define KernelPackage/sched-red
   TITLE:=Random Early Detection (RED)
   DEPENDS:=+kmod-sched-core
   KCONFIG:=CONFIG_NET_SCH_RED
-  FILES:=$(LINUX_DIR)/net/sched/sch_red.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/sched/sch_red.ko
   AUTOLOAD:=$(call AutoProbe,sch_red)
 endef
 
@@ -976,7 +976,7 @@ define KernelPackage/sched-skbprio
   TITLE:=SKB priority queue scheduler (SKBPRIO)
   DEPENDS:=+kmod-sched-core
   KCONFIG:= CONFIG_NET_SCH_SKBPRIO
-  FILES:= $(LINUX_DIR)/net/sched/sch_skbprio.ko
+  FILES:= $(LINUX_OBJ_DIR)/net/sched/sch_skbprio.ko
   AUTOLOAD:=$(call AutoProbe,sch_skbprio)
 endef
 
@@ -987,14 +987,14 @@ define KernelPackage/bpf-test
   SUBMENU:=$(NETWORK_SUPPORT_MENU)
   TITLE:=Test Berkeley Packet Filter functionality
   KCONFIG:=CONFIG_TEST_BPF
-  FILES:=$(LINUX_DIR)/lib/test_bpf.ko
+  FILES:=$(LINUX_OBJ_DIR)/lib/test_bpf.ko
 endef
 
 $(eval $(call KernelPackage,bpf-test))
 
 
 SCHED_MODULES_EXTRA = sch_codel sch_dsmark sch_gred sch_multiq sch_sfq sch_teql sch_fq act_pedit act_simple act_skbmod act_csum em_cmp em_nbyte em_meta em_text
-SCHED_FILES_EXTRA = $(foreach mod,$(SCHED_MODULES_EXTRA),$(LINUX_DIR)/net/sched/$(mod).ko)
+SCHED_FILES_EXTRA = $(foreach mod,$(SCHED_MODULES_EXTRA),$(LINUX_OBJ_DIR)/net/sched/$(mod).ko)
 
 define KernelPackage/sched
   SUBMENU:=$(NETWORK_SUPPORT_MENU)
@@ -1038,7 +1038,7 @@ define KernelPackage/tcp-bbr
   SUBMENU:=$(NETWORK_SUPPORT_MENU)
   TITLE:=BBR TCP congestion control
   KCONFIG:=CONFIG_TCP_CONG_BBR
-  FILES:=$(LINUX_DIR)/net/ipv4/tcp_bbr.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/ipv4/tcp_bbr.ko
   AUTOLOAD:=$(call AutoProbe,tcp_bbr)
 endef
 
@@ -1062,7 +1062,7 @@ define KernelPackage/tls
   TITLE:=In-kernel TLS Support with HW Offload
   KCONFIG:=CONFIG_TLS \
 	CONFIG_TLS_DEVICE=y
-  FILES:=$(LINUX_DIR)/net/tls/tls.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/tls/tls.ko
   AUTOLOAD:=$(call AutoProbe,tls)
 endef
 
@@ -1080,7 +1080,7 @@ define KernelPackage/tcp-hybla
   SUBMENU:=$(NETWORK_SUPPORT_MENU)
   TITLE:=TCP-Hybla congestion control algorithm
   KCONFIG:=CONFIG_TCP_CONG_HYBLA
-  FILES:=$(LINUX_DIR)/net/ipv4/tcp_hybla.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/ipv4/tcp_hybla.ko
   AUTOLOAD:=$(call AutoProbe,tcp_hybla)
 endef
 
@@ -1098,7 +1098,7 @@ define KernelPackage/tcp-scalable
   SUBMENU:=$(NETWORK_SUPPORT_MENU)
   TITLE:=TCP-Scalable congestion control algorithm
   KCONFIG:=CONFIG_TCP_CONG_SCALABLE
-  FILES:=$(LINUX_DIR)/net/ipv4/tcp_scalable.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/ipv4/tcp_scalable.ko
   AUTOLOAD:=$(call AutoProbe,tcp-scalable)
 endef
 
@@ -1121,8 +1121,8 @@ define KernelPackage/ax25
 	CONFIG_AX25 \
 	CONFIG_MKISS
   FILES:= \
-	$(LINUX_DIR)/net/ax25/ax25.ko \
-	$(LINUX_DIR)/drivers/net/hamradio/mkiss.ko
+	$(LINUX_OBJ_DIR)/net/ax25/ax25.ko \
+	$(LINUX_OBJ_DIR)/drivers/net/hamradio/mkiss.ko
   AUTOLOAD:=$(call AutoLoad,80,ax25 mkiss)
 endef
 
@@ -1138,7 +1138,7 @@ define KernelPackage/pktgen
   DEPENDS:=@!TARGET_uml
   TITLE:=Network packet generator
   KCONFIG:=CONFIG_NET_PKTGEN
-  FILES:=$(LINUX_DIR)/net/core/pktgen.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/core/pktgen.ko
   AUTOLOAD:=$(call AutoLoad,99,pktgen)
 endef
 
@@ -1157,8 +1157,8 @@ define KernelPackage/l2tp
   KCONFIG:=CONFIG_L2TP \
 	CONFIG_L2TP_V3=y \
 	CONFIG_L2TP_DEBUGFS=n
-  FILES:=$(LINUX_DIR)/net/l2tp/l2tp_core.ko \
-	$(LINUX_DIR)/net/l2tp/l2tp_netlink.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/l2tp/l2tp_core.ko \
+	$(LINUX_OBJ_DIR)/net/l2tp/l2tp_netlink.ko
   AUTOLOAD:=$(call AutoLoad,32,l2tp_core l2tp_netlink)
 endef
 
@@ -1174,7 +1174,7 @@ define KernelPackage/l2tp-eth
   TITLE:=L2TP ethernet pseudowire support for L2TPv3
   DEPENDS:=+kmod-l2tp
   KCONFIG:=CONFIG_L2TP_ETH
-  FILES:=$(LINUX_DIR)/net/l2tp/l2tp_eth.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/l2tp/l2tp_eth.ko
   AUTOLOAD:=$(call AutoLoad,33,l2tp_eth)
 endef
 
@@ -1190,8 +1190,8 @@ define KernelPackage/l2tp-ip
   DEPENDS:=+kmod-l2tp
   KCONFIG:=CONFIG_L2TP_IP
   FILES:= \
-	$(LINUX_DIR)/net/l2tp/l2tp_ip.ko \
-	$(if $(CONFIG_IPV6),$(LINUX_DIR)/net/l2tp/l2tp_ip6.ko)
+	$(LINUX_OBJ_DIR)/net/l2tp/l2tp_ip.ko \
+	$(if $(CONFIG_IPV6),$(LINUX_OBJ_DIR)/net/l2tp/l2tp_ip6.ko)
   AUTOLOAD:=$(call AutoLoad,33,l2tp_ip $(if $(CONFIG_IPV6),l2tp_ip6))
 endef
 
@@ -1217,7 +1217,7 @@ define KernelPackage/sctp
      CONFIG_SCTP_DEFAULT_COOKIE_HMAC_NONE=n \
      CONFIG_SCTP_DEFAULT_COOKIE_HMAC_SHA1=n \
      CONFIG_SCTP_DEFAULT_COOKIE_HMAC_MD5=y
-  FILES:= $(LINUX_DIR)/net/sctp/sctp.ko
+  FILES:= $(LINUX_OBJ_DIR)/net/sctp/sctp.ko
   AUTOLOAD:= $(call AutoLoad,32,sctp)
   DEPENDS:=+kmod-lib-crc32c +kmod-crypto-md5 +kmod-crypto-hmac \
     +kmod-udptunnel4 +kmod-udptunnel6
@@ -1235,7 +1235,7 @@ define KernelPackage/netem
   TITLE:=Network emulation functionality
   DEPENDS:=+kmod-sched
   KCONFIG:=CONFIG_NET_SCH_NETEM
-  FILES:=$(LINUX_DIR)/net/sched/sch_netem.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/sched/sch_netem.ko
   AUTOLOAD:=$(call AutoLoad,99,netem)
 endef
 
@@ -1256,7 +1256,7 @@ define KernelPackage/slip
        CONFIG_SLIP_MODE_SLIP6=y
 
   FILES:= \
-       $(LINUX_DIR)/drivers/net/slip/slip.ko
+       $(LINUX_OBJ_DIR)/drivers/net/slip/slip.ko
   AUTOLOAD:=$(call AutoLoad,30,slip)
 endef
 
@@ -1270,7 +1270,7 @@ define KernelPackage/dnsresolver
   SUBMENU:=$(NETWORK_SUPPORT_MENU)
   TITLE:=In-kernel DNS Resolver
   KCONFIG:= CONFIG_DNS_RESOLVER
-  FILES:=$(LINUX_DIR)/net/dns_resolver/dns_resolver.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/dns_resolver/dns_resolver.ko
   AUTOLOAD:=$(call AutoLoad,30,dns_resolver)
 endef
 
@@ -1285,7 +1285,7 @@ define KernelPackage/rxrpc
 	CONFIG_RXKAD=m \
 	CONFIG_AF_RXRPC_DEBUG=n
   FILES:= \
-	$(LINUX_DIR)/net/rxrpc/rxrpc.ko
+	$(LINUX_OBJ_DIR)/net/rxrpc/rxrpc.ko
   AUTOLOAD:=$(call AutoLoad,30,rxrpc.ko)
   DEPENDS:= +kmod-crypto-manager +kmod-crypto-pcbc +kmod-crypto-fcrypt \
     +kmod-udptunnel4 +kmod-udptunnel6
@@ -1309,9 +1309,9 @@ define KernelPackage/mpls
 	CONFIG_MPLS_ROUTING=m \
 	CONFIG_MPLS_IPTUNNEL=m
   FILES:= \
-	$(LINUX_DIR)/net/mpls/mpls_gso.ko \
-	$(LINUX_DIR)/net/mpls/mpls_iptunnel.ko \
-	$(LINUX_DIR)/net/mpls/mpls_router.ko
+	$(LINUX_OBJ_DIR)/net/mpls/mpls_gso.ko \
+	$(LINUX_OBJ_DIR)/net/mpls/mpls_iptunnel.ko \
+	$(LINUX_OBJ_DIR)/net/mpls/mpls_router.ko
   AUTOLOAD:=$(call AutoLoad,30,mpls_router mpls_iptunnel mpls_gso)
 endef
 
@@ -1329,7 +1329,7 @@ define KernelPackage/9pnet
 	CONFIG_NET_9P_DEBUG=n \
 	CONFIG_NET_9P_FD=n at ge5.17
   FILES:= \
-	$(LINUX_DIR)/net/9p/9pnet.ko
+	$(LINUX_OBJ_DIR)/net/9p/9pnet.ko
   AUTOLOAD:=$(call AutoLoad,29,9pnet)
 endef
 
@@ -1348,7 +1348,7 @@ define KernelPackage/9pvirtio
 	CONFIG_NET_9P_XEN=n \
 	CONFIG_NET_9P_VIRTIO
   FILES:= \
-	$(LINUX_DIR)/net/9p/9pnet_virtio.ko
+	$(LINUX_OBJ_DIR)/net/9p/9pnet_virtio.ko
   AUTOLOAD:=$(call AutoLoad,29,9pnet_virtio)
 endef
 
@@ -1364,7 +1364,7 @@ define KernelPackage/nlmon
   SUBMENU:=$(NETWORK_SUPPORT_MENU)
   TITLE:=Virtual netlink monitoring device
   KCONFIG:=CONFIG_NLMON
-  FILES:=$(LINUX_DIR)/drivers/net/nlmon.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/nlmon.ko
   AUTOLOAD:=$(call AutoProbe,nlmon)
 endef
 
@@ -1380,7 +1380,7 @@ define KernelPackage/mdio
   TITLE:=MDIO (clause 45) PHY support
   KCONFIG:=CONFIG_MDIO
   HIDDEN:=1
-  FILES:=$(LINUX_DIR)/drivers/net/mdio.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/mdio.ko
   AUTOLOAD:=$(call AutoLoad,32,mdio)
 endef
 
@@ -1395,7 +1395,7 @@ define KernelPackage/mdio-bus-mux
   TITLE:=MDIO bus multiplexers
   KCONFIG:=CONFIG_MDIO_BUS_MUX
   HIDDEN:=1
-  FILES:=$(LINUX_DIR)/drivers/net/mdio/mdio-mux.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/mdio/mdio-mux.ko
   AUTOLOAD:=$(call AutoLoad,32,mdio-mux)
 endef
 
@@ -1410,7 +1410,7 @@ define KernelPackage/macsec
   TITLE:=IEEE 802.1AE MAC-level encryption (MAC)
   DEPENDS:=+kmod-crypto-gcm
   KCONFIG:=CONFIG_MACSEC
-  FILES:=$(LINUX_DIR)/drivers/net/macsec.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/macsec.ko
   AUTOLOAD:=$(call AutoLoad,13,macsec)
 endef
 
@@ -1425,7 +1425,7 @@ define KernelPackage/netlink-diag
   SUBMENU:=$(NETWORK_SUPPORT_MENU)
   TITLE:=Netlink diag support for ss utility
   KCONFIG:=CONFIG_NETLINK_DIAG
-  FILES:=$(LINUX_DIR)/net/netlink/netlink_diag.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/netlink/netlink_diag.ko
   AUTOLOAD:=$(call AutoLoad,31,netlink-diag)
 endef
 
@@ -1446,10 +1446,10 @@ define KernelPackage/inet-diag
 	CONFIG_INET_RAW_DIAG \
 	CONFIG_INET_DIAG_DESTROY=n
   FILES:= \
-	$(LINUX_DIR)/net/ipv4/inet_diag.ko \
-	$(LINUX_DIR)/net/ipv4/tcp_diag.ko \
-	$(LINUX_DIR)/net/ipv4/udp_diag.ko \
-	$(LINUX_DIR)/net/ipv4/raw_diag.ko
+	$(LINUX_OBJ_DIR)/net/ipv4/inet_diag.ko \
+	$(LINUX_OBJ_DIR)/net/ipv4/tcp_diag.ko \
+	$(LINUX_OBJ_DIR)/net/ipv4/udp_diag.ko \
+	$(LINUX_OBJ_DIR)/net/ipv4/raw_diag.ko
   AUTOLOAD:=$(call AutoLoad,31,inet_diag tcp_diag udp_diag raw_diag)
 endef
 
@@ -1466,7 +1466,7 @@ define KernelPackage/xdp-sockets-diag
   TITLE:=PF_XDP sockets monitoring interface support for ss utility
   DEPENDS:=@KERNEL_XDP_SOCKETS
   KCONFIG:=CONFIG_XDP_SOCKETS_DIAG
-  FILES:=$(LINUX_DIR)/net/xdp/xsk_diag.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/xdp/xsk_diag.ko
   AUTOLOAD:=$(call AutoLoad,31,xsk_diag)
 endef
 
@@ -1488,7 +1488,7 @@ define KernelPackage/wireguard
   KCONFIG:= \
 	  CONFIG_WIREGUARD \
 	  CONFIG_WIREGUARD_DEBUG=n
-  FILES:=$(LINUX_DIR)/drivers/net/wireguard/wireguard.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/wireguard/wireguard.ko
   AUTOLOAD:=$(call AutoProbe,wireguard)
 endef
 
@@ -1509,7 +1509,7 @@ define KernelPackage/netconsole
   TITLE:=Network console logging support
   KCONFIG:=CONFIG_NETCONSOLE \
 	  CONFIG_NETCONSOLE_DYNAMIC=n
-  FILES:=$(LINUX_DIR)/drivers/net/netconsole.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/netconsole.ko
   AUTOLOAD:=$(call AutoProbe,netconsole)
 endef
 
@@ -1526,7 +1526,7 @@ define KernelPackage/qrtr
   HIDDEN:=1
   KCONFIG:=CONFIG_QRTR
   FILES:= \
-  $(LINUX_DIR)/net/qrtr/qrtr.ko
+  $(LINUX_OBJ_DIR)/net/qrtr/qrtr.ko
   AUTOLOAD:=$(call AutoProbe,qrtr)
 endef
 
@@ -1541,7 +1541,7 @@ define KernelPackage/qrtr-tun
   TITLE:=TUN device for Qualcomm IPC Router
   DEPENDS:=+kmod-qrtr
   KCONFIG:=CONFIG_QRTR_TUN
-  FILES:= $(LINUX_DIR)/net/qrtr/qrtr-tun.ko
+  FILES:= $(LINUX_OBJ_DIR)/net/qrtr/qrtr-tun.ko
   AUTOLOAD:=$(call AutoProbe,qrtr-tun)
 endef
 
@@ -1556,7 +1556,7 @@ define KernelPackage/qrtr-smd
   TITLE:=SMD IPC Router channels
   DEPENDS:=+kmod-qrtr @TARGET_qualcommax
   KCONFIG:=CONFIG_QRTR_SMD
-  FILES:= $(LINUX_DIR)/net/qrtr/qrtr-smd.ko
+  FILES:= $(LINUX_OBJ_DIR)/net/qrtr/qrtr-smd.ko
   AUTOLOAD:=$(call AutoProbe,qrtr-smd)
 endef
 
@@ -1571,7 +1571,7 @@ define KernelPackage/qrtr-mhi
   TITLE:=MHI IPC Router channels
   DEPENDS:=+kmod-mhi-bus +kmod-qrtr
   KCONFIG:=CONFIG_QRTR_MHI
-  FILES:= $(LINUX_DIR)/net/qrtr/qrtr-mhi.ko
+  FILES:= $(LINUX_OBJ_DIR)/net/qrtr/qrtr-mhi.ko
   AUTOLOAD:=$(call AutoProbe,qrtr-mhi)
 endef
 
diff --git a/package/kernel/linux/modules/nls.mk b/package/kernel/linux/modules/nls.mk
index 7450ed1ce5..83d8c78630 100644
--- a/package/kernel/linux/modules/nls.mk
+++ b/package/kernel/linux/modules/nls.mk
@@ -9,7 +9,7 @@ define KernelPackage/nls-base
   SUBMENU:=Native Language Support
   TITLE:=Native Language Support
   KCONFIG:=CONFIG_NLS
-  FILES:=$(LINUX_DIR)/fs/nls/nls_base.ko
+  FILES:=$(LINUX_OBJ_DIR)/fs/nls/nls_base.ko
 endef
 
 define KernelPackage/nls-base/description
@@ -23,7 +23,7 @@ define KernelPackage/nls-cp437
   SUBMENU:=Native Language Support
   TITLE:=Codepage 437 (United States, Canada)
   KCONFIG:=CONFIG_NLS_CODEPAGE_437
-  FILES:=$(LINUX_DIR)/fs/nls/nls_cp437.ko
+  FILES:=$(LINUX_OBJ_DIR)/fs/nls/nls_cp437.ko
   AUTOLOAD:=$(call AutoLoad,25,nls_cp437)
   $(call AddDepends/nls)
 endef
@@ -39,7 +39,7 @@ define KernelPackage/nls-cp775
   SUBMENU:=Native Language Support
   TITLE:=Codepage 775 (Baltic Rim)
   KCONFIG:=CONFIG_NLS_CODEPAGE_775
-  FILES:=$(LINUX_DIR)/fs/nls/nls_cp775.ko
+  FILES:=$(LINUX_OBJ_DIR)/fs/nls/nls_cp775.ko
   AUTOLOAD:=$(call AutoLoad,25,nls_cp775)
   $(call AddDepends/nls)
 endef
@@ -55,7 +55,7 @@ define KernelPackage/nls-cp850
   SUBMENU:=Native Language Support
   TITLE:=Codepage 850 (Europe)
   KCONFIG:=CONFIG_NLS_CODEPAGE_850
-  FILES:=$(LINUX_DIR)/fs/nls/nls_cp850.ko
+  FILES:=$(LINUX_OBJ_DIR)/fs/nls/nls_cp850.ko
   AUTOLOAD:=$(call AutoLoad,25,nls_cp850)
   $(call AddDepends/nls)
 endef
@@ -71,7 +71,7 @@ define KernelPackage/nls-cp852
   SUBMENU:=Native Language Support
   TITLE:=Codepage 852 (Europe)
   KCONFIG:=CONFIG_NLS_CODEPAGE_852
-  FILES:=$(LINUX_DIR)/fs/nls/nls_cp852.ko
+  FILES:=$(LINUX_OBJ_DIR)/fs/nls/nls_cp852.ko
   AUTOLOAD:=$(call AutoLoad,25,nls_cp852)
   $(call AddDepends/nls)
 endef
@@ -87,7 +87,7 @@ define KernelPackage/nls-cp862
   SUBMENU:=Native Language Support
   TITLE:=Codepage 862 (Hebrew)
   KCONFIG:=CONFIG_NLS_CODEPAGE_862
-  FILES:=$(LINUX_DIR)/fs/nls/nls_cp862.ko
+  FILES:=$(LINUX_OBJ_DIR)/fs/nls/nls_cp862.ko
   AUTOLOAD:=$(call AutoLoad,25,nls_cp862)
   $(call AddDepends/nls)
 endef
@@ -103,7 +103,7 @@ define KernelPackage/nls-cp864
   SUBMENU:=Native Language Support
   TITLE:=Codepage 864 (Arabic)
   KCONFIG:=CONFIG_NLS_CODEPAGE_864
-  FILES:=$(LINUX_DIR)/fs/nls/nls_cp864.ko
+  FILES:=$(LINUX_OBJ_DIR)/fs/nls/nls_cp864.ko
   AUTOLOAD:=$(call AutoLoad,25,nls_cp864)
   $(call AddDepends/nls)
 endef
@@ -119,7 +119,7 @@ define KernelPackage/nls-cp866
   SUBMENU:=Native Language Support
   TITLE:=Codepage 866 (Cyrillic)
   KCONFIG:=CONFIG_NLS_CODEPAGE_866
-  FILES:=$(LINUX_DIR)/fs/nls/nls_cp866.ko
+  FILES:=$(LINUX_OBJ_DIR)/fs/nls/nls_cp866.ko
   AUTOLOAD:=$(call AutoLoad,25,nls_cp866)
   $(call AddDepends/nls)
 endef
@@ -136,8 +136,8 @@ define KernelPackage/nls-cp932
   TITLE:=Codepage 932 (Japanese)
   KCONFIG:=CONFIG_NLS_CODEPAGE_932
   FILES:= \
-	$(LINUX_DIR)/fs/nls/nls_cp932.ko \
-	$(LINUX_DIR)/fs/nls/nls_euc-jp.ko
+	$(LINUX_OBJ_DIR)/fs/nls/nls_cp932.ko \
+	$(LINUX_OBJ_DIR)/fs/nls/nls_euc-jp.ko
   AUTOLOAD:=$(call AutoLoad,25,nls_cp932 nls_euc-jp)
   $(call AddDepends/nls)
 endef
@@ -153,7 +153,7 @@ define KernelPackage/nls-cp936
   SUBMENU:=Native Language Support
   TITLE:=Codepage 936 (Simplified Chinese)
   KCONFIG:=CONFIG_NLS_CODEPAGE_936
-  FILES:=$(LINUX_DIR)/fs/nls/nls_cp936.ko
+  FILES:=$(LINUX_OBJ_DIR)/fs/nls/nls_cp936.ko
   AUTOLOAD:=$(call AutoLoad,25,nls_cp936)
   $(call AddDepends/nls)
 endef
@@ -169,7 +169,7 @@ define KernelPackage/nls-cp950
   SUBMENU:=Native Language Support
   TITLE:=Codepage 950 (Traditional Chinese)
   KCONFIG:=CONFIG_NLS_CODEPAGE_950
-  FILES:=$(LINUX_DIR)/fs/nls/nls_cp950.ko
+  FILES:=$(LINUX_OBJ_DIR)/fs/nls/nls_cp950.ko
   AUTOLOAD:=$(call AutoLoad,25,nls_cp950)
   $(call AddDepends/nls)
 endef
@@ -185,7 +185,7 @@ define KernelPackage/nls-cp1250
   SUBMENU:=Native Language Support
   TITLE:=Codepage 1250 (Eastern Europe)
   KCONFIG:=CONFIG_NLS_CODEPAGE_1250
-  FILES:=$(LINUX_DIR)/fs/nls/nls_cp1250.ko
+  FILES:=$(LINUX_OBJ_DIR)/fs/nls/nls_cp1250.ko
   AUTOLOAD:=$(call AutoLoad,25,nls_cp1250)
   $(call AddDepends/nls)
 endef
@@ -201,7 +201,7 @@ define KernelPackage/nls-cp1251
   SUBMENU:=Native Language Support
   TITLE:=Codepage 1251 (Russian)
   KCONFIG:=CONFIG_NLS_CODEPAGE_1251
-  FILES:=$(LINUX_DIR)/fs/nls/nls_cp1251.ko
+  FILES:=$(LINUX_OBJ_DIR)/fs/nls/nls_cp1251.ko
   AUTOLOAD:=$(call AutoLoad,25,nls_cp1251)
   $(call AddDepends/nls)
 endef
@@ -217,7 +217,7 @@ define KernelPackage/nls-iso8859-1
   SUBMENU:=Native Language Support
   TITLE:=ISO 8859-1 (Latin 1; Western European Languages)
   KCONFIG:=CONFIG_NLS_ISO8859_1
-  FILES:=$(LINUX_DIR)/fs/nls/nls_iso8859-1.ko
+  FILES:=$(LINUX_OBJ_DIR)/fs/nls/nls_iso8859-1.ko
   AUTOLOAD:=$(call AutoLoad,25,nls_iso8859-1)
   $(call AddDepends/nls)
 endef
@@ -233,7 +233,7 @@ define KernelPackage/nls-iso8859-2
   SUBMENU:=Native Language Support
   TITLE:=ISO 8859-2 (Latin 2; Central European Languages)
   KCONFIG:=CONFIG_NLS_ISO8859_2
-  FILES:=$(LINUX_DIR)/fs/nls/nls_iso8859-2.ko
+  FILES:=$(LINUX_OBJ_DIR)/fs/nls/nls_iso8859-2.ko
   AUTOLOAD:=$(call AutoLoad,25,nls_iso8859-2)
   $(call AddDepends/nls)
 endef
@@ -249,7 +249,7 @@ define KernelPackage/nls-iso8859-6
   SUBMENU:=Native Language Support
   TITLE:=ISO 8859-6 (Arabic)
   KCONFIG:=CONFIG_NLS_ISO8859_6
-  FILES:=$(LINUX_DIR)/fs/nls/nls_iso8859-6.ko
+  FILES:=$(LINUX_OBJ_DIR)/fs/nls/nls_iso8859-6.ko
   AUTOLOAD:=$(call AutoLoad,25,nls_iso8859-6)
   $(call AddDepends/nls)
 endef
@@ -265,7 +265,7 @@ define KernelPackage/nls-iso8859-8
   SUBMENU:=Native Language Support
   TITLE:=ISO 8859-8, CP1255 (Hebrew)
   KCONFIG:=CONFIG_NLS_ISO8859_8
-  FILES:=$(LINUX_DIR)/fs/nls/nls_cp1255.ko
+  FILES:=$(LINUX_OBJ_DIR)/fs/nls/nls_cp1255.ko
   AUTOLOAD:=$(call AutoLoad,25,nls_cp1255)
   $(call AddDepends/nls)
 endef
@@ -281,7 +281,7 @@ define KernelPackage/nls-iso8859-13
   SUBMENU:=Native Language Support
   TITLE:=ISO 8859-13 (Latin 7; Baltic)
   KCONFIG:=CONFIG_NLS_ISO8859_13
-  FILES:=$(LINUX_DIR)/fs/nls/nls_iso8859-13.ko
+  FILES:=$(LINUX_OBJ_DIR)/fs/nls/nls_iso8859-13.ko
   AUTOLOAD:=$(call AutoLoad,25,nls_iso8859-13)
   $(call AddDepends/nls)
 endef
@@ -297,7 +297,7 @@ define KernelPackage/nls-iso8859-15
   SUBMENU:=Native Language Support
   TITLE:=ISO 8859-15 (Latin 9; Western, with Euro symbol)
   KCONFIG:=CONFIG_NLS_ISO8859_15
-  FILES:=$(LINUX_DIR)/fs/nls/nls_iso8859-15.ko
+  FILES:=$(LINUX_OBJ_DIR)/fs/nls/nls_iso8859-15.ko
   AUTOLOAD:=$(call AutoLoad,25,nls_iso8859-15)
   $(call AddDepends/nls)
 endef
@@ -313,7 +313,7 @@ define KernelPackage/nls-koi8r
   SUBMENU:=Native Language Support
   TITLE:=KOI8-R (Russian)
   KCONFIG:=CONFIG_NLS_KOI8_R
-  FILES:=$(LINUX_DIR)/fs/nls/nls_koi8-r.ko
+  FILES:=$(LINUX_OBJ_DIR)/fs/nls/nls_koi8-r.ko
   AUTOLOAD:=$(call AutoLoad,25,nls_koi8-r)
   $(call AddDepends/nls)
 endef
@@ -329,7 +329,7 @@ define KernelPackage/nls-utf8
   SUBMENU:=Native Language Support
   TITLE:=UTF-8
   KCONFIG:=CONFIG_NLS_UTF8
-  FILES:=$(LINUX_DIR)/fs/nls/nls_utf8.ko
+  FILES:=$(LINUX_OBJ_DIR)/fs/nls/nls_utf8.ko
   AUTOLOAD:=$(call AutoLoad,25,nls_utf8)
   $(call AddDepends/nls)
 endef
diff --git a/package/kernel/linux/modules/other.mk b/package/kernel/linux/modules/other.mk
index face579472..b986b6b573 100644
--- a/package/kernel/linux/modules/other.mk
+++ b/package/kernel/linux/modules/other.mk
@@ -16,7 +16,7 @@ define KernelPackage/6lowpan
   KCONFIG:= \
 	CONFIG_6LOWPAN \
 	CONFIG_6LOWPAN_NHC=n
-  FILES:=$(LINUX_DIR)/net/6lowpan/6lowpan.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/6lowpan/6lowpan.ko
   AUTOLOAD:=$(call AutoProbe,6lowpan)
 endef
 
@@ -50,15 +50,15 @@ define KernelPackage/bluetooth
 	CONFIG_BT_HIDP
   $(call AddDepends/rfkill)
   FILES:= \
-	$(LINUX_DIR)/net/bluetooth/bluetooth.ko \
-	$(LINUX_DIR)/net/bluetooth/rfcomm/rfcomm.ko \
-	$(LINUX_DIR)/net/bluetooth/bnep/bnep.ko \
-	$(LINUX_DIR)/net/bluetooth/hidp/hidp.ko \
-	$(LINUX_DIR)/drivers/bluetooth/hci_uart.ko \
-	$(LINUX_DIR)/drivers/bluetooth/btusb.ko \
-	$(LINUX_DIR)/drivers/bluetooth/btintel.ko \
-	$(LINUX_DIR)/drivers/bluetooth/btrtl.ko \
-	$(LINUX_DIR)/drivers/bluetooth/btmtk.ko at ge5.17
+	$(LINUX_OBJ_DIR)/net/bluetooth/bluetooth.ko \
+	$(LINUX_OBJ_DIR)/net/bluetooth/rfcomm/rfcomm.ko \
+	$(LINUX_OBJ_DIR)/net/bluetooth/bnep/bnep.ko \
+	$(LINUX_OBJ_DIR)/net/bluetooth/hidp/hidp.ko \
+	$(LINUX_OBJ_DIR)/drivers/bluetooth/hci_uart.ko \
+	$(LINUX_OBJ_DIR)/drivers/bluetooth/btusb.ko \
+	$(LINUX_OBJ_DIR)/drivers/bluetooth/btintel.ko \
+	$(LINUX_OBJ_DIR)/drivers/bluetooth/btrtl.ko \
+	$(LINUX_OBJ_DIR)/drivers/bluetooth/btmtk.ko at ge5.17
   AUTOLOAD:=$(call AutoProbe,bluetooth rfcomm bnep hidp hci_uart btusb)
 endef
 
@@ -76,7 +76,7 @@ define KernelPackage/ath3k
 	CONFIG_BT_ATH3K \
 	CONFIG_BT_HCIUART_ATH3K=y
   FILES:= \
-	$(LINUX_DIR)/drivers/bluetooth/ath3k.ko
+	$(LINUX_OBJ_DIR)/drivers/bluetooth/ath3k.ko
   AUTOLOAD:=$(call AutoProbe,ath3k)
 endef
 
@@ -92,7 +92,7 @@ define KernelPackage/bluetooth-6lowpan
   TITLE:=Bluetooth 6LoWPAN support
   DEPENDS:=+kmod-6lowpan +kmod-bluetooth
   KCONFIG:=CONFIG_BT_6LOWPAN
-  FILES:=$(LINUX_DIR)/net/bluetooth/bluetooth_6lowpan.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/bluetooth/bluetooth_6lowpan.ko
   AUTOLOAD:=$(call AutoProbe,bluetooth_6lowpan)
 endef
 
@@ -111,8 +111,8 @@ define KernelPackage/btmrvl
 	CONFIG_BT_MRVL \
 	CONFIG_BT_MRVL_SDIO
   FILES:= \
-	$(LINUX_DIR)/drivers/bluetooth/btmrvl.ko \
-	$(LINUX_DIR)/drivers/bluetooth/btmrvl_sdio.ko
+	$(LINUX_OBJ_DIR)/drivers/bluetooth/btmrvl.ko \
+	$(LINUX_OBJ_DIR)/drivers/bluetooth/btmrvl_sdio.ko
   AUTOLOAD:=$(call AutoProbe,btmrvl btmrvl_sdio)
 endef
 
@@ -130,7 +130,7 @@ define KernelPackage/btsdio
   KCONFIG:= \
 	CONFIG_BT_HCIBTSDIO
   FILES:= \
-	$(LINUX_DIR)/drivers/bluetooth/btsdio.ko
+	$(LINUX_OBJ_DIR)/drivers/bluetooth/btsdio.ko
   AUTOLOAD:=$(call AutoProbe,btsdio)
 endef
 
@@ -148,7 +148,7 @@ define KernelPackage/dma-buf
   KCONFIG:=CONFIG_DMA_SHARED_BUFFER
   ifeq ($(strip $(CONFIG_EXTERNAL_KERNEL_TREE)),"")
     ifeq ($(strip $(CONFIG_KERNEL_GIT_CLONE_URI)),"")
-      FILES:=$(LINUX_DIR)/drivers/dma-buf/dma-shared-buffer.ko
+      FILES:=$(LINUX_OBJ_DIR)/drivers/dma-buf/dma-shared-buffer.ko
     endif
   endif
   AUTOLOAD:=$(call AutoLoad,20,dma-shared-buffer)
@@ -160,7 +160,7 @@ define KernelPackage/eeprom-93cx6
   SUBMENU:=$(OTHER_MENU)
   TITLE:=EEPROM 93CX6 support
   KCONFIG:=CONFIG_EEPROM_93CX6
-  FILES:=$(LINUX_DIR)/drivers/misc/eeprom/eeprom_93cx6.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/misc/eeprom/eeprom_93cx6.ko
   AUTOLOAD:=$(call AutoLoad,20,eeprom_93cx6)
 endef
 
@@ -176,7 +176,7 @@ define KernelPackage/eeprom-at24
   TITLE:=EEPROM AT24 support
   KCONFIG:=CONFIG_EEPROM_AT24
   DEPENDS:=+kmod-i2c-core +kmod-regmap-i2c
-  FILES:=$(LINUX_DIR)/drivers/misc/eeprom/at24.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/misc/eeprom/at24.ko
   AUTOLOAD:=$(call AutoProbe,at24)
 endef
 
@@ -191,7 +191,7 @@ define KernelPackage/eeprom-at25
   SUBMENU:=$(OTHER_MENU)
   TITLE:=EEPROM AT25 support
   KCONFIG:=CONFIG_EEPROM_AT25
-  FILES:=$(LINUX_DIR)/drivers/misc/eeprom/at25.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/misc/eeprom/at25.ko
   AUTOLOAD:=$(call AutoProbe,at25)
 endef
 
@@ -212,10 +212,10 @@ define KernelPackage/google-firmware
 	CONFIG_GOOGLE_MEMCONSOLE_COREBOOT \
 	CONFIG_GOOGLE_VPD
   FILES:= \
-	  $(LINUX_DIR)/drivers/firmware/google/coreboot_table.ko \
-	  $(LINUX_DIR)/drivers/firmware/google/memconsole.ko \
-	  $(LINUX_DIR)/drivers/firmware/google/memconsole-coreboot.ko \
-	  $(LINUX_DIR)/drivers/firmware/google/vpd-sysfs.ko
+	  $(LINUX_OBJ_DIR)/drivers/firmware/google/coreboot_table.ko \
+	  $(LINUX_OBJ_DIR)/drivers/firmware/google/memconsole.ko \
+	  $(LINUX_OBJ_DIR)/drivers/firmware/google/memconsole-coreboot.ko \
+	  $(LINUX_OBJ_DIR)/drivers/firmware/google/vpd-sysfs.ko
   AUTOLOAD:=$(call AutoProbe,coreboot_table memconsole-coreboot vpd-sysfs)
 endef
 
@@ -233,7 +233,7 @@ define KernelPackage/gpio-f7188x
   TITLE:=Fintek F718xx/F818xx GPIO Support
   DEPENDS:=@GPIO_SUPPORT @TARGET_x86
   KCONFIG:=CONFIG_GPIO_F7188X
-  FILES:=$(LINUX_DIR)/drivers/gpio/gpio-f7188x.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/gpio/gpio-f7188x.ko
   AUTOLOAD:=$(call AutoProbe,gpio-f7188x)
 endef
 
@@ -248,7 +248,7 @@ define KernelPackage/lkdtm
   SUBMENU:=$(OTHER_MENU)
   TITLE:=Linux Kernel Dump Test Tool Module
   KCONFIG:=CONFIG_LKDTM
-  FILES:=$(LINUX_DIR)/drivers/misc/lkdtm/lkdtm.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/misc/lkdtm/lkdtm.ko
   AUTOLOAD:=$(call AutoProbe,lkdtm)
 endef
 
@@ -266,7 +266,7 @@ define KernelPackage/pinctrl-mcp23s08
   HIDDEN:=1
   DEPENDS:=@GPIO_SUPPORT +kmod-regmap-core
   KCONFIG:=CONFIG_PINCTRL_MCP23S08
-  FILES:=$(LINUX_DIR)/drivers/pinctrl/pinctrl-mcp23s08.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/pinctrl/pinctrl-mcp23s08.ko
   AUTOLOAD:=$(call AutoLoad,40,pinctrl-mcp23s08)
 endef
 
@@ -285,7 +285,7 @@ define KernelPackage/pinctrl-mcp23s08-i2c
 	+kmod-i2c-core \
 	+kmod-regmap-i2c
   KCONFIG:=CONFIG_PINCTRL_MCP23S08_I2C
-  FILES:=$(LINUX_DIR)/drivers/pinctrl/pinctrl-mcp23s08_i2c.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/pinctrl/pinctrl-mcp23s08_i2c.ko
   AUTOLOAD:=$(call AutoLoad,40,pinctrl-mcp23s08-i2c)
 endef
 
@@ -301,7 +301,7 @@ define KernelPackage/pinctrl-mcp23s08-spi
   TITLE:=Microchip MCP23xxx I/O expander (SPI)
   DEPENDS:=@GPIO_SUPPORT +kmod-pinctrl-mcp23s08
   KCONFIG:=CONFIG_PINCTRL_MCP23S08_SPI
-  FILES:=$(LINUX_DIR)/drivers/pinctrl/pinctrl-mcp23s08_spi.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/pinctrl/pinctrl-mcp23s08_spi.ko
   AUTOLOAD:=$(call AutoLoad,40,pinctrl-mcp23s08-spi)
 endef
 
@@ -316,7 +316,7 @@ define KernelPackage/gpio-nxp-74hc164
   SUBMENU:=$(OTHER_MENU)
   TITLE:=NXP 74HC164 GPIO expander support
   KCONFIG:=CONFIG_GPIO_74X164
-  FILES:=$(LINUX_DIR)/drivers/gpio/gpio-74x164.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/gpio/gpio-74x164.ko
   AUTOLOAD:=$(call AutoProbe,gpio-74x164)
 endef
 
@@ -331,7 +331,7 @@ define KernelPackage/gpio-pca953x
   DEPENDS:=@GPIO_SUPPORT +kmod-i2c-core +kmod-regmap-i2c
   TITLE:=PCA95xx, TCA64xx, and MAX7310 I/O ports
   KCONFIG:=CONFIG_GPIO_PCA953X
-  FILES:=$(LINUX_DIR)/drivers/gpio/gpio-pca953x.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/gpio/gpio-pca953x.ko
   AUTOLOAD:=$(call AutoLoad,55,gpio-pca953x)
 endef
 
@@ -347,7 +347,7 @@ define KernelPackage/gpio-pcf857x
   DEPENDS:=@GPIO_SUPPORT +kmod-i2c-core
   TITLE:=PCX857x, PCA967x and MAX732X I2C GPIO expanders
   KCONFIG:=CONFIG_GPIO_PCF857X
-  FILES:=$(LINUX_DIR)/drivers/gpio/gpio-pcf857x.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/gpio/gpio-pcf857x.ko
   AUTOLOAD:=$(call AutoLoad,55,gpio-pcf857x)
 endef
 
@@ -363,7 +363,7 @@ define KernelPackage/gpio-it87
   DEPENDS:=@GPIO_SUPPORT @TARGET_x86
   TITLE:=GPIO support for IT87xx Super I/O chips
   KCONFIG:=CONFIG_GPIO_IT87
-  FILES:=$(LINUX_DIR)/drivers/gpio/gpio-it87.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/gpio/gpio-it87.ko
   AUTOLOAD:=$(call AutoLoad,25,gpio-it87,1)
 endef
 
@@ -381,7 +381,7 @@ define KernelPackage/gpio-amd-fch
   DEPENDS:=@GPIO_SUPPORT @TARGET_x86
   TITLE:=GPIO support for AMD Fusion Controller Hub (G-series SOCs)
   KCONFIG:=CONFIG_GPIO_AMD_FCH
-  FILES:=$(LINUX_DIR)/drivers/gpio/gpio-amd-fch.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/gpio/gpio-amd-fch.ko
   AUTOLOAD:=$(call AutoLoad,25,gpio-amd-fch,1)
 endef
 
@@ -400,8 +400,8 @@ define KernelPackage/ppdev
 	CONFIG_PARPORT \
 	CONFIG_PPDEV
   FILES:= \
-	$(LINUX_DIR)/drivers/parport/parport.ko \
-	$(LINUX_DIR)/drivers/char/ppdev.ko
+	$(LINUX_OBJ_DIR)/drivers/parport/parport.ko \
+	$(LINUX_OBJ_DIR)/drivers/char/ppdev.ko
   AUTOLOAD:=$(call AutoLoad,50,parport ppdev)
 endef
 
@@ -424,7 +424,7 @@ define KernelPackage/parport-pc
 	CONFIG_SCSI_IMM=n \
 	CONFIG_SCSI_PPA=n
   FILES:= \
-	$(LINUX_DIR)/drivers/parport/parport_pc.ko
+	$(LINUX_OBJ_DIR)/drivers/parport/parport_pc.ko
   AUTOLOAD:=$(call AutoLoad,51,parport_pc)
 endef
 
@@ -438,7 +438,7 @@ define KernelPackage/lp
   KCONFIG:= \
 	CONFIG_PRINTER
   FILES:= \
-	$(LINUX_DIR)/drivers/char/lp.ko
+	$(LINUX_OBJ_DIR)/drivers/char/lp.ko
   AUTOLOAD:=$(call AutoLoad,52,lp)
 endef
 
@@ -458,8 +458,8 @@ define KernelPackage/mmc
 	CONFIG_MMC_WBSD=n \
 	CONFIG_SDIO_UART=n
   FILES:= \
-	$(LINUX_DIR)/drivers/mmc/core/mmc_core.ko \
-	$(LINUX_DIR)/drivers/mmc/core/mmc_block.ko
+	$(LINUX_OBJ_DIR)/drivers/mmc/core/mmc_core.ko \
+	$(LINUX_OBJ_DIR)/drivers/mmc/core/mmc_block.ko
   AUTOLOAD:=$(call AutoProbe,mmc_core mmc_block,1)
 endef
 
@@ -479,8 +479,8 @@ define KernelPackage/sdhci
 	CONFIG_MMC_SDHCI_PLTFM \
 	CONFIG_MMC_SDHCI_PCI=n
   FILES:= \
-	$(LINUX_DIR)/drivers/mmc/host/sdhci.ko \
-	$(LINUX_DIR)/drivers/mmc/host/sdhci-pltfm.ko
+	$(LINUX_OBJ_DIR)/drivers/mmc/host/sdhci.ko \
+	$(LINUX_OBJ_DIR)/drivers/mmc/host/sdhci-pltfm.ko
 
   AUTOLOAD:=$(call AutoProbe,sdhci-pltfm,1)
 endef
@@ -501,7 +501,7 @@ define KernelPackage/rfkill
     CONFIG_RFKILL_INPUT=y \
     CONFIG_RFKILL_LEDS=y
   FILES:= \
-    $(LINUX_DIR)/net/rfkill/rfkill.ko
+    $(LINUX_OBJ_DIR)/net/rfkill/rfkill.ko
   AUTOLOAD:=$(call AutoLoad,20,rfkill)
 endef
 
@@ -518,7 +518,7 @@ define KernelPackage/softdog
   TITLE:=Software watchdog driver
   KCONFIG:=CONFIG_SOFT_WATCHDOG \
   	CONFIG_SOFT_WATCHDOG_PRETIMEOUT=n
-  FILES:=$(LINUX_DIR)/drivers/$(WATCHDOG_DIR)/softdog.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/$(WATCHDOG_DIR)/softdog.ko
   AUTOLOAD:=$(call AutoLoad,50,softdog,1)
 endef
 
@@ -545,7 +545,7 @@ define KernelPackage/ssb
 	CONFIG_SSB_POSSIBLE=y \
 	CONFIG_SSB_SPROM=y \
 	CONFIG_SSB_SILENT=y
-  FILES:=$(LINUX_DIR)/drivers/ssb/ssb.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/ssb/ssb.ko
   AUTOLOAD:=$(call AutoLoad,18,ssb,1)
 endef
 
@@ -572,7 +572,7 @@ define KernelPackage/bcma
 	CONFIG_BCMA_DRIVER_PCI_HOSTMODE=n \
 	CONFIG_BCMA_DRIVER_GMAC_CMN=n \
 	CONFIG_BCMA_DEBUG=n
-  FILES:=$(LINUX_DIR)/drivers/bcma/bcma.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/bcma/bcma.ko
   AUTOLOAD:=$(call AutoLoad,29,bcma)
 endef
 
@@ -590,7 +590,7 @@ define KernelPackage/rtc-ds1307
   DEPENDS:=+kmod-i2c-core +kmod-regmap-i2c +kmod-hwmon-core
   KCONFIG:=CONFIG_RTC_DRV_DS1307 \
 	CONFIG_RTC_CLASS=y
-  FILES:=$(LINUX_DIR)/drivers/rtc/rtc-ds1307.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/rtc/rtc-ds1307.ko
   AUTOLOAD:=$(call AutoProbe,rtc-ds1307)
 endef
 
@@ -610,7 +610,7 @@ define KernelPackage/rtc-ds1374
   KCONFIG:=CONFIG_RTC_DRV_DS1374 \
 	CONFIG_RTC_DRV_DS1374_WDT=n \
 	CONFIG_RTC_CLASS=y
-  FILES:=$(LINUX_DIR)/drivers/rtc/rtc-ds1374.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/rtc/rtc-ds1374.ko
   AUTOLOAD:=$(call AutoProbe,rtc-ds1374)
 endef
 
@@ -628,7 +628,7 @@ define KernelPackage/rtc-ds1672
   DEPENDS:=+kmod-i2c-core
   KCONFIG:=CONFIG_RTC_DRV_DS1672 \
 	CONFIG_RTC_CLASS=y
-  FILES:=$(LINUX_DIR)/drivers/rtc/rtc-ds1672.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/rtc/rtc-ds1672.ko
   AUTOLOAD:=$(call AutoProbe,rtc-ds1672)
 endef
 
@@ -646,7 +646,7 @@ define KernelPackage/rtc-em3027
   DEPENDS:=+kmod-i2c-core
   KCONFIG:=CONFIG_RTC_DRV_EM3027 \
 	CONFIG_RTC_CLASS=y
-  FILES:=$(LINUX_DIR)/drivers/rtc/rtc-em3027.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/rtc/rtc-em3027.ko
   AUTOLOAD:=$(call AutoProbe,rtc-em3027)
 endef
 
@@ -664,7 +664,7 @@ define KernelPackage/rtc-isl1208
   DEPENDS:=+kmod-i2c-core
   KCONFIG:=CONFIG_RTC_DRV_ISL1208 \
 	CONFIG_RTC_CLASS=y
-  FILES:=$(LINUX_DIR)/drivers/rtc/rtc-isl1208.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/rtc/rtc-isl1208.ko
   AUTOLOAD:=$(call AutoProbe,rtc-isl1208)
 endef
 
@@ -682,7 +682,7 @@ define KernelPackage/rtc-pcf8563
   DEPENDS:=+kmod-i2c-core
   KCONFIG:=CONFIG_RTC_DRV_PCF8563 \
 	CONFIG_RTC_CLASS=y
-  FILES:=$(LINUX_DIR)/drivers/rtc/rtc-pcf8563.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/rtc/rtc-pcf8563.ko
   AUTOLOAD:=$(call AutoProbe,rtc-pcf8563)
 endef
 
@@ -701,7 +701,7 @@ define KernelPackage/rtc-pcf2123
   DEPENDS:=+kmod-regmap-spi
   KCONFIG:=CONFIG_RTC_DRV_PCF2123 \
 	CONFIG_RTC_CLASS=y
-  FILES:=$(LINUX_DIR)/drivers/rtc/rtc-pcf2123.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/rtc/rtc-pcf2123.ko
   AUTOLOAD:=$(call AutoProbe,rtc-pcf2123)
 endef
 
@@ -718,7 +718,7 @@ define KernelPackage/rtc-pcf2127
   DEPENDS:=+kmod-i2c-core +kmod-regmap-spi
   KCONFIG:=CONFIG_RTC_DRV_PCF2127 \
 	CONFIG_RTC_CLASS=y
-  FILES:=$(LINUX_DIR)/drivers/rtc/rtc-pcf2127.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/rtc/rtc-pcf2127.ko
   AUTOLOAD:=$(call AutoProbe,rtc-pcf2127)
 endef
 
@@ -735,7 +735,7 @@ define KernelPackage/rtc-r7301
   DEPENDS:=+kmod-regmap-mmio
   KCONFIG:=CONFIG_RTC_DRV_R7301 \
 	CONFIG_RTC_CLASS=y
-  FILES:=$(LINUX_DIR)/drivers/rtc/rtc-r7301.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/rtc/rtc-r7301.ko
   AUTOLOAD:=$(call AutoProbe,rtc-r7301)
 endef
 
@@ -752,7 +752,7 @@ define KernelPackage/rtc-rs5c372a
   DEPENDS:=+kmod-i2c-core
   KCONFIG:=CONFIG_RTC_DRV_RS5C372 \
 	CONFIG_RTC_CLASS=y
-  FILES:=$(LINUX_DIR)/drivers/rtc/rtc-rs5c372.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/rtc/rtc-rs5c372.ko
   AUTOLOAD:=$(call AutoLoad,50,rtc-rs5c372,1)
 endef
 
@@ -769,7 +769,7 @@ define KernelPackage/rtc-rx8025
   DEPENDS:=+kmod-i2c-core
   KCONFIG:=CONFIG_RTC_DRV_RX8025 \
 	CONFIG_RTC_CLASS=y
-  FILES:=$(LINUX_DIR)/drivers/rtc/rtc-rx8025.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/rtc/rtc-rx8025.ko
   AUTOLOAD:=$(call AutoLoad,50,rtc-rx8025,1)
 endef
 
@@ -786,7 +786,7 @@ define KernelPackage/rtc-s35390a
   DEPENDS:=+kmod-i2c-core
   KCONFIG:=CONFIG_RTC_DRV_S35390A \
 	CONFIG_RTC_CLASS=y
-  FILES:=$(LINUX_DIR)/drivers/rtc/rtc-s35390a.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/rtc/rtc-s35390a.ko
   AUTOLOAD:=$(call AutoLoad,50,rtc-s35390a,1)
 endef
 
@@ -803,7 +803,7 @@ define KernelPackage/rtc-x1205
   DEPENDS:=+kmod-i2c-core
   KCONFIG:=CONFIG_RTC_DRV_X1205 \
 	CONFIG_RTC_CLASS=y
-  FILES:=$(LINUX_DIR)/drivers/rtc/rtc-x1205.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/rtc/rtc-x1205.ko
   AUTOLOAD:=$(call AutoProbe,rtc-x1205)
 endef
 
@@ -818,14 +818,14 @@ define KernelPackage/mtdtests
   TITLE:=MTD subsystem tests
   KCONFIG:=CONFIG_MTD_TESTS
   FILES:=\
-	$(LINUX_DIR)/drivers/mtd/tests/mtd_nandecctest.ko \
-	$(LINUX_DIR)/drivers/mtd/tests/mtd_oobtest.ko \
-	$(LINUX_DIR)/drivers/mtd/tests/mtd_pagetest.ko \
-	$(LINUX_DIR)/drivers/mtd/tests/mtd_readtest.ko \
-	$(LINUX_DIR)/drivers/mtd/tests/mtd_speedtest.ko \
-	$(LINUX_DIR)/drivers/mtd/tests/mtd_stresstest.ko \
-	$(LINUX_DIR)/drivers/mtd/tests/mtd_subpagetest.ko \
-	$(LINUX_DIR)/drivers/mtd/tests/mtd_torturetest.ko
+	$(LINUX_OBJ_DIR)/drivers/mtd/tests/mtd_nandecctest.ko \
+	$(LINUX_OBJ_DIR)/drivers/mtd/tests/mtd_oobtest.ko \
+	$(LINUX_OBJ_DIR)/drivers/mtd/tests/mtd_pagetest.ko \
+	$(LINUX_OBJ_DIR)/drivers/mtd/tests/mtd_readtest.ko \
+	$(LINUX_OBJ_DIR)/drivers/mtd/tests/mtd_speedtest.ko \
+	$(LINUX_OBJ_DIR)/drivers/mtd/tests/mtd_stresstest.ko \
+	$(LINUX_OBJ_DIR)/drivers/mtd/tests/mtd_subpagetest.ko \
+	$(LINUX_OBJ_DIR)/drivers/mtd/tests/mtd_torturetest.ko
 endef
 
 define KernelPackage/mtdtests/description
@@ -839,7 +839,7 @@ define KernelPackage/mtdoops
   SUBMENU:=$(OTHER_MENU)
   TITLE:=Log panic/oops to an MTD buffer
   KCONFIG:=CONFIG_MTD_OOPS
-  FILES:=$(LINUX_DIR)/drivers/mtd/mtdoops.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/mtd/mtdoops.ko
 endef
 
 define KernelPackage/mtdoops/description
@@ -855,7 +855,7 @@ define KernelPackage/mtdram
   KCONFIG:=CONFIG_MTD_MTDRAM \
     CONFIG_MTDRAM_TOTAL_SIZE=4096 \
     CONFIG_MTDRAM_ERASE_SIZE=128
-  FILES:=$(LINUX_DIR)/drivers/mtd/devices/mtdram.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/mtd/devices/mtdram.ko
 endef
 
 define KernelPackage/mtdram/description
@@ -872,7 +872,7 @@ define KernelPackage/ramoops
   KCONFIG:=CONFIG_PSTORE_RAM \
 	CONFIG_PSTORE_CONSOLE=y
   DEPENDS:=+kmod-pstore +kmod-reed-solomon
-  FILES:= $(LINUX_DIR)/fs/pstore/ramoops.ko
+  FILES:= $(LINUX_OBJ_DIR)/fs/pstore/ramoops.ko
   AUTOLOAD:=$(call AutoLoad,30,ramoops,1)
 endef
 
@@ -890,7 +890,7 @@ define KernelPackage/reed-solomon
   KCONFIG:=CONFIG_REED_SOLOMON \
 	CONFIG_REED_SOLOMON_DEC8=y \
 	CONFIG_REED_SOLOMON_ENC8=y
-  FILES:= $(LINUX_DIR)/lib/reed_solomon/reed_solomon.ko
+  FILES:= $(LINUX_OBJ_DIR)/lib/reed_solomon/reed_solomon.ko
   AUTOLOAD:=$(call AutoLoad,30,reed_solomon,1)
 endef
 
@@ -914,10 +914,10 @@ define KernelPackage/serial-8250
 	CONFIG_SERIAL_8250_DETECT_IRQ=n \
 	CONFIG_SERIAL_8250_RSA=n
   FILES:= \
-	$(LINUX_DIR)/drivers/tty/serial/8250/8250.ko \
-	$(LINUX_DIR)/drivers/tty/serial/8250/8250_base.ko \
-	$(if $(CONFIG_PCI),$(LINUX_DIR)/drivers/tty/serial/8250/8250_pci.ko) \
-	$(if $(CONFIG_GPIOLIB),$(LINUX_DIR)/drivers/tty/serial/serial_mctrl_gpio.ko)
+	$(LINUX_OBJ_DIR)/drivers/tty/serial/8250/8250.ko \
+	$(LINUX_OBJ_DIR)/drivers/tty/serial/8250/8250_base.ko \
+	$(if $(CONFIG_PCI),$(LINUX_OBJ_DIR)/drivers/tty/serial/8250/8250_pci.ko) \
+	$(if $(CONFIG_GPIOLIB),$(LINUX_OBJ_DIR)/drivers/tty/serial/serial_mctrl_gpio.ko)
   AUTOLOAD:=$(call AutoProbe,8250 8250_base 8250_pci)
 endef
 
@@ -932,7 +932,7 @@ define KernelPackage/serial-8250-exar
   SUBMENU:=$(OTHER_MENU)
   TITLE:=Exar 8250 UARTs
   KCONFIG:= CONFIG_SERIAL_8250_EXAR
-  FILES:=$(LINUX_DIR)/drivers/tty/serial/8250/8250_exar.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/tty/serial/8250/8250_exar.ko
   AUTOLOAD:=$(call AutoProbe,8250 8250_base 8250_exar)
   DEPENDS:=@PCI_SUPPORT +kmod-serial-8250
 endef
@@ -949,8 +949,8 @@ define KernelPackage/regmap-core
   TITLE:=Generic register map support
   HIDDEN:=1
   KCONFIG:=CONFIG_REGMAP
-ifneq ($(wildcard $(LINUX_DIR)/drivers/base/regmap/regmap-core.ko),)
-  FILES:=$(LINUX_DIR)/drivers/base/regmap/regmap-core.ko
+ifneq ($(wildcard $(LINUX_OBJ_DIR)/drivers/base/regmap/regmap-core.ko),)
+  FILES:=$(LINUX_OBJ_DIR)/drivers/base/regmap/regmap-core.ko
 endif
 endef
 
@@ -968,7 +968,7 @@ define KernelPackage/regmap-spi
   HIDDEN:=1
   KCONFIG:=CONFIG_REGMAP_SPI \
 	   CONFIG_SPI=y
-  FILES:=$(LINUX_DIR)/drivers/base/regmap/regmap-spi.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/base/regmap/regmap-spi.ko
 endef
 
 define KernelPackage/regmap-spi/description
@@ -984,7 +984,7 @@ define KernelPackage/regmap-i2c
   DEPENDS:=+kmod-regmap-core +kmod-i2c-core
   HIDDEN:=1
   KCONFIG:=CONFIG_REGMAP_I2C
-  FILES:=$(LINUX_DIR)/drivers/base/regmap/regmap-i2c.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/base/regmap/regmap-i2c.ko
 endef
 
 define KernelPackage/regmap-i2c/description
@@ -1000,7 +1000,7 @@ define KernelPackage/regmap-mmio
   DEPENDS:=+kmod-regmap-core
   HIDDEN:=1
   KCONFIG:=CONFIG_REGMAP_MMIO
-  FILES:=$(LINUX_DIR)/drivers/base/regmap/regmap-mmio.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/base/regmap/regmap-mmio.ko
 endef
 
 define KernelPackage/regmap-mmio/description
@@ -1015,7 +1015,7 @@ define KernelPackage/ikconfig
   TITLE:=Kernel configuration via /proc/config.gz
   KCONFIG:=CONFIG_IKCONFIG \
 	   CONFIG_IKCONFIG_PROC=y
-  FILES:=$(LINUX_DIR)/kernel/configs.ko
+  FILES:=$(LINUX_OBJ_DIR)/kernel/configs.ko
   AUTOLOAD:=$(call AutoLoad,70,configs)
 endef
 
@@ -1036,8 +1036,8 @@ define KernelPackage/zram
 	CONFIG_ZRAM_WRITEBACK=n \
 	CONFIG_ZSMALLOC_STAT=n
   FILES:= \
-	$(LINUX_DIR)/mm/zsmalloc.ko \
-	$(LINUX_DIR)/drivers/block/zram/zram.ko
+	$(LINUX_OBJ_DIR)/mm/zsmalloc.ko \
+	$(LINUX_OBJ_DIR)/drivers/block/zram/zram.ko
   AUTOLOAD:=$(call AutoLoad,20,zsmalloc zram)
 endef
 
@@ -1081,7 +1081,7 @@ define KernelPackage/pps
   SUBMENU:=$(OTHER_MENU)
   TITLE:=PPS support
   KCONFIG:=CONFIG_PPS
-  FILES:=$(LINUX_DIR)/drivers/pps/pps_core.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/pps/pps_core.ko
   AUTOLOAD:=$(call AutoLoad,17,pps_core,1)
 endef
 
@@ -1099,7 +1099,7 @@ define KernelPackage/pps-gpio
   TITLE:=PPS client using GPIO
   DEPENDS:=+kmod-pps
   KCONFIG:=CONFIG_PPS_CLIENT_GPIO
-  FILES:=$(LINUX_DIR)/drivers/pps/clients/pps-gpio.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/pps/clients/pps-gpio.ko
   AUTOLOAD:=$(call AutoLoad,18,pps-gpio,1)
 endef
 
@@ -1117,7 +1117,7 @@ define KernelPackage/pps-ldisc
   TITLE:=PPS line discipline
   DEPENDS:=+kmod-pps
   KCONFIG:=CONFIG_PPS_CLIENT_LDISC
-  FILES:=$(LINUX_DIR)/drivers/pps/clients/pps-ldisc.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/pps/clients/pps-ldisc.ko
   AUTOLOAD:=$(call AutoLoad,18,pps-ldisc,1)
 endef
 
@@ -1136,7 +1136,7 @@ define KernelPackage/ptp
   KCONFIG:= \
 	CONFIG_PTP_1588_CLOCK \
 	CONFIG_NET_PTP_CLASSIFY=y
-  FILES:=$(LINUX_DIR)/drivers/ptp/ptp.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/ptp/ptp.ko
   AUTOLOAD:=$(call AutoLoad,18,ptp,1)
 endef
 
@@ -1153,7 +1153,7 @@ define KernelPackage/ptp-qoriq
   TITLE:=Freescale QorIQ PTP support
   DEPENDS:=@(TARGET_mpc85xx||TARGET_qoriq) +kmod-ptp
   KCONFIG:=CONFIG_PTP_1588_CLOCK_QORIQ
-  FILES:=$(LINUX_DIR)/drivers/ptp/ptp-qoriq.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/ptp/ptp-qoriq.ko
   AUTOLOAD:=$(call AutoProbe,ptp-qoriq)
 endef
 
@@ -1169,7 +1169,7 @@ define KernelPackage/random-core
   SUBMENU:=$(OTHER_MENU)
   TITLE:=Hardware Random Number Generator Core support
   KCONFIG:=CONFIG_HW_RANDOM
-  FILES:=$(LINUX_DIR)/drivers/char/hw_random/rng-core.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/char/hw_random/rng-core.ko
 endef
 
 define KernelPackage/random-core/description
@@ -1215,7 +1215,7 @@ define KernelPackage/gpio-beeper
 	CONFIG_INPUT_MISC=y \
 	CONFIG_INPUT_GPIO_BEEPER
   FILES:= \
-	$(LINUX_DIR)/drivers/input/misc/gpio-beeper.ko
+	$(LINUX_OBJ_DIR)/drivers/input/misc/gpio-beeper.ko
   AUTOLOAD:=$(call AutoLoad,50,gpio-beeper)
 endef
 
@@ -1230,7 +1230,7 @@ define KernelPackage/echo
   SUBMENU:=$(OTHER_MENU)
   TITLE:=Line Echo Canceller
   KCONFIG:=CONFIG_ECHO
-  FILES:=$(LINUX_DIR)/drivers/misc/echo/echo.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/misc/echo/echo.ko
   AUTOLOAD:=$(call AutoLoad,50,echo)
 endef
 
@@ -1248,7 +1248,7 @@ define KernelPackage/keys-encrypted
   DEPENDS:=@KERNEL_KEYS +kmod-crypto-cbc +kmod-crypto-hmac +kmod-crypto-rng \
            +kmod-crypto-sha256 +kmod-keys-trusted
   KCONFIG:=CONFIG_ENCRYPTED_KEYS
-  FILES:=$(LINUX_DIR)/security/keys/encrypted-keys/encrypted-keys.ko
+  FILES:=$(LINUX_OBJ_DIR)/security/keys/encrypted-keys/encrypted-keys.ko
   AUTOLOAD:=$(call AutoLoad,01,encrypted-keys,1)
 endef
 
@@ -1268,7 +1268,7 @@ define KernelPackage/keys-trusted
   TITLE:=TPM trusted keys on kernel keyring
   DEPENDS:=@KERNEL_KEYS +kmod-crypto-hash +kmod-crypto-hmac +kmod-crypto-sha1 +kmod-tpm
   KCONFIG:=CONFIG_TRUSTED_KEYS
-  FILES:= $(LINUX_DIR)/security/keys/trusted-keys/trusted.ko
+  FILES:= $(LINUX_OBJ_DIR)/security/keys/trusted-keys/trusted.ko
   AUTOLOAD:=$(call AutoLoad,01,trusted-keys,1)
 endef
 
@@ -1289,7 +1289,7 @@ define KernelPackage/tpm
   DEPENDS:= +kmod-random-core +kmod-asn1-decoder \
 	  +kmod-asn1-encoder +kmod-oid-registry
   KCONFIG:= CONFIG_TCG_TPM
-  FILES:= $(LINUX_DIR)/drivers/char/tpm/tpm.ko
+  FILES:= $(LINUX_OBJ_DIR)/drivers/char/tpm/tpm.ko
   AUTOLOAD:=$(call AutoLoad,10,tpm,1)
 endef
 
@@ -1305,8 +1305,8 @@ define KernelPackage/tpm-tis
 	DEPENDS:= @TARGET_x86 +kmod-tpm
   KCONFIG:= CONFIG_TCG_TIS
   FILES:= \
-	$(LINUX_DIR)/drivers/char/tpm/tpm_tis.ko \
-	$(LINUX_DIR)/drivers/char/tpm/tpm_tis_core.ko
+	$(LINUX_OBJ_DIR)/drivers/char/tpm/tpm_tis.ko \
+	$(LINUX_OBJ_DIR)/drivers/char/tpm/tpm_tis_core.ko
   AUTOLOAD:=$(call AutoLoad,20,tpm_tis,1)
 endef
 
@@ -1324,7 +1324,7 @@ define KernelPackage/tpm-i2c-atmel
   TITLE:=TPM I2C Atmel Support
   DEPENDS:= +kmod-tpm +kmod-i2c-core
   KCONFIG:= CONFIG_TCG_TIS_I2C_ATMEL
-  FILES:= $(LINUX_DIR)/drivers/char/tpm/tpm_i2c_atmel.ko
+  FILES:= $(LINUX_OBJ_DIR)/drivers/char/tpm/tpm_i2c_atmel.ko
   AUTOLOAD:=$(call AutoLoad,40,tpm_i2c_atmel,1)
 endef
 
@@ -1339,7 +1339,7 @@ define KernelPackage/tpm-i2c-infineon
   TITLE:= TPM I2C Infineon driver
   DEPENDS:= +kmod-tpm +kmod-i2c-core
   KCONFIG:= CONFIG_TCG_TIS_I2C_INFINEON
-  FILES:= $(LINUX_DIR)/drivers/char/tpm/tpm_i2c_infineon.ko
+  FILES:= $(LINUX_OBJ_DIR)/drivers/char/tpm/tpm_i2c_infineon.ko
   AUTOLOAD:= $(call AutoLoad,40,tpm_i2c_infineon,1)
 endef
 
@@ -1356,7 +1356,7 @@ define KernelPackage/i6300esb-wdt
   DEPENDS:=@PCI_SUPPORT @!SMALL_FLASH
   KCONFIG:=CONFIG_I6300ESB_WDT \
 	   CONFIG_WATCHDOG_CORE=y
-  FILES:=$(LINUX_DIR)/drivers/$(WATCHDOG_DIR)/i6300esb.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/$(WATCHDOG_DIR)/i6300esb.ko
   AUTOLOAD:=$(call AutoLoad,50,i6300esb,1)
 endef
 
@@ -1373,7 +1373,7 @@ define KernelPackage/mhi-bus
   TITLE:=MHI bus
   KCONFIG:=CONFIG_MHI_BUS \
            CONFIG_MHI_BUS_DEBUG=y
-  FILES:=$(LINUX_DIR)/drivers/bus/mhi/host/mhi.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/bus/mhi/host/mhi.ko
   AUTOLOAD:=$(call AutoProbe,mhi)
 endef
 
@@ -1388,7 +1388,7 @@ define KernelPackage/mhi-pci-generic
   TITLE:=MHI PCI controller driver
   DEPENDS:=@PCI_SUPPORT +kmod-mhi-bus
   KCONFIG:=CONFIG_MHI_BUS_PCI_GENERIC
-  FILES:=$(LINUX_DIR)/drivers/bus/mhi/host/mhi_pci_generic.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/bus/mhi/host/mhi_pci_generic.ko
   AUTOLOAD:=$(call AutoProbe,mhi_pci_generic)
 endef
 
diff --git a/package/kernel/linux/modules/pcmcia.mk b/package/kernel/linux/modules/pcmcia.mk
index 11c2106cb0..58970cb6fb 100644
--- a/package/kernel/linux/modules/pcmcia.mk
+++ b/package/kernel/linux/modules/pcmcia.mk
@@ -18,8 +18,8 @@ define KernelPackage/pcmcia-core
 	CONFIG_PCCARD \
 	PCMCIA_DEBUG=n
   FILES:= \
-	$(LINUX_DIR)/drivers/pcmcia/pcmcia_core.ko \
-	$(LINUX_DIR)/drivers/pcmcia/pcmcia.ko
+	$(LINUX_OBJ_DIR)/drivers/pcmcia/pcmcia_core.ko \
+	$(LINUX_OBJ_DIR)/drivers/pcmcia/pcmcia.ko
   AUTOLOAD:=$(call AutoLoad,25,pcmcia_core pcmcia)
 endef
 
@@ -39,7 +39,7 @@ endef
 define KernelPackage/pcmcia-rsrc
   TITLE:=PCMCIA resource support
   KCONFIG:=CONFIG_PCCARD_NONSTATIC=y
-  FILES:=$(LINUX_DIR)/drivers/pcmcia/pcmcia_rsrc.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/pcmcia/pcmcia_rsrc.ko
   AUTOLOAD:=$(call AutoLoad,26,pcmcia_rsrc)
   $(call AddDepends/pcmcia)
 endef
@@ -54,7 +54,7 @@ $(eval $(call KernelPackage,pcmcia-rsrc))
 define KernelPackage/pcmcia-yenta
   TITLE:=yenta socket driver
   KCONFIG:=CONFIG_YENTA
-  FILES:=$(LINUX_DIR)/drivers/pcmcia/yenta_socket.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/pcmcia/yenta_socket.ko
   AUTOLOAD:=$(call AutoLoad,41,yenta_socket)
   DEPENDS:=+kmod-pcmcia-rsrc
   $(call AddDepends/pcmcia)
@@ -68,7 +68,7 @@ define KernelPackage/pcmcia-serial
   KCONFIG:= \
 	CONFIG_PCMCIA_SERIAL_CS \
 	CONFIG_SERIAL_8250_CS
-  FILES:=$(LINUX_DIR)/drivers/tty/serial/8250/serial_cs.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/tty/serial/8250/serial_cs.ko
   AUTOLOAD:=$(call AutoLoad,45,serial_cs)
   DEPENDS:=+kmod-serial-8250
   $(call AddDepends/pcmcia)
@@ -84,7 +84,7 @@ $(eval $(call KernelPackage,pcmcia-serial))
 define KernelPackage/pcmcia-pd6729
   TITLE:=Cirrus PD6729 compatible bridge support
   KCONFIG:=CONFIG_PD6729
-  FILES:=$(LINUX_DIR)/drivers/pcmcia/pd6729.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/pcmcia/pd6729.ko
   AUTOLOAD:=$(call AutoLoad,41,pd6729)
   DEPENDS:=+kmod-pcmcia-rsrc
   $(call AddDepends/pcmcia)
@@ -100,7 +100,7 @@ $(eval $(call KernelPackage,pcmcia-pd6729))
 define KernelPackage/pcmcia-nozomi
   TITLE:=Option Fusion+ card
   KCONFIG:=CONFIG_NOZOMI
-  FILES:=$(LINUX_DIR)/drivers/tty/nozomi.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/tty/nozomi.ko
   AUTOLOAD:=$(call AutoLoad,60,nozomi)
   DEPENDS:=+kmod-pcmcia-rsrc
   $(call AddDepends/pcmcia)
diff --git a/package/kernel/linux/modules/sound.mk b/package/kernel/linux/modules/sound.mk
index 2bfa146207..8d8b018705 100644
--- a/package/kernel/linux/modules/sound.mk
+++ b/package/kernel/linux/modules/sound.mk
@@ -21,22 +21,22 @@ SOUNDCORE_LOAD ?= \
 	snd-compress
 
 SOUNDCORE_FILES ?= \
-	$(LINUX_DIR)/sound/soundcore.ko \
-	$(LINUX_DIR)/sound/core/snd.ko \
-	$(LINUX_DIR)/sound/core/snd-hwdep.ko \
-	$(LINUX_DIR)/sound/core/snd-seq-device.ko \
-	$(LINUX_DIR)/sound/core/snd-rawmidi.ko \
-	$(LINUX_DIR)/sound/core/snd-timer.ko \
-	$(LINUX_DIR)/sound/core/snd-pcm.ko \
-	$(LINUX_DIR)/sound/core/oss/snd-mixer-oss.ko \
-	$(LINUX_DIR)/sound/core/oss/snd-pcm-oss.ko \
-	$(LINUX_DIR)/sound/core/snd-compress.ko
+	$(LINUX_OBJ_DIR)/sound/soundcore.ko \
+	$(LINUX_OBJ_DIR)/sound/core/snd.ko \
+	$(LINUX_OBJ_DIR)/sound/core/snd-hwdep.ko \
+	$(LINUX_OBJ_DIR)/sound/core/snd-seq-device.ko \
+	$(LINUX_OBJ_DIR)/sound/core/snd-rawmidi.ko \
+	$(LINUX_OBJ_DIR)/sound/core/snd-timer.ko \
+	$(LINUX_OBJ_DIR)/sound/core/snd-pcm.ko \
+	$(LINUX_OBJ_DIR)/sound/core/oss/snd-mixer-oss.ko \
+	$(LINUX_OBJ_DIR)/sound/core/oss/snd-pcm-oss.ko \
+	$(LINUX_OBJ_DIR)/sound/core/snd-compress.ko
 
 SOUNDCORE_LOAD += \
 	$(if $(CONFIG_SND_DMAENGINE_PCM),snd-pcm-dmaengine)
 
 SOUNDCORE_FILES += \
-	$(if $(CONFIG_SND_DMAENGINE_PCM),$(LINUX_DIR)/sound/core/snd-pcm-dmaengine.ko)
+	$(if $(CONFIG_SND_DMAENGINE_PCM),$(LINUX_OBJ_DIR)/sound/core/snd-pcm-dmaengine.ko)
 
 define KernelPackage/sound-core
   SUBMENU:=$(SOUND_MENU)
@@ -65,8 +65,8 @@ endef
 
 define KernelPackage/sound-core/uml
   FILES:= \
-	$(LINUX_DIR)/sound/soundcore.ko \
-	$(LINUX_DIR)/arch/um/drivers/hostaudio.ko
+	$(LINUX_OBJ_DIR)/sound/soundcore.ko \
+	$(LINUX_OBJ_DIR)/arch/um/drivers/hostaudio.ko
   AUTOLOAD+=$(call AutoLoad,30,soundcore hostaudio)
 endef
 
@@ -87,8 +87,8 @@ define KernelPackage/ac97
   TITLE:=ac97 controller
   KCONFIG:=CONFIG_SND_AC97_CODEC
   FILES:= \
-	$(LINUX_DIR)/sound/ac97_bus.ko \
-	$(LINUX_DIR)/sound/pci/ac97/snd-ac97-codec.ko
+	$(LINUX_OBJ_DIR)/sound/ac97_bus.ko \
+	$(LINUX_OBJ_DIR)/sound/pci/ac97/snd-ac97-codec.ko
   AUTOLOAD:=$(call AutoLoad,35,ac97_bus snd-ac97-codec)
   $(call AddDepends/sound)
 endef
@@ -104,7 +104,7 @@ define KernelPackage/sound-mpu401
   TITLE:=MPU-401 uart driver
   KCONFIG:=CONFIG_SND_MPU401_UART
   FILES:= \
-	$(LINUX_DIR)/sound/drivers/mpu401/snd-mpu401-uart.ko
+	$(LINUX_OBJ_DIR)/sound/drivers/mpu401/snd-mpu401-uart.ko
   AUTOLOAD:=$(call AutoLoad,35,snd-mpu401-uart)
   $(call AddDepends/sound)
 endef
@@ -120,9 +120,9 @@ $(eval $(call KernelPackage,sound-mpu401))
 define KernelPackage/sound-seq
   TITLE:=Sequencer support
   FILES:= \
-	$(LINUX_DIR)/sound/core/seq/snd-seq.ko \
-	$(LINUX_DIR)/sound/core/seq/snd-seq-midi-event.ko \
-	$(LINUX_DIR)/sound/core/seq/snd-seq-midi.ko
+	$(LINUX_OBJ_DIR)/sound/core/seq/snd-seq.ko \
+	$(LINUX_OBJ_DIR)/sound/core/seq/snd-seq-midi-event.ko \
+	$(LINUX_OBJ_DIR)/sound/core/seq/snd-seq-midi.ko
   AUTOLOAD:=$(call AutoLoad,35,snd-seq snd-seq-midi-event snd-seq-midi)
   $(call AddDepends/sound)
 endef
@@ -138,7 +138,7 @@ define KernelPackage/sound-ens1371
   TITLE:=(Creative) Ensoniq AudioPCI 1371
   KCONFIG:=CONFIG_SND_ENS1371
   DEPENDS:=@PCI_SUPPORT +kmod-ac97
-  FILES:=$(LINUX_DIR)/sound/pci/snd-ens1371.ko
+  FILES:=$(LINUX_OBJ_DIR)/sound/pci/snd-ens1371.ko
   AUTOLOAD:=$(call AutoLoad,36,snd-ens1371)
   $(call AddDepends/sound)
 endef
@@ -154,7 +154,7 @@ define KernelPackage/sound-i8x0
   TITLE:=Intel/SiS/nVidia/AMD/ALi AC97 Controller
   DEPENDS:=+kmod-ac97
   KCONFIG:=CONFIG_SND_INTEL8X0
-  FILES:=$(LINUX_DIR)/sound/pci/snd-intel8x0.ko
+  FILES:=$(LINUX_OBJ_DIR)/sound/pci/snd-intel8x0.ko
   AUTOLOAD:=$(call AutoLoad,36,snd-intel8x0)
   $(call AddDepends/sound)
 endef
@@ -172,7 +172,7 @@ define KernelPackage/sound-via82xx
   TITLE:=VIA 82xx AC97 Controller
   DEPENDS:=+kmod-ac97 +kmod-sound-mpu401
   KCONFIG:=CONFIG_SND_VIA82XX
-  FILES:=$(LINUX_DIR)/sound/pci/snd-via82xx.ko
+  FILES:=$(LINUX_OBJ_DIR)/sound/pci/snd-via82xx.ko
   AUTOLOAD:=$(call AutoLoad,36,snd-via82xx)
   $(call AddDepends/sound)
 endef
@@ -193,7 +193,7 @@ define KernelPackage/sound-soc-core
 	CONFIG_SND_SOC_ADI=n \
 	CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM=y \
 	CONFIG_SND_SOC_ALL_CODECS=n
-  FILES:=$(LINUX_DIR)/sound/soc/snd-soc-core.ko
+  FILES:=$(LINUX_OBJ_DIR)/sound/soc/snd-soc-core.ko
   AUTOLOAD:=$(call AutoLoad,55,snd-soc-core)
   $(call AddDepends/sound)
 endef
@@ -204,7 +204,7 @@ $(eval $(call KernelPackage,sound-soc-core))
 define KernelPackage/sound-soc-ac97
   TITLE:=AC97 Codec support
   KCONFIG:=CONFIG_SND_SOC_AC97_CODEC
-  FILES:=$(LINUX_DIR)/sound/soc/codecs/snd-soc-ac97.ko
+  FILES:=$(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-ac97.ko
   AUTOLOAD:=$(call AutoLoad,57,snd-soc-ac97)
   DEPENDS:=+kmod-ac97 +kmod-sound-soc-core
   $(call AddDepends/sound)
@@ -221,9 +221,9 @@ define KernelPackage/sound-soc-imx
 	CONFIG_SND_SOC_FSL_SSI \
 	CONFIG_SND_SOC_IMX_PCM_DMA
   FILES:= \
-	$(LINUX_DIR)/sound/soc/fsl/snd-soc-imx-audmux.ko \
-	$(LINUX_DIR)/sound/soc/fsl/snd-soc-fsl-ssi.ko \
-	$(LINUX_DIR)/sound/soc/fsl/imx-pcm-dma.ko
+	$(LINUX_OBJ_DIR)/sound/soc/fsl/snd-soc-imx-audmux.ko \
+	$(LINUX_OBJ_DIR)/sound/soc/fsl/snd-soc-fsl-ssi.ko \
+	$(LINUX_OBJ_DIR)/sound/soc/fsl/imx-pcm-dma.ko
   AUTOLOAD:=$(call AutoLoad,56,snd-soc-imx-audmux snd-soc-fsl-ssi snd-soc-imx-pcm)
   DEPENDS:=@TARGET_imx +kmod-sound-soc-core
   $(call AddDepends/sound)
@@ -240,8 +240,8 @@ define KernelPackage/sound-soc-imx-sgtl5000
   TITLE:=IMX SoC support for SGTL5000
   KCONFIG:=CONFIG_SND_SOC_IMX_SGTL5000
   FILES:=\
-	$(LINUX_DIR)/sound/soc/codecs/snd-soc-sgtl5000.ko \
-	$(LINUX_DIR)/sound/soc/fsl/snd-soc-imx-sgtl5000.ko
+	$(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-sgtl5000.ko \
+	$(LINUX_OBJ_DIR)/sound/soc/fsl/snd-soc-imx-sgtl5000.ko
   AUTOLOAD:=$(call AutoLoad,57,snd-soc-sgtl5000 snd-soc-imx-sgtl5000)
   DEPENDS:=@TARGET_imx +kmod-sound-soc-imx +kmod-regmap-i2c
   $(call AddDepends/sound)
@@ -258,8 +258,8 @@ define KernelPackage/sound-soc-spdif
   TITLE:=SoC S/PDIF codec support
   KCONFIG:=CONFIG_SND_SOC_SPDIF
   FILES:= \
-	$(LINUX_DIR)/sound/soc/codecs/snd-soc-spdif-tx.ko \
-	$(LINUX_DIR)/sound/soc/codecs/snd-soc-spdif-rx.ko
+	$(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-spdif-tx.ko \
+	$(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-spdif-rx.ko
   DEPENDS:=+kmod-sound-soc-core
   AUTOLOAD:=$(call AutoProbe,snd-soc-spdif-tx snd-soc-spdif-rx)
   $(call AddDepends/sound)
@@ -274,7 +274,7 @@ define KernelPackage/pcspkr
   KCONFIG:= \
 	CONFIG_SND_PCSP
   FILES:= \
-	$(LINUX_DIR)/sound/drivers/pcsp/snd-pcsp.ko
+	$(LINUX_OBJ_DIR)/sound/drivers/pcsp/snd-pcsp.ko
   AUTOLOAD:=$(call AutoLoad,50,snd-pcsp)
   $(call AddDepends/sound)
 endef
@@ -291,7 +291,7 @@ define KernelPackage/sound-dummy
   KCONFIG:= \
 	CONFIG_SND_DUMMY
   FILES:= \
-	$(LINUX_DIR)/sound/drivers/snd-dummy.ko
+	$(LINUX_OBJ_DIR)/sound/drivers/snd-dummy.ko
   AUTOLOAD:=$(call AutoLoad,32,snd-dummy)
 endef
 
@@ -313,9 +313,9 @@ define KernelPackage/sound-hda-core
 	CONFIG_SND_HDA_PATCH_LOADER=n \
 	CONFIG_SND_HDA_GENERIC
   FILES:= \
-	$(LINUX_DIR)/sound/hda/snd-hda-core.ko \
-	$(LINUX_DIR)/sound/pci/hda/snd-hda-codec.ko \
-	$(LINUX_DIR)/sound/pci/hda/snd-hda-codec-generic.ko
+	$(LINUX_OBJ_DIR)/sound/hda/snd-hda-core.ko \
+	$(LINUX_OBJ_DIR)/sound/pci/hda/snd-hda-codec.ko \
+	$(LINUX_OBJ_DIR)/sound/pci/hda/snd-hda-codec-generic.ko
   AUTOLOAD:=$(call AutoProbe,snd-hda-core snd-hda-codec snd-hda-codec-generic)
   $(call AddDepends/sound,+kmod-regmap-core)
 endef
@@ -332,7 +332,7 @@ define KernelPackage/sound-hda-codec-realtek
   KCONFIG:= \
 	CONFIG_SND_HDA_CODEC_REALTEK
   FILES:= \
-	$(LINUX_DIR)/sound/pci/hda/snd-hda-codec-realtek.ko
+	$(LINUX_OBJ_DIR)/sound/pci/hda/snd-hda-codec-realtek.ko
   AUTOLOAD:=$(call AutoProbe,snd-hda-codec-realtek)
   $(call AddDepends/sound,kmod-sound-hda-core)
 endef
@@ -349,7 +349,7 @@ define KernelPackage/sound-hda-codec-cmedia
   KCONFIG:= \
 	CONFIG_SND_HDA_CODEC_CMEDIA
   FILES:= \
-	$(LINUX_DIR)/sound/pci/hda/snd-hda-codec-cmedia.ko
+	$(LINUX_OBJ_DIR)/sound/pci/hda/snd-hda-codec-cmedia.ko
   AUTOLOAD:=$(call AutoProbe,snd-hda-codec-cmedia)
   $(call AddDepends/sound,kmod-sound-hda-core)
 endef
@@ -366,7 +366,7 @@ define KernelPackage/sound-hda-codec-analog
   KCONFIG:= \
 	CONFIG_SND_HDA_CODEC_ANALOG
   FILES:= \
-	$(LINUX_DIR)/sound/pci/hda/snd-hda-codec-analog.ko
+	$(LINUX_OBJ_DIR)/sound/pci/hda/snd-hda-codec-analog.ko
   AUTOLOAD:=$(call AutoProbe,snd-hda-codec-analog)
   $(call AddDepends/sound,kmod-sound-hda-core)
 endef
@@ -383,7 +383,7 @@ define KernelPackage/sound-hda-codec-idt
   KCONFIG:= \
 	CONFIG_SND_HDA_CODEC_SIGMATEL
   FILES:= \
-	$(LINUX_DIR)/sound/pci/hda/snd-hda-codec-idt.ko
+	$(LINUX_OBJ_DIR)/sound/pci/hda/snd-hda-codec-idt.ko
   AUTOLOAD:=$(call AutoProbe,snd-hda-codec-idt)
   $(call AddDepends/sound,kmod-sound-hda-core)
 endef
@@ -400,7 +400,7 @@ define KernelPackage/sound-hda-codec-si3054
   KCONFIG:= \
 	CONFIG_SND_HDA_CODEC_SI3054
   FILES:= \
-	$(LINUX_DIR)/sound/pci/hda/snd-hda-codec-si3054.ko
+	$(LINUX_OBJ_DIR)/sound/pci/hda/snd-hda-codec-si3054.ko
   AUTOLOAD:=$(call AutoProbe,snd-hda-codec-si3054)
   $(call AddDepends/sound,kmod-sound-hda-core)
 endef
@@ -417,7 +417,7 @@ define KernelPackage/sound-hda-codec-cirrus
   KCONFIG:= \
 	CONFIG_SND_HDA_CODEC_CIRRUS
   FILES:= \
-	$(LINUX_DIR)/sound/pci/hda/snd-hda-codec-cirrus.ko
+	$(LINUX_OBJ_DIR)/sound/pci/hda/snd-hda-codec-cirrus.ko
   AUTOLOAD:=$(call AutoProbe,snd-hda-codec-cirrus)
   $(call AddDepends/sound,kmod-sound-hda-core)
 endef
@@ -434,7 +434,7 @@ define KernelPackage/sound-hda-codec-ca0110
   KCONFIG:= \
 	CONFIG_SND_HDA_CODEC_CA0110
   FILES:= \
-	$(LINUX_DIR)/sound/pci/hda/snd-hda-codec-ca0110.ko
+	$(LINUX_OBJ_DIR)/sound/pci/hda/snd-hda-codec-ca0110.ko
   AUTOLOAD:=$(call AutoProbe,snd-hda-codec-ca0110)
   $(call AddDepends/sound,kmod-sound-hda-core)
 endef
@@ -452,7 +452,7 @@ define KernelPackage/sound-hda-codec-ca0132
 	CONFIG_SND_HDA_CODEC_CA0132 \
 	CONFIG_SND_HDA_CODEC_CA0132_DSP=n
   FILES:= \
-	$(LINUX_DIR)/sound/pci/hda/snd-hda-codec-ca0132.ko
+	$(LINUX_OBJ_DIR)/sound/pci/hda/snd-hda-codec-ca0132.ko
   AUTOLOAD:=$(call AutoProbe,snd-hda-codec-ca0132)
   $(call AddDepends/sound,kmod-sound-hda-core)
 endef
@@ -469,7 +469,7 @@ define KernelPackage/sound-hda-codec-conexant
   KCONFIG:= \
 	CONFIG_SND_HDA_CODEC_CONEXANT
   FILES:= \
-	$(LINUX_DIR)/sound/pci/hda/snd-hda-codec-conexant.ko
+	$(LINUX_OBJ_DIR)/sound/pci/hda/snd-hda-codec-conexant.ko
   AUTOLOAD:=$(call AutoProbe,snd-hda-codec-conexant)
   $(call AddDepends/sound,kmod-sound-hda-core)
 endef
@@ -486,7 +486,7 @@ define KernelPackage/sound-hda-codec-via
   KCONFIG:= \
 	CONFIG_SND_HDA_CODEC_VIA
   FILES:= \
-	$(LINUX_DIR)/sound/pci/hda/snd-hda-codec-via.ko
+	$(LINUX_OBJ_DIR)/sound/pci/hda/snd-hda-codec-via.ko
   AUTOLOAD:=$(call AutoProbe,snd-hda-codec-via)
   $(call AddDepends/sound,kmod-sound-hda-core)
 endef
@@ -503,7 +503,7 @@ define KernelPackage/sound-hda-codec-hdmi
   KCONFIG:= \
 	CONFIG_SND_HDA_CODEC_HDMI
   FILES:= \
-	$(LINUX_DIR)/sound/pci/hda/snd-hda-codec-hdmi.ko
+	$(LINUX_OBJ_DIR)/sound/pci/hda/snd-hda-codec-hdmi.ko
   AUTOLOAD:=$(call AutoProbe,snd-hda-codec-hdmi)
   $(call AddDepends/sound,kmod-sound-hda-core)
 endef
@@ -522,8 +522,8 @@ define KernelPackage/sound-hda-intel
 	CONFIG_SOUND_PCI \
 	CONFIG_SND_HDA_INTEL
   FILES:= \
-	$(LINUX_DIR)/sound/pci/hda/snd-hda-intel.ko \
-	$(LINUX_DIR)/sound/hda/snd-intel-dspcfg.ko
+	$(LINUX_OBJ_DIR)/sound/pci/hda/snd-hda-intel.ko \
+	$(LINUX_OBJ_DIR)/sound/hda/snd-intel-dspcfg.ko
   AUTOLOAD:=$(call AutoProbe,snd-hda-intel)
   $(call AddDepends/sound,kmod-sound-hda-core)
 endef
diff --git a/package/kernel/linux/modules/spi.mk b/package/kernel/linux/modules/spi.mk
index 78a1c8a032..42059eb313 100644
--- a/package/kernel/linux/modules/spi.mk
+++ b/package/kernel/linux/modules/spi.mk
@@ -15,8 +15,8 @@ define KernelPackage/mmc-spi
           CONFIG_SPI=y \
           CONFIG_SPI_MASTER=y
   FILES:=\
-	$(LINUX_DIR)/drivers/mmc/host/of_mmc_spi.ko \
-	$(LINUX_DIR)/drivers/mmc/host/mmc_spi.ko
+	$(LINUX_OBJ_DIR)/drivers/mmc/host/of_mmc_spi.ko \
+	$(LINUX_OBJ_DIR)/drivers/mmc/host/mmc_spi.ko
   AUTOLOAD:=$(call AutoProbe,of_mmc_spi mmc_spi)
 endef
 
@@ -33,7 +33,7 @@ define KernelPackage/spi-bitbang
   KCONFIG:=CONFIG_SPI_BITBANG \
           CONFIG_SPI=y \
           CONFIG_SPI_MASTER=y
-  FILES:=$(LINUX_DIR)/drivers/spi/spi-bitbang.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/spi/spi-bitbang.ko
 endef
 
 define KernelPackage/spi-bitbang/description
@@ -48,7 +48,7 @@ define KernelPackage/spi-gpio
   TITLE:=GPIO-based bitbanging SPI Master
   DEPENDS:=@GPIO_SUPPORT +kmod-spi-bitbang
   KCONFIG:=CONFIG_SPI_GPIO
-  FILES:=$(LINUX_DIR)/drivers/spi/spi-gpio.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/spi/spi-gpio.ko
   AUTOLOAD:=$(call AutoProbe,spi-gpio)
 endef
 
@@ -64,7 +64,7 @@ define KernelPackage/spi-dev
   KCONFIG:=CONFIG_SPI_SPIDEV \
           CONFIG_SPI=y \
           CONFIG_SPI_MASTER=y
-  FILES:=$(LINUX_DIR)/drivers/spi/spidev.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/spi/spidev.ko
   AUTOLOAD:=$(call AutoProbe,spidev)
 endef
 
diff --git a/package/kernel/linux/modules/usb.mk b/package/kernel/linux/modules/usb.mk
index 6218ec994c..89edbc0b6d 100644
--- a/package/kernel/linux/modules/usb.mk
+++ b/package/kernel/linux/modules/usb.mk
@@ -17,8 +17,8 @@ define KernelPackage/usb-core
   DEPENDS:=@USB_SUPPORT
   KCONFIG:=CONFIG_USB CONFIG_XPS_USB_HCD_XILINX=n CONFIG_USB_FHCI_HCD=n
   FILES:= \
-	$(LINUX_DIR)/drivers/usb/core/usbcore.ko \
-	$(LINUX_DIR)/drivers/usb/common/usb-common.ko
+	$(LINUX_OBJ_DIR)/drivers/usb/core/usbcore.ko \
+	$(LINUX_OBJ_DIR)/drivers/usb/common/usb-common.ko
   AUTOLOAD:=$(call AutoLoad,20,usb-common usbcore,1)
   $(call AddDepends/nls)
 endef
@@ -39,7 +39,7 @@ endef
 define KernelPackage/usb-ledtrig-usbport
   TITLE:=LED trigger for USB ports
   KCONFIG:=CONFIG_USB_LEDS_TRIGGER_USBPORT
-  FILES:=$(LINUX_DIR)/drivers/usb/core/ledtrig-usbport.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/core/ledtrig-usbport.ko
   AUTOLOAD:=$(call AutoLoad,50,ledtrig-usbport)
   $(call AddDepends/usb)
 endef
@@ -58,7 +58,7 @@ define KernelPackage/usb-phy-nop
   TITLE:=Support for USB NOP transceiver
   KCONFIG:=CONFIG_NOP_USB_XCEIV
   HIDDEN:=1
-  FILES:=$(LINUX_DIR)/drivers/usb/phy/phy-generic.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/phy/phy-generic.ko
   AUTOLOAD:=$(call AutoLoad,21,phy-generic,1)
   $(call AddDepends/usb)
 endef
@@ -76,8 +76,8 @@ define KernelPackage/phy-ath79-usb
 	CONFIG_PHY_AR7200_USB
   DEPENDS:=@TARGET_ath79
   HIDDEN:=1
-  FILES:=$(LINUX_DIR)/drivers/phy/phy-ar7100-usb.ko \
-	$(LINUX_DIR)/drivers/phy/phy-ar7200-usb.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/phy/phy-ar7100-usb.ko \
+	$(LINUX_OBJ_DIR)/drivers/phy/phy-ar7200-usb.ko
   AUTOLOAD:=$(call AutoLoad,21,phy-ar7100-usb phy-ar7200-usb,1)
   $(call AddDepends/usb)
 endef
@@ -94,7 +94,7 @@ define KernelPackage/usb-gadget
   KCONFIG:=CONFIG_USB_GADGET
   HIDDEN:=1
   FILES:=\
-	$(LINUX_DIR)/drivers/usb/gadget/udc/udc-core.ko
+	$(LINUX_OBJ_DIR)/drivers/usb/gadget/udc/udc-core.ko
   AUTOLOAD:=$(call AutoLoad,21,udc-core,1)
   DEPENDS:=@USB_GADGET_SUPPORT
   $(call AddDepends/usb)
@@ -111,7 +111,7 @@ define KernelPackage/usb-lib-composite
   KCONFIG:=CONFIG_USB_LIBCOMPOSITE
   DEPENDS:=+kmod-usb-gadget +kmod-fs-configfs
   HIDDEN:=1
-  FILES:=$(LINUX_DIR)/drivers/usb/gadget/libcomposite.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/gadget/libcomposite.ko
   AUTOLOAD:=$(call AutoLoad,50,libcomposite)
   $(call AddDepends/usb)
 endef
@@ -127,8 +127,8 @@ define KernelPackage/usb-gadget-hid
   KCONFIG:=CONFIG_USB_G_HID
   DEPENDS:=+kmod-usb-gadget +kmod-usb-lib-composite
   FILES:= \
-	  $(LINUX_DIR)/drivers/usb/gadget/legacy/g_hid.ko \
-	  $(LINUX_DIR)/drivers/usb/gadget/function/usb_f_hid.ko
+	  $(LINUX_OBJ_DIR)/drivers/usb/gadget/legacy/g_hid.ko \
+	  $(LINUX_OBJ_DIR)/drivers/usb/gadget/function/usb_f_hid.ko
   AUTOLOAD:=$(call AutoLoad,52,usb_f_hid)
   $(call AddDepends/usb)
 endef
@@ -146,7 +146,7 @@ define KernelPackage/usb-gadget-ehci-debug
 	CONFIG_USB_G_DBGP_SERIAL=y \
 	CONFIG_USB_G_DBGP_PRINTK=n
   DEPENDS:=+kmod-usb-gadget +kmod-usb-lib-composite +kmod-usb-gadget-serial
-  FILES:=$(LINUX_DIR)/drivers/usb/gadget/legacy/g_dbgp.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/gadget/legacy/g_dbgp.ko
   $(call AddDepends/usb)
 endef
 
@@ -164,11 +164,11 @@ define KernelPackage/usb-gadget-eth
 	CONFIG_USB_ETH_EEM=n
   DEPENDS:=+kmod-usb-gadget +kmod-usb-lib-composite
   FILES:= \
-	$(LINUX_DIR)/drivers/usb/gadget/function/u_ether.ko \
-	$(LINUX_DIR)/drivers/usb/gadget/function/usb_f_ecm.ko \
-	$(LINUX_DIR)/drivers/usb/gadget/function/usb_f_ecm_subset.ko \
-	$(LINUX_DIR)/drivers/usb/gadget/function/usb_f_rndis.ko \
-	$(LINUX_DIR)/drivers/usb/gadget/legacy/g_ether.ko
+	$(LINUX_OBJ_DIR)/drivers/usb/gadget/function/u_ether.ko \
+	$(LINUX_OBJ_DIR)/drivers/usb/gadget/function/usb_f_ecm.ko \
+	$(LINUX_OBJ_DIR)/drivers/usb/gadget/function/usb_f_ecm_subset.ko \
+	$(LINUX_OBJ_DIR)/drivers/usb/gadget/function/usb_f_rndis.ko \
+	$(LINUX_OBJ_DIR)/drivers/usb/gadget/legacy/g_ether.ko
   AUTOLOAD:=$(call AutoLoad,52,usb_f_ecm)
   $(call AddDepends/usb)
 endef
@@ -185,8 +185,8 @@ define KernelPackage/usb-gadget-ncm
   DEPENDS:=+kmod-usb-gadget +kmod-usb-lib-composite \
 	+kmod-usb-gadget-eth
   FILES:= \
-	$(LINUX_DIR)/drivers/usb/gadget/function/usb_f_ncm.ko \
-	$(LINUX_DIR)/drivers/usb/gadget/legacy/g_ncm.ko
+	$(LINUX_OBJ_DIR)/drivers/usb/gadget/function/usb_f_ncm.ko \
+	$(LINUX_OBJ_DIR)/drivers/usb/gadget/legacy/g_ncm.ko
   AUTOLOAD:=$(call AutoLoad,52,usb_f_ncm)
   $(call AddDepends/usb)
 endef
@@ -202,11 +202,11 @@ define KernelPackage/usb-gadget-serial
   KCONFIG:=CONFIG_USB_G_SERIAL
   DEPENDS:=+kmod-usb-gadget +kmod-usb-lib-composite
   FILES:= \
-	$(LINUX_DIR)/drivers/usb/gadget/function/u_serial.ko \
-	$(LINUX_DIR)/drivers/usb/gadget/function/usb_f_acm.ko \
-	$(LINUX_DIR)/drivers/usb/gadget/function/usb_f_obex.ko \
-	$(LINUX_DIR)/drivers/usb/gadget/function/usb_f_serial.ko \
-	$(LINUX_DIR)/drivers/usb/gadget/legacy/g_serial.ko
+	$(LINUX_OBJ_DIR)/drivers/usb/gadget/function/u_serial.ko \
+	$(LINUX_OBJ_DIR)/drivers/usb/gadget/function/usb_f_acm.ko \
+	$(LINUX_OBJ_DIR)/drivers/usb/gadget/function/usb_f_obex.ko \
+	$(LINUX_OBJ_DIR)/drivers/usb/gadget/function/usb_f_serial.ko \
+	$(LINUX_OBJ_DIR)/drivers/usb/gadget/legacy/g_serial.ko
   AUTOLOAD:=$(call AutoLoad,52,usb_f_acm)
   $(call AddDepends/usb)
 endef
@@ -222,8 +222,8 @@ define KernelPackage/usb-gadget-mass-storage
   KCONFIG:=CONFIG_USB_MASS_STORAGE
   DEPENDS:=+kmod-usb-gadget +kmod-usb-lib-composite
   FILES:= \
-	$(LINUX_DIR)/drivers/usb/gadget/function/usb_f_mass_storage.ko \
-	$(LINUX_DIR)/drivers/usb/gadget/legacy/g_mass_storage.ko
+	$(LINUX_OBJ_DIR)/drivers/usb/gadget/function/usb_f_mass_storage.ko \
+	$(LINUX_OBJ_DIR)/drivers/usb/gadget/legacy/g_mass_storage.ko
   AUTOLOAD:=$(call AutoLoad,52,usb_f_mass_storage)
   $(call AddDepends/usb)
 endef
@@ -239,7 +239,7 @@ define KernelPackage/usb-gadget-cdc-composite
   KCONFIG:=CONFIG_USB_CDC_COMPOSITE
   DEPENDS:=+kmod-usb-gadget +kmod-usb-lib-composite \
 	+kmod-usb-gadget-eth +kmod-usb-gadget-serial
-  FILES:= $(LINUX_DIR)/drivers/usb/gadget/legacy/g_cdc.ko
+  FILES:= $(LINUX_OBJ_DIR)/drivers/usb/gadget/legacy/g_cdc.ko
   $(call AddDepends/usb)
 endef
 
@@ -257,7 +257,7 @@ define KernelPackage/usb-uhci
 	CONFIG_USB_PCI=y \
 	CONFIG_USB_UHCI_ALT \
 	CONFIG_USB_UHCI_HCD
-  FILES:=$(LINUX_DIR)/drivers/usb/host/uhci-hcd.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/host/uhci-hcd.ko
   AUTOLOAD:=$(call AutoLoad,50,uhci-hcd,1)
   $(call AddDepends/usb)
 endef
@@ -285,10 +285,10 @@ define KernelPackage/usb-ohci
 	CONFIG_USB_OHCI_HCD_OMAP3=y \
 	CONFIG_USB_OHCI_HCD_PLATFORM=y
   FILES:= \
-	$(LINUX_DIR)/drivers/usb/host/ohci-hcd.ko \
-	$(LINUX_DIR)/drivers/usb/host/ohci-platform.ko
-  ifneq ($(wildcard $(LINUX_DIR)/drivers/usb/host/ohci-at91.ko),)
-    FILES+=$(LINUX_DIR)/drivers/usb/host/ohci-at91.ko
+	$(LINUX_OBJ_DIR)/drivers/usb/host/ohci-hcd.ko \
+	$(LINUX_OBJ_DIR)/drivers/usb/host/ohci-platform.ko
+  ifneq ($(wildcard $(LINUX_OBJ_DIR)/drivers/usb/host/ohci-at91.ko),)
+    FILES+=$(LINUX_OBJ_DIR)/drivers/usb/host/ohci-at91.ko
   endif
   AUTOLOAD:=$(call AutoLoad,50,ohci-hcd ohci-platform ohci-at91,1)
   $(call AddDepends/usb)
@@ -307,7 +307,7 @@ define KernelPackage/usb-ohci-pci
   KCONFIG:= \
 	CONFIG_USB_PCI=y \
 	CONFIG_USB_OHCI_HCD_PCI
-  FILES:=$(LINUX_DIR)/drivers/usb/host/ohci-pci.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/host/ohci-pci.ko
   AUTOLOAD:=$(call AutoLoad,51,ohci-pci,1)
   $(call AddDepends/usb)
 endef
@@ -325,7 +325,7 @@ define KernelPackage/usb-bcma
   HIDDEN:=1
   KCONFIG:=CONFIG_USB_HCD_BCMA
   FILES:= \
-	$(if $(CONFIG_USB_HCD_BCMA),$(LINUX_DIR)/drivers/usb/host/bcma-hcd.ko)
+	$(if $(CONFIG_USB_HCD_BCMA),$(LINUX_OBJ_DIR)/drivers/usb/host/bcma-hcd.ko)
   AUTOLOAD:=$(call AutoLoad,19,$(if $(CONFIG_USB_HCD_BCMA),bcma-hcd),1)
   $(call AddDepends/usb)
 endef
@@ -337,7 +337,7 @@ define KernelPackage/usb-ssb
   HIDDEN:=1
   KCONFIG:=CONFIG_USB_HCD_SSB
   FILES:= \
-	$(if $(CONFIG_USB_HCD_SSB),$(LINUX_DIR)/drivers/usb/host/ssb-hcd.ko)
+	$(if $(CONFIG_USB_HCD_SSB),$(LINUX_OBJ_DIR)/drivers/usb/host/ssb-hcd.ko)
   AUTOLOAD:=$(call AutoLoad,19,$(if $(CONFIG_USB_HCD_SSB),ssb-hcd),1)
   $(call AddDepends/usb)
 endef
@@ -349,7 +349,7 @@ define KernelPackage/usb-ehci
   KCONFIG:= \
 	CONFIG_USB_EHCI_HCD
   FILES:= \
-	$(LINUX_DIR)/drivers/usb/host/ehci-hcd.ko
+	$(LINUX_OBJ_DIR)/drivers/usb/host/ehci-hcd.ko
   AUTOLOAD:=$(call AutoLoad,35,ehci-hcd,1)
   $(call AddDepends/usb)
 endef
@@ -374,18 +374,18 @@ define KernelPackage/usb2
 	CONFIG_USB_EHCI_HCD_AT91=y \
 	CONFIG_USB_EHCI_FSL
   FILES:= \
-	$(LINUX_DIR)/drivers/usb/host/ehci-platform.ko
-  ifneq ($(wildcard $(LINUX_DIR)/drivers/usb/host/ehci-orion.ko),)
-    FILES+=$(LINUX_DIR)/drivers/usb/host/ehci-orion.ko
+	$(LINUX_OBJ_DIR)/drivers/usb/host/ehci-platform.ko
+  ifneq ($(wildcard $(LINUX_OBJ_DIR)/drivers/usb/host/ehci-orion.ko),)
+    FILES+=$(LINUX_OBJ_DIR)/drivers/usb/host/ehci-orion.ko
   endif
-  ifneq ($(wildcard $(LINUX_DIR)/drivers/usb/host/ehci-atmel.ko),)
-    FILES+=$(LINUX_DIR)/drivers/usb/host/ehci-atmel.ko
+  ifneq ($(wildcard $(LINUX_OBJ_DIR)/drivers/usb/host/ehci-atmel.ko),)
+    FILES+=$(LINUX_OBJ_DIR)/drivers/usb/host/ehci-atmel.ko
   endif
-  ifneq ($(wildcard $(LINUX_DIR)/drivers/usb/host/ehci-fsl.ko),)
-    FILES+=$(LINUX_DIR)/drivers/usb/host/ehci-fsl.ko
+  ifneq ($(wildcard $(LINUX_OBJ_DIR)/drivers/usb/host/ehci-fsl.ko),)
+    FILES+=$(LINUX_OBJ_DIR)/drivers/usb/host/ehci-fsl.ko
   endif
-  ifneq ($(wildcard $(LINUX_DIR)/drivers/usb/host/fsl-mph-dr-of.ko),)
-    FILES+=$(LINUX_DIR)/drivers/usb/host/fsl-mph-dr-of.ko
+  ifneq ($(wildcard $(LINUX_OBJ_DIR)/drivers/usb/host/fsl-mph-dr-of.ko),)
+    FILES+=$(LINUX_OBJ_DIR)/drivers/usb/host/fsl-mph-dr-of.ko
   endif
   AUTOLOAD:=$(call AutoLoad,40,ehci-hcd ehci-platform ehci-orion ehci-atmel ehci-fsl fsl-mph-dr-of,1)
   $(call AddDepends/usb)
@@ -404,7 +404,7 @@ define KernelPackage/usb2-pci
   KCONFIG:= \
 	CONFIG_USB_PCI=y \
 	CONFIG_USB_EHCI_PCI
-  FILES:=$(LINUX_DIR)/drivers/usb/host/ehci-pci.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/host/ehci-pci.ko
   AUTOLOAD:=$(call AutoLoad,42,ehci-pci,1)
   $(call AddDepends/usb)
 endef
@@ -426,7 +426,7 @@ define KernelPackage/usb-dwc2
 	CONFIG_USB_DWC2_TRACK_MISSED_SOFS=n \
 	CONFIG_USB_DWC2_DEBUG_PERIODIC=n
   FILES:= \
-	$(LINUX_DIR)/drivers/usb/dwc2/dwc2.ko
+	$(LINUX_OBJ_DIR)/drivers/usb/dwc2/dwc2.ko
   AUTOLOAD:=$(call AutoLoad,54,dwc2,1)
   $(call AddDepends/usb)
 endef
@@ -446,7 +446,7 @@ define KernelPackage/usb-dwc2-pci
 	CONFIG_USB_PCI=y \
 	CONFIG_USB_DWC2_PCI
   FILES:= \
-	$(LINUX_DIR)/drivers/usb/dwc2/dwc2_pci.ko
+	$(LINUX_OBJ_DIR)/drivers/usb/dwc2/dwc2_pci.ko
   AUTOLOAD:=$(call AutoLoad,54,dwc2_pci,1)
   $(call AddDepends/usb)
 endef
@@ -468,7 +468,7 @@ define KernelPackage/usb-dwc3
 	CONFIG_USB_DWC3_DUAL_ROLE=n \
 	CONFIG_USB_DWC3_DEBUG=n \
 	CONFIG_USB_DWC3_VERBOSE=n
-  FILES:= $(LINUX_DIR)/drivers/usb/dwc3/dwc3.ko
+  FILES:= $(LINUX_OBJ_DIR)/drivers/usb/dwc3/dwc3.ko
   AUTOLOAD:=$(call AutoLoad,54,dwc3,1)
   $(call AddDepends/usb)
 endef
@@ -485,7 +485,7 @@ define KernelPackage/usb-dwc3-qcom
   TITLE:=DWC3 Qualcomm USB driver
   DEPENDS:=@(TARGET_ipq40xx||TARGET_ipq806x||TARGET_qualcommax) +kmod-usb-dwc3
   KCONFIG:= CONFIG_USB_DWC3_QCOM
-  FILES:= $(LINUX_DIR)/drivers/usb/dwc3/dwc3-qcom.ko
+  FILES:= $(LINUX_OBJ_DIR)/drivers/usb/dwc3/dwc3-qcom.ko
   AUTOLOAD:=$(call AutoLoad,53,dwc3-qcom,1)
   $(call AddDepends/usb)
 endef
@@ -503,7 +503,7 @@ $(eval $(call KernelPackage,usb-dwc3-qcom))
 define KernelPackage/usb-acm
   TITLE:=Support for modems/isdn controllers
   KCONFIG:=CONFIG_USB_ACM
-  FILES:=$(LINUX_DIR)/drivers/usb/class/cdc-acm.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/class/cdc-acm.ko
   AUTOLOAD:=$(call AutoProbe,cdc-acm)
 $(call AddDepends/usb)
 endef
@@ -518,7 +518,7 @@ $(eval $(call KernelPackage,usb-acm))
 define KernelPackage/usb-wdm
   TITLE:=USB Wireless Device Management
   KCONFIG:=CONFIG_USB_WDM
-  FILES:=$(LINUX_DIR)/drivers/usb/class/cdc-wdm.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/class/cdc-wdm.ko
   AUTOLOAD:=$(call AutoProbe,cdc-wdm)
 $(call AddDepends/usb)
 $(call AddDepends/usb-net)
@@ -539,8 +539,8 @@ define KernelPackage/usb-audio
   $(call AddDepends/usb)
   $(call AddDepends/sound)
   FILES:= \
-	$(LINUX_DIR)/sound/usb/snd-usbmidi-lib.ko \
-	$(LINUX_DIR)/sound/usb/snd-usb-audio.ko
+	$(LINUX_OBJ_DIR)/sound/usb/snd-usbmidi-lib.ko \
+	$(LINUX_OBJ_DIR)/sound/usb/snd-usb-audio.ko
   AUTOLOAD:=$(call AutoProbe,snd-usbmidi-lib snd-usb-audio)
 endef
 
@@ -554,7 +554,7 @@ $(eval $(call KernelPackage,usb-audio))
 define KernelPackage/usb-printer
   TITLE:=Support for printers
   KCONFIG:=CONFIG_USB_PRINTER
-  FILES:=$(LINUX_DIR)/drivers/usb/class/usblp.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/class/usblp.ko
   AUTOLOAD:=$(call AutoProbe,usblp)
   $(call AddDepends/usb)
 endef
@@ -569,7 +569,7 @@ $(eval $(call KernelPackage,usb-printer))
 define KernelPackage/usb-serial
   TITLE:=Support for USB-to-Serial converters
   KCONFIG:=CONFIG_USB_SERIAL
-  FILES:=$(LINUX_DIR)/drivers/usb/serial/usbserial.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/serial/usbserial.ko
   AUTOLOAD:=$(call AutoProbe,usbserial)
   $(call AddDepends/usb)
 endef
@@ -590,7 +590,7 @@ endef
 define KernelPackage/usb-serial-belkin
   TITLE:=Support for Belkin devices
   KCONFIG:=CONFIG_USB_SERIAL_BELKIN
-  FILES:=$(LINUX_DIR)/drivers/usb/serial/belkin_sa.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/serial/belkin_sa.ko
   AUTOLOAD:=$(call AutoProbe,belkin_sa)
   $(call AddDepends/usb-serial)
 endef
@@ -605,7 +605,7 @@ $(eval $(call KernelPackage,usb-serial-belkin))
 define KernelPackage/usb-serial-ch341
   TITLE:=Support for CH341 devices
   KCONFIG:=CONFIG_USB_SERIAL_CH341
-  FILES:=$(LINUX_DIR)/drivers/usb/serial/ch341.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/serial/ch341.ko
   AUTOLOAD:=$(call AutoProbe,ch341)
   $(call AddDepends/usb-serial)
 endef
@@ -620,7 +620,7 @@ $(eval $(call KernelPackage,usb-serial-ch341))
 define KernelPackage/usb-serial-edgeport
   TITLE:=Support for Digi Edgeport devices
   KCONFIG:=CONFIG_USB_SERIAL_EDGEPORT
-  FILES:=$(LINUX_DIR)/drivers/usb/serial/io_edgeport.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/serial/io_edgeport.ko
   AUTOLOAD:=$(call AutoProbe,io_edgeport)
   $(call AddDepends/usb-serial)
   DEPENDS+=+edgeport-firmware
@@ -652,7 +652,7 @@ $(eval $(call KernelPackage,usb-serial-edgeport))
 define KernelPackage/usb-serial-ftdi
   TITLE:=Support for FTDI devices
   KCONFIG:=CONFIG_USB_SERIAL_FTDI_SIO
-  FILES:=$(LINUX_DIR)/drivers/usb/serial/ftdi_sio.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/serial/ftdi_sio.ko
   AUTOLOAD:=$(call AutoProbe,ftdi_sio)
   $(call AddDepends/usb-serial)
 endef
@@ -667,7 +667,7 @@ $(eval $(call KernelPackage,usb-serial-ftdi))
 define KernelPackage/usb-serial-garmin
   TITLE:=Support for Garmin GPS devices
   KCONFIG:=CONFIG_USB_SERIAL_GARMIN
-  FILES:=$(LINUX_DIR)/drivers/usb/serial/garmin_gps.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/serial/garmin_gps.ko
   AUTOLOAD:=$(call AutoProbe,garmin_gps)
   $(call AddDepends/usb-serial)
 endef
@@ -682,7 +682,7 @@ $(eval $(call KernelPackage,usb-serial-garmin))
 define KernelPackage/usb-serial-simple
   TITLE:=USB Serial Simple (Motorola phone)
   KCONFIG:=CONFIG_USB_SERIAL_SIMPLE
-  FILES:=$(LINUX_DIR)/drivers/usb/serial/usb-serial-simple.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/serial/usb-serial-simple.ko
   AUTOLOAD:=$(call AutoProbe,usb-serial-simple)
   $(call AddDepends/usb-serial)
 endef
@@ -710,7 +710,7 @@ $(eval $(call KernelPackage,usb-serial-simple))
 define KernelPackage/usb-serial-ti-usb
   TITLE:=Support for TI USB 3410/5052
   KCONFIG:=CONFIG_USB_SERIAL_TI
-  FILES:=$(LINUX_DIR)/drivers/usb/serial/ti_usb_3410_5052.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/serial/ti_usb_3410_5052.ko
   AUTOLOAD:=$(call AutoProbe,ti_usb_3410_5052)
   $(call AddDepends/usb-serial)
 endef
@@ -725,7 +725,7 @@ $(eval $(call KernelPackage,usb-serial-ti-usb))
 define KernelPackage/usb-serial-ipw
   TITLE:=Support for IPWireless 3G devices
   KCONFIG:=CONFIG_USB_SERIAL_IPW
-  FILES:=$(LINUX_DIR)/drivers/usb/serial/ipw.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/serial/ipw.ko
   AUTOLOAD:=$(call AutoProbe,ipw)
   $(call AddDepends/usb-serial,+kmod-usb-serial-wwan)
 endef
@@ -736,7 +736,7 @@ $(eval $(call KernelPackage,usb-serial-ipw))
 define KernelPackage/usb-serial-mct
   TITLE:=Support for Magic Control Tech. devices
   KCONFIG:=CONFIG_USB_SERIAL_MCT_U232
-  FILES:=$(LINUX_DIR)/drivers/usb/serial/mct_u232.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/serial/mct_u232.ko
   AUTOLOAD:=$(call AutoProbe,mct_u232)
   $(call AddDepends/usb-serial)
 endef
@@ -751,7 +751,7 @@ $(eval $(call KernelPackage,usb-serial-mct))
 define KernelPackage/usb-serial-mos7720
   TITLE:=Support for Moschip MOS7720 devices
   KCONFIG:=CONFIG_USB_SERIAL_MOS7720 CONFIG_USB_SERIAL_MOS7715_PARPORT=y
-  FILES:=$(LINUX_DIR)/drivers/usb/serial/mos7720.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/serial/mos7720.ko
   DEPENDS:=+kmod-ppdev
   AUTOLOAD:=$(call AutoProbe,mos7720)
   $(call AddDepends/usb-serial)
@@ -767,7 +767,7 @@ $(eval $(call KernelPackage,usb-serial-mos7720))
 define KernelPackage/usb-serial-mos7840
   TITLE:=Support for Moschip MOS7840 devices
   KCONFIG:=CONFIG_USB_SERIAL_MOS7840
-  FILES:=$(LINUX_DIR)/drivers/usb/serial/mos7840.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/serial/mos7840.ko
   AUTOLOAD:=$(call AutoProbe,mos7840)
   $(call AddDepends/usb-serial)
 endef
@@ -782,7 +782,7 @@ $(eval $(call KernelPackage,usb-serial-mos7840))
 define KernelPackage/usb-serial-pl2303
   TITLE:=Support for Prolific PL2303 devices
   KCONFIG:=CONFIG_USB_SERIAL_PL2303
-  FILES:=$(LINUX_DIR)/drivers/usb/serial/pl2303.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/serial/pl2303.ko
   AUTOLOAD:=$(call AutoProbe,pl2303)
   $(call AddDepends/usb-serial)
 endef
@@ -797,7 +797,7 @@ $(eval $(call KernelPackage,usb-serial-pl2303))
 define KernelPackage/usb-serial-cp210x
   TITLE:=Support for Silicon Labs cp210x devices
   KCONFIG:=CONFIG_USB_SERIAL_CP210X
-  FILES:=$(LINUX_DIR)/drivers/usb/serial/cp210x.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/serial/cp210x.ko
   AUTOLOAD:=$(call AutoProbe,cp210x)
   $(call AddDepends/usb-serial)
 endef
@@ -812,7 +812,7 @@ $(eval $(call KernelPackage,usb-serial-cp210x))
 define KernelPackage/usb-serial-ark3116
   TITLE:=Support for ArkMicroChips ARK3116 devices
   KCONFIG:=CONFIG_USB_SERIAL_ARK3116
-  FILES:=$(LINUX_DIR)/drivers/usb/serial/ark3116.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/serial/ark3116.ko
   AUTOLOAD:=$(call AutoProbe,ark3116)
   $(call AddDepends/usb-serial)
 endef
@@ -827,7 +827,7 @@ $(eval $(call KernelPackage,usb-serial-ark3116))
 define KernelPackage/usb-serial-oti6858
   TITLE:=Support for Ours Technology OTI6858 devices
   KCONFIG:=CONFIG_USB_SERIAL_OTI6858
-  FILES:=$(LINUX_DIR)/drivers/usb/serial/oti6858.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/serial/oti6858.ko
   AUTOLOAD:=$(call AutoProbe,oti6858)
   $(call AddDepends/usb-serial)
 endef
@@ -842,7 +842,7 @@ $(eval $(call KernelPackage,usb-serial-oti6858))
 define KernelPackage/usb-serial-sierrawireless
   TITLE:=Support for Sierra Wireless devices
   KCONFIG:=CONFIG_USB_SERIAL_SIERRAWIRELESS
-  FILES:=$(LINUX_DIR)/drivers/usb/serial/sierra.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/serial/sierra.ko
   AUTOLOAD:=$(call AutoProbe,sierra)
   $(call AddDepends/usb-serial)
 endef
@@ -857,7 +857,7 @@ $(eval $(call KernelPackage,usb-serial-sierrawireless))
 define KernelPackage/usb-serial-visor
   TITLE:=Support for Handspring Visor devices
   KCONFIG:=CONFIG_USB_SERIAL_VISOR
-  FILES:=$(LINUX_DIR)/drivers/usb/serial/visor.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/serial/visor.ko
   AUTOLOAD:=$(call AutoProbe,visor)
   $(call AddDepends/usb-serial)
 endef
@@ -872,7 +872,7 @@ $(eval $(call KernelPackage,usb-serial-visor))
 define KernelPackage/usb-serial-cypress-m8
   TITLE:=Support for CypressM8 USB-Serial
   KCONFIG:=CONFIG_USB_SERIAL_CYPRESS_M8
-  FILES:=$(LINUX_DIR)/drivers/usb/serial/cypress_m8.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/serial/cypress_m8.ko
   AUTOLOAD:=$(call AutoProbe,cypress_m8)
   $(call AddDepends/usb-serial)
 endef
@@ -904,8 +904,8 @@ define KernelPackage/usb-serial-keyspan
 	CONFIG_USB_SERIAL_KEYSPAN_USA49W \
 	CONFIG_USB_SERIAL_KEYSPAN_USA49WLC
   FILES:= \
-	$(LINUX_DIR)/drivers/usb/serial/keyspan.ko \
-	$(wildcard $(LINUX_DIR)/drivers/usb/misc/ezusb.ko)
+	$(LINUX_OBJ_DIR)/drivers/usb/serial/keyspan.ko \
+	$(wildcard $(LINUX_OBJ_DIR)/drivers/usb/misc/ezusb.ko)
   AUTOLOAD:=$(call AutoProbe,ezusb keyspan)
   $(call AddDepends/usb-serial)
 endef
@@ -920,7 +920,7 @@ $(eval $(call KernelPackage,usb-serial-keyspan))
 define KernelPackage/usb-serial-wwan
   TITLE:=Support for GSM and CDMA modems
   KCONFIG:=CONFIG_USB_SERIAL_WWAN
-  FILES:=$(LINUX_DIR)/drivers/usb/serial/usb_wwan.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/serial/usb_wwan.ko
   HIDDEN:=1
   AUTOLOAD:=$(call AutoProbe,usb_wwan)
   $(call AddDepends/usb-serial)
@@ -936,7 +936,7 @@ $(eval $(call KernelPackage,usb-serial-wwan))
 define KernelPackage/usb-serial-option
   TITLE:=Support for Option HSDPA modems
   KCONFIG:=CONFIG_USB_SERIAL_OPTION
-  FILES:=$(LINUX_DIR)/drivers/usb/serial/option.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/serial/option.ko
   AUTOLOAD:=$(call AutoProbe,option)
   $(call AddDepends/usb-serial,+kmod-usb-serial-wwan)
 endef
@@ -951,7 +951,7 @@ $(eval $(call KernelPackage,usb-serial-option))
 define KernelPackage/usb-serial-qualcomm
   TITLE:=Support for Qualcomm USB serial
   KCONFIG:=CONFIG_USB_SERIAL_QUALCOMM
-  FILES:=$(LINUX_DIR)/drivers/usb/serial/qcserial.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/serial/qcserial.ko
   AUTOLOAD:=$(call AutoProbe,qcserial)
   $(call AddDepends/usb-serial,+kmod-usb-serial-wwan)
 endef
@@ -967,7 +967,7 @@ define KernelPackage/usb-storage
   TITLE:=USB Storage support
   DEPENDS:= +kmod-scsi-core
   KCONFIG:=CONFIG_USB_STORAGE
-  FILES:=$(LINUX_DIR)/drivers/usb/storage/usb-storage.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/storage/usb-storage.ko
   AUTOLOAD:=$(call AutoProbe,usb-storage,1)
   $(call AddDepends/usb)
 endef
@@ -995,16 +995,16 @@ define KernelPackage/usb-storage-extras
 	CONFIG_USB_STORAGE_SDDR55 \
 	CONFIG_USB_STORAGE_USBAT
   FILES:= \
-	$(LINUX_DIR)/drivers/usb/storage/ums-alauda.ko \
-	$(LINUX_DIR)/drivers/usb/storage/ums-cypress.ko \
-	$(LINUX_DIR)/drivers/usb/storage/ums-datafab.ko \
-	$(LINUX_DIR)/drivers/usb/storage/ums-freecom.ko \
-	$(LINUX_DIR)/drivers/usb/storage/ums-isd200.ko \
-	$(LINUX_DIR)/drivers/usb/storage/ums-jumpshot.ko \
-	$(LINUX_DIR)/drivers/usb/storage/ums-karma.ko \
-	$(LINUX_DIR)/drivers/usb/storage/ums-sddr09.ko \
-	$(LINUX_DIR)/drivers/usb/storage/ums-sddr55.ko \
-	$(LINUX_DIR)/drivers/usb/storage/ums-usbat.ko
+	$(LINUX_OBJ_DIR)/drivers/usb/storage/ums-alauda.ko \
+	$(LINUX_OBJ_DIR)/drivers/usb/storage/ums-cypress.ko \
+	$(LINUX_OBJ_DIR)/drivers/usb/storage/ums-datafab.ko \
+	$(LINUX_OBJ_DIR)/drivers/usb/storage/ums-freecom.ko \
+	$(LINUX_OBJ_DIR)/drivers/usb/storage/ums-isd200.ko \
+	$(LINUX_OBJ_DIR)/drivers/usb/storage/ums-jumpshot.ko \
+	$(LINUX_OBJ_DIR)/drivers/usb/storage/ums-karma.ko \
+	$(LINUX_OBJ_DIR)/drivers/usb/storage/ums-sddr09.ko \
+	$(LINUX_OBJ_DIR)/drivers/usb/storage/ums-sddr55.ko \
+	$(LINUX_OBJ_DIR)/drivers/usb/storage/ums-usbat.ko
   AUTOLOAD:=$(call AutoProbe,ums-alauda ums-cypress ums-datafab \
 				ums-freecom ums-isd200 ums-jumpshot \
 				ums-karma ums-sddr09 ums-sddr55 ums-usbat)
@@ -1023,7 +1023,7 @@ define KernelPackage/usb-storage-uas
   TITLE:=USB Attached SCSI (UASP) support
   DEPENDS:=+kmod-usb-storage
   KCONFIG:=CONFIG_USB_UAS
-  FILES:=$(LINUX_DIR)/drivers/usb/storage/uas.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/storage/uas.ko
   AUTOLOAD:=$(call AutoProbe,uas,1)
 endef
 
@@ -1041,7 +1041,7 @@ define KernelPackage/usb-atm
   TITLE:=Support for ATM on USB bus
   DEPENDS:=+kmod-atm
   KCONFIG:=CONFIG_USB_ATM
-  FILES:=$(LINUX_DIR)/drivers/usb/atm/usbatm.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/atm/usbatm.ko
   AUTOLOAD:=$(call AutoProbe,usbatm)
   $(call AddDepends/usb)
 endef
@@ -1062,7 +1062,7 @@ endef
 define KernelPackage/usb-atm-speedtouch
   TITLE:=SpeedTouch USB ADSL modems support
   KCONFIG:=CONFIG_USB_SPEEDTOUCH
-  FILES:=$(LINUX_DIR)/drivers/usb/atm/speedtch.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/atm/speedtch.ko
   AUTOLOAD:=$(call AutoProbe,speedtch)
   $(call AddDepends/usb-atm)
 endef
@@ -1076,7 +1076,7 @@ $(eval $(call KernelPackage,usb-atm-speedtouch))
 
 define KernelPackage/usb-atm-ueagle
   TITLE:=Eagle 8051 based USB ADSL modems support
-  FILES:=$(LINUX_DIR)/drivers/usb/atm/ueagle-atm.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/atm/ueagle-atm.ko
   KCONFIG:=CONFIG_USB_UEAGLEATM
   AUTOLOAD:=$(call AutoProbe,ueagle-atm)
   $(call AddDepends/usb-atm)
@@ -1091,7 +1091,7 @@ $(eval $(call KernelPackage,usb-atm-ueagle))
 
 define KernelPackage/usb-atm-cxacru
   TITLE:=cxacru
-  FILES:=$(LINUX_DIR)/drivers/usb/atm/cxacru.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/atm/cxacru.ko
   KCONFIG:=CONFIG_USB_CXACRU
   AUTOLOAD:=$(call AutoProbe,cxacru)
   $(call AddDepends/usb-atm)
@@ -1110,7 +1110,7 @@ define KernelPackage/usb-net
   KCONFIG:=CONFIG_USB_USBNET \
 	CONFIG_USB_NET_DRIVERS
   AUTOLOAD:=$(call AutoProbe,usbnet)
-  FILES:=$(LINUX_DIR)/drivers/$(USBNET_DIR)/usbnet.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/$(USBNET_DIR)/usbnet.ko
   $(call AddDepends/usb)
 endef
 
@@ -1130,7 +1130,7 @@ endef
 define KernelPackage/usb-net-aqc111
   TITLE:=Support for USB-to-Ethernet Aquantia AQtion 5/2.5GbE
   KCONFIG:=CONFIG_USB_NET_AQC111
-  FILES:=$(LINUX_DIR)/drivers/$(USBNET_DIR)/aqc111.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/$(USBNET_DIR)/aqc111.ko
   AUTOLOAD:=$(call AutoProbe,aqc111)
   $(call AddDepends/usb-net)
 endef
@@ -1148,7 +1148,7 @@ define KernelPackage/usb-net-asix
 	+kmod-libphy +kmod-net-selftests +kmod-mdio-devres +kmod-phy-ax88796b \
 	+LINUX_6_1:kmod-phylink
   KCONFIG:=CONFIG_USB_NET_AX8817X
-  FILES:=$(LINUX_DIR)/drivers/$(USBNET_DIR)/asix.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/$(USBNET_DIR)/asix.ko
   AUTOLOAD:=$(call AutoProbe,asix)
   $(call AddDepends/usb-net)
 endef
@@ -1164,7 +1164,7 @@ define KernelPackage/usb-net-asix-ax88179
   TITLE:=Kernel module for USB-to-Gigabit-Ethernet Asix convertors
   DEPENDS:=+kmod-libphy
   KCONFIG:=CONFIG_USB_NET_AX88179_178A
-  FILES:=$(LINUX_DIR)/drivers/$(USBNET_DIR)/ax88179_178a.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/$(USBNET_DIR)/ax88179_178a.ko
   AUTOLOAD:=$(call AutoProbe,ax88179_178a)
   $(call AddDepends/usb-net)
 endef
@@ -1181,7 +1181,7 @@ define KernelPackage/usb-net-hso
   TITLE:=Kernel module for Option USB High Speed Mobile Devices
   KCONFIG:=CONFIG_USB_HSO
   FILES:= \
-	$(LINUX_DIR)/drivers/$(USBNET_DIR)/hso.ko
+	$(LINUX_OBJ_DIR)/drivers/$(USBNET_DIR)/hso.ko
   AUTOLOAD:=$(call AutoProbe,hso)
   $(call AddDepends/usb-net)
   $(call AddDepends/rfkill)
@@ -1197,7 +1197,7 @@ $(eval $(call KernelPackage,usb-net-hso))
 define KernelPackage/usb-net-kaweth
   TITLE:=Kernel module for USB-to-Ethernet Kaweth convertors
   KCONFIG:=CONFIG_USB_KAWETH
-  FILES:=$(LINUX_DIR)/drivers/$(USBNET_DIR)/kaweth.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/$(USBNET_DIR)/kaweth.ko
   AUTOLOAD:=$(call AutoProbe,kaweth)
   $(call AddDepends/usb-net)
 endef
@@ -1213,7 +1213,7 @@ define KernelPackage/usb-net-lan78xx
   TITLE:=USB-To-Ethernet Microchip LAN78XX convertors
   DEPENDS:=+kmod-fixed-phy +kmod-phy-microchip +PACKAGE_kmod-of-mdio:kmod-of-mdio
   KCONFIG:=CONFIG_USB_LAN78XX
-  FILES:=$(LINUX_DIR)/drivers/$(USBNET_DIR)/lan78xx.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/$(USBNET_DIR)/lan78xx.ko
   AUTOLOAD:=$(call AutoProbe,lan78xx)
   $(call AddDepends/usb-net)
 endef
@@ -1229,7 +1229,7 @@ $(eval $(call KernelPackage,usb-net-lan78xx))
 define KernelPackage/usb-net-pegasus
   TITLE:=Kernel module for USB-to-Ethernet Pegasus convertors
   KCONFIG:=CONFIG_USB_PEGASUS
-  FILES:=$(LINUX_DIR)/drivers/$(USBNET_DIR)/pegasus.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/$(USBNET_DIR)/pegasus.ko
   AUTOLOAD:=$(call AutoProbe,pegasus)
   $(call AddDepends/usb-net)
 endef
@@ -1244,7 +1244,7 @@ $(eval $(call KernelPackage,usb-net-pegasus))
 define KernelPackage/usb-net-mcs7830
   TITLE:=Kernel module for USB-to-Ethernet MCS7830 convertors
   KCONFIG:=CONFIG_USB_NET_MCS7830
-  FILES:=$(LINUX_DIR)/drivers/$(USBNET_DIR)/mcs7830.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/$(USBNET_DIR)/mcs7830.ko
   AUTOLOAD:=$(call AutoProbe,mcs7830)
   $(call AddDepends/usb-net)
 endef
@@ -1260,7 +1260,7 @@ define KernelPackage/usb-net-smsc75xx
   TITLE:=SMSC LAN75XX based USB 2.0 Gigabit ethernet devices
   DEPENDS:=+kmod-libphy
   KCONFIG:=CONFIG_USB_NET_SMSC75XX
-  FILES:=$(LINUX_DIR)/drivers/$(USBNET_DIR)/smsc75xx.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/$(USBNET_DIR)/smsc75xx.ko
   AUTOLOAD:=$(call AutoProbe,smsc75xx)
   $(call AddDepends/usb-net, +kmod-lib-crc16)
 endef
@@ -1276,7 +1276,7 @@ define KernelPackage/usb-net-smsc95xx
   TITLE:=SMSC LAN95XX based USB 2.0 10/100 ethernet devices
   DEPENDS:=+kmod-libphy +kmod-phy-smsc +LINUX_6_1:kmod-net-selftests
   KCONFIG:=CONFIG_USB_NET_SMSC95XX
-  FILES:=$(LINUX_DIR)/drivers/$(USBNET_DIR)/smsc95xx.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/$(USBNET_DIR)/smsc95xx.ko
   AUTOLOAD:=$(call AutoProbe,smsc95xx)
   $(call AddDepends/usb-net, +kmod-lib-crc16)
 endef
@@ -1291,7 +1291,7 @@ $(eval $(call KernelPackage,usb-net-smsc95xx))
 define KernelPackage/usb-net-dm9601-ether
   TITLE:=Support for DM9601 ethernet connections
   KCONFIG:=CONFIG_USB_NET_DM9601
-  FILES:=$(LINUX_DIR)/drivers/$(USBNET_DIR)/dm9601.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/$(USBNET_DIR)/dm9601.ko
   AUTOLOAD:=$(call AutoProbe,dm9601)
   $(call AddDepends/usb-net)
 endef
@@ -1305,7 +1305,7 @@ $(eval $(call KernelPackage,usb-net-dm9601-ether))
 define KernelPackage/usb-net-cdc-ether
   TITLE:=Support for cdc ethernet connections
   KCONFIG:=CONFIG_USB_NET_CDCETHER
-  FILES:=$(LINUX_DIR)/drivers/$(USBNET_DIR)/cdc_ether.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/$(USBNET_DIR)/cdc_ether.ko
   AUTOLOAD:=$(call AutoProbe,cdc_ether)
   $(call AddDepends/usb-net)
 endef
@@ -1320,7 +1320,7 @@ $(eval $(call KernelPackage,usb-net-cdc-ether))
 define KernelPackage/usb-net-cdc-eem
   TITLE:=Support for CDC EEM connections
   KCONFIG:=CONFIG_USB_NET_CDC_EEM
-  FILES:=$(LINUX_DIR)/drivers/$(USBNET_DIR)/cdc_eem.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/$(USBNET_DIR)/cdc_eem.ko
   AUTOLOAD:=$(call AutoProbe,cdc_eem)
   $(call AddDepends/usb-net)
 endef
@@ -1337,7 +1337,7 @@ define KernelPackage/usb-net-cdc-subset
   KCONFIG:= \
 	CONFIG_USB_NET_CDC_SUBSET \
 	CONFIG_USB_ARMLINUX
-  FILES:=$(LINUX_DIR)/drivers/$(USBNET_DIR)/cdc_subset.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/$(USBNET_DIR)/cdc_subset.ko
   AUTOLOAD:=$(call AutoProbe,cdc_subset)
   $(call AddDepends/usb-net)
 endef
@@ -1352,7 +1352,7 @@ $(eval $(call KernelPackage,usb-net-cdc-subset))
 define KernelPackage/usb-net-qmi-wwan
   TITLE:=QMI WWAN driver
   KCONFIG:=CONFIG_USB_NET_QMI_WWAN
-  FILES:= $(LINUX_DIR)/drivers/$(USBNET_DIR)/qmi_wwan.ko
+  FILES:= $(LINUX_OBJ_DIR)/drivers/$(USBNET_DIR)/qmi_wwan.ko
   AUTOLOAD:=$(call AutoProbe,qmi_wwan)
   $(call AddDepends/usb-net,+kmod-usb-wdm)
 endef
@@ -1367,7 +1367,7 @@ $(eval $(call KernelPackage,usb-net-qmi-wwan))
 define KernelPackage/usb-net-rtl8150
   TITLE:=Kernel module for USB-to-Ethernet Realtek convertors
   KCONFIG:=CONFIG_USB_RTL8150
-  FILES:=$(LINUX_DIR)/drivers/$(USBNET_DIR)/rtl8150.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/$(USBNET_DIR)/rtl8150.ko
   AUTOLOAD:=$(call AutoProbe,rtl8150)
   $(call AddDepends/usb-net)
 endef
@@ -1383,7 +1383,7 @@ define KernelPackage/usb-net-rtl8152
   TITLE:=Kernel module for USB-to-Ethernet Realtek convertors
   DEPENDS:=+r8152-firmware +kmod-crypto-sha256 +kmod-usb-net-cdc-ncm
   KCONFIG:=CONFIG_USB_RTL8152
-  FILES:=$(LINUX_DIR)/drivers/$(USBNET_DIR)/r8152.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/$(USBNET_DIR)/r8152.ko
   AUTOLOAD:=$(call AutoProbe,r8152)
   $(call AddDepends/usb-net)
 endef
@@ -1398,7 +1398,7 @@ $(eval $(call KernelPackage,usb-net-rtl8152))
 define KernelPackage/usb-net-sr9700
   TITLE:=Support for CoreChip SR9700 ethernet devices
   KCONFIG:=CONFIG_USB_NET_SR9700
-  FILES:=$(LINUX_DIR)/drivers/$(USBNET_DIR)/sr9700.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/$(USBNET_DIR)/sr9700.ko
   AUTOLOAD:=$(call AutoProbe,sr9700)
   $(call AddDepends/usb-net)
 endef
@@ -1413,7 +1413,7 @@ $(eval $(call KernelPackage,usb-net-sr9700))
 define KernelPackage/usb-net-rndis
   TITLE:=Support for RNDIS connections
   KCONFIG:=CONFIG_USB_NET_RNDIS_HOST
-  FILES:= $(LINUX_DIR)/drivers/$(USBNET_DIR)/rndis_host.ko
+  FILES:= $(LINUX_OBJ_DIR)/drivers/$(USBNET_DIR)/rndis_host.ko
   AUTOLOAD:=$(call AutoProbe,rndis_host)
   $(call AddDepends/usb-net,+kmod-usb-net-cdc-ether)
 endef
@@ -1430,7 +1430,7 @@ define KernelPackage/usb-net-cdc-mbim
   TITLE:=Kernel module for MBIM Devices
   KCONFIG:=CONFIG_USB_NET_CDC_MBIM
   FILES:= \
-   $(LINUX_DIR)/drivers/$(USBNET_DIR)/cdc_mbim.ko
+   $(LINUX_OBJ_DIR)/drivers/$(USBNET_DIR)/cdc_mbim.ko
   AUTOLOAD:=$(call AutoProbe,cdc_mbim)
   $(call AddDepends/usb-net,+kmod-usb-wdm +kmod-usb-net-cdc-ncm)
 endef
@@ -1445,7 +1445,7 @@ $(eval $(call KernelPackage,usb-net-cdc-mbim))
 define KernelPackage/usb-net-cdc-ncm
   TITLE:=Support for CDC NCM connections
   KCONFIG:=CONFIG_USB_NET_CDC_NCM
-  FILES:= $(LINUX_DIR)/drivers/$(USBNET_DIR)/cdc_ncm.ko
+  FILES:= $(LINUX_OBJ_DIR)/drivers/$(USBNET_DIR)/cdc_ncm.ko
   AUTOLOAD:=$(call AutoProbe,cdc_ncm)
   $(call AddDepends/usb-net,+kmod-usb-net-cdc-ether)
 endef
@@ -1460,7 +1460,7 @@ $(eval $(call KernelPackage,usb-net-cdc-ncm))
 define KernelPackage/usb-net-huawei-cdc-ncm
   TITLE:=Support for Huawei CDC NCM connections
   KCONFIG:=CONFIG_USB_NET_HUAWEI_CDC_NCM
-  FILES:= $(LINUX_DIR)/drivers/$(USBNET_DIR)/huawei_cdc_ncm.ko
+  FILES:= $(LINUX_OBJ_DIR)/drivers/$(USBNET_DIR)/huawei_cdc_ncm.ko
   AUTOLOAD:=$(call AutoProbe,huawei_cdc_ncm)
   $(call AddDepends/usb-net,+kmod-usb-net-cdc-ncm +kmod-usb-wdm)
 endef
@@ -1475,7 +1475,7 @@ $(eval $(call KernelPackage,usb-net-huawei-cdc-ncm))
 define KernelPackage/usb-net-sierrawireless
   TITLE:=Support for Sierra Wireless devices
   KCONFIG:=CONFIG_USB_SIERRA_NET
-  FILES:=$(LINUX_DIR)/drivers/net/usb/sierra_net.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/usb/sierra_net.ko
   AUTOLOAD:=$(call AutoProbe,sierra_net)
   $(call AddDepends/usb-net)
 endef
@@ -1490,7 +1490,7 @@ $(eval $(call KernelPackage,usb-net-sierrawireless))
 define KernelPackage/usb-net-ipheth
   TITLE:=Apple iPhone USB Ethernet driver
   KCONFIG:=CONFIG_USB_IPHETH
-  FILES:=$(LINUX_DIR)/drivers/net/usb/ipheth.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/usb/ipheth.ko
   AUTOLOAD:=$(call AutoProbe,ipheth)
   $(call AddDepends/usb-net)
 endef
@@ -1505,7 +1505,7 @@ $(eval $(call KernelPackage,usb-net-ipheth))
 define KernelPackage/usb-net-kalmia
   TITLE:=Samsung Kalmia based LTE USB modem
   KCONFIG:=CONFIG_USB_NET_KALMIA
-  FILES:=$(LINUX_DIR)/drivers/net/usb/kalmia.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/usb/kalmia.ko
   AUTOLOAD:=$(call AutoProbe,kalmia)
   $(call AddDepends/usb-net)
 endef
@@ -1519,7 +1519,7 @@ $(eval $(call KernelPackage,usb-net-kalmia))
 define KernelPackage/usb-net-pl
   TITLE:=Prolific PL-2301/2302/25A1 based cables
   KCONFIG:=CONFIG_USB_NET_PLUSB
-  FILES:=$(LINUX_DIR)/drivers/net/usb/plusb.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/usb/plusb.ko
   AUTOLOAD:=$(call AutoProbe,plusb)
   $(call AddDepends/usb-net)
 endef
@@ -1534,7 +1534,7 @@ define KernelPackage/usb-hid
   TITLE:=Support for USB Human Input Devices
   KCONFIG:=CONFIG_HID_SUPPORT=y CONFIG_USB_HID CONFIG_USB_HIDDEV=y
   DEPENDS:=+kmod-hid +kmod-hid-generic +kmod-input-evdev
-  FILES:=$(LINUX_DIR)/drivers/$(USBHID_DIR)/usbhid.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/$(USBHID_DIR)/usbhid.ko
   AUTOLOAD:=$(call AutoProbe,usbhid)
   $(call AddDepends/usb)
 endef
@@ -1551,7 +1551,7 @@ define KernelPackage/usb-hid-cp2112
   TITLE:=Silicon Labs CP2112 HID USB to SMBus Master Bridge
   KCONFIG:=CONFIG_HID_CP2112
   DEPENDS:=@GPIO_SUPPORT +kmod-usb-hid +kmod-i2c-core
-  FILES:=$(LINUX_DIR)/drivers/hid/hid-cp2112.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/hid/hid-cp2112.ko
   AUTOLOAD:=$(call AutoProbe,hid-cp2112)
 endef
 
@@ -1568,7 +1568,7 @@ define KernelPackage/usb-hid-mcp2221
   TITLE:=Microchip USB 2.0 to I2C/UART Protocol Converter with GPIO
   KCONFIG:=CONFIG_HID_MCP2221
   DEPENDS:=@GPIO_SUPPORT +kmod-usb-hid +kmod-i2c-core
-  FILES:=$(LINUX_DIR)/drivers/hid/hid-mcp2221.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/hid/hid-mcp2221.ko
   AUTOLOAD:=$(call AutoProbe,hid-mcp2221)
 endef
 
@@ -1584,7 +1584,7 @@ define KernelPackage/usb-yealink
   TITLE:=USB Yealink VOIP phone
   DEPENDS:=+kmod-input-evdev
   KCONFIG:=CONFIG_USB_YEALINK CONFIG_INPUT_YEALINK CONFIG_INPUT=m CONFIG_INPUT_MISC=y
-  FILES:=$(LINUX_DIR)/drivers/$(USBINPUT_DIR)/yealink.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/$(USBINPUT_DIR)/yealink.ko
   AUTOLOAD:=$(call AutoProbe,yealink)
   $(call AddDepends/usb)
 endef
@@ -1600,7 +1600,7 @@ define KernelPackage/usb-cm109
   TITLE:=Support for CM109 device
   DEPENDS:=+kmod-input-evdev
   KCONFIG:=CONFIG_USB_CM109 CONFIG_INPUT_CM109 CONFIG_INPUT=m CONFIG_INPUT_MISC=y
-  FILES:=$(LINUX_DIR)/drivers/$(USBINPUT_DIR)/cm109.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/$(USBINPUT_DIR)/cm109.ko
   AUTOLOAD:=$(call AutoProbe,cm109)
   $(call AddDepends/usb)
 endef
@@ -1616,7 +1616,7 @@ define KernelPackage/usb-test
   TITLE:=USB Testing Driver
   DEPENDS:=@DEVEL
   KCONFIG:=CONFIG_USB_TEST
-  FILES:=$(LINUX_DIR)/drivers/usb/misc/usbtest.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/misc/usbtest.ko
   $(call AddDepends/usb)
 endef
 
@@ -1632,7 +1632,7 @@ define KernelPackage/usbip
   KCONFIG:= \
 	CONFIG_USBIP_CORE \
 	CONFIG_USBIP_DEBUG=n
-  FILES:=$(LINUX_DIR)/drivers/usb/usbip/usbip-core.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/usbip/usbip-core.ko
   AUTOLOAD:=$(call AutoProbe,usbip-core)
   $(call AddDepends/usb)
 endef
@@ -1644,7 +1644,7 @@ define KernelPackage/usbip-client
   TITLE := USB-over-IP client driver
   DEPENDS := +kmod-usbip
   KCONFIG := CONFIG_USBIP_VHCI_HCD
-  FILES :=$(LINUX_DIR)/drivers/usb/usbip/vhci-hcd.ko
+  FILES :=$(LINUX_OBJ_DIR)/drivers/usb/usbip/vhci-hcd.ko
   AUTOLOAD := $(call AutoProbe,vhci-hcd)
   $(call AddDepends/usb)
 endef
@@ -1657,7 +1657,7 @@ $(call KernelPackage/usbip/Default)
   TITLE := USB-over-IP host driver
   DEPENDS := +kmod-usbip
   KCONFIG := CONFIG_USBIP_HOST
-  FILES :=$(LINUX_DIR)/drivers/usb/usbip/usbip-host.ko
+  FILES :=$(LINUX_OBJ_DIR)/drivers/usb/usbip/usbip-host.ko
   AUTOLOAD := $(call AutoProbe,usbip-host)
   $(call AddDepends/usb)
 endef
@@ -1675,9 +1675,9 @@ define KernelPackage/usb-chipidea
 	CONFIG_USB_CHIPIDEA_UDC=y \
 	CONFIG_USB_CHIPIDEA_DEBUG=y
   FILES:= \
-	$(LINUX_DIR)/drivers/extcon/extcon-core.ko \
-	$(LINUX_DIR)/drivers/usb/chipidea/ci_hdrc.ko \
-	$(LINUX_DIR)/drivers/usb/common/ulpi.ko
+	$(LINUX_OBJ_DIR)/drivers/extcon/extcon-core.ko \
+	$(LINUX_OBJ_DIR)/drivers/usb/chipidea/ci_hdrc.ko \
+	$(LINUX_OBJ_DIR)/drivers/usb/common/ulpi.ko
   AUTOLOAD:=$(call AutoLoad,39,ci_hdrc,1)
   $(call AddDepends/usb)
 endef
@@ -1699,8 +1699,8 @@ define KernelPackage/usb-chipidea2
 	CONFIG_USB_CHIPIDEA_UDC=y \
 	CONFIG_USB_CHIPIDEA_DEBUG=y
   FILES:= \
-	$(LINUX_DIR)/drivers/extcon/extcon-core.ko \
-	$(LINUX_DIR)/drivers/usb/chipidea/ci_hdrc_usb2.ko
+	$(LINUX_OBJ_DIR)/drivers/extcon/extcon-core.ko \
+	$(LINUX_OBJ_DIR)/drivers/usb/chipidea/ci_hdrc_usb2.ko
   AUTOLOAD:=$(call AutoLoad,39,ci_hdrc_usb2,1)
   $(call AddDepends/usb)
 endef
@@ -1716,7 +1716,7 @@ define KernelPackage/usbmon
   TITLE:=USB traffic monitor
   KCONFIG:=CONFIG_USB_MON
   $(call AddDepends/usb)
-  FILES:=$(LINUX_DIR)/drivers/usb/mon/usbmon.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/mon/usbmon.ko
   AUTOLOAD:=$(call AutoProbe,usbmon)
 endef
 
@@ -1727,8 +1727,8 @@ endef
 $(eval $(call KernelPackage,usbmon))
 
 XHCI_MODULES := xhci-pci xhci-plat-hcd
-XHCI_FILES := $(wildcard $(patsubst %,$(LINUX_DIR)/drivers/usb/host/%.ko,$(XHCI_MODULES)))
-XHCI_AUTOLOAD := $(patsubst $(LINUX_DIR)/drivers/usb/host/%.ko,%,$(XHCI_FILES))
+XHCI_FILES := $(wildcard $(patsubst %,$(LINUX_OBJ_DIR)/drivers/usb/host/%.ko,$(XHCI_MODULES)))
+XHCI_AUTOLOAD := $(patsubst $(LINUX_OBJ_DIR)/drivers/usb/host/%.ko,%,$(XHCI_FILES))
 
 define KernelPackage/usb3
   TITLE:=Support for USB3 controllers
@@ -1763,7 +1763,7 @@ define KernelPackage/usb-net2280
 	CONFIG_USB_PCI=y \
 	CONFIG_USB_NET2280
   DEPENDS:=@PCI_SUPPORT +kmod-usb-gadget
-  FILES:=$(LINUX_DIR)/drivers/usb/gadget/udc/net2280.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/gadget/udc/net2280.ko
   AUTOLOAD:=$(call AutoLoad,46,net2280)
   $(call AddDepends/usb)
 endef
@@ -1778,7 +1778,7 @@ define KernelPackage/usb-roles
   TITLE:=USB Role Switch Library Module
   KCONFIG:=CONFIG_USB_ROLE_SWITCH
   HIDDEN:=1
-  FILES:=$(LINUX_DIR)/drivers/usb/roles/roles.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/roles/roles.ko
   $(call AddDepends/usb)
 endef
 
@@ -1795,7 +1795,7 @@ define KernelPackage/usb-xhci-hcd
 	  CONFIG_USB_XHCI_HCD \
 	  CONFIG_USB_XHCI_HCD_DEBUGGING=n
   HIDDEN:=1
-  FILES:=$(LINUX_DIR)/drivers/usb/host/xhci-hcd.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/host/xhci-hcd.ko
   AUTOLOAD:=$(call AutoLoad,54,xhci-hcd,1)
   $(call AddDepends/usb)
 endef
@@ -1814,7 +1814,7 @@ define KernelPackage/usb-xhci-mtk
   KCONFIG:=CONFIG_USB_XHCI_MTK
   HIDDEN:=1
   FILES:= \
-	 $(LINUX_DIR)/drivers/usb/host/xhci-mtk-hcd.ko
+	 $(LINUX_OBJ_DIR)/drivers/usb/host/xhci-mtk-hcd.ko
   AUTOLOAD:=$(call AutoLoad,54,xhci-mtk-hcd,1)
   $(call AddDepends/usb)
 endef
@@ -1830,7 +1830,7 @@ define KernelPackage/usb-xhci-pci-renesas
   TITLE:=Support for additional Renesas xHCI controller with firmware
   KCONFIG:=CONFIG_USB_XHCI_PCI_RENESAS
   HIDDEN:=1
-  FILES:=$(LINUX_DIR)/drivers/usb/host/xhci-pci-renesas.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/host/xhci-pci-renesas.ko
   AUTOLOAD:=$(call AutoLoad,54,xhci-pci-renesas,1)
   $(call AddDepends/usb)
 endef
@@ -1848,7 +1848,7 @@ define KernelPackage/chaoskey
   TITLE:=Chaoskey hardware RNG support
   DEPENDS:=+kmod-random-core
   KCONFIG:=CONFIG_USB_CHAOSKEY
-  FILES:=$(LINUX_DIR)/drivers/usb/misc/chaoskey.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/misc/chaoskey.ko
   AUTOLOAD:=$(call AutoProbe,chaoskey)
   $(call AddDepends/usb)
 endef
diff --git a/package/kernel/linux/modules/video.mk b/package/kernel/linux/modules/video.mk
index 6ae2bf5104..fbecb11ce2 100644
--- a/package/kernel/linux/modules/video.mk
+++ b/package/kernel/linux/modules/video.mk
@@ -23,8 +23,8 @@ define KernelPackage/acpi-video
   HIDDEN:=1
   KCONFIG:=CONFIG_ACPI_VIDEO \
 	CONFIG_ACPI_WMI
-  FILES:=$(LINUX_DIR)/drivers/acpi/video.ko \
-	$(LINUX_DIR)/drivers/platform/x86/wmi.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/acpi/video.ko \
+	$(LINUX_OBJ_DIR)/drivers/platform/x86/wmi.ko
   AUTOLOAD:=$(call AutoProbe,wmi video)
 endef
 
@@ -47,7 +47,7 @@ define KernelPackage/backlight
 		CONFIG_BACKLIGHT_ADP8870=n \
 		CONFIG_BACKLIGHT_OT200=n \
 		CONFIG_BACKLIGHT_PM8941_WLED=n
-	FILES:=$(LINUX_DIR)/drivers/video/backlight/backlight.ko
+	FILES:=$(LINUX_OBJ_DIR)/drivers/video/backlight/backlight.ko
 	AUTOLOAD:=$(call AutoProbe,video backlight)
 endef
 
@@ -62,7 +62,7 @@ define KernelPackage/backlight-pwm
 	TITLE:=PWM Backlight support
 	DEPENDS:=+kmod-backlight
 	KCONFIG:=CONFIG_BACKLIGHT_PWM
-	FILES:=$(LINUX_DIR)/drivers/video/backlight/pwm_bl.ko
+	FILES:=$(LINUX_OBJ_DIR)/drivers/video/backlight/pwm_bl.ko
 	AUTOLOAD:=$(call AutoProbe,video pwm_bl)
 endef
 
@@ -100,8 +100,8 @@ define KernelPackage/fb
 	CONFIG_CONSOLE_TRANSLATIONS=y \
 	CONFIG_VT_CONSOLE=y \
 	CONFIG_VT_HW_CONSOLE_BINDING=y
-  FILES:=$(LINUX_DIR)/drivers/video/fbdev/core/fb.ko \
-	$(LINUX_DIR)/lib/fonts/font.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/video/fbdev/core/fb.ko \
+	$(LINUX_OBJ_DIR)/lib/fonts/font.ko
   AUTOLOAD:=$(call AutoLoad,06,fb font)
 endef
 
@@ -110,7 +110,7 @@ define KernelPackage/fb/description
 endef
 
 define KernelPackage/fb/x86
-  FILES+=$(LINUX_DIR)/arch/x86/video/fbdev.ko
+  FILES+=$(LINUX_OBJ_DIR)/arch/x86/video/fbdev.ko
   AUTOLOAD:=$(call AutoLoad,06,fbdev fb font)
 endef
 
@@ -122,7 +122,7 @@ define KernelPackage/fb-cfb-fillrect
   TITLE:=Framebuffer software rectangle filling support
   DEPENDS:=+kmod-fb
   KCONFIG:=CONFIG_FB_CFB_FILLRECT
-  FILES:=$(LINUX_DIR)/drivers/video/fbdev/core/cfbfillrect.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/video/fbdev/core/cfbfillrect.ko
   AUTOLOAD:=$(call AutoLoad,07,cfbfillrect)
 endef
 
@@ -138,7 +138,7 @@ define KernelPackage/fb-cfb-copyarea
   TITLE:=Framebuffer software copy area support
   DEPENDS:=+kmod-fb
   KCONFIG:=CONFIG_FB_CFB_COPYAREA
-  FILES:=$(LINUX_DIR)/drivers/video/fbdev/core/cfbcopyarea.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/video/fbdev/core/cfbcopyarea.ko
   AUTOLOAD:=$(call AutoLoad,07,cfbcopyarea)
 endef
 
@@ -153,7 +153,7 @@ define KernelPackage/fb-cfb-imgblt
   TITLE:=Framebuffer software image blit support
   DEPENDS:=+kmod-fb
   KCONFIG:=CONFIG_FB_CFB_IMAGEBLIT
-  FILES:=$(LINUX_DIR)/drivers/video/fbdev/core/cfbimgblt.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/video/fbdev/core/cfbimgblt.ko
   AUTOLOAD:=$(call AutoLoad,07,cfbimgblt)
 endef
 
@@ -169,7 +169,7 @@ define KernelPackage/fb-sys-fops
   TITLE:=Framebuffer software sys ops support
   DEPENDS:=+kmod-fb
   KCONFIG:=CONFIG_FB_SYS_FOPS
-  FILES:=$(LINUX_DIR)/drivers/video/fbdev/core/fb_sys_fops.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/video/fbdev/core/fb_sys_fops.ko
   AUTOLOAD:=$(call AutoLoad,07,fb_sys_fops)
 endef
 
@@ -189,9 +189,9 @@ define KernelPackage/fb-sys-ram
 	CONFIG_FB_SYS_FILLRECT \
 	CONFIG_FB_SYS_IMAGEBLIT
   FILES:= \
-	$(LINUX_DIR)/drivers/video/fbdev/core/syscopyarea.ko \
-	$(LINUX_DIR)/drivers/video/fbdev/core/sysfillrect.ko \
-	$(LINUX_DIR)/drivers/video/fbdev/core/sysimgblt.ko
+	$(LINUX_OBJ_DIR)/drivers/video/fbdev/core/syscopyarea.ko \
+	$(LINUX_OBJ_DIR)/drivers/video/fbdev/core/sysfillrect.ko \
+	$(LINUX_OBJ_DIR)/drivers/video/fbdev/core/sysimgblt.ko
   AUTOLOAD:=$(call AutoLoad,07,syscopyarea sysfillrect sysimgblt)
 endef
 
@@ -213,7 +213,7 @@ define KernelPackage/fb-tft
        CONFIG_FB_DEFERRED_IO=y \
        CONFIG_FB_TFT
   FILES:= \
-       $(LINUX_DIR)/drivers/staging/fbtft/fbtft.ko
+       $(LINUX_OBJ_DIR)/drivers/staging/fbtft/fbtft.ko
   AUTOLOAD:=$(call AutoLoad,08,fbtft)
 endef
 
@@ -229,7 +229,7 @@ define KernelPackage/fb-tft-ili9486
   TITLE:=FB driver for the ILI9486 LCD Controller
   DEPENDS:=+kmod-fb-tft
   KCONFIG:=CONFIG_FB_TFT_ILI9486
-  FILES:=$(LINUX_DIR)/drivers/staging/fbtft/fb_ili9486.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/staging/fbtft/fb_ili9486.ko
   AUTOLOAD:=$(call AutoLoad,09,fb_ili9486)
 endef
 
@@ -248,8 +248,8 @@ define KernelPackage/drm
 	+kmod-fb
   KCONFIG:=CONFIG_DRM
   FILES:= \
-	$(LINUX_DIR)/drivers/gpu/drm/drm.ko \
-	$(LINUX_DIR)/drivers/gpu/drm/drm_panel_orientation_quirks.ko
+	$(LINUX_OBJ_DIR)/drivers/gpu/drm/drm.ko \
+	$(LINUX_OBJ_DIR)/drivers/gpu/drm/drm_panel_orientation_quirks.ko
   AUTOLOAD:=$(call AutoLoad,05,drm)
 endef
 
@@ -264,7 +264,7 @@ define KernelPackage/drm-buddy
   TITLE:=A page based buddy allocator
   DEPENDS:=@DISPLAY_SUPPORT +kmod-drm @LINUX_6_1
   KCONFIG:=CONFIG_DRM_BUDDY
-  FILES:= $(LINUX_DIR)/drivers/gpu/drm/drm_buddy.ko
+  FILES:= $(LINUX_OBJ_DIR)/drivers/gpu/drm/drm_buddy.ko
   AUTOLOAD:=$(call AutoProbe,drm_buddy)
 endef
 
@@ -279,7 +279,7 @@ define KernelPackage/drm-display-helper
   TITLE:=DRM helpers for display adapters drivers
   DEPENDS:=@DISPLAY_SUPPORT +kmod-drm-kms-helper @LINUX_6_1
   KCONFIG:=CONFIG_DRM_DISPLAY_HELPER
-  FILES:=$(LINUX_DIR)/drivers/gpu/drm/display/drm_display_helper.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/gpu/drm/display/drm_display_helper.ko
   AUTOLOAD:=$(call AutoProbe,drm_display_helper)
 endef
 
@@ -294,7 +294,7 @@ define KernelPackage/drm-ttm
   TITLE:=GPU memory management subsystem
   DEPENDS:=@DISPLAY_SUPPORT +kmod-drm
   KCONFIG:=CONFIG_DRM_TTM
-  FILES:=$(LINUX_DIR)/drivers/gpu/drm/ttm/ttm.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/gpu/drm/ttm/ttm.ko
   AUTOLOAD:=$(call AutoProbe,ttm)
 endef
 
@@ -312,7 +312,7 @@ define KernelPackage/drm-ttm-helper
   HIDDEN:=1
   DEPENDS:=@DISPLAY_SUPPORT +kmod-drm-ttm
   KCONFIG:=CONFIG_DRM_TTM_HELPER
-  FILES:=$(LINUX_DIR)/drivers/gpu/drm/drm_ttm_helper.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/gpu/drm/drm_ttm_helper.ko
   AUTOLOAD:=$(call AutoProbe,drm_ttm_helper)
 endef
 
@@ -327,7 +327,7 @@ define KernelPackage/drm-kms-helper
   KCONFIG:= \
     CONFIG_DRM_KMS_HELPER \
     CONFIG_DRM_KMS_FB_HELPER=y
-  FILES:=$(LINUX_DIR)/drivers/gpu/drm/drm_kms_helper.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/gpu/drm/drm_kms_helper.ko
   AUTOLOAD:=$(call AutoProbe,drm_kms_helper)
 endef
 
@@ -349,8 +349,8 @@ define KernelPackage/drm-amdgpu
 	CONFIG_DRM_AMDGPU_CIK=y \
 	CONFIG_DRM_AMD_DC=y \
 	CONFIG_DEBUG_KERNEL_DC=n
-  FILES:=$(LINUX_DIR)/drivers/gpu/drm/amd/amdgpu/amdgpu.ko \
-	$(LINUX_DIR)/drivers/gpu/drm/scheduler/gpu-sched.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/gpu/drm/amd/amdgpu/amdgpu.ko \
+	$(LINUX_OBJ_DIR)/drivers/gpu/drm/scheduler/gpu-sched.ko
   AUTOLOAD:=$(call AutoProbe,amdgpu)
 endef
 
@@ -380,8 +380,8 @@ define KernelPackage/drm-imx
 	CONFIG_DRM_IMX_LDB=n \
 	CONFIG_DRM_IMX_HDMI=n
   FILES:= \
-	$(LINUX_DIR)/drivers/gpu/drm/imx/imxdrm.ko \
-	$(LINUX_DIR)/drivers/gpu/ipu-v3/imx-ipu-v3.ko
+	$(LINUX_OBJ_DIR)/drivers/gpu/drm/imx/imxdrm.ko \
+	$(LINUX_OBJ_DIR)/drivers/gpu/ipu-v3/imx-ipu-v3.ko
   AUTOLOAD:=$(call AutoLoad,08,imxdrm imx-ipu-v3 imx-ipuv3-crtc)
 endef
 
@@ -399,9 +399,9 @@ define KernelPackage/drm-imx-hdmi
 	CONFIG_DRM_DW_HDMI_AHB_AUDIO \
 	CONFIG_DRM_DW_HDMI_I2S_AUDIO
   FILES:= \
-	$(LINUX_DIR)/drivers/gpu/drm/bridge/synopsys/dw-hdmi.ko \
-	$(LINUX_DIR)/drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.ko \
-	$(LINUX_DIR)/drivers/gpu/drm/imx/dw_hdmi-imx.ko
+	$(LINUX_OBJ_DIR)/drivers/gpu/drm/bridge/synopsys/dw-hdmi.ko \
+	$(LINUX_OBJ_DIR)/drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.ko \
+	$(LINUX_OBJ_DIR)/drivers/gpu/drm/imx/dw_hdmi-imx.ko
   AUTOLOAD:=$(call AutoLoad,08,dw-hdmi dw-hdmi-ahb-audio.ko dw_hdmi-imx)
 endef
 
@@ -425,9 +425,9 @@ define KernelPackage/drm-imx-ldb
 	CONFIG_DRM_PANEL_LVDS=n \
 	CONFIG_DRM_PANEL_S6E8AA0=n \
 	CONFIG_DRM_PANEL_SITRONIX_ST7789V=n
-  FILES:=$(LINUX_DIR)/drivers/gpu/drm/imx/imx-ldb.ko \
-	$(LINUX_DIR)/drivers/gpu/drm/panel/panel-simple.ko \
-	$(LINUX_DIR)/drivers/gpu/drm/drm_dp_aux_bus.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/gpu/drm/imx/imx-ldb.ko \
+	$(LINUX_OBJ_DIR)/drivers/gpu/drm/panel/panel-simple.ko \
+	$(LINUX_OBJ_DIR)/drivers/gpu/drm/drm_dp_aux_bus.ko
   AUTOLOAD:=$(call AutoLoad,08,imx-ldb)
 endef
 
@@ -444,7 +444,7 @@ define KernelPackage/drm-radeon
 	+kmod-drm-ttm +kmod-drm-ttm-helper +kmod-i2c-algo-bit +radeon-firmware \
 	+LINUX_6_1:kmod-drm-display-helper +LINUX_6_1:kmod-acpi-video
   KCONFIG:=CONFIG_DRM_RADEON
-  FILES:=$(LINUX_DIR)/drivers/gpu/drm/radeon/radeon.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/gpu/drm/radeon/radeon.ko
   AUTOLOAD:=$(call AutoProbe,radeon)
 endef
 
@@ -468,7 +468,7 @@ define KernelPackage/video-core
 	CONFIG_VIDEO_DEV \
 	CONFIG_V4L_PLATFORM_DRIVERS=y
   FILES:= \
-	$(LINUX_DIR)/drivers/media/$(V4L2_DIR)/videodev.ko
+	$(LINUX_OBJ_DIR)/drivers/media/$(V4L2_DIR)/videodev.ko
   AUTOLOAD:=$(call AutoLoad,60, videodev v4l2-common)
 endef
 
@@ -503,10 +503,10 @@ define KernelPackage/video-videobuf2
 	CONFIG_VIDEOBUF2_MEMOPS \
 	CONFIG_VIDEOBUF2_VMALLOC
   FILES:= \
-	$(LINUX_DIR)/drivers/media/common/videobuf2/videobuf2-common.ko \
-	$(LINUX_DIR)/drivers/media/common/videobuf2/videobuf2-v4l2.ko \
-	$(LINUX_DIR)/drivers/media/common/videobuf2/videobuf2-memops.ko \
-	$(LINUX_DIR)/drivers/media/common/videobuf2/videobuf2-vmalloc.ko
+	$(LINUX_OBJ_DIR)/drivers/media/common/videobuf2/videobuf2-common.ko \
+	$(LINUX_OBJ_DIR)/drivers/media/common/videobuf2/videobuf2-v4l2.ko \
+	$(LINUX_OBJ_DIR)/drivers/media/common/videobuf2/videobuf2-memops.ko \
+	$(LINUX_OBJ_DIR)/drivers/media/common/videobuf2/videobuf2-vmalloc.ko
   AUTOLOAD:=$(call AutoLoad,65,videobuf2-core videobuf-v4l2 videobuf2-memops videobuf2-vmalloc)
   $(call AddDepends/video)
 endef
@@ -522,7 +522,7 @@ define KernelPackage/video-cpia2
   TITLE:=CPIA2 video driver
   DEPENDS:=@USB_SUPPORT +kmod-usb-core
   KCONFIG:=CONFIG_VIDEO_CPIA2
-  FILES:=$(LINUX_DIR)/drivers/media/$(V4L2_USB_DIR)/cpia2/cpia2.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/media/$(V4L2_USB_DIR)/cpia2/cpia2.ko
   AUTOLOAD:=$(call AutoProbe,cpia2)
   $(call AddDepends/camera)
 endef
@@ -540,7 +540,7 @@ define KernelPackage/video-pwc
   KCONFIG:= \
 	CONFIG_USB_PWC \
 	CONFIG_USB_PWC_DEBUG=n
-  FILES:=$(LINUX_DIR)/drivers/media/$(V4L2_USB_DIR)/pwc/pwc.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/media/$(V4L2_USB_DIR)/pwc/pwc.ko
   AUTOLOAD:=$(call AutoProbe,pwc)
   $(call AddDepends/camera)
 endef
@@ -556,7 +556,7 @@ define KernelPackage/video-uvc
   TITLE:=USB Video Class (UVC) support
   DEPENDS:=@USB_SUPPORT +kmod-usb-core +kmod-video-videobuf2 +kmod-input-core
   KCONFIG:= CONFIG_USB_VIDEO_CLASS
-  FILES:=$(LINUX_DIR)/drivers/media/$(V4L2_USB_DIR)/uvc/uvcvideo.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/media/$(V4L2_USB_DIR)/uvc/uvcvideo.ko
   AUTOLOAD:=$(call AutoProbe,uvcvideo)
   $(call AddDepends/camera)
 endef
@@ -573,7 +573,7 @@ define KernelPackage/video-gspca-core
   TITLE:=GSPCA webcam core support framework
   DEPENDS:=@USB_SUPPORT +kmod-usb-core +kmod-input-core +kmod-video-videobuf2
   KCONFIG:=CONFIG_USB_GSPCA
-  FILES:=$(LINUX_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_main.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_main.ko
   AUTOLOAD:=$(call AutoProbe,gspca_main)
   $(call AddDepends/camera)
 endef
@@ -595,7 +595,7 @@ endef
 define KernelPackage/video-gspca-conex
   TITLE:=conex webcam support
   KCONFIG:=CONFIG_USB_GSPCA_CONEX
-  FILES:=$(LINUX_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_conex.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_conex.ko
   AUTOLOAD:=$(call AutoProbe,gspca_conex)
   $(call AddDepends/camera-gspca)
 endef
@@ -610,7 +610,7 @@ $(eval $(call KernelPackage,video-gspca-conex))
 define KernelPackage/video-gspca-etoms
   TITLE:=etoms webcam support
   KCONFIG:=CONFIG_USB_GSPCA_ETOMS
-  FILES:=$(LINUX_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_etoms.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_etoms.ko
   AUTOLOAD:=$(call AutoProbe,gspca_etoms)
   $(call AddDepends/camera-gspca)
 endef
@@ -625,7 +625,7 @@ $(eval $(call KernelPackage,video-gspca-etoms))
 define KernelPackage/video-gspca-finepix
   TITLE:=finepix webcam support
   KCONFIG:=CONFIG_USB_GSPCA_FINEPIX
-  FILES:=$(LINUX_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_finepix.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_finepix.ko
   AUTOLOAD:=$(call AutoProbe,gspca_finepix)
   $(call AddDepends/camera-gspca)
 endef
@@ -640,7 +640,7 @@ $(eval $(call KernelPackage,video-gspca-finepix))
 define KernelPackage/video-gspca-mars
   TITLE:=mars webcam support
   KCONFIG:=CONFIG_USB_GSPCA_MARS
-  FILES:=$(LINUX_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_mars.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_mars.ko
   AUTOLOAD:=$(call AutoProbe,gspca_mars)
   $(call AddDepends/camera-gspca)
 endef
@@ -655,7 +655,7 @@ $(eval $(call KernelPackage,video-gspca-mars))
 define KernelPackage/video-gspca-mr97310a
   TITLE:=mr97310a webcam support
   KCONFIG:=CONFIG_USB_GSPCA_MR97310A
-  FILES:=$(LINUX_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_mr97310a.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_mr97310a.ko
   AUTOLOAD:=$(call AutoProbe,gspca_mr97310a)
   $(call AddDepends/camera-gspca)
 endef
@@ -670,7 +670,7 @@ $(eval $(call KernelPackage,video-gspca-mr97310a))
 define KernelPackage/video-gspca-ov519
   TITLE:=ov519 webcam support
   KCONFIG:=CONFIG_USB_GSPCA_OV519
-  FILES:=$(LINUX_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_ov519.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_ov519.ko
   AUTOLOAD:=$(call AutoProbe,gspca_ov519)
   $(call AddDepends/camera-gspca)
 endef
@@ -685,7 +685,7 @@ $(eval $(call KernelPackage,video-gspca-ov519))
 define KernelPackage/video-gspca-ov534
   TITLE:=ov534 webcam support
   KCONFIG:=CONFIG_USB_GSPCA_OV534
-  FILES:=$(LINUX_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_ov534.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_ov534.ko
   AUTOLOAD:=$(call AutoProbe,gspca_ov534)
   $(call AddDepends/camera-gspca)
 endef
@@ -700,7 +700,7 @@ $(eval $(call KernelPackage,video-gspca-ov534))
 define KernelPackage/video-gspca-ov534-9
   TITLE:=ov534-9 webcam support
   KCONFIG:=CONFIG_USB_GSPCA_OV534_9
-  FILES:=$(LINUX_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_ov534_9.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_ov534_9.ko
   AUTOLOAD:=$(call AutoProbe,gspca_ov534_9)
   $(call AddDepends/camera-gspca)
 endef
@@ -715,7 +715,7 @@ $(eval $(call KernelPackage,video-gspca-ov534-9))
 define KernelPackage/video-gspca-pac207
   TITLE:=pac207 webcam support
   KCONFIG:=CONFIG_USB_GSPCA_PAC207
-  FILES:=$(LINUX_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_pac207.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_pac207.ko
   AUTOLOAD:=$(call AutoProbe,gspca_pac207)
   $(call AddDepends/camera-gspca)
 endef
@@ -730,7 +730,7 @@ $(eval $(call KernelPackage,video-gspca-pac207))
 define KernelPackage/video-gspca-pac7311
   TITLE:=pac7311 webcam support
   KCONFIG:=CONFIG_USB_GSPCA_PAC7311
-  FILES:=$(LINUX_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_pac7311.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_pac7311.ko
   AUTOLOAD:=$(call AutoProbe,gspca_pac7311)
   $(call AddDepends/camera-gspca)
 endef
@@ -745,7 +745,7 @@ $(eval $(call KernelPackage,video-gspca-pac7311))
 define KernelPackage/video-gspca-se401
   TITLE:=se401 webcam support
   KCONFIG:=CONFIG_USB_GSPCA_SE401
-  FILES:=$(LINUX_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_se401.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_se401.ko
   AUTOLOAD:=$(call AutoProbe,gspca_se401)
   $(call AddDepends/camera-gspca)
 endef
@@ -760,7 +760,7 @@ $(eval $(call KernelPackage,video-gspca-se401))
 define KernelPackage/video-gspca-sn9c20x
   TITLE:=sn9c20x webcam support
   KCONFIG:=CONFIG_USB_GSPCA_SN9C20X
-  FILES:=$(LINUX_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_sn9c20x.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_sn9c20x.ko
   AUTOLOAD:=$(call AutoProbe,gspca_sn9c20x)
   $(call AddDepends/camera-gspca)
 endef
@@ -775,7 +775,7 @@ $(eval $(call KernelPackage,video-gspca-sn9c20x))
 define KernelPackage/video-gspca-sonixb
   TITLE:=sonixb webcam support
   KCONFIG:=CONFIG_USB_GSPCA_SONIXB
-  FILES:=$(LINUX_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_sonixb.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_sonixb.ko
   AUTOLOAD:=$(call AutoProbe,gspca_sonixb)
   $(call AddDepends/camera-gspca)
 endef
@@ -790,7 +790,7 @@ $(eval $(call KernelPackage,video-gspca-sonixb))
 define KernelPackage/video-gspca-sonixj
   TITLE:=sonixj webcam support
   KCONFIG:=CONFIG_USB_GSPCA_SONIXJ
-  FILES:=$(LINUX_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_sonixj.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_sonixj.ko
   AUTOLOAD:=$(call AutoProbe,gspca_sonixj)
   $(call AddDepends/camera-gspca)
 endef
@@ -805,7 +805,7 @@ $(eval $(call KernelPackage,video-gspca-sonixj))
 define KernelPackage/video-gspca-spca500
   TITLE:=spca500 webcam support
   KCONFIG:=CONFIG_USB_GSPCA_SPCA500
-  FILES:=$(LINUX_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_spca500.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_spca500.ko
   AUTOLOAD:=$(call AutoProbe,gspca_spca500)
   $(call AddDepends/camera-gspca)
 endef
@@ -820,7 +820,7 @@ $(eval $(call KernelPackage,video-gspca-spca500))
 define KernelPackage/video-gspca-spca501
   TITLE:=spca501 webcam support
   KCONFIG:=CONFIG_USB_GSPCA_SPCA501
-  FILES:=$(LINUX_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_spca501.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_spca501.ko
   AUTOLOAD:=$(call AutoProbe,gspca_spca501)
   $(call AddDepends/camera-gspca)
 endef
@@ -835,7 +835,7 @@ $(eval $(call KernelPackage,video-gspca-spca501))
 define KernelPackage/video-gspca-spca505
   TITLE:=spca505 webcam support
   KCONFIG:=CONFIG_USB_GSPCA_SPCA505
-  FILES:=$(LINUX_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_spca505.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_spca505.ko
   AUTOLOAD:=$(call AutoProbe,gspca_spca505)
   $(call AddDepends/camera-gspca)
 endef
@@ -850,7 +850,7 @@ $(eval $(call KernelPackage,video-gspca-spca505))
 define KernelPackage/video-gspca-spca506
   TITLE:=spca506 webcam support
   KCONFIG:=CONFIG_USB_GSPCA_SPCA506
-  FILES:=$(LINUX_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_spca506.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_spca506.ko
   AUTOLOAD:=$(call AutoProbe,gspca_spca506)
   $(call AddDepends/camera-gspca)
 endef
@@ -865,7 +865,7 @@ $(eval $(call KernelPackage,video-gspca-spca506))
 define KernelPackage/video-gspca-spca508
   TITLE:=spca508 webcam support
   KCONFIG:=CONFIG_USB_GSPCA_SPCA508
-  FILES:=$(LINUX_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_spca508.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_spca508.ko
   AUTOLOAD:=$(call AutoProbe,gspca_spca508)
   $(call AddDepends/camera-gspca)
 endef
@@ -880,7 +880,7 @@ $(eval $(call KernelPackage,video-gspca-spca508))
 define KernelPackage/video-gspca-spca561
   TITLE:=spca561 webcam support
   KCONFIG:=CONFIG_USB_GSPCA_SPCA561
-  FILES:=$(LINUX_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_spca561.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_spca561.ko
   AUTOLOAD:=$(call AutoProbe,gspca_spca561)
   $(call AddDepends/camera-gspca)
 endef
@@ -895,7 +895,7 @@ $(eval $(call KernelPackage,video-gspca-spca561))
 define KernelPackage/video-gspca-sq905
   TITLE:=sq905 webcam support
   KCONFIG:=CONFIG_USB_GSPCA_SQ905
-  FILES:=$(LINUX_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_sq905.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_sq905.ko
   AUTOLOAD:=$(call AutoProbe,gspca_sq905)
   $(call AddDepends/camera-gspca)
 endef
@@ -910,7 +910,7 @@ $(eval $(call KernelPackage,video-gspca-sq905))
 define KernelPackage/video-gspca-sq905c
   TITLE:=sq905c webcam support
   KCONFIG:=CONFIG_USB_GSPCA_SQ905C
-  FILES:=$(LINUX_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_sq905c.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_sq905c.ko
   AUTOLOAD:=$(call AutoProbe,gspca_sq905c)
   $(call AddDepends/camera-gspca)
 endef
@@ -925,7 +925,7 @@ $(eval $(call KernelPackage,video-gspca-sq905c))
 define KernelPackage/video-gspca-sq930x
   TITLE:=sq930x webcam support
   KCONFIG:=CONFIG_USB_GSPCA_SQ930X
-  FILES:=$(LINUX_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_sq930x.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_sq930x.ko
   AUTOLOAD:=$(call AutoProbe,gspca_sq930x)
   $(call AddDepends/camera-gspca)
 endef
@@ -940,7 +940,7 @@ $(eval $(call KernelPackage,video-gspca-sq930x))
 define KernelPackage/video-gspca-stk014
   TITLE:=stk014 webcam support
   KCONFIG:=CONFIG_USB_GSPCA_STK014
-  FILES:=$(LINUX_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_stk014.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_stk014.ko
   AUTOLOAD:=$(call AutoProbe,gspca_stk014)
   $(call AddDepends/camera-gspca)
 endef
@@ -955,7 +955,7 @@ $(eval $(call KernelPackage,video-gspca-stk014))
 define KernelPackage/video-gspca-sunplus
   TITLE:=sunplus webcam support
   KCONFIG:=CONFIG_USB_GSPCA_SUNPLUS
-  FILES:=$(LINUX_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_sunplus.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_sunplus.ko
   AUTOLOAD:=$(call AutoProbe,gspca_sunplus)
   $(call AddDepends/camera-gspca)
 endef
@@ -970,7 +970,7 @@ $(eval $(call KernelPackage,video-gspca-sunplus))
 define KernelPackage/video-gspca-t613
   TITLE:=t613 webcam support
   KCONFIG:=CONFIG_USB_GSPCA_T613
-  FILES:=$(LINUX_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_t613.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_t613.ko
   AUTOLOAD:=$(call AutoProbe,gspca_t613)
   $(call AddDepends/camera-gspca)
 endef
@@ -985,7 +985,7 @@ $(eval $(call KernelPackage,video-gspca-t613))
 define KernelPackage/video-gspca-tv8532
   TITLE:=tv8532 webcam support
   KCONFIG:=CONFIG_USB_GSPCA_TV8532
-  FILES:=$(LINUX_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_tv8532.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_tv8532.ko
   AUTOLOAD:=$(call AutoProbe,gspca_tv8532)
   $(call AddDepends/camera-gspca)
 endef
@@ -1000,7 +1000,7 @@ $(eval $(call KernelPackage,video-gspca-tv8532))
 define KernelPackage/video-gspca-vc032x
   TITLE:=vc032x webcam support
   KCONFIG:=CONFIG_USB_GSPCA_VC032X
-  FILES:=$(LINUX_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_vc032x.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_vc032x.ko
   AUTOLOAD:=$(call AutoProbe,gspca_vc032x)
   $(call AddDepends/camera-gspca)
 endef
@@ -1015,7 +1015,7 @@ $(eval $(call KernelPackage,video-gspca-vc032x))
 define KernelPackage/video-gspca-zc3xx
   TITLE:=zc3xx webcam support
   KCONFIG:=CONFIG_USB_GSPCA_ZC3XX
-  FILES:=$(LINUX_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_zc3xx.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_zc3xx.ko
   AUTOLOAD:=$(call AutoProbe,gspca_zc3xx)
   $(call AddDepends/camera-gspca)
 endef
@@ -1030,7 +1030,7 @@ $(eval $(call KernelPackage,video-gspca-zc3xx))
 define KernelPackage/video-gspca-m5602
   TITLE:=m5602 webcam support
   KCONFIG:=CONFIG_USB_M5602
-  FILES:=$(LINUX_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/m5602/gspca_m5602.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/m5602/gspca_m5602.ko
   AUTOLOAD:=$(call AutoProbe,gspca_m5602)
   $(call AddDepends/camera-gspca)
 endef
@@ -1045,7 +1045,7 @@ $(eval $(call KernelPackage,video-gspca-m5602))
 define KernelPackage/video-gspca-stv06xx
   TITLE:=stv06xx webcam support
   KCONFIG:=CONFIG_USB_STV06XX
-  FILES:=$(LINUX_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/stv06xx/gspca_stv06xx.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/stv06xx/gspca_stv06xx.ko
   AUTOLOAD:=$(call AutoProbe,gspca_stv06xx)
   $(call AddDepends/camera-gspca)
 endef
@@ -1060,7 +1060,7 @@ $(eval $(call KernelPackage,video-gspca-stv06xx))
 define KernelPackage/video-gspca-gl860
   TITLE:=gl860 webcam support
   KCONFIG:=CONFIG_USB_GL860
-  FILES:=$(LINUX_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gl860/gspca_gl860.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gl860/gspca_gl860.ko
   AUTOLOAD:=$(call AutoProbe,gspca_gl860)
   $(call AddDepends/camera-gspca)
 endef
@@ -1075,7 +1075,7 @@ $(eval $(call KernelPackage,video-gspca-gl860))
 define KernelPackage/video-gspca-jeilinj
   TITLE:=jeilinj webcam support
   KCONFIG:=CONFIG_USB_GSPCA_JEILINJ
-  FILES:=$(LINUX_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_jeilinj.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_jeilinj.ko
   AUTOLOAD:=$(call AutoProbe,gspca_jeilinj)
   $(call AddDepends/camera-gspca)
 endef
@@ -1090,7 +1090,7 @@ $(eval $(call KernelPackage,video-gspca-jeilinj))
 define KernelPackage/video-gspca-konica
   TITLE:=konica webcam support
   KCONFIG:=CONFIG_USB_GSPCA_KONICA
-  FILES:=$(LINUX_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_konica.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_konica.ko
   AUTOLOAD:=$(call AutoProbe,gspca_konica)
   $(call AddDepends/camera-gspca)
 endef
@@ -1111,7 +1111,7 @@ define KernelPackage/video-mem2mem
   HIDDEN:=1
   DEPENDS:=+kmod-video-videobuf2
   KCONFIG:= CONFIG_V4L_MEM2MEM_DRIVERS=y
-  FILES:= $(LINUX_DIR)/drivers/media/$(V4L2_DIR)/v4l2-mem2mem.ko
+  FILES:= $(LINUX_OBJ_DIR)/drivers/media/$(V4L2_DIR)/v4l2-mem2mem.ko
   AUTOLOAD:=$(call AutoLoad,66,v4l2-mem2mem)
   $(call AddDepends/video)
 endef
@@ -1130,7 +1130,7 @@ define KernelPackage/video-dma
   KCONFIG:= \
 	CONFIG_VIDEOBUF2_DMA_CONTIG \
 	CONFIG_VIDEOBUF2_DMA_SG
-  FILES:= $(LINUX_DIR)/drivers/media/common/videobuf2/videobuf2-dma-*.ko
+  FILES:= $(LINUX_OBJ_DIR)/drivers/media/common/videobuf2/videobuf2-dma-*.ko
   AUTOLOAD:=$(call AutoLoad,66,videobuf2-dma-contig videobuf2-dma-sg)
   $(call AddDepends/video)
 endef
@@ -1148,9 +1148,9 @@ define KernelPackage/video-coda
   	CONFIG_VIDEO_CODA \
   	CONFIG_VIDEO_IMX_VDOA
   FILES:= \
-  	$(LINUX_DIR)/drivers/media/$(V4L2_MEM2MEM_DIR)/coda/coda-vpu.ko \
-  	$(LINUX_DIR)/drivers/media/$(V4L2_MEM2MEM_DIR)/coda/imx-vdoa.ko \
- 	$(LINUX_DIR)/drivers/media/$(V4L2_DIR)/v4l2-jpeg.ko
+  	$(LINUX_OBJ_DIR)/drivers/media/$(V4L2_MEM2MEM_DIR)/coda/coda-vpu.ko \
+  	$(LINUX_OBJ_DIR)/drivers/media/$(V4L2_MEM2MEM_DIR)/coda/imx-vdoa.ko \
+ 	$(LINUX_OBJ_DIR)/drivers/media/$(V4L2_DIR)/v4l2-jpeg.ko
   AUTOLOAD:=$(call AutoProbe,coda-vpu imx-vdoa v4l2-jpeg)
   $(call AddDepends/video)
 endef
@@ -1165,7 +1165,7 @@ define KernelPackage/video-pxp
   TITLE:=i.MX PXP support
   DEPENDS:=@TARGET_imx +kmod-video-mem2mem +kmod-video-dma
   KCONFIG:= CONFIG_VIDEO_IMX_PXP
-  FILES:= $(LINUX_DIR)/drivers/media/$(V4L2_MEM2MEM_DIR)/imx-pxp.ko
+  FILES:= $(LINUX_OBJ_DIR)/drivers/media/$(V4L2_MEM2MEM_DIR)/imx-pxp.ko
   AUTOLOAD:=$(call AutoProbe,imx-pxp)
   $(call AddDepends/video)
 endef
@@ -1182,7 +1182,7 @@ define KernelPackage/video-tw686x
   TITLE:=TW686x support
   DEPENDS:=@PCIE_SUPPORT +kmod-video-dma +kmod-sound-core
   KCONFIG:= CONFIG_VIDEO_TW686X
-  FILES:= $(LINUX_DIR)/drivers/media/pci/tw686x/tw686x.ko
+  FILES:= $(LINUX_OBJ_DIR)/drivers/media/pci/tw686x/tw686x.ko
   AUTOLOAD:=$(call AutoProbe,tw686x)
   MODPARAMS.tw686x:=dma_mode=contig
   $(call AddDepends/framegrabber)
diff --git a/package/kernel/linux/modules/virt.mk b/package/kernel/linux/modules/virt.mk
index 82fb1af2de..4ad941d448 100644
--- a/package/kernel/linux/modules/virt.mk
+++ b/package/kernel/linux/modules/virt.mk
@@ -9,7 +9,7 @@ define KernelPackage/irqbypass
   TITLE:=IRQ offload/bypass manager
   KCONFIG:=CONFIG_IRQ_BYPASS_MANAGER
   HIDDEN:=1
-  FILES:= $(LINUX_DIR)/virt/lib/irqbypass.ko
+  FILES:= $(LINUX_OBJ_DIR)/virt/lib/irqbypass.ko
   AUTOLOAD:=$(call AutoProbe,irqbypass.ko)
 endef
 $(eval $(call KernelPackage,irqbypass))
@@ -23,7 +23,7 @@ define KernelPackage/kvm-x86
 	  CONFIG_KVM \
 	  CONFIG_KVM_MMU_AUDIT=n \
 	  CONFIG_VIRTUALIZATION=y
-  FILES:= $(LINUX_DIR)/arch/$(LINUX_KARCH)/kvm/kvm.ko
+  FILES:= $(LINUX_OBJ_DIR)/arch/$(LINUX_KARCH)/kvm/kvm.ko
   AUTOLOAD:=$(call AutoProbe,kvm.ko)
 endef
 
@@ -45,7 +45,7 @@ define KernelPackage/kvm-intel
   TITLE:=KVM for Intel processors support
   DEPENDS:=+kmod-kvm-x86
   KCONFIG:=CONFIG_KVM_INTEL
-  FILES:= $(LINUX_DIR)/arch/$(LINUX_KARCH)/kvm/kvm-intel.ko
+  FILES:= $(LINUX_OBJ_DIR)/arch/$(LINUX_KARCH)/kvm/kvm-intel.ko
   AUTOLOAD:=$(call AutoProbe,kvm-intel.ko)
 endef
 
@@ -62,7 +62,7 @@ define KernelPackage/kvm-amd
   TITLE:=KVM for AMD processors support
   DEPENDS:=+kmod-kvm-x86
   KCONFIG:=CONFIG_KVM_AMD
-  FILES:= $(LINUX_DIR)/arch/$(LINUX_KARCH)/kvm/kvm-amd.ko
+  FILES:= $(LINUX_OBJ_DIR)/arch/$(LINUX_KARCH)/kvm/kvm-amd.ko
   AUTOLOAD:=$(call AutoProbe,kvm-amd.ko)
 endef
 
@@ -83,9 +83,9 @@ define KernelPackage/vfio
 	CONFIG_VFIO_NOIOMMU=n \
 	CONFIG_VFIO_MDEV=n
   FILES:= \
-	$(LINUX_DIR)/drivers/vfio/vfio.ko \
-	$(LINUX_DIR)/drivers/vfio/vfio_virqfd.ko \
-	$(LINUX_DIR)/drivers/vfio/vfio_iommu_type1.ko
+	$(LINUX_OBJ_DIR)/drivers/vfio/vfio.ko \
+	$(LINUX_OBJ_DIR)/drivers/vfio/vfio_virqfd.ko \
+	$(LINUX_OBJ_DIR)/drivers/vfio/vfio_iommu_type1.ko
   AUTOLOAD:=$(call AutoProbe,vfio vfio_iommu_type1 vfio_virqfd)
 endef
 
@@ -104,8 +104,8 @@ define KernelPackage/vfio-pci
 	CONFIG_VFIO_PCI \
 	CONFIG_VFIO_PCI_IGD=n
   FILES:= \
-	$(LINUX_DIR)/drivers/vfio/pci/vfio-pci-core.ko \
-	$(LINUX_DIR)/drivers/vfio/pci/vfio-pci.ko
+	$(LINUX_OBJ_DIR)/drivers/vfio/pci/vfio-pci-core.ko \
+	$(LINUX_OBJ_DIR)/drivers/vfio/pci/vfio-pci.ko
   AUTOLOAD:=$(call AutoProbe,vfio-pci)
 endef
 
@@ -121,8 +121,8 @@ define KernelPackage/vhost
   SUBMENU:=Virtualization
   TITLE:=Host kernel accelerator for virtio (base)
   KCONFIG:=CONFIG_VHOST
-  FILES:=$(LINUX_DIR)/drivers/vhost/vhost.ko \
-    $(LINUX_DIR)/drivers/vhost/vhost_iotlb.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/vhost/vhost.ko \
+    $(LINUX_OBJ_DIR)/drivers/vhost/vhost_iotlb.ko
   AUTOLOAD:=$(call AutoProbe,vhost vhost_iotlb)
 endef
 
@@ -134,7 +134,7 @@ define KernelPackage/vhost-net
   TITLE:=Host kernel accelerator for virtio-net
   DEPENDS:=+kmod-tun +kmod-vhost
   KCONFIG:=CONFIG_VHOST_NET
-  FILES:=$(LINUX_DIR)/drivers/vhost/vhost_net.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/vhost/vhost_net.ko
   AUTOLOAD:=$(call AutoProbe,vhost_net)
 endef
 
diff --git a/package/kernel/linux/modules/w1.mk b/package/kernel/linux/modules/w1.mk
index 9cba28da11..e6b5263e2c 100644
--- a/package/kernel/linux/modules/w1.mk
+++ b/package/kernel/linux/modules/w1.mk
@@ -13,7 +13,7 @@ define KernelPackage/w1
   SUBMENU:=$(W1_MENU)
   TITLE:=Dallas's 1-wire support
   KCONFIG:=CONFIG_W1
-  FILES:=$(LINUX_DIR)/drivers/w1/wire.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/w1/wire.ko
   DEPENDS:=+kmod-hwmon-core
 endef
 
diff --git a/package/kernel/linux/modules/wpan.mk b/package/kernel/linux/modules/wpan.mk
index dab8a0cb71..70a85e2845 100644
--- a/package/kernel/linux/modules/wpan.mk
+++ b/package/kernel/linux/modules/wpan.mk
@@ -14,8 +14,8 @@ define KernelPackage/ieee802154
 	CONFIG_IEEE802154_SOCKET=y \
 	CONFIG_IEEE802154_NL802154_EXPERIMENTAL=n
   FILES:= \
-	$(LINUX_DIR)/net/ieee802154/ieee802154.ko \
-	$(LINUX_DIR)/net/ieee802154/ieee802154_socket.ko
+	$(LINUX_OBJ_DIR)/net/ieee802154/ieee802154.ko \
+	$(LINUX_OBJ_DIR)/net/ieee802154/ieee802154_socket.ko
   AUTOLOAD:=$(call AutoLoad,90,ieee802154 ieee802154_socket)
 endef
 
@@ -36,7 +36,7 @@ define KernelPackage/mac802154
   KCONFIG:= \
 	CONFIG_MAC802154 \
 	CONFIG_IEEE802154_DRIVERS=y
-  FILES:=$(LINUX_DIR)/net/mac802154/mac802154.ko
+  FILES:=$(LINUX_OBJ_DIR)/net/mac802154/mac802154.ko
   AUTOLOAD:=$(call AutoLoad,91,mac802154)
 endef
 
@@ -57,7 +57,7 @@ define KernelPackage/fakelb
   TITLE:=Fake LR-WPAN driver
   DEPENDS:=+kmod-mac802154
   KCONFIG:=CONFIG_IEEE802154_FAKELB
-  FILES:=$(LINUX_DIR)/drivers/net/ieee802154/fakelb.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ieee802154/fakelb.ko
   AUTOLOAD:=$(call AutoLoad,92,fakelb)
 endef
 
@@ -73,7 +73,7 @@ define KernelPackage/atusb
   TITLE:=ATUSB transceiver driver
   DEPENDS:=@USB_SUPPORT +kmod-usb-core +kmod-mac802154
   KCONFIG:=CONFIG_IEEE802154_ATUSB
-  FILES:=$(LINUX_DIR)/drivers/net/ieee802154/atusb.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ieee802154/atusb.ko
   AUTOLOAD:=$(call AutoProbe,atusb)
 endef
 
@@ -87,7 +87,7 @@ define KernelPackage/at86rf230
 	CONFIG_IEEE802154_AT86RF230_DEBUGFS=n \
 	CONFIG_SPI=y \
 	CONFIG_SPI_MASTER=y
-  FILES:=$(LINUX_DIR)/drivers/net/ieee802154/at86rf230.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ieee802154/at86rf230.ko
   AUTOLOAD:=$(call AutoProbe,at86rf230)
 endef
 
@@ -100,7 +100,7 @@ define KernelPackage/mrf24j40
   KCONFIG:=CONFIG_IEEE802154_MRF24J40 \
 	CONFIG_SPI=y \
 	CONFIG_SPI_MASTER=y
-  FILES:=$(LINUX_DIR)/drivers/net/ieee802154/mrf24j40.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ieee802154/mrf24j40.ko
   AUTOLOAD:=$(call AutoProbe,mrf24j40)
 endef
 
@@ -113,7 +113,7 @@ define KernelPackage/cc2520
   KCONFIG:=CONFIG_IEEE802154_CC2520 \
 	CONFIG_SPI=y \
 	CONFIG_SPI_MASTER=y
-  FILES:=$(LINUX_DIR)/drivers/net/ieee802154/cc2520.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ieee802154/cc2520.ko
   AUTOLOAD:=$(call AutoProbe,cc2520)
 endef
 
@@ -128,7 +128,7 @@ define KernelPackage/ca8210
 	CONFIG_SPI=y \
 	CONFIG_SPI_MASTER=y \
 	CONFIG_IEEE802154_CA8210_DEBUGFS=n
-  FILES:=$(LINUX_DIR)/drivers/net/ieee802154/ca8210.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ieee802154/ca8210.ko
   AUTOLOAD:=$(call AutoProbe,ca8210)
 endef
 
@@ -141,7 +141,7 @@ define KernelPackage/ieee802154-6lowpan
   DEPENDS:=+kmod-6lowpan +kmod-ieee802154
   KCONFIG:=CONFIG_IEEE802154_6LOWPAN
   FILES:= \
-	$(LINUX_DIR)/net/ieee802154/6lowpan/ieee802154_6lowpan.ko
+	$(LINUX_OBJ_DIR)/net/ieee802154/6lowpan/ieee802154_6lowpan.ko
   AUTOLOAD:=$(call AutoLoad,91,ieee802154_6lowpan)
 endef
 
diff --git a/target/linux/apm821xx/modules.mk b/target/linux/apm821xx/modules.mk
index 1abb12a483..b9efff297d 100644
--- a/target/linux/apm821xx/modules.mk
+++ b/target/linux/apm821xx/modules.mk
@@ -1,7 +1,7 @@
 define KernelPackage/ata-dwc
   TITLE:=DesignWare Cores SATA support
   KCONFIG:=CONFIG_SATA_DWC
-  FILES:=$(LINUX_DIR)/drivers/ata/sata_dwc_460ex.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/ata/sata_dwc_460ex.ko
   AUTOLOAD:=$(call AutoLoad,40,sata_dwc_460ex,1)
   $(call AddDepends/ata)
 endef
@@ -22,7 +22,7 @@ define KernelPackage/hw-crypto-4xx
   DEPENDS:=@TARGET_apm821xx +kmod-random-core +kmod-crypto-manager \
 	   +kmod-crypto-ccm +kmod-crypto-gcm \
 	   +kmod-crypto-sha1 +kmod-crypto-sha256 +kmod-crypto-sha512
-  FILES:=$(LINUX_DIR)/drivers/crypto/amcc/crypto4xx.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/crypto/amcc/crypto4xx.ko
   AUTOLOAD:=$(call AutoLoad,09,crypto4xx,1)
   $(call AddDepends/crypto)
 endef
diff --git a/target/linux/armsr/modules.mk b/target/linux/armsr/modules.mk
index 6e9ecda999..a689c91238 100644
--- a/target/linux/armsr/modules.mk
+++ b/target/linux/armsr/modules.mk
@@ -3,7 +3,7 @@ define KernelPackage/acpi-mdio
   TITLE:=ACPI MDIO support
   DEPENDS:=@(TARGET_armsr_armv8) +kmod-libphy +kmod-mdio-devres
   KCONFIG:=CONFIG_ACPI_MDIO
-  FILES:=$(LINUX_DIR)/drivers/net/mdio/acpi_mdio.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/mdio/acpi_mdio.ko
   AUTOLOAD:=$(call AutoLoad,11,acpi_mdio)
 endef
 
@@ -18,7 +18,7 @@ define KernelPackage/bcmgenet
   DEPENDS:=@(TARGET_armsr_armv8) +kmod-mdio-bcm-unimac
   TITLE:=Broadcom GENET internal MAC (Raspberry Pi 4)
   KCONFIG:=CONFIG_BCMGENET
-  FILES=$(LINUX_DIR)/drivers/net/ethernet/broadcom/genet/genet.ko
+  FILES=$(LINUX_OBJ_DIR)/drivers/net/ethernet/broadcom/genet/genet.ko
   AUTOLOAD=$(call AutoLoad,30,genet)
 endef
 
@@ -29,7 +29,7 @@ define KernelPackage/mdio-bcm-unimac
   DEPENDS:=@(TARGET_armsr_armv8) +kmod-of-mdio
   TITLE:=Broadcom UniMAC MDIO bus controller
   KCONFIG:=CONFIG_MDIO_BCM_UNIMAC
-  FILES=$(LINUX_DIR)/drivers/net/mdio/mdio-bcm-unimac.ko
+  FILES=$(LINUX_OBJ_DIR)/drivers/net/mdio/mdio-bcm-unimac.ko
   AUTOLOAD=$(call AutoLoad,30,mdio-bcm-unimac)
 endef
 
@@ -41,7 +41,7 @@ define KernelPackage/fsl-pcs-lynx
   TITLE:=NXP (Freescale) Lynx PCS
   HIDDEN:=1
   KCONFIG:=CONFIG_PCS_LYNX
-  FILES=$(LINUX_DIR)/drivers/net/pcs/pcs-lynx.ko
+  FILES=$(LINUX_OBJ_DIR)/drivers/net/pcs/pcs-lynx.ko
   AUTOLOAD=$(call AutoLoad,30,pcs-lynx)
 endef
 
@@ -52,7 +52,7 @@ define KernelPackage/pcs-xpcs
   TITLE:=Synopsis DesignWare PCS driver
   DEPENDS:=@(TARGET_armsr_armv8) +kmod-phylink
   KCONFIG:=CONFIG_PCS_XPCS
-  FILES:=$(LINUX_DIR)/drivers/net/pcs/pcs_xpcs.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/pcs/pcs_xpcs.ko
   AUTOLOAD:=$(call AutoLoad,20,pcs_xpcs)
 endef
 
@@ -64,7 +64,7 @@ define KernelPackage/fsl-fec
     +kmod-ptp +kmod-net-selftests
   TITLE:=NXP (Freescale) FEC Ethernet controller (i.MX)
   KCONFIG:=CONFIG_FEC
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/freescale/fec.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/freescale/fec.ko
   AUTOLOAD:=$(call AutoLoad,35,fec)
 endef
 
@@ -75,7 +75,7 @@ define KernelPackage/fsl-xgmac-mdio
   DEPENDS:=@(TARGET_armsr_armv8) +kmod-libphy +kmod-of-mdio +kmod-acpi-mdio
   TITLE:=NXP (Freescale) MDIO bus
   KCONFIG:=CONFIG_FSL_XGMAC_MDIO
-  FILES=$(LINUX_DIR)/drivers/net/ethernet/freescale/xgmac_mdio.ko
+  FILES=$(LINUX_OBJ_DIR)/drivers/net/ethernet/freescale/xgmac_mdio.ko
   AUTOLOAD=$(call AutoLoad,30,xgmac_mdio)
 endef
 
@@ -87,7 +87,7 @@ define KernelPackage/fsl-mc-dpio
   HIDDEN:=1
   KCONFIG:=CONFIG_FSL_MC_BUS=y \
     CONFIG_FSL_MC_DPIO
-  FILES:=$(LINUX_DIR)/drivers/soc/fsl/dpio/fsl-mc-dpio.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/soc/fsl/dpio/fsl-mc-dpio.ko
   AUTOLOAD=$(call AutoLoad,30,fsl-mc-dpio)
 endef
 
@@ -102,10 +102,10 @@ define KernelPackage/fsl-enetc-net
     CONFIG_FSL_ENETC_VF \
     CONFIG_FSL_ENETC_QOS=y
   FILES:= \
-    $(LINUX_DIR)/drivers/net/ethernet/freescale/enetc/fsl-enetc.ko \
-    $(LINUX_DIR)/drivers/net/ethernet/freescale/enetc/fsl-enetc-vf.ko \
-    $(LINUX_DIR)/drivers/net/ethernet/freescale/enetc/fsl-enetc-mdio.ko \
-    $(LINUX_DIR)/drivers/net/ethernet/freescale/enetc/fsl-enetc-ierb.ko
+    $(LINUX_OBJ_DIR)/drivers/net/ethernet/freescale/enetc/fsl-enetc.ko \
+    $(LINUX_OBJ_DIR)/drivers/net/ethernet/freescale/enetc/fsl-enetc-vf.ko \
+    $(LINUX_OBJ_DIR)/drivers/net/ethernet/freescale/enetc/fsl-enetc-mdio.ko \
+    $(LINUX_OBJ_DIR)/drivers/net/ethernet/freescale/enetc/fsl-enetc-ierb.ko
   AUTOLOAD=$(call AutoLoad,35,fsl-enetc)
 endef
 
@@ -123,9 +123,9 @@ define KernelPackage/fsl-dpaa1-net
     CONFIG_FSL_BMAN_TEST=n \
     CONFIG_FSL_QMAN_TEST=n
   MODULES:= \
-    $(LINUX_DIR)/drivers/net/ethernet/freescale/dpaa/fsl_dpa.ko \
-    $(LINUX_DIR)/drivers/net/ethernet/freescale/fman/fsl_dpaa_fman.ko \
-    $(LINUX_DIR)/drivers/net/ethernet/freescale/fman/fsl_dpaa_mac.ko
+    $(LINUX_OBJ_DIR)/drivers/net/ethernet/freescale/dpaa/fsl_dpa.ko \
+    $(LINUX_OBJ_DIR)/drivers/net/ethernet/freescale/fman/fsl_dpaa_fman.ko \
+    $(LINUX_OBJ_DIR)/drivers/net/ethernet/freescale/fman/fsl_dpaa_mac.ko
   AUTOLOAD=$(call AutoLoad,35,fsl-dpa)
 endef
 
@@ -140,7 +140,7 @@ define KernelPackage/fsl-dpaa2-net
     CONFIG_FSL_MC_UAPI_SUPPORT=y \
     CONFIG_FSL_DPAA2_ETH
   FILES:= \
-  $(LINUX_DIR)/drivers/net/ethernet/freescale/dpaa2/fsl-dpaa2-eth.ko
+  $(LINUX_OBJ_DIR)/drivers/net/ethernet/freescale/dpaa2/fsl-dpaa2-eth.ko
   AUTOLOAD=$(call AutoLoad,35,fsl-dpaa2-eth)
 endef
 
@@ -151,7 +151,7 @@ define KernelPackage/fsl-dpaa2-console
   TITLE:=NXP DPAA2 Debug console
   DEPENDS:=@(TARGET_armsr_armv8)
   KCONFIG:=CONFIG_DPAA2_CONSOLE
-  FILES=$(LINUX_DIR)/drivers/soc/fsl/dpaa2-console.ko
+  FILES=$(LINUX_OBJ_DIR)/drivers/soc/fsl/dpaa2-console.ko
   AUTOLOAD=$(call AutoLoad,40,dpaa2-console)
 endef
 
@@ -167,7 +167,7 @@ define KernelPackage/marvell-mdio
   TITLE:=Marvell Armada platform MDIO driver
   DEPENDS:=@(TARGET_armsr_armv8) +kmod-libphy +kmod-of-mdio +kmod-acpi-mdio
   KCONFIG:=CONFIG_MVMDIO
-  FILES=$(LINUX_DIR)/drivers/net/ethernet/marvell/mvmdio.ko
+  FILES=$(LINUX_OBJ_DIR)/drivers/net/ethernet/marvell/mvmdio.ko
   AUTOLOAD=$(call AutoLoad,30,marvell-mdio)
 endef
 
@@ -178,7 +178,7 @@ define KernelPackage/mvneta
   TITLE:=Marvell Armada 370/38x/XP/37xx network driver
   DEPENDS:=@(TARGET_armsr_armv8) +kmod-marvell-mdio +kmod-phylink
   KCONFIG:=CONFIG_MVNETA
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/marvell/mvneta.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/marvell/mvneta.ko
   AUTOLOAD=$(call AutoLoad,30,mvneta)
 endef
 
@@ -190,7 +190,7 @@ define KernelPackage/mvpp2
   DEPENDS:=@(TARGET_armsr_armv8) +kmod-marvell-mdio +kmod-phylink
   KCONFIG:=CONFIG_MVPP2 \
     CONFIG_MVPP2_PTP=n
-  FILES=$(LINUX_DIR)/drivers/net/ethernet/marvell/mvpp2/mvpp2.ko
+  FILES=$(LINUX_OBJ_DIR)/drivers/net/ethernet/marvell/mvpp2/mvpp2.ko
   AUTOLOAD=$(call AutoLoad,40,mvpp2)
 endef
 
@@ -200,7 +200,7 @@ define KernelPackage/imx2-wdt
   SUBMENU:=$(OTHER_MENU)
   TITLE:=NXP (Freescale) i.MX2+ and Layerscape watchdog driver
   KCONFIG:=CONFIG_IMX2_WDT
-  FILES=$(LINUX_DIR)/drivers/watchdog/imx2_wdt.ko
+  FILES=$(LINUX_OBJ_DIR)/drivers/watchdog/imx2_wdt.ko
   AUTOLOAD=$(call AutoLoad,60,imx2_wdt)
 endef
 
@@ -210,7 +210,7 @@ define KernelPackage/imx7-ulp-wdt
   SUBMENU:=$(OTHER_MENU)
   TITLE:=NXP (Freescale) i.MX7ULP and later watchdog
   KCONFIG:=CONFIG_IMX7ULP_WDT
-  FILES=$(LINUX_DIR)/drivers/watchdog/imx7ulp_wdt.ko
+  FILES=$(LINUX_OBJ_DIR)/drivers/watchdog/imx7ulp_wdt.ko
   AUTOLOAD=$(call AutoLoad,60,imx7ulp_wdt)
 endef
 
@@ -226,9 +226,9 @@ define KernelPackage/stmmac-core
     CONFIG_STMMAC_PLATFORM \
     CONFIG_CONFIG_DWMAC_DWC_QOS_ETH=n \
     CONFIG_DWMAC_GENERIC
-  FILES=$(LINUX_DIR)/drivers/net/ethernet/stmicro/stmmac/stmmac.ko \
-    $(LINUX_DIR)/drivers/net/ethernet/stmicro/stmmac/stmmac-platform.ko \
-    $(LINUX_DIR)/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.ko
+  FILES=$(LINUX_OBJ_DIR)/drivers/net/ethernet/stmicro/stmmac/stmmac.ko \
+    $(LINUX_OBJ_DIR)/drivers/net/ethernet/stmicro/stmmac/stmmac-platform.ko \
+    $(LINUX_OBJ_DIR)/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.ko
   AUTOLOAD=$(call AutoLoad,40,stmmac stmmac-platform dwmac-generic)
 endef
 
@@ -239,7 +239,7 @@ define KernelPackage/dwmac-imx
   TITLE:=NXP i.MX8 Ethernet controller
   DEPENDS:=+kmod-stmmac-core
   KCONFIG:=CONFIG_DWMAC_IMX8
-  FILES=$(LINUX_DIR)/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.ko
+  FILES=$(LINUX_OBJ_DIR)/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.ko
   AUTOLOAD=$(call AutoLoad,45,dwmac-imx)
 endef
 
@@ -250,7 +250,7 @@ define KernelPackage/dwmac-sun8i
   TITLE:=Allwinner H3/A83T/A64 (sun8i) Ethernet
   DEPENDS:=+kmod-stmmac-core +kmod-mdio-bus-mux
   KCONFIG:=CONFIG_DWMAC_SUN8I
-  FILES=$(LINUX_DIR)/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.ko
+  FILES=$(LINUX_OBJ_DIR)/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.ko
   AUTOLOAD=$(call AutoLoad,45,dwmac-sun8i)
 endef
 
@@ -261,7 +261,7 @@ define KernelPackage/dwmac-rockchip
   TITLE:=Rockchip RK3328/RK3399/RK3568 Ethernet
   DEPENDS:=+kmod-stmmac-core +kmod-mdio-bus-mux
   KCONFIG:=CONFIG_DWMAC_ROCKCHIP
-  FILES=$(LINUX_DIR)/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.ko
+  FILES=$(LINUX_OBJ_DIR)/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.ko
   AUTOLOAD=$(call AutoLoad,45,dwmac-rk)
 endef
 
@@ -272,8 +272,8 @@ define KernelPackage/mdio-thunder
   TITLE:=Marvell (Cavium) Thunder MDIO controller
   DEPENDS:=@(TARGET_armsr_armv8) +kmod-of-mdio
   KCONFIG:=CONFIG_MDIO_THUNDER
-  FILES=$(LINUX_DIR)/drivers/net/mdio/mdio-cavium.ko \
-    $(LINUX_DIR)/drivers/net/mdio/mdio-thunder.ko
+  FILES=$(LINUX_OBJ_DIR)/drivers/net/mdio/mdio-cavium.ko \
+    $(LINUX_OBJ_DIR)/drivers/net/mdio/mdio-thunder.ko
   AUTOLOAD=$(call AutoLoad,30,mdio-cavium mdio-thunder)
 endef
 
@@ -288,10 +288,10 @@ define KernelPackage/thunderx-net
     CONFIG_THUNDER_NIC_VF \
     CONFIG_THUNDER_NIC_BGX \
     CONFIG_THUNDER_NIC_RGX
-  FILES=$(LINUX_DIR)/drivers/net/ethernet/cavium/thunder/nicvf.ko \
-    $(LINUX_DIR)/drivers/net/ethernet/cavium/thunder/nicpf.ko \
-    $(LINUX_DIR)/drivers/net/ethernet/cavium/thunder/thunder_xcv.ko \
-    $(LINUX_DIR)/drivers/net/ethernet/cavium/thunder/thunder_bgx.ko
+  FILES=$(LINUX_OBJ_DIR)/drivers/net/ethernet/cavium/thunder/nicvf.ko \
+    $(LINUX_OBJ_DIR)/drivers/net/ethernet/cavium/thunder/nicpf.ko \
+    $(LINUX_OBJ_DIR)/drivers/net/ethernet/cavium/thunder/thunder_xcv.ko \
+    $(LINUX_OBJ_DIR)/drivers/net/ethernet/cavium/thunder/thunder_bgx.ko
   AUTOLOAD=$(call AutoLoad,40,nicpf nicvf thunder_xcv thunder_bgx)
 endef
 
@@ -307,11 +307,11 @@ define KernelPackage/octeontx2-net
     CONFIG_OCTEONTX2_PF \
     CONFIG_OCTEONTX2_VF \
     CONFIG_NDC_DIS_DYNAMIC_CACHING=n
-  FILES=$(LINUX_DIR)/drivers/net/ethernet/marvell/octeontx2/af/rvu_mbox.ko \
-    $(LINUX_DIR)/drivers/net/ethernet/marvell/octeontx2/af/rvu_af.ko \
-    $(LINUX_DIR)/drivers/net/ethernet/marvell/octeontx2/nic/rvu_nicpf.ko \
-    $(LINUX_DIR)/drivers/net/ethernet/marvell/octeontx2/nic/rvu_nicvf.ko \
-    $(LINUX_DIR)/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ptp.ko
+  FILES=$(LINUX_OBJ_DIR)/drivers/net/ethernet/marvell/octeontx2/af/rvu_mbox.ko \
+    $(LINUX_OBJ_DIR)/drivers/net/ethernet/marvell/octeontx2/af/rvu_af.ko \
+    $(LINUX_OBJ_DIR)/drivers/net/ethernet/marvell/octeontx2/nic/rvu_nicpf.ko \
+    $(LINUX_OBJ_DIR)/drivers/net/ethernet/marvell/octeontx2/nic/rvu_nicvf.ko \
+    $(LINUX_OBJ_DIR)/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ptp.ko
   AUTOLOAD=$(call AutoLoad,40,rvu_af rvu_mbox rvu_nicpf rvu_nicvf otx2_ptp)
 endef
 $(eval $(call KernelPackage,octeontx2-net))
@@ -320,7 +320,7 @@ define KernelPackage/wdt-sp805
   SUBMENU:=$(OTHER_MENU)
   TITLE:=ARM SP805 Watchdog
   KCONFIG:=CONFIG_ARM_SP805_WATCHDOG
-  FILES=$(LINUX_DIR)/drivers/watchdog/sp805_wdt.ko
+  FILES=$(LINUX_OBJ_DIR)/drivers/watchdog/sp805_wdt.ko
   AUTOLOAD=$(call AutoLoad,50,sp805_wdt)
 endef
 
diff --git a/target/linux/at91/modules.mk b/target/linux/at91/modules.mk
index 0590afef82..48404ea33c 100644
--- a/target/linux/at91/modules.mk
+++ b/target/linux/at91/modules.mk
@@ -7,7 +7,7 @@ define KernelPackage/mmc-at91
   TITLE:=MMC/SD Card Support on AT91
   DEPENDS:=@TARGET_at91 +kmod-mmc
   KCONFIG:=CONFIG_MMC_AT91
-  FILES:=$(LINUX_DIR)/drivers/mmc/host/at91_mci.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/mmc/host/at91_mci.ko
   AUTOLOAD:=$(call AutoLoad,90,at91_mci,1)
 endef
 
@@ -22,7 +22,7 @@ define KernelPackage/pwm-atmel
   TITLE:=PWM on atmel SoC
   DEPENDS:=@TARGET_at91
   KCONFIG:=CONFIG_ATMEL_PWM
-  FILES:=$(LINUX_DIR)/drivers/misc/atmel_pwm.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/misc/atmel_pwm.ko
   AUTOLOAD:=$(call AutoLoad,51,atmel_pwm)
 endef
 
@@ -37,7 +37,7 @@ define KernelPackage/at91-adc
   TITLE:=ADC on atmel SoC
   DEPENDS:=@TARGET_at91 +kmod-iio-core +kmod-input-core
   KCONFIG:=CONFIG_AT91_ADC
-  FILES:=$(LINUX_DIR)/drivers/iio/adc/at91_adc.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/iio/adc/at91_adc.ko
   AUTOLOAD:=$(call AutoLoad,40,at91_adc)
 endef
 
@@ -52,10 +52,10 @@ define KernelPackage/at91-udc
   TITLE:=USB Device Controller on atmel SoC
   DEPENDS:=@TARGET_at91 +kmod-usb-gadget +kmod-regmap-core
   KCONFIG:=CONFIG_USB_AT91
-ifneq ($(wildcard $(LINUX_DIR)/drivers/usb/gadget/udc/at91_udc.ko),)
-  FILES:=$(LINUX_DIR)/drivers/usb/gadget/udc/at91_udc.ko
+ifneq ($(wildcard $(LINUX_OBJ_DIR)/drivers/usb/gadget/udc/at91_udc.ko),)
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/gadget/udc/at91_udc.ko
 else
-  FILES:=$(LINUX_DIR)/drivers/usb/gadget/at91_udc.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/gadget/at91_udc.ko
 endif
   AUTOLOAD:=$(call AutoLoad,51,at91_udc)
 endef
@@ -71,10 +71,10 @@ define KernelPackage/atmel-usba-udc
   TITLE:=High-speed USB Device Controller on atmel SoC
   DEPENDS:=@TARGET_at91 +kmod-usb-gadget
   KCONFIG:=CONFIG_USB_ATMEL_USBA
-ifneq ($(wildcard $(LINUX_DIR)/drivers/usb/gadget/udc/atmel_usba_udc.ko),)
-  FILES:=$(LINUX_DIR)/drivers/usb/gadget/udc/atmel_usba_udc.ko
+ifneq ($(wildcard $(LINUX_OBJ_DIR)/drivers/usb/gadget/udc/atmel_usba_udc.ko),)
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/gadget/udc/atmel_usba_udc.ko
 else
-  FILES:=$(LINUX_DIR)/drivers/usb/gadget/atmel_usba_udc.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/gadget/atmel_usba_udc.ko
 endif
   AUTOLOAD:=$(call AutoLoad,51,atmel_usba_udc)
 endef
diff --git a/target/linux/ath79/modules.mk b/target/linux/ath79/modules.mk
index 946440dd61..e2819feda1 100644
--- a/target/linux/ath79/modules.mk
+++ b/target/linux/ath79/modules.mk
@@ -5,7 +5,7 @@ define KernelPackage/leds-reset
   TITLE:=reset controller LED support
   DEPENDS:= @TARGET_ath79
   KCONFIG:=CONFIG_LEDS_RESET=m
-  FILES:=$(LINUX_DIR)/drivers/leds/leds-reset.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/leds/leds-reset.ko
   AUTOLOAD:=$(call AutoLoad,60,leds-reset,1)
 endef
 
diff --git a/target/linux/bcm27xx/modules/hwmon.mk b/target/linux/bcm27xx/modules/hwmon.mk
index 0f1547cd4f..7a9002d12f 100644
--- a/target/linux/bcm27xx/modules/hwmon.mk
+++ b/target/linux/bcm27xx/modules/hwmon.mk
@@ -5,7 +5,7 @@
 define KernelPackage/hwmon-raspberrypi
   TITLE:=Raspberry Pi voltage monitor
   KCONFIG:=CONFIG_SENSORS_RASPBERRYPI_HWMON
-  FILES:=$(LINUX_DIR)/drivers/hwmon/raspberrypi-hwmon.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/hwmon/raspberrypi-hwmon.ko
   AUTOLOAD:=$(call AutoLoad,60,raspberrypi-hwmon)
   $(call AddDepends/hwmon, at TARGET_bcm27xx)
 endef
diff --git a/target/linux/bcm27xx/modules/other.mk b/target/linux/bcm27xx/modules/other.mk
index 99b71d4d69..9b741f0536 100644
--- a/target/linux/bcm27xx/modules/other.mk
+++ b/target/linux/bcm27xx/modules/other.mk
@@ -8,7 +8,7 @@ define KernelPackage/pwm-raspberrypi-poe
   KCONFIG:= \
     CONFIG_PWM=y \
     CONFIG_PWM_RASPBERRYPI_POE
-  FILES:=$(LINUX_DIR)/drivers/pwm/pwm-raspberrypi-poe.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/pwm/pwm-raspberrypi-poe.ko
   AUTOLOAD:=$(call AutoLoad,20,pwm-raspberrypi-poe)
   DEPENDS:=@TARGET_bcm27xx +kmod-hwmon-pwmfan
 endef
@@ -24,7 +24,7 @@ define KernelPackage/smi-bcm2835
   SUBMENU:=$(OTHER_MENU)
   TITLE:=BCM2835 SMI driver
   KCONFIG:=CONFIG_BCM2835_SMI
-  FILES:=$(LINUX_DIR)/drivers/misc/bcm2835_smi.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/misc/bcm2835_smi.ko
   AUTOLOAD:=$(call AutoLoad,20,bcm2835_smi)
   DEPENDS:=@TARGET_bcm27xx
 endef
@@ -41,7 +41,7 @@ define KernelPackage/smi-bcm2835-dev
   SUBMENU:=$(OTHER_MENU)
   TITLE:=BCM2835 SMI device driver
   KCONFIG:=CONFIG_BCM2835_SMI_DEV
-  FILES:=$(LINUX_DIR)/drivers/char/broadcom/bcm2835_smi_dev.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/char/broadcom/bcm2835_smi_dev.ko
   AUTOLOAD:=$(call AutoLoad,21,bcm2835_smi_dev)
   DEPENDS:=@TARGET_bcm27xx +kmod-smi-bcm2835
 endef
diff --git a/target/linux/bcm27xx/modules/sound.mk b/target/linux/bcm27xx/modules/sound.mk
index e61f07852b..326acef314 100644
--- a/target/linux/bcm27xx/modules/sound.mk
+++ b/target/linux/bcm27xx/modules/sound.mk
@@ -9,7 +9,7 @@ define KernelPackage/sound-arm-bcm2835
     CONFIG_SND_BCM2835 \
     CONFIG_SND_ARMAACI=n
   FILES:= \
-    $(LINUX_DIR)/drivers/staging/vc04_services/bcm2835-audio/snd-bcm2835.ko
+    $(LINUX_OBJ_DIR)/drivers/staging/vc04_services/bcm2835-audio/snd-bcm2835.ko
   AUTOLOAD:=$(call AutoLoad,68,snd-bcm2835)
   DEPENDS:=@TARGET_bcm27xx
   $(call AddDepends/sound)
@@ -29,7 +29,7 @@ define KernelPackage/sound-soc-bcm2835-i2s
     CONFIG_SND_SOC_DMAENGINE_PCM=y \
     CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM=y
   FILES:= \
-    $(LINUX_DIR)/sound/soc/bcm/snd-soc-bcm2835-i2s.ko
+    $(LINUX_OBJ_DIR)/sound/soc/bcm/snd-soc-bcm2835-i2s.ko
   AUTOLOAD:=$(call AutoLoad,68,snd-soc-bcm2835-i2s)
   DEPENDS:=@TARGET_bcm27xx +kmod-sound-soc-core
   $(call AddDepends/sound)
@@ -47,7 +47,7 @@ define KernelPackage/sound-soc-rpi-simple-soundcard
   KCONFIG:= \
     CONFIG_SND_RPI_SIMPLE_SOUNDCARD
   FILES:= \
-    $(LINUX_DIR)/sound/soc/bcm/snd-soc-rpi-simple-soundcard.ko
+    $(LINUX_OBJ_DIR)/sound/soc/bcm/snd-soc-rpi-simple-soundcard.ko
   AUTOLOAD:=$(call AutoLoad,68,snd-soc-rpi-simple-soundcard)
   DEPENDS:= \
     kmod-sound-soc-bcm2835-i2s
@@ -66,7 +66,7 @@ define KernelPackage/sound-soc-rpi-wm8804-soundcard
   KCONFIG:= \
     CONFIG_SND_RPI_WM8804_SOUNDCARD
   FILES:= \
-    $(LINUX_DIR)/sound/soc/bcm/snd-soc-rpi-wm8804-soundcard.ko
+    $(LINUX_OBJ_DIR)/sound/soc/bcm/snd-soc-rpi-wm8804-soundcard.ko
   AUTOLOAD:=$(call AutoLoad,68,snd-soc-rpi-wm8804-soundcard)
   DEPENDS:= \
     kmod-sound-soc-bcm2835-i2s
@@ -87,8 +87,8 @@ define KernelPackage/sound-soc-adau1977-adc
     CONFIG_SND_SOC_ADAU1977 \
     CONFIG_SND_SOC_ADAU1977_I2C
   FILES:= \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-adau1977.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-adau1977-i2c.ko
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-adau1977.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-adau1977-i2c.ko
   AUTOLOAD:=$(call AutoLoad,68,snd-soc-adau1977 snd-soc-adau1977-i2c)
   DEPENDS:= \
     kmod-sound-soc-bcm2835-i2s \
@@ -112,9 +112,9 @@ define KernelPackage/sound-soc-allo-boss-dac
     CONFIG_SND_SOC_PCM512x \
     CONFIG_SND_SOC_PCM512x_I2C
   FILES:= \
-    $(LINUX_DIR)/sound/soc/bcm/snd-soc-allo-boss-dac.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-pcm512x.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-pcm512x-i2c.ko
+    $(LINUX_OBJ_DIR)/sound/soc/bcm/snd-soc-allo-boss-dac.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-pcm512x.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-pcm512x-i2c.ko
   AUTOLOAD:=$(call AutoLoad,68,snd-soc-pcm512x-i2c snd-soc-pcm512x \
     snd-soc-allo-boss-dac)
   DEPENDS:= \
@@ -137,7 +137,7 @@ define KernelPackage/sound-soc-allo-boss2-dac
     CONFIG_SND_AUDIO_GRAPH_CARD \
     CONFIG_SND_BCM2708_SOC_ALLO_BOSS2_DAC
   FILES:= \
-    $(LINUX_DIR)/sound/soc/bcm/snd-soc-allo-boss2-dac.ko
+    $(LINUX_OBJ_DIR)/sound/soc/bcm/snd-soc-allo-boss2-dac.ko
   AUTOLOAD:=$(call AutoLoad,68,snd-soc-allo-boss2-dac)
   DEPENDS:= \
     kmod-sound-soc-bcm2835-i2s \
@@ -160,8 +160,8 @@ define KernelPackage/sound-soc-allo-digione
     CONFIG_SND_SOC_WM8804 \
     CONFIG_SND_SOC_WM8804_I2C
   FILES:= \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-wm8804.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-wm8804-i2c.ko
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-wm8804.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-wm8804-i2c.ko
   AUTOLOAD:=$(call AutoLoad,68,snd-soc-wm8804-i2c snd-soc-wm8804 \
     snd-soc-allo-digione)
   DEPENDS:= \
@@ -186,9 +186,9 @@ define KernelPackage/sound-soc-allo-piano-dac
     CONFIG_SND_SOC_PCM512x \
     CONFIG_SND_SOC_PCM512x_I2C
   FILES:= \
-    $(LINUX_DIR)/sound/soc/bcm/snd-soc-allo-piano-dac.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-pcm512x.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-pcm512x-i2c.ko
+    $(LINUX_OBJ_DIR)/sound/soc/bcm/snd-soc-allo-piano-dac.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-pcm512x.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-pcm512x-i2c.ko
   AUTOLOAD:=$(call AutoLoad,68,snd-soc-pcm512x-i2c snd-soc-pcm512x \
     snd-soc-allo-piano-dac)
   DEPENDS:= \
@@ -212,9 +212,9 @@ define KernelPackage/sound-soc-allo-piano-dac-plus
     CONFIG_SND_SOC_PCM512x \
     CONFIG_SND_SOC_PCM512x_I2C
   FILES:= \
-    $(LINUX_DIR)/sound/soc/bcm/snd-soc-allo-piano-dac-plus.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-pcm512x.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-pcm512x-i2c.ko
+    $(LINUX_OBJ_DIR)/sound/soc/bcm/snd-soc-allo-piano-dac-plus.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-pcm512x.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-pcm512x-i2c.ko
   AUTOLOAD:=$(call AutoLoad,68,snd-soc-pcm512x-i2c snd-soc-pcm512x \
     snd-soc-allo-piano-dac-plus)
   DEPENDS:= \
@@ -238,9 +238,9 @@ define KernelPackage/sound-soc-audiosense-pi
     CONFIG_SND_SOC_TLV320AIC32X4 \
     CONFIG_SND_SOC_TLV320AIC32X4_I2C
   FILES:= \
-    $(LINUX_DIR)/sound/soc/bcm/snd-soc-audiosense-pi.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-tlv320aic32x4.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-tlv320aic32x4-i2c.ko
+    $(LINUX_OBJ_DIR)/sound/soc/bcm/snd-soc-audiosense-pi.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-tlv320aic32x4.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-tlv320aic32x4-i2c.ko
   AUTOLOAD:=$(call AutoLoad,68,snd-soc-tlv320aic32x4-i2c snd-soc-tlv320aic32x4 \
     snd-soc-audiosense-pi)
   DEPENDS:= \
@@ -266,9 +266,9 @@ define KernelPackage/sound-soc-allo-katana-codec
     CONFIG_SND_SOC_PCM512x_I2C \
     CONFIG_SND_SIMPLE_CARD_UTILS
   FILES:= \
-    $(LINUX_DIR)/sound/soc/bcm/snd-soc-allo-katana-codec.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-pcm512x.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-pcm512x-i2c.ko
+    $(LINUX_OBJ_DIR)/sound/soc/bcm/snd-soc-allo-katana-codec.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-pcm512x.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-pcm512x-i2c.ko
   AUTOLOAD:=$(call AutoLoad,68,snd-soc-pcm512x-i2c snd-soc-pcm512x \
     snd-soc-allo-katana-codec)
   DEPENDS:= \
@@ -292,8 +292,8 @@ define KernelPackage/sound-soc-audioinjector-isolated-soundcard
     CONFIG_SND_SOC_CS4271 \
     CONFIG_SND_SOC_CS4271_I2C
   FILES:= \
-    $(LINUX_DIR)/sound/soc/bcm/snd-soc-audioinjector-isolated-soundcard.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-wm8731.ko
+    $(LINUX_OBJ_DIR)/sound/soc/bcm/snd-soc-audioinjector-isolated-soundcard.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-wm8731.ko
   AUTOLOAD:=$(call AutoLoad,68,snd-soc-cs4271.o \
     snd-soc-cs4271-i2c \
     snd-soc-audioinjector-isolated-soundcard)
@@ -319,9 +319,9 @@ define KernelPackage/sound-soc-audioinjector-octo-soundcard
     CONFIG_SND_SOC_CS42XX8 \
     CONFIG_SND_SOC_CS42XX8_I2C
   FILES:= \
-    $(LINUX_DIR)/sound/soc/bcm/snd-soc-audioinjector-octo-soundcard.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-cs42xx8.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-cs42xx8-i2c.ko
+    $(LINUX_OBJ_DIR)/sound/soc/bcm/snd-soc-audioinjector-octo-soundcard.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-cs42xx8.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-cs42xx8-i2c.ko
   AUTOLOAD:=$(call AutoLoad,68,snd-soc- \
     snd-soc-audioinjector-octo-soundcard)
   DEPENDS:= \
@@ -344,8 +344,8 @@ define KernelPackage/sound-soc-audioinjector-pi-soundcard
     CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD \
     CONFIG_SND_SOC_WM8731
   FILES:= \
-    $(LINUX_DIR)/sound/soc/bcm/snd-soc-audioinjector-pi-soundcard.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-wm8731.ko
+    $(LINUX_OBJ_DIR)/sound/soc/bcm/snd-soc-audioinjector-pi-soundcard.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-wm8731.ko
   AUTOLOAD:=$(call AutoLoad,68,snd-soc-wm8731 \
     snd-soc-audioinjector-pi-soundcard)
   DEPENDS:= \
@@ -368,7 +368,7 @@ define KernelPackage/sound-soc-chipdip-dac
   KCONFIG:= \
     CONFIG_SND_BCM2708_SOC_CHIPDIP_DAC
   FILES:= \
-    $(LINUX_DIR)/sound/soc/bcm/snd-soc-chipdip-dac.ko
+    $(LINUX_OBJ_DIR)/sound/soc/bcm/snd-soc-chipdip-dac.ko
   AUTOLOAD:=$(call AutoLoad,68,snd-soc-chipdip-dac)
   DEPENDS:= \
     kmod-sound-soc-bcm2835-i2s
@@ -388,8 +388,8 @@ define KernelPackage/sound-soc-dacberry-soundcard
     CONFIG_SND_DACBERRY400 \
     CONFIG_SND_SOC_TLV320AIC3X_I2C
   FILES:= \
-    $(LINUX_DIR)/sound/soc/bcm/snd-soc-dacberry400.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-tlv320aic3x.ko
+    $(LINUX_OBJ_DIR)/sound/soc/bcm/snd-soc-dacberry400.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-tlv320aic3x.ko
   AUTOLOAD:=$(call AutoLoad,68,snd-soc-tlv320aic3x-i2c snd-soc-dacberry400)
   DEPENDS:= \
     kmod-sound-soc-bcm2835-i2s \
@@ -413,10 +413,10 @@ define KernelPackage/sound-soc-digidac1-soundcard
     CONFIG_SND_SOC_WM8804 \
     CONFIG_SND_SOC_WM8804_I2C
   FILES:= \
-    $(LINUX_DIR)/sound/soc/bcm/snd-soc-digidac1-soundcard.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-wm8741.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-wm8804.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-wm8804-i2c.ko
+    $(LINUX_OBJ_DIR)/sound/soc/bcm/snd-soc-digidac1-soundcard.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-wm8741.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-wm8804.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-wm8804-i2c.ko
   AUTOLOAD:=$(call AutoLoad,68,snd-soc-wm8741 \
     snd-soc-wm8804 snd-soc-wm8804-i2c \
     snd-soc-digidac1-soundcard)
@@ -441,8 +441,8 @@ define KernelPackage/sound-soc-dionaudio-loco
     CONFIG_SND_BCM2708_SOC_DIONAUDIO_LOCO \
     CONFIG_SND_SOC_PCM5102A
   FILES:= \
-    $(LINUX_DIR)/sound/soc/bcm/snd-soc-dionaudio-loco.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-pcm5102a.ko
+    $(LINUX_OBJ_DIR)/sound/soc/bcm/snd-soc-dionaudio-loco.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-pcm5102a.ko
   AUTOLOAD:=$(call AutoLoad,68,snd-soc-pcm5102a \
     snd-soc-dionaudio-loco)
   DEPENDS:= \
@@ -464,9 +464,9 @@ define KernelPackage/sound-soc-dionaudio-loco-v2
     CONFIG_SND_SOC_PCM512x \
     CONFIG_SND_SOC_PCM512x_I2C
   FILES:= \
-    $(LINUX_DIR)/sound/soc/bcm/snd-soc-dionaudio-loco.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-pcm512x.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-pcm512x-i2c.ko
+    $(LINUX_OBJ_DIR)/sound/soc/bcm/snd-soc-dionaudio-loco.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-pcm512x.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-pcm512x-i2c.ko
   AUTOLOAD:=$(call AutoLoad,68,snd-soc-pcm512x snd-soc-pcm512x-i2c \
     snd-soc-dionaudio-loco)
   DEPENDS:= \
@@ -488,8 +488,8 @@ define KernelPackage/sound-soc-fe-pi
     CONFIG_SND_BCM2708_SOC_FE_PI_AUDIO \
     CONFIG_SND_SOC_SGTL5000
   FILES:= \
-    $(LINUX_DIR)/sound/soc/bcm/snd-soc-fe-pi-audio.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-sgtl5000.ko
+    $(LINUX_OBJ_DIR)/sound/soc/bcm/snd-soc-fe-pi-audio.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-sgtl5000.ko
   AUTOLOAD:=$(call AutoLoad,68,snd-soc-sgtl5000 \
     snd-soc-fe-pi-audio)
   DEPENDS:= \
@@ -511,7 +511,7 @@ define KernelPackage/sound-soc-googlevoicehat
     CONFIG_SND_BCM2708_SOC_GOOGLEVOICEHAT_SOUNDCARD \
     CONFIG_SND_SOC_VOICEHAT
   FILES:= \
-    $(LINUX_DIR)/sound/soc/bcm/snd-soc-googlevoicehat-codec.ko
+    $(LINUX_OBJ_DIR)/sound/soc/bcm/snd-soc-googlevoicehat-codec.ko
   AUTOLOAD:=$(call AutoLoad,68,snd-soc-googlevoicehat-codec)
   DEPENDS:= \
     kmod-sound-soc-bcm2835-i2s \
@@ -532,7 +532,7 @@ define KernelPackage/sound-soc-hifiberry-dac
     CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC \
     CONFIG_SND_SOC_PCM5102A
   FILES:= \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-pcm5102a.ko
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-pcm5102a.ko
   AUTOLOAD:=$(call AutoLoad,68,snd-soc-pcm5102a)
   DEPENDS:= \
     kmod-sound-soc-bcm2835-i2s \
@@ -555,10 +555,10 @@ define KernelPackage/sound-soc-hifiberry-dacplus
     CONFIG_SND_SOC_PCM512x \
     CONFIG_SND_SOC_PCM512x_I2C
   FILES:= \
-    $(LINUX_DIR)/drivers/clk/clk-hifiberry-dacpro.ko \
-    $(LINUX_DIR)/sound/soc/bcm/snd-soc-hifiberry-dacplus.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-pcm512x.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-pcm512x-i2c.ko
+    $(LINUX_OBJ_DIR)/drivers/clk/clk-hifiberry-dacpro.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/bcm/snd-soc-hifiberry-dacplus.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-pcm512x.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-pcm512x-i2c.ko
   AUTOLOAD:=$(call AutoLoad,68,clk-hifiberry-dacpro snd-soc-pcm512x \
     snd-soc-pcm512x-i2c snd-soc-hifiberry-dacplus)
   DEPENDS:= \
@@ -582,10 +582,10 @@ define KernelPackage/sound-soc-hifiberry-dacplusadc
     CONFIG_SND_SOC_PCM512x \
     CONFIG_SND_SOC_DMIC
   FILES:= \
-    $(LINUX_DIR)/drivers/clk/clk-hifiberry-dacpro.ko \
-    $(LINUX_DIR)/sound/soc/bcm/snd-soc-hifiberry-dacplusadc.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-pcm512x.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-dmic.ko
+    $(LINUX_OBJ_DIR)/drivers/clk/clk-hifiberry-dacpro.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/bcm/snd-soc-hifiberry-dacplusadc.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-pcm512x.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-dmic.ko
   AUTOLOAD:=$(call AutoLoad,68,clk-hifiberry-dacpro snd-soc-pcm512x \
     snd-soc-dmic snd-soc-hifiberry-dacplusadc)
   DEPENDS:= \
@@ -606,7 +606,7 @@ define KernelPackage/sound-soc-hifiberry-dacplusdsp
   KCONFIG:= \
     CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUSDSP
   FILES:= \
-    $(LINUX_DIR)/sound/soc/bcm/snd-soc-hifiberry-dacplusdsp.ko
+    $(LINUX_OBJ_DIR)/sound/soc/bcm/snd-soc-hifiberry-dacplusdsp.ko
   AUTOLOAD:=$(call AutoLoad,68,snd-soc-hifiberry-dacplusdsp)
   DEPENDS:= \
     kmod-sound-soc-bcm2835-i2s \
@@ -628,10 +628,10 @@ define KernelPackage/sound-soc-hifiberry-dacplushd
     CONFIG_SND_SOC_PCM179X \
     CONFIG_SND_SOC_PCM179X_I2C
   FILES:= \
-    $(LINUX_DIR)/drivers/clk/clk-hifiberry-dachd.ko \
-    $(LINUX_DIR)/sound/soc/bcm/snd-soc-hifiberry-dacplushd.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-pcm179x-codec.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-pcm179x-i2c.ko
+    $(LINUX_OBJ_DIR)/drivers/clk/clk-hifiberry-dachd.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/bcm/snd-soc-hifiberry-dacplushd.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-pcm179x-codec.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-pcm179x-i2c.ko
   AUTOLOAD:=$(call AutoLoad,68,clk-hifiberry-dachd snd-soc-pcm179x-codec \
     snd-soc-pcm179x-i2c snd-soc-hifiberry-dacplushd)
   DEPENDS:= \
@@ -657,11 +657,11 @@ define KernelPackage/sound-soc-hifiberry-dacplusadc-pro
     CONFIG_SND_SOC_PCM512x \
     CONFIG_SND_SOC_PCM512x_I2C
   FILES:= \
-    $(LINUX_DIR)/sound/soc/bcm/snd-soc-hifiberry-dacplusadcpro.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-pcm186x.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-pcm186x-i2c.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-pcm512x.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-pcm512x-i2c.ko
+    $(LINUX_OBJ_DIR)/sound/soc/bcm/snd-soc-hifiberry-dacplusadcpro.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-pcm186x.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-pcm186x-i2c.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-pcm512x.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-pcm512x-i2c.ko
   AUTOLOAD:=$(call AutoLoad,68,snd-soc-pcm186x snd-soc-pcm186x-i2c \
     snd-soc-pcm512x snd-soc-pcm512x-i2c snd-soc-hifiberry-dacplusadcpro)
   DEPENDS:= \
@@ -685,8 +685,8 @@ define KernelPackage/sound-soc-hifiberry-digi
     CONFIG_SND_SOC_WM8804 \
     CONFIG_SND_SOC_WM8804_I2C
   FILES:= \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-wm8804.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-wm8804-i2c.ko
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-wm8804.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-wm8804-i2c.ko
   AUTOLOAD:=$(call AutoLoad,68,snd-soc-wm8804 snd-soc-wm8804-i2c)
   DEPENDS:= \
     kmod-sound-soc-bcm2835-i2s \
@@ -709,7 +709,7 @@ define KernelPackage/sound-soc-hifiberry-amp
     CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP \
     CONFIG_SND_SOC_TAS5713
   FILES:= \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-tas5713.ko
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-tas5713.ko
   AUTOLOAD:=$(call AutoLoad,68,snd-soc-tas5713)
   DEPENDS:= \
     kmod-sound-soc-bcm2835-i2s \
@@ -732,8 +732,8 @@ define KernelPackage/sound-soc-iqaudio-codec
     CONFIG_SND_BCM2708_SOC_IQAUDIO_CODEC \
     CONFIG_SND_SOC_DA7213
   FILES:= \
-    $(LINUX_DIR)/sound/soc/bcm/snd-soc-iqaudio-codec.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-da7213.ko
+    $(LINUX_OBJ_DIR)/sound/soc/bcm/snd-soc-iqaudio-codec.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-da7213.ko
   AUTOLOAD:=$(call AutoLoad,68,snd-soc-da7213 snd-soc-iqaudio-codec)
   DEPENDS:= \
     kmod-sound-soc-bcm2835-i2s \
@@ -756,9 +756,9 @@ define KernelPackage/sound-soc-iqaudio-dac
     CONFIG_SND_SOC_PCM512x \
     CONFIG_SND_SOC_PCM512x_I2C
   FILES:= \
-    $(LINUX_DIR)/sound/soc/bcm/snd-soc-iqaudio-dac.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-pcm512x.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-pcm512x-i2c.ko
+    $(LINUX_OBJ_DIR)/sound/soc/bcm/snd-soc-iqaudio-dac.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-pcm512x.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-pcm512x-i2c.ko
   AUTOLOAD:=$(call AutoLoad,68,snd-soc-pcm512x snd-soc-pcm512x-i2c \
     snd-soc-iqaudio-dac)
   DEPENDS:= \
@@ -782,8 +782,8 @@ define KernelPackage/sound-soc-iqaudio-digi
     CONFIG_SND_SOC_WM8804 \
     CONFIG_SND_SOC_WM8804_I2C
   FILES:= \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-wm8804.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-wm8804-i2c.ko
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-wm8804.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-wm8804-i2c.ko
   AUTOLOAD:=$(call AutoLoad,68,snd-soc-wm8804 snd-soc-wm8804-i2c)
   DEPENDS:= \
     kmod-sound-soc-bcm2835-i2s \
@@ -806,8 +806,8 @@ define KernelPackage/sound-soc-i-sabe-q2m
     CONFIG_SND_BCM2708_SOC_I_SABRE_Q2M \
     CONFIG_SND_SOC_I_SABRE_CODEC
   FILES:= \
-    $(LINUX_DIR)/sound/soc/bcm/snd-soc-i-sabre-q2m.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-i-sabre-codec.ko
+    $(LINUX_OBJ_DIR)/sound/soc/bcm/snd-soc-i-sabre-q2m.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-i-sabre-codec.ko
   AUTOLOAD:=$(call AutoLoad,68,snd-soc-i-sabre-codec snd-soc-i-sabre-q2m)
   DEPENDS:= \
     kmod-sound-soc-bcm2835-i2s \
@@ -832,11 +832,11 @@ define KernelPackage/sound-soc-justboom-both
     CONFIG_SND_SOC_WM8804 \
     CONFIG_SND_SOC_WM8804_I2C
   FILES:= \
-    $(LINUX_DIR)/sound/soc/bcm/snd-soc-justboom-both.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-pcm512x.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-pcm512x-i2c.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-wm8804.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-wm8804-i2c.ko
+    $(LINUX_OBJ_DIR)/sound/soc/bcm/snd-soc-justboom-both.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-pcm512x.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-pcm512x-i2c.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-wm8804.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-wm8804-i2c.ko
   AUTOLOAD:=$(call AutoLoad,68,snd-soc-pcm512x-i2c snd-soc-pcm512x \
     snd-soc-wm8804-i2c snd-soc-wm8804 \
     snd-soc-justboom-both)
@@ -862,9 +862,9 @@ define KernelPackage/sound-soc-justboom-dac
     CONFIG_SND_SOC_PCM512x \
     CONFIG_SND_SOC_PCM512x_I2C
   FILES:= \
-    $(LINUX_DIR)/sound/soc/bcm/snd-soc-justboom-dac.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-pcm512x.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-pcm512x-i2c.ko
+    $(LINUX_OBJ_DIR)/sound/soc/bcm/snd-soc-justboom-dac.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-pcm512x.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-pcm512x-i2c.ko
   AUTOLOAD:=$(call AutoLoad,68,snd-soc-pcm512x-i2c snd-soc-pcm512x \
     snd-soc-justboom-dac)
   DEPENDS:= \
@@ -888,8 +888,8 @@ define KernelPackage/sound-soc-justboom-digi
     CONFIG_SND_SOC_WM8804 \
     CONFIG_SND_SOC_WM8804_I2C
   FILES:= \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-wm8804.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-wm8804-i2c.ko
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-wm8804.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-wm8804-i2c.ko
   AUTOLOAD:=$(call AutoLoad,68,snd-soc-wm8804-i2c snd-soc-wm8804)
   DEPENDS:= \
     kmod-sound-soc-bcm2835-i2s \
@@ -913,8 +913,8 @@ define KernelPackage/sound-soc-pifi-40-amp
     CONFIG_SND_PIFI_40 \
     CONFIG_SND_SOC_TAS571X
   FILES:= \
-    $(LINUX_DIR)/sound/soc/bcm/snd-soc-pifi-40.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-tas571x.ko
+    $(LINUX_OBJ_DIR)/sound/soc/bcm/snd-soc-pifi-40.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-tas571x.ko
   AUTOLOAD:=$(call AutoLoad,68,snd-soc-tas571x)
   DEPENDS:= \
     kmod-sound-soc-bcm2835-i2s
@@ -934,8 +934,8 @@ define KernelPackage/sound-soc-pisound
     CONFIG_SND_PISOUND \
     CONFIG_SND_SOC_PCM5102A
   FILES:= \
-    $(LINUX_DIR)/sound/soc/bcm/snd-soc-pisound.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-pcm5102a.ko
+    $(LINUX_OBJ_DIR)/sound/soc/bcm/snd-soc-pisound.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-pcm5102a.ko
   AUTOLOAD:=$(call AutoLoad,68,snd-soc-pcm5102a snd-soc-pisound)
   DEPENDS:= \
     kmod-sound-soc-bcm2835-i2s
@@ -970,14 +970,14 @@ define KernelPackage/sound-soc-rpi-cirrus
     CONFIG_SND_SOC_WM8804 \
     CONFIG_SND_SOC_WM_ADSP
   FILES:= \
-    $(LINUX_DIR)/drivers/firmware/cirrus/cs_dsp.ko \
-    $(LINUX_DIR)/drivers/mfd/arizona.ko \
-    $(LINUX_DIR)/drivers/mfd/arizona-i2c.ko \
-    $(LINUX_DIR)/sound/soc/bcm/snd-soc-rpi-cirrus.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-arizona.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-wm-adsp.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-wm5102.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-wm8804.ko
+    $(LINUX_OBJ_DIR)/drivers/firmware/cirrus/cs_dsp.ko \
+    $(LINUX_OBJ_DIR)/drivers/mfd/arizona.ko \
+    $(LINUX_OBJ_DIR)/drivers/mfd/arizona-i2c.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/bcm/snd-soc-rpi-cirrus.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-arizona.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-wm-adsp.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-wm5102.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-wm8804.ko
   AUTOLOAD:=$(call AutoLoad,68,snd-soc-rpi-cirrus)
   DEPENDS:= \
     kmod-sound-soc-bcm2835-i2s \
@@ -999,7 +999,7 @@ define KernelPackage/sound-soc-rpi-dac
     CONFIG_SND_BCM2708_SOC_RPI_DAC \
     CONFIG_SND_SOC_PCM1794A
   FILES:= \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-pcm1794a.ko
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-pcm1794a.ko
   AUTOLOAD:=$(call AutoLoad,68,snd-soc-pcm1794a)
   DEPENDS:= \
     kmod-sound-soc-bcm2835-i2s \
@@ -1020,7 +1020,7 @@ define KernelPackage/sound-soc-merus-amp
   KCONFIG:= \
     CONFIG_SND_SOC_MA120X0P
   FILES:= \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-ma120x0p.ko
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-ma120x0p.ko
   AUTOLOAD:=$(call AutoLoad,68,snd-soc-ma120x0p)
   DEPENDS:= \
     kmod-sound-soc-bcm2835-i2s \
@@ -1043,8 +1043,8 @@ define KernelPackage/sound-soc-rpi-proto
     CONFIG_SND_BCM2708_SOC_RPI_PROTO \
     CONFIG_SND_SOC_WM8731
   FILES:= \
-    $(LINUX_DIR)/sound/soc/bcm/snd-soc-rpi-proto.ko \
-    $(LINUX_DIR)/sound/soc/codecs/snd-soc-wm8731.ko
+    $(LINUX_OBJ_DIR)/sound/soc/bcm/snd-soc-rpi-proto.ko \
+    $(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-wm8731.ko
   AUTOLOAD:=$(call AutoLoad,68,snd-soc-wm8731 snd-soc-rpi-proto)
   DEPENDS:= \
     kmod-sound-soc-bcm2835-i2s \
diff --git a/target/linux/bcm27xx/modules/spi.mk b/target/linux/bcm27xx/modules/spi.mk
index 948978dd44..c33ddf812c 100644
--- a/target/linux/bcm27xx/modules/spi.mk
+++ b/target/linux/bcm27xx/modules/spi.mk
@@ -9,7 +9,7 @@ define KernelPackage/spi-bcm2835
     CONFIG_SPI=y \
     CONFIG_SPI_BCM2835 \
     CONFIG_SPI_MASTER=y
-  FILES:=$(LINUX_DIR)/drivers/spi/spi-bcm2835.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/spi/spi-bcm2835.ko
   AUTOLOAD:=$(call AutoLoad,89,spi-bcm2835)
   DEPENDS:=@TARGET_bcm27xx
 endef
@@ -28,7 +28,7 @@ define KernelPackage/spi-bcm2835-aux
     CONFIG_SPI=y \
     CONFIG_SPI_BCM2835AUX \
     CONFIG_SPI_MASTER=y
-  FILES:=$(LINUX_DIR)/drivers/spi/spi-bcm2835aux.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/spi/spi-bcm2835aux.ko
   AUTOLOAD:=$(call AutoLoad,89,spi-bcm2835aux)
   DEPENDS:=@TARGET_bcm27xx
 endef
diff --git a/target/linux/bcm27xx/modules/video.mk b/target/linux/bcm27xx/modules/video.mk
index 86fc44c0a4..9d538d61bc 100644
--- a/target/linux/bcm27xx/modules/video.mk
+++ b/target/linux/bcm27xx/modules/video.mk
@@ -15,7 +15,7 @@ define KernelPackage/camera-bcm2835
     CONFIG_VIDEO_IMX708=n \
     CONFIG_VIDEO_ISP_BCM2835=n
   FILES:= \
-    $(LINUX_DIR)/drivers/staging/vc04_services/bcm2835-camera/bcm2835-v4l2.ko
+    $(LINUX_OBJ_DIR)/drivers/staging/vc04_services/bcm2835-camera/bcm2835-v4l2.ko
   AUTOLOAD:=$(call AutoLoad,65,bcm2835-v4l2)
   $(call AddDepends/video, at TARGET_bcm27xx +kmod-vchiq-mmal-bcm2835 +kmod-video-videobuf2)
 endef
@@ -42,11 +42,11 @@ define KernelPackage/drm-vc4
     CONFIG_DRM_V3D=n \
     CONFIG_DRM_TVE200=n
   FILES:= \
-    $(LINUX_DIR)/drivers/gpu/drm/display/drm_display_helper.ko \
-    $(LINUX_DIR)/drivers/gpu/drm/drm_dma_helper.ko \
-    $(LINUX_DIR)/drivers/gpu/drm/vc4/vc4.ko \
-    $(LINUX_DIR)/drivers/gpu/drm/drm_kms_helper.ko \
-    $(LINUX_DIR)/drivers/media/cec/core/cec.ko
+    $(LINUX_OBJ_DIR)/drivers/gpu/drm/display/drm_display_helper.ko \
+    $(LINUX_OBJ_DIR)/drivers/gpu/drm/drm_dma_helper.ko \
+    $(LINUX_OBJ_DIR)/drivers/gpu/drm/vc4/vc4.ko \
+    $(LINUX_OBJ_DIR)/drivers/gpu/drm/drm_kms_helper.ko \
+    $(LINUX_OBJ_DIR)/drivers/media/cec/core/cec.ko
   AUTOLOAD:=$(call AutoProbe,vc4)
 endef
 
@@ -63,7 +63,7 @@ define KernelPackage/vc-sm-cma
   KCONFIG:= \
     CONFIG_BCM_VC_SM_CMA
   FILES:= \
-    $(LINUX_DIR)/drivers/staging/vc04_services/vc-sm-cma/vc-sm-cma.ko
+    $(LINUX_OBJ_DIR)/drivers/staging/vc04_services/vc-sm-cma/vc-sm-cma.ko
   $(call AddDepends/video, at TARGET_bcm27xx)
 endef
 
@@ -81,7 +81,7 @@ define KernelPackage/vchiq-mmal-bcm2835
     CONFIG_BCM2835_VCHIQ_MMAL \
     CONFIG_VIDEO_CODEC_BCM2835=n
   FILES:= \
-    $(LINUX_DIR)/drivers/staging/vc04_services/vchiq-mmal/bcm2835-mmal-vchiq.ko
+    $(LINUX_OBJ_DIR)/drivers/staging/vc04_services/vchiq-mmal/bcm2835-mmal-vchiq.ko
   $(call AddDepends/video, at TARGET_bcm27xx +kmod-vc-sm-cma)
 endef
 
diff --git a/target/linux/bcm47xx/modules.mk b/target/linux/bcm47xx/modules.mk
index 5924694a53..e6622ae6e5 100644
--- a/target/linux/bcm47xx/modules.mk
+++ b/target/linux/bcm47xx/modules.mk
@@ -8,9 +8,9 @@ define KernelPackage/bgmac
   DEPENDS:=@TARGET_bcm47xx @!TARGET_bcm47xx_legacy
   SUBMENU:=$(NETWORK_DEVICES_MENU)
   FILES:= \
-	$(LINUX_DIR)/drivers/net/ethernet/broadcom/bgmac-bcma.ko \
-	$(LINUX_DIR)/drivers/net/ethernet/broadcom/bgmac-bcma-mdio.ko \
-	$(LINUX_DIR)/drivers/net/ethernet/broadcom/bgmac.ko
+	$(LINUX_OBJ_DIR)/drivers/net/ethernet/broadcom/bgmac-bcma.ko \
+	$(LINUX_OBJ_DIR)/drivers/net/ethernet/broadcom/bgmac-bcma-mdio.ko \
+	$(LINUX_OBJ_DIR)/drivers/net/ethernet/broadcom/bgmac.ko
   AUTOLOAD:=$(call AutoProbe,bgmac-bcma)
 endef
 
diff --git a/target/linux/bcm53xx/modules.mk b/target/linux/bcm53xx/modules.mk
index 4b28923d8b..a946bf07ce 100644
--- a/target/linux/bcm53xx/modules.mk
+++ b/target/linux/bcm53xx/modules.mk
@@ -7,7 +7,7 @@ define KernelPackage/phy-bcm-ns-usb2
   KCONFIG:=CONFIG_PHY_BCM_NS_USB2
   DEPENDS:=@TARGET_bcm53xx
   SUBMENU:=$(USB_MENU)
-  FILES:=$(LINUX_DIR)/drivers/phy/broadcom/phy-bcm-ns-usb2.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/phy/broadcom/phy-bcm-ns-usb2.ko
   AUTOLOAD:=$(call AutoLoad,45,phy-bcm-ns-usb2,1)
 endef
 
@@ -23,7 +23,7 @@ define KernelPackage/phy-bcm-ns-usb3
   KCONFIG:=CONFIG_PHY_BCM_NS_USB3
   DEPENDS:=@TARGET_bcm53xx
   SUBMENU:=$(USB_MENU)
-  FILES:=$(LINUX_DIR)/drivers/phy/broadcom/phy-bcm-ns-usb3.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/phy/broadcom/phy-bcm-ns-usb3.ko
   AUTOLOAD:=$(call AutoLoad,45,phy-bcm-ns-usb3,1)
 endef
 
@@ -41,7 +41,7 @@ define KernelPackage/i2c-bcm-iproc
 	CONFIG_I2C_SLAVE_TESTUNIT=n
   DEPENDS:=@TARGET_bcm53xx +kmod-i2c-core
   SUBMENU:=$(I2C_MENU)
-  FILES:=$(LINUX_DIR)/drivers/i2c/busses/i2c-bcm-iproc.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/i2c/busses/i2c-bcm-iproc.ko
   AUTOLOAD:=$(call AutoLoad,59,i2c-bcm-iproc,1)
 endef
 
diff --git a/target/linux/bcm63xx/modules.mk b/target/linux/bcm63xx/modules.mk
index c329f3865a..f1de5d9efb 100644
--- a/target/linux/bcm63xx/modules.mk
+++ b/target/linux/bcm63xx/modules.mk
@@ -7,7 +7,7 @@ define KernelPackage/pcmcia-bcm63xx
   TITLE:=Broadcom BCM63xx PCMCIA support
   DEPENDS:=@TARGET_bcm63xx +kmod-pcmcia-rsrc
   KCONFIG:=CONFIG_PCMCIA_BCM63XX
-  FILES:=$(LINUX_DIR)/drivers/pcmcia/bcm63xx_pcmcia.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/pcmcia/bcm63xx_pcmcia.ko
   AUTOLOAD:=$(call AutoLoad,41,bcm63xx_pcmcia)
 endef
 
@@ -23,7 +23,7 @@ define KernelPackage/bcm63xx-udc
   DEPENDS:=@TARGET_bcm63xx +kmod-usb-gadget
   KCONFIG:=CONFIG_USB_BCM63XX_UDC
   FILES:= \
-	$(LINUX_DIR)/drivers/usb/gadget/udc/bcm63xx_udc.ko
+	$(LINUX_OBJ_DIR)/drivers/usb/gadget/udc/bcm63xx_udc.ko
   AUTOLOAD:=$(call AutoLoad,51,bcm63xx_udc)
   $(call AddDepends/usb)
 endef
diff --git a/target/linux/bmips/modules.mk b/target/linux/bmips/modules.mk
index 3032dab709..0ecd6ad798 100644
--- a/target/linux/bmips/modules.mk
+++ b/target/linux/bmips/modules.mk
@@ -4,7 +4,7 @@ define KernelPackage/leds-bcm6328
   SUBMENU:=$(LEDS_MENU)
   TITLE:=BCM6328 LED support
   KCONFIG:=CONFIG_LEDS_BCM6328
-  FILES:=$(LINUX_DIR)/drivers/leds/leds-bcm6328.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/leds/leds-bcm6328.ko
   DEPENDS:=@TARGET_bmips
   AUTOLOAD:=$(call AutoLoad,60,leds-bcm6328,1)
 endef
@@ -19,7 +19,7 @@ define KernelPackage/leds-bcm6358
   SUBMENU:=$(LEDS_MENU)
   TITLE:=BCM6358 LED support
   KCONFIG:=CONFIG_LEDS_BCM6358
-  FILES:=$(LINUX_DIR)/drivers/leds/leds-bcm6358.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/leds/leds-bcm6358.ko
   DEPENDS:=@TARGET_bmips
   AUTOLOAD:=$(call AutoLoad,60,leds-bcm6358,1)
 endef
@@ -34,7 +34,7 @@ define KernelPackage/leds-sercomm-msp430
   SUBMENU:=$(LEDS_MENU)
   TITLE:=Sercomm MSP430G2513 LED support
   KCONFIG:=CONFIG_LEDS_SERCOMM_MSP430
-  FILES:=$(LINUX_DIR)/drivers/leds/leds-sercomm-msp430.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/leds/leds-sercomm-msp430.ko
   DEPENDS:=@TARGET_bmips +kmod-ledtrig-pattern
   AUTOLOAD:=$(call AutoLoad,60,leds-sercomm-msp430,1)
 endef
diff --git a/target/linux/gemini/modules.mk b/target/linux/gemini/modules.mk
index 5f544d12c7..b0832d463d 100644
--- a/target/linux/gemini/modules.mk
+++ b/target/linux/gemini/modules.mk
@@ -5,7 +5,7 @@ define KernelPackage/usb-fotg210
   CONFIG_USB_FOTG210 \
   CONFIG_USB_FOTG210_HCD=y \
   CONFIG_USB_FOTG210_UDC=y
-  FILES:=$(LINUX_DIR)/drivers/usb/fotg210/fotg210.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/fotg210/fotg210.ko
   AUTOLOAD:=$(call AutoLoad,50,fotg210,1)
   $(call AddDepends/usb)
 endef
diff --git a/target/linux/ipq806x/modules.mk b/target/linux/ipq806x/modules.mk
index a2b844d0f0..1d7f283c51 100644
--- a/target/linux/ipq806x/modules.mk
+++ b/target/linux/ipq806x/modules.mk
@@ -3,7 +3,7 @@ define KernelPackage/phy-qcom-ipq806x-usb
   DEPENDS:=@TARGET_ipq806x
   KCONFIG:= CONFIG_PHY_QCOM_IPQ806X_USB
   FILES:= \
-    $(LINUX_DIR)/drivers/phy/qualcomm/phy-qcom-ipq806x-usb.ko
+    $(LINUX_OBJ_DIR)/drivers/phy/qualcomm/phy-qcom-ipq806x-usb.ko
   AUTOLOAD:=$(call AutoLoad,45,phy-qcom-ipq806x-usb,1)
   $(call AddDepends/usb)
 endef
@@ -26,12 +26,12 @@ define KernelPackage/sound-soc-ipq8064-storm
 	CONFIG_SND_SOC_APQ8016_SBC=n \
 	CONFIG_SND_SOC_SC7180=n
   FILES:=\
-	$(LINUX_DIR)/drivers/clk/qcom/lcc-ipq806x.ko \
-	$(LINUX_DIR)/sound/soc/codecs/snd-soc-max98357a.ko \
-	$(LINUX_DIR)/sound/soc/qcom/snd-soc-lpass-cpu.ko \
-	$(LINUX_DIR)/sound/soc/qcom/snd-soc-lpass-ipq806x.ko \
-	$(LINUX_DIR)/sound/soc/qcom/snd-soc-lpass-platform.ko \
-	$(LINUX_DIR)/sound/soc/qcom/snd-soc-storm.ko
+	$(LINUX_OBJ_DIR)/drivers/clk/qcom/lcc-ipq806x.ko \
+	$(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-max98357a.ko \
+	$(LINUX_OBJ_DIR)/sound/soc/qcom/snd-soc-lpass-cpu.ko \
+	$(LINUX_OBJ_DIR)/sound/soc/qcom/snd-soc-lpass-ipq806x.ko \
+	$(LINUX_OBJ_DIR)/sound/soc/qcom/snd-soc-lpass-platform.ko \
+	$(LINUX_OBJ_DIR)/sound/soc/qcom/snd-soc-storm.ko
   AUTOLOAD:=$(call AutoProbe,lcc-ipq806x \
 	snd-soc-max98357a snd-soc-lpass-ipq806x snd-soc-storm)
   $(call AddDepends/sound)
diff --git a/target/linux/kirkwood/modules.mk b/target/linux/kirkwood/modules.mk
index 1543098cd4..e4a8cb2f6c 100644
--- a/target/linux/kirkwood/modules.mk
+++ b/target/linux/kirkwood/modules.mk
@@ -2,7 +2,7 @@ define KernelPackage/ata-marvell-sata
   TITLE:=Marvell Serial ATA support
   DEPENDS:=@TARGET_kirkwood
   KCONFIG:=CONFIG_SATA_MV CONFIG_SATA_PMP=y
-  FILES:=$(LINUX_DIR)/drivers/ata/sata_mv.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/ata/sata_mv.ko
   AUTOLOAD:=$(call AutoLoad,41,sata_mv,1)
   $(call AddDepends/ata)
 endef
@@ -19,7 +19,7 @@ define KernelPackage/mvsdio
   DEPENDS:=+kmod-mmc @TARGET_kirkwood
   KCONFIG:= CONFIG_MMC_MVSDIO
   FILES:= \
-	$(LINUX_DIR)/drivers/mmc/host/mvsdio.ko
+	$(LINUX_OBJ_DIR)/drivers/mmc/host/mvsdio.ko
   AUTOLOAD:=$(call AutoProbe,mvsdio,1)
 endef
 
diff --git a/target/linux/layerscape/modules.mk b/target/linux/layerscape/modules.mk
index 9aa11e08fb..8de633ae9a 100644
--- a/target/linux/layerscape/modules.mk
+++ b/target/linux/layerscape/modules.mk
@@ -6,7 +6,7 @@ define KernelPackage/ahci-qoriq
   SUBMENU:=$(BLOCK_MENU)
   TITLE:=Freescale QorIQ AHCI SATA support
   KCONFIG:=CONFIG_AHCI_QORIQ
-  FILES:=$(LINUX_DIR)/drivers/ata/ahci_qoriq.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/ata/ahci_qoriq.ko
   AUTOLOAD:=$(call AutoLoad,40,ahci-qoriq,1)
   $(call AddDepends/ata,+kmod-ata-ahci-platform @TARGET_layerscape)
 endef
@@ -24,7 +24,7 @@ define KernelPackage/ppfe
   DEPENDS:=@TARGET_layerscape
   KCONFIG:=CONFIG_FSL_PPFE \
   	CONFIG_FSL_PPFE_UTIL_DISABLED=y
-  FILES:=$(LINUX_DIR)/drivers/staging/fsl_ppfe/pfe.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/staging/fsl_ppfe/pfe.ko
   AUTOLOAD:=$(call AutoLoad,35,pfe)
 endef
 
diff --git a/target/linux/mediatek/modules.mk b/target/linux/mediatek/modules.mk
index 8480123725..2f8c780fc8 100644
--- a/target/linux/mediatek/modules.mk
+++ b/target/linux/mediatek/modules.mk
@@ -2,8 +2,8 @@ define KernelPackage/ata-ahci-mtk
   TITLE:=Mediatek AHCI Serial ATA support
   KCONFIG:=CONFIG_AHCI_MTK
   FILES:= \
-	$(LINUX_DIR)/drivers/ata/ahci_mtk.ko \
-	$(LINUX_DIR)/drivers/ata/libahci_platform.ko
+	$(LINUX_OBJ_DIR)/drivers/ata/ahci_mtk.ko \
+	$(LINUX_OBJ_DIR)/drivers/ata/libahci_platform.ko
   AUTOLOAD:=$(call AutoLoad,40,libahci libahci_platform ahci_mtk,1)
   $(call AddDepends/ata)
   DEPENDS+=@(TARGET_mediatek_mt7622||TARGET_mediatek_mt7623)
@@ -21,7 +21,7 @@ define KernelPackage/btmtkuart
   DEPENDS:=@TARGET_mediatek_mt7622 +kmod-bluetooth +mt7622bt-firmware
   KCONFIG:=CONFIG_BT_MTKUART
   FILES:= \
-	$(LINUX_DIR)/drivers/bluetooth/btmtkuart.ko
+	$(LINUX_OBJ_DIR)/drivers/bluetooth/btmtkuart.ko
   AUTOLOAD:=$(call AutoProbe,btmtkuart)
 endef
 
@@ -32,7 +32,7 @@ define KernelPackage/iio-mt6577-auxadc
   DEPENDS:=@(TARGET_mediatek_mt7622||TARGET_mediatek_filogic)
   KCONFIG:=CONFIG_MEDIATEK_MT6577_AUXADC
   FILES:= \
-	$(LINUX_DIR)/drivers/iio/adc/mt6577_auxadc.ko
+	$(LINUX_OBJ_DIR)/drivers/iio/adc/mt6577_auxadc.ko
   AUTOLOAD:=$(call AutoProbe,mt6577_auxadc)
   $(call AddDepends/iio)
 endef
diff --git a/target/linux/mvebu/modules.mk b/target/linux/mvebu/modules.mk
index 311cc07c7f..7c22b32d34 100644
--- a/target/linux/mvebu/modules.mk
+++ b/target/linux/mvebu/modules.mk
@@ -3,7 +3,7 @@ define KernelPackage/linkstation-poweroff
   DEPENDS:=@TARGET_mvebu
   TITLE:=Buffalo LinkStation power off driver
   KCONFIG:=CONFIG_POWER_RESET_LINKSTATION
-  FILES:=$(LINUX_DIR)/drivers/power/reset/linkstation-poweroff.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/power/reset/linkstation-poweroff.ko
   AUTOLOAD:=$(call AutoLoad,31,linkstation-poweroff,1)
 endef
 
@@ -22,7 +22,7 @@ define KernelPackage/leds-turris-omnia
    TITLE:=LED support for CZ.NIC's Turris Omnia
    DEPENDS:=@TARGET_mvebu_cortexa9
    KCONFIG:=CONFIG_LEDS_TURRIS_OMNIA
-   FILES:=$(LINUX_DIR)/drivers/leds/leds-turris-omnia.ko
+   FILES:=$(LINUX_OBJ_DIR)/drivers/leds/leds-turris-omnia.ko
    AUTOLOAD:=$(call AutoLoad,60,leds-turris-omnia,1)
 endef
 
diff --git a/target/linux/oxnas/modules.mk b/target/linux/oxnas/modules.mk
index 35d03c5d61..b6a8f370fa 100644
--- a/target/linux/oxnas/modules.mk
+++ b/target/linux/oxnas/modules.mk
@@ -1,7 +1,7 @@
 define KernelPackage/ata-oxnas-sata
   TITLE:=oxnas Serial ATA support
   KCONFIG:=CONFIG_SATA_OXNAS
-  FILES:=$(LINUX_DIR)/drivers/ata/sata_oxnas.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/ata/sata_oxnas.ko
   AUTOLOAD:=$(call AutoLoad,41,sata_oxnas,1)
   $(call AddDepends/ata, at TARGET_oxnas)
 endef
@@ -16,7 +16,7 @@ $(eval $(call KernelPackage,ata-oxnas-sata))
 define KernelPackage/usb2-oxnas
   TITLE:=OX820 EHCI driver
   KCONFIG:=CONFIG_USB_EHCI_OXNAS
-  FILES:=$(LINUX_DIR)/drivers/usb/host/ehci-oxnas.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/usb/host/ehci-oxnas.ko
   AUTOLOAD:=$(call AutoLoad,55,ehci-oxnas,1)
   $(call AddDepends/usb, at TARGET_oxnas_ox820 +kmod-usb2)
 endef
diff --git a/target/linux/ramips/modules.mk b/target/linux/ramips/modules.mk
index 6f199c46a2..373b8a9aef 100644
--- a/target/linux/ramips/modules.mk
+++ b/target/linux/ramips/modules.mk
@@ -13,7 +13,7 @@ define KernelPackage/pwm-mediatek-ramips
 	CONFIG_PWM_MEDIATEK_RAMIPS \
 	CONFIG_PWM_SYSFS=y
   FILES:= \
-	$(LINUX_DIR)/drivers/pwm/pwm-mediatek-ramips.ko
+	$(LINUX_OBJ_DIR)/drivers/pwm/pwm-mediatek-ramips.ko
   AUTOLOAD:=$(call AutoProbe,pwm-mediatek-ramips)
 endef
 
@@ -32,7 +32,7 @@ define KernelPackage/sdhci-mt7620
 	CONFIG_MTK_AEE_KDUMP=n \
 	CONFIG_MTK_MMC_CD_POLL=n
   FILES:= \
-	$(LINUX_DIR)/drivers/mmc/host/mtk-mmc/mtk_sd.ko
+	$(LINUX_OBJ_DIR)/drivers/mmc/host/mtk-mmc/mtk_sd.ko
   AUTOLOAD:=$(call AutoProbe,mtk_sd,1)
 endef
 
@@ -80,8 +80,8 @@ define KernelPackage/dma-ralink
 	CONFIG_DW_DMAC_PCI=n \
 	CONFIG_DMA_RALINK
   FILES:= \
-	$(LINUX_DIR)/drivers/dma/virt-dma.ko \
-	$(LINUX_DIR)/drivers/staging/ralink-gdma/ralink-gdma.ko
+	$(LINUX_OBJ_DIR)/drivers/dma/virt-dma.ko \
+	$(LINUX_OBJ_DIR)/drivers/staging/ralink-gdma/ralink-gdma.ko
   AUTOLOAD:=$(call AutoLoad,52,ralink-gdma)
 endef
 
@@ -100,8 +100,8 @@ define KernelPackage/hsdma-mtk
 	CONFIG_DW_DMAC_PCI=n \
 	CONFIG_MTK_HSDMA
   FILES:= \
-	$(LINUX_DIR)/drivers/dma/virt-dma.ko \
-	$(LINUX_DIR)/drivers/staging/mt7621-dma/hsdma-mt7621.ko
+	$(LINUX_OBJ_DIR)/drivers/dma/virt-dma.ko \
+	$(LINUX_OBJ_DIR)/drivers/staging/mt7621-dma/hsdma-mt7621.ko
   AUTOLOAD:=$(call AutoLoad,53,hsdma-mt7621)
 endef
 
@@ -120,10 +120,10 @@ define KernelPackage/sound-mt7620
 	CONFIG_SND_SIMPLE_CARD_UTILS \
 	CONFIG_SND_SOC_WM8960
   FILES:= \
-	$(LINUX_DIR)/sound/soc/ralink/snd-soc-ralink-i2s.ko \
-	$(LINUX_DIR)/sound/soc/generic/snd-soc-simple-card.ko \
-	$(LINUX_DIR)/sound/soc/generic/snd-soc-simple-card-utils.ko \
-	$(LINUX_DIR)/sound/soc/codecs/snd-soc-wm8960.ko
+	$(LINUX_OBJ_DIR)/sound/soc/ralink/snd-soc-ralink-i2s.ko \
+	$(LINUX_OBJ_DIR)/sound/soc/generic/snd-soc-simple-card.ko \
+	$(LINUX_OBJ_DIR)/sound/soc/generic/snd-soc-simple-card-utils.ko \
+	$(LINUX_OBJ_DIR)/sound/soc/codecs/snd-soc-wm8960.ko
   AUTOLOAD:=$(call AutoLoad,90,snd-soc-wm8960 snd-soc-ralink-i2s snd-soc-simple-card)
   $(call AddDepends/sound)
 endef
diff --git a/target/linux/sunxi/modules.mk b/target/linux/sunxi/modules.mk
index 28ed86ba4c..f04c756c63 100644
--- a/target/linux/sunxi/modules.mk
+++ b/target/linux/sunxi/modules.mk
@@ -8,7 +8,7 @@ define KernelPackage/mfd-ac100
     DEPENDS:=@TARGET_sunxi
     KCONFIG:= \
 	CONFIG_MFD_AC100
-    FILES:=$(LINUX_DIR)/drivers/mfd/ac100.ko
+    FILES:=$(LINUX_OBJ_DIR)/drivers/mfd/ac100.ko
     AUTOLOAD:=$(call AutoLoad,50,ac100)
 endef
 
@@ -26,7 +26,7 @@ define KernelPackage/rtc-ac100
     KCONFIG:= \
 	CONFIG_RTC_DRV_AC100 \
 	CONFIG_RTC_CLASS=y
-    FILES:=$(LINUX_DIR)/drivers/rtc/rtc-ac100.ko
+    FILES:=$(LINUX_OBJ_DIR)/drivers/rtc/rtc-ac100.ko
     AUTOLOAD:=$(call AutoLoad,50,rtc-ac100)
 endef
 
@@ -43,7 +43,7 @@ define KernelPackage/rtc-sunxi
     KCONFIG:= \
 	CONFIG_RTC_DRV_SUNXI \
 	CONFIG_RTC_CLASS=y
-    FILES:=$(LINUX_DIR)/drivers/rtc/rtc-sunxi.ko
+    FILES:=$(LINUX_OBJ_DIR)/drivers/rtc/rtc-sunxi.ko
     AUTOLOAD:=$(call AutoLoad,50,rtc-sunxi)
 endef
 
@@ -63,7 +63,7 @@ define KernelPackage/sunxi-ir
 	CONFIG_RC_DEVICES=y \
 	CONFIG_RC_CORE=y \
 	CONFIG_IR_SUNXI
-    FILES:=$(LINUX_DIR)/drivers/media/rc/sunxi-cir.ko
+    FILES:=$(LINUX_OBJ_DIR)/drivers/media/rc/sunxi-cir.ko
     AUTOLOAD:=$(call AutoLoad,50,sunxi-cir)
 endef
 
@@ -78,7 +78,7 @@ define KernelPackage/ata-sunxi
     SUBMENU:=$(BLOCK_MENU)
     DEPENDS:=@TARGET_sunxi +kmod-ata-ahci-platform +kmod-scsi-core
     KCONFIG:=CONFIG_AHCI_SUNXI
-    FILES:=$(LINUX_DIR)/drivers/ata/ahci_sunxi.ko
+    FILES:=$(LINUX_OBJ_DIR)/drivers/ata/ahci_sunxi.ko
     AUTOLOAD:=$(call AutoLoad,41,ahci_sunxi,1)
 endef
 
@@ -93,7 +93,7 @@ define KernelPackage/sun4i-emac
   TITLE:=AllWinner EMAC Ethernet support
   DEPENDS:=@TARGET_sunxi +kmod-of-mdio +kmod-libphy
   KCONFIG:=CONFIG_SUN4I_EMAC
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/allwinner/sun4i-emac.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/allwinner/sun4i-emac.ko
   AUTOLOAD:=$(call AutoProbe,sun4i-emac)
 endef
 
@@ -102,7 +102,7 @@ $(eval $(call KernelPackage,sun4i-emac))
 define KernelPackage/sound-soc-sunxi
   TITLE:=AllWinner built-in SoC sound support
   KCONFIG:=CONFIG_SND_SUN4I_CODEC
-  FILES:=$(LINUX_DIR)/sound/soc/sunxi/sun4i-codec.ko
+  FILES:=$(LINUX_OBJ_DIR)/sound/soc/sunxi/sun4i-codec.ko
   AUTOLOAD:=$(call AutoLoad,65,sun4i-codec)
   DEPENDS:=@TARGET_sunxi +kmod-sound-soc-core
   $(call AddDepends/sound)
@@ -117,7 +117,7 @@ $(eval $(call KernelPackage,sound-soc-sunxi))
 define KernelPackage/sound-soc-sunxi-spdif
   TITLE:=Allwinner A10 SPDIF Support
   KCONFIG:=CONFIG_SND_SUN4I_SPDIF
-  FILES:=$(LINUX_DIR)/sound/soc/sunxi/sun4i-spdif.ko
+  FILES:=$(LINUX_OBJ_DIR)/sound/soc/sunxi/sun4i-spdif.ko
   AUTOLOAD:=$(call AutoLoad,65,sun4i-spdif)
   DEPENDS:=@TARGET_sunxi +kmod-sound-soc-spdif
   $(call AddDepends/sound)
diff --git a/target/linux/x86/modules.mk b/target/linux/x86/modules.mk
index f5f225d06f..d8b3f9003b 100644
--- a/target/linux/x86/modules.mk
+++ b/target/linux/x86/modules.mk
@@ -7,7 +7,7 @@ define KernelPackage/amd-xgbe
   TITLE:=AMD Ethernet on SoC support
   DEPENDS:=@PCI_SUPPORT @x86_64 +kmod-lib-crc32c +kmod-ptp +kmod-libphy +kmod-mdio-devres
   KCONFIG:=CONFIG_AMD_XGBE
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/amd/xgbe/amd-xgbe.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/net/ethernet/amd/xgbe/amd-xgbe.ko
   AUTOLOAD:=$(call AutoLoad,35,amd-xgbe)
 endef
 
@@ -25,7 +25,7 @@ define KernelPackage/f71808e-wdt
   KCONFIG:=\
 	CONFIG_F71808E_WDT \
 	CONFIG_WATCHDOG_CORE=y
-  FILES:=$(LINUX_DIR)/drivers/watchdog/f71808e_wdt.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/watchdog/f71808e_wdt.ko
   AUTOLOAD:=$(call AutoProbe,f71808e-wdt,1)
 endef
 
@@ -40,7 +40,7 @@ define KernelPackage/sound-cs5535audio
   TITLE:=CS5535/CS5536 Audio Controller
   DEPENDS:=@TARGET_x86_geode +kmod-ac97
   KCONFIG:=CONFIG_SND_CS5535AUDIO
-  FILES:=$(LINUX_DIR)/sound/pci/cs5535audio/snd-cs5535audio.ko
+  FILES:=$(LINUX_OBJ_DIR)/sound/pci/cs5535audio/snd-cs5535audio.ko
   AUTOLOAD:=$(call AutoLoad,36,snd-cs5535audio)
   $(call AddDepends/sound)
 endef
@@ -57,7 +57,7 @@ define KernelPackage/sp5100-tco
   TITLE:=SP5100 Watchdog Support
   DEPENDS:=@TARGET_x86
   KCONFIG:=CONFIG_SP5100_TCO
-  FILES:=$(LINUX_DIR)/drivers/watchdog/sp5100_tco.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/watchdog/sp5100_tco.ko
   AUTOLOAD:=$(call AutoLoad,50,sp5100_tco,1)
 endef
 
@@ -73,7 +73,7 @@ define KernelPackage/ib700-wdt
   TITLE:=IB700 SBC Watchdog Timer
   DEPENDS:=@TARGET_x86
   KCONFIG:=CONFIG_IB700_WDT
-  FILES:=$(LINUX_DIR)/drivers/watchdog/ib700wdt.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/watchdog/ib700wdt.ko
   AUTOLOAD:=$(call AutoLoad,50,ib700wdt,1)
 endef
 
@@ -90,7 +90,7 @@ define KernelPackage/it87-wdt
   TITLE:=ITE IT87 Watchdog Timer
   DEPENDS:=@TARGET_x86
   KCONFIG:=CONFIG_IT87_WDT
-  FILES:=$(LINUX_DIR)/drivers/watchdog/it87_wdt.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/watchdog/it87_wdt.ko
   AUTOLOAD:=$(call AutoLoad,50,it87-wdt,1)
   MODPARAMS.it87-wdt:= \
 	nogameport=1 \
@@ -112,8 +112,8 @@ define KernelPackage/itco-wdt
 	CONFIG_ITCO_WDT \
 	CONFIG_ITCO_VENDOR_SUPPORT=y \
 	CONFIG_WATCHDOG_CORE=y
-  FILES:=$(LINUX_DIR)/drivers/watchdog/iTCO_wdt.ko \
-         $(LINUX_DIR)/drivers/watchdog/iTCO_vendor_support.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/watchdog/iTCO_wdt.ko \
+         $(LINUX_OBJ_DIR)/drivers/watchdog/iTCO_vendor_support.ko
   AUTOLOAD:=$(call AutoLoad,50,iTCO_vendor_support iTCO_wdt,1)
 endef
 
@@ -129,7 +129,7 @@ define KernelPackage/pcengines-apuv2
   TITLE:=PC Engines APUv2/3 front button and LEDs driver
   DEPENDS:=@TARGET_x86 +kmod-gpio-amd-fch +kmod-leds-gpio
   KCONFIG:=CONFIG_PCENGINES_APU2
-  FILES:=$(LINUX_DIR)/drivers/platform/x86/pcengines-apuv2.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/platform/x86/pcengines-apuv2.ko
   AUTOLOAD:=$(call AutoLoad,60,pcengines-apuv2)
 endef
 
@@ -148,7 +148,7 @@ define KernelPackage/meraki-mx100
     +kmod-usb-ledtrig-usbport +PACKAGE_kmod-meraki-mx100:nu801 +kmod-itco-wdt \
     +kmod-leds-uleds
   KCONFIG:=CONFIG_MERAKI_MX100
-  FILES:=$(LINUX_DIR)/drivers/platform/x86/meraki-mx100.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/platform/x86/meraki-mx100.ko
   AUTOLOAD:=$(call AutoLoad,60,meraki-mx100,1)
 endef
 
@@ -168,7 +168,7 @@ define KernelPackage/w83627hf-wdt
   KCONFIG:=\
 	CONFIG_W83627HF_WDT \
 	CONFIG_WATCHDOG_CORE=y
-  FILES:=$(LINUX_DIR)/drivers/watchdog/w83627hf_wdt.ko
+  FILES:=$(LINUX_OBJ_DIR)/drivers/watchdog/w83627hf_wdt.ko
   AUTOLOAD:=$(call AutoLoad,50,w83627hf-wdt,1)
 endef
 
-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |       ehem+openwrt at m5p.com     PGP 87145445       |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445





From ehem+openwrt at m5p.com  Sat Nov 11 22:51:08 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Sat, 11 Nov 2023 22:51:08 -0800
Subject: [PATCH 12/20] [WIP] build: adjust include paths to use
 LINUX_SRC_DIR/LINUX_OBJ_DIR
In-Reply-To: <cover.1700010286.git.ehem+openwrt@m5p.com>
References: <cover.1700010286.git.ehem+openwrt@m5p.com>
Message-ID: <d0885cdb69a39768f3a6d68151cb3a8bd90b3d8a.1700010293.git.ehem+openwrt@m5p.com>

Most headers come out of the source.  Some spots also reference the
kernel build directory.

Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>
---
 include/image.mk                                 | 3 ++-
 include/kernel.mk                                | 2 +-
 package/devel/perf/Makefile                      | 2 +-
 package/kernel/bpf-headers/Makefile              | 6 +++---
 package/kernel/lantiq/ltq-adsl/Makefile          | 4 ++--
 package/kernel/lantiq/ltq-ifxos/Makefile         | 4 ++--
 package/kernel/lantiq/ltq-tapi/Makefile          | 4 ++--
 package/kernel/lantiq/ltq-vdsl-vr11-mei/Makefile | 4 ++--
 package/kernel/lantiq/ltq-vdsl-vr11/Makefile     | 4 ++--
 package/kernel/lantiq/ltq-vdsl-vr9-mei/Makefile  | 4 ++--
 package/kernel/lantiq/ltq-vdsl-vr9/Makefile      | 4 ++--
 package/kernel/lantiq/ltq-vmmc/Makefile          | 4 ++--
 package/kernel/mac80211/Makefile                 | 6 +++---
 package/network/config/ltq-adsl-app/Makefile     | 2 +-
 package/network/services/ppp/Makefile            | 6 +++---
 package/network/utils/iproute2/Makefile          | 2 +-
 package/network/utils/ipset/Makefile             | 2 +-
 17 files changed, 32 insertions(+), 31 deletions(-)

diff --git a/include/image.mk b/include/image.mk
index 794b32387d..a0a1d755d4 100644
--- a/include/image.mk
+++ b/include/image.mk
@@ -187,7 +187,8 @@ define Image/BuildDTB/sub
 		$(DTS_CPPFLAGS) \
 		-I$(DTS_DIR) \
 		-I$(DTS_DIR)/include \
-		-I$(LINUX_DIR)/include/ \
+		-I$(LINUX_OBJ_DIR)/include/ \
+		-I$(LINUX_SRC_DIR)/include/ \
 		-undef -D__DTS__ $(3) \
 		-o $(2).tmp $(1)
 	$(LINUX_OBJ_DIR)/scripts/dtc/dtc -O dtb \
diff --git a/include/kernel.mk b/include/kernel.mk
index ff34f74bed..8362fa768b 100644
--- a/include/kernel.mk
+++ b/include/kernel.mk
@@ -71,7 +71,7 @@ else
   else ifeq ($(call qstrip,$(CONFIG_EXTERNAL_KERNEL_TREE))$(call qstrip,$(CONFIG_KERNEL_GIT_CLONE_URI)),)
       LINUX_SITE:=@KERNEL/linux/kernel/v$(word 1,$(subst ., ,$(KERNEL_BASE))).x
   else
-      LINUX_UNAME_VERSION:=$(strip $(shell cat $(LINUX_DIR)/include/config/kernel.release 2>/dev/null))
+      LINUX_UNAME_VERSION:=$(strip $(shell cat $(LINUX_OBJ_DIR)/include/config/kernel.release 2>/dev/null))
   endif
 
   MODULES_SUBDIR:=lib/modules/$(LINUX_UNAME_VERSION)
diff --git a/package/devel/perf/Makefile b/package/devel/perf/Makefile
index f9573c4150..31881c0136 100644
--- a/package/devel/perf/Makefile
+++ b/package/devel/perf/Makefile
@@ -38,7 +38,7 @@ define Package/perf/description
   perf is the Linux performance monitoring tool
 endef
 
-HOST_CFLAGS += -I$(LINUX_DIR)/tools/include
+HOST_CFLAGS += -I$(LINUX_SRC_DIR)/tools/include
 
 TARGET_LDFLAGS += $(INTL_LDFLAGS)
 
diff --git a/package/kernel/bpf-headers/Makefile b/package/kernel/bpf-headers/Makefile
index 5efd2e1cf0..e000a1d56c 100644
--- a/package/kernel/bpf-headers/Makefile
+++ b/package/kernel/bpf-headers/Makefile
@@ -79,10 +79,10 @@ define Build/Configure
 	yes '' | $(KERNEL_MAKE) oldconfig
 	grep 'CONFIG_HZ=' $(REAL_LINUX_DIR)/.config | \
 		cut -d= -f2 | \
-		bc -q $(LINUX_DIR)/kernel/time/timeconst.bc \
-		> $(LINUX_DIR)/include/generated/timeconst.h
+		bc -q $(LINUX_SRC_DIR)/kernel/time/timeconst.bc \
+		> $(LINUX_OBJ_DIR)/include/generated/timeconst.h
 	$(BPF_DOC) --header \
-		--file $(LINUX_DIR)/tools/include/uapi/linux/bpf.h \
+		--file $(LINUX_SRC_DIR)/tools/include/uapi/linux/bpf.h \
 		> $(PKG_BUILD_DIR)/tools/lib/bpf/bpf_helper_defs.h
 endef
 
diff --git a/package/kernel/lantiq/ltq-adsl/Makefile b/package/kernel/lantiq/ltq-adsl/Makefile
index ac96674933..01cf8f8791 100644
--- a/package/kernel/lantiq/ltq-adsl/Makefile
+++ b/package/kernel/lantiq/ltq-adsl/Makefile
@@ -49,7 +49,7 @@ IFX_DSL_CHANNELS_PER_LINE=1
 MAKE_FLAGS += \
 	$(KERNEL_MAKE_FLAGS)
 
-CONFIGURE_ARGS += --enable-kernel-include="$(LINUX_DIR)/include" \
+CONFIGURE_ARGS += --enable-kernel-include="$(LINUX_SRC_DIR)/include" \
 	--with-max-device="$(IFX_DSL_MAX_DEVICE)" \
 	--with-lines-per-device="$(IFX_DSL_LINES_PER_DEVICE)" \
 	--with-channels-per-line="$(IFX_DSL_CHANNELS_PER_LINE)" \
@@ -68,7 +68,7 @@ CONFIGURE_ARGS += --enable-kernel-include="$(LINUX_DIR)/include" \
 	--enable-dsl-pm-line-thresholds \
 	--enable-dsl-pm-optional-parameters \
 	--enable-linux-26 \
-	--enable-kernelbuild="$(LINUX_DIR)" \
+	--enable-kernelbuild="$(LINUX_OBJ_DIR)" \
 	ARCH=$(LINUX_KARCH)
 
 CONFIG_TAG_danube:=DANUBE
diff --git a/package/kernel/lantiq/ltq-ifxos/Makefile b/package/kernel/lantiq/ltq-ifxos/Makefile
index 97f7ca78ce..f5cb1d233b 100644
--- a/package/kernel/lantiq/ltq-ifxos/Makefile
+++ b/package/kernel/lantiq/ltq-ifxos/Makefile
@@ -41,8 +41,8 @@ endef
 CONFIGURE_ARGS += \
 	ARCH=$(LINUX_KARCH) \
 	--enable-linux-26 \
-	--enable-kernelbuild="$(LINUX_DIR)" \
-	--enable-kernelincl="$(LINUX_DIR)/include" \
+	--enable-kernelbuild="$(LINUX_OBJ_DIR)" \
+	--enable-kernelincl="$(LINUX_SRC_DIR)/include" \
 	--with-kernel-module
 
 define Build/InstallDev
diff --git a/package/kernel/lantiq/ltq-tapi/Makefile b/package/kernel/lantiq/ltq-tapi/Makefile
index d44eeae565..80435e4c10 100644
--- a/package/kernel/lantiq/ltq-tapi/Makefile
+++ b/package/kernel/lantiq/ltq-tapi/Makefile
@@ -46,8 +46,8 @@ MAKE_FLAGS += \
 CONFIGURE_ARGS += \
 	ARCH=$(LINUX_KARCH) \
 	--enable-linux-26 \
-	--enable-kernelbuild="$(LINUX_DIR)" \
-	--enable-kernelincl="$(LINUX_DIR)/include" \
+	--enable-kernelbuild="$(LINUX_OBJ_DIR)" \
+	--enable-kernelincl="$(LINUX_SRC_DIR)/include" \
 	--with-ifxos-incl=$(STAGING_DIR)/usr/include/ifxos \
 	$(call autoconf_bool,CONFIG_IFX_DRV_TAPI_EVENT_LOGGER,el-debug) \
 	$(call autoconf_bool,CONFIG_VOICE_CPE_TAPI_FAX,fax t38) \
diff --git a/package/kernel/lantiq/ltq-vdsl-vr11-mei/Makefile b/package/kernel/lantiq/ltq-vdsl-vr11-mei/Makefile
index 7b8a948179..570f806426 100644
--- a/package/kernel/lantiq/ltq-vdsl-vr11-mei/Makefile
+++ b/package/kernel/lantiq/ltq-vdsl-vr11-mei/Makefile
@@ -83,7 +83,7 @@ MEI_DRV_CFLAGS+= \
 	-DMEI_TARGET_x86=1
 
 CONFIGURE_ARGS += \
-	--enable-kernelincl="$(LINUX_DIR)/include" \
+	--enable-kernelincl="$(LINUX_SRC_DIR)/include" \
 	--enable-device=vr11 \
 	--enable-debug \
 	--enable-error_print \
@@ -91,7 +91,7 @@ CONFIGURE_ARGS += \
 	--enable-ifxos-library="-L$(STAGING_DIR)/usr/lib" \
 	--enable-add_drv_cflags="$(MEI_DRV_CFLAGS)" \
 	--enable-linux-26 \
-	--enable-kernelbuild="$(LINUX_DIR)" \
+	--enable-kernelbuild="$(LINUX_OBJ_DIR)" \
 	--enable-drv_test_appl=yes \
 	ARCH=$(LINUX_KARCH)
 
diff --git a/package/kernel/lantiq/ltq-vdsl-vr11/Makefile b/package/kernel/lantiq/ltq-vdsl-vr11/Makefile
index 11f96d744a..0289ed1e22 100644
--- a/package/kernel/lantiq/ltq-vdsl-vr11/Makefile
+++ b/package/kernel/lantiq/ltq-vdsl-vr11/Makefile
@@ -54,14 +54,14 @@ CONFIGURE_ARGS += \
 	--enable-add_ext_drv_cflags="-DDSL_DRV_ATM_PTM_INTERFACE_ENABLE=1" \
 	--enable-debug-logger-support=no
 
-CONFIGURE_ARGS += --enable-kernel-include="$(LINUX_DIR)/include" \
+CONFIGURE_ARGS += --enable-kernel-include="$(LINUX_SRC_DIR)/include" \
 	--enable-vrx \
 	--enable-vrx-device=vr11 \
 	--enable-ifxos \
 	--enable-ifxos-include="-I$(STAGING_DIR)/usr/include/ifxos" \
 	--enable-driver-include="-I$(STAGING_DIR)/usr/include/vdsl" \
 	--enable-linux-26 \
-	--enable-kernelbuild="$(LINUX_DIR)" \
+	--enable-kernelbuild="$(LINUX_OBJ_DIR)" \
 	--enable-debug-prints=no \
 	ARCH=$(LINUX_KARCH)
 
diff --git a/package/kernel/lantiq/ltq-vdsl-vr9-mei/Makefile b/package/kernel/lantiq/ltq-vdsl-vr9-mei/Makefile
index e9c5a681fd..f78e6255f3 100644
--- a/package/kernel/lantiq/ltq-vdsl-vr9-mei/Makefile
+++ b/package/kernel/lantiq/ltq-vdsl-vr9-mei/Makefile
@@ -66,7 +66,7 @@ MEI_DRV_CFLAGS = \
 	-DMEI_SUPPORT_OPTIMIZED_FW_DL=1
 
 CONFIGURE_ARGS += \
-	--enable-kernelincl="$(LINUX_DIR)/include" \
+	--enable-kernelincl="$(LINUX_SRC_DIR)/include" \
 	--enable-device=vr9 \
 	--with-max-device=1 \
 	--with-lines-per-device=1 \
@@ -76,7 +76,7 @@ CONFIGURE_ARGS += \
 	--enable-ifxos-library="-L$(STAGING_DIR)/usr/lib" \
 	--enable-add_drv_cflags="$(MEI_DRV_CFLAGS)" \
 	--enable-linux-26 \
-	--enable-kernelbuild="$(LINUX_DIR)" \
+	--enable-kernelbuild="$(LINUX_OBJ_DIR)" \
 	--enable-drv_test_appl=yes \
 	ARCH=$(LINUX_KARCH)
 
diff --git a/package/kernel/lantiq/ltq-vdsl-vr9/Makefile b/package/kernel/lantiq/ltq-vdsl-vr9/Makefile
index ebcb935a73..f580e38778 100644
--- a/package/kernel/lantiq/ltq-vdsl-vr9/Makefile
+++ b/package/kernel/lantiq/ltq-vdsl-vr9/Makefile
@@ -45,7 +45,7 @@ MAKE_FLAGS += \
 	$(KERNEL_MAKE_FLAGS) \
 	SHELL="$(BASH)"
 
-CONFIGURE_ARGS += --enable-kernel-include="$(LINUX_DIR)/include" \
+CONFIGURE_ARGS += --enable-kernel-include="$(LINUX_SRC_DIR)/include" \
 	--with-max-device="1" \
 	--with-lines-per-device="1" \
 	--with-channels-per-line="1" \
@@ -56,7 +56,7 @@ CONFIGURE_ARGS += --enable-kernel-include="$(LINUX_DIR)/include" \
 	--enable-driver-include="-I$(STAGING_DIR)/usr/include/vdsl" \
 	--enable-add-drv-cflags="-DMODULE -DINCLUDE_DSL_ATM_PTM_INTERFACE_SUPPORT" \
 	--enable-linux-26 \
-	--enable-kernelbuild="$(LINUX_DIR)" \
+	--enable-kernelbuild="$(LINUX_OBJ_DIR)" \
 	--enable-debug-prints=no \
 	ARCH=mips
 
diff --git a/package/kernel/lantiq/ltq-vmmc/Makefile b/package/kernel/lantiq/ltq-vmmc/Makefile
index c96cee819b..55c5688240 100644
--- a/package/kernel/lantiq/ltq-vmmc/Makefile
+++ b/package/kernel/lantiq/ltq-vmmc/Makefile
@@ -45,8 +45,8 @@ MAKE_FLAGS += \
 CONFIGURE_ARGS += \
 	ARCH=$(LINUX_KARCH) \
 	--enable-linux-26 \
-	--enable-kernelbuild="$(LINUX_DIR)" \
-	--enable-kernelincl="$(LINUX_DIR)/include" \
+	--enable-kernelbuild="$(LINUX_OBJ_DIR)" \
+	--enable-kernelincl="$(LINUX_SRC_DIR)/include" \
 	--enable-tapiincl="$(STAGING_DIR)/usr/include/drv_tapi" \
 	--with-ifxos-incl=$(STAGING_DIR)/usr/include/ifxos \
 	$(call autoconf_bool,CONFIG_VOICE_CPE_VMMC_EVENT_LOGGER,el-debug) \
diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile
index c9e2a37f6d..d5e3171f94 100644
--- a/package/kernel/mac80211/Makefile
+++ b/package/kernel/mac80211/Makefile
@@ -325,9 +325,9 @@ endif
 ifeq ($(strip $(CONFIG_EXTERNAL_KERNEL_TREE)),"")
   ifeq ($(strip $(CONFIG_KERNEL_GIT_CLONE_URI)),"")
     define Build/Configure
-	  cmp $(PKG_BUILD_DIR)/include/linux/ath9k_platform.h $(LINUX_DIR)/include/linux/ath9k_platform.h
-	  cmp $(PKG_BUILD_DIR)/include/linux/ath5k_platform.h $(LINUX_DIR)/include/linux/ath5k_platform.h
-	  cmp $(PKG_BUILD_DIR)/include/linux/rt2x00_platform.h $(LINUX_DIR)/include/linux/rt2x00_platform.h
+	  cmp $(PKG_BUILD_DIR)/include/linux/ath9k_platform.h $(LINUX_SRC_DIR)/include/linux/ath9k_platform.h
+	  cmp $(PKG_BUILD_DIR)/include/linux/ath5k_platform.h $(LINUX_SRC_DIR)/include/linux/ath5k_platform.h
+	  cmp $(PKG_BUILD_DIR)/include/linux/rt2x00_platform.h $(LINUX_SRC_DIR)/include/linux/rt2x00_platform.h
     endef
   endif
 endif
diff --git a/package/network/config/ltq-adsl-app/Makefile b/package/network/config/ltq-adsl-app/Makefile
index 472e3c0ed9..6764d2c77f 100644
--- a/package/network/config/ltq-adsl-app/Makefile
+++ b/package/network/config/ltq-adsl-app/Makefile
@@ -74,7 +74,7 @@ CONFIGURE_ARGS += \
 	--enable-dsl-pm-line-thresholds \
 	--enable-dsl-pm-optional-parameters
 
-TARGET_CFLAGS += -I$(LINUX_DIR)/include
+TARGET_CFLAGS += -I$(LINUX_OBJ_DIR)/include -I$(LINUX_SRC_DIR)/include
 
 define Build/Prepare
 	$(call Build/Prepare/Default)
diff --git a/package/network/services/ppp/Makefile b/package/network/services/ppp/Makefile
index 5f4b8ac02f..5848c9cca0 100644
--- a/package/network/services/ppp/Makefile
+++ b/package/network/services/ppp/Makefile
@@ -183,9 +183,9 @@ $(call Build/Configure/Default,, \
 )
 	mkdir -p $(PKG_BUILD_DIR)/pppd/plugins/pppoatm/linux
 	$(CP) \
-		$(LINUX_DIR)/include/linux/compiler.h \
-		$(LINUX_DIR)/include/linux/compiler_types.h \
-		$(LINUX_DIR)/include/$(LINUX_UAPI_DIR)linux/atm*.h \
+		$(LINUX_SRC_DIR)/include/linux/compiler.h \
+		$(LINUX_SRC_DIR)/include/linux/compiler_types.h \
+		$(LINUX_SRC_DIR)/include/$(LINUX_UAPI_DIR)linux/atm*.h \
 		$(PKG_BUILD_DIR)/pppd/plugins/pppoatm/linux/
 endef
 
diff --git a/package/network/utils/iproute2/Makefile b/package/network/utils/iproute2/Makefile
index 7f4556e7d3..5204cb878b 100644
--- a/package/network/utils/iproute2/Makefile
+++ b/package/network/utils/iproute2/Makefile
@@ -177,7 +177,7 @@ TARGET_LDFLAGS += -Wl,--as-needed
 TARGET_CPPFLAGS += -I$(STAGING_DIR)/usr/include/libnl-tiny
 
 MAKE_FLAGS += \
-	KERNEL_INCLUDE="$(LINUX_DIR)/include/uapi" \
+	KERNEL_INCLUDE="$(LINUX_SRC_DIR)/include/uapi" \
 	SHARED_LIBS=$(SHARED_LIBS) \
 	IP_CONFIG_TINY=$(IP_CONFIG_TINY) \
 	BUILD_VARIANT=$(BUILD_VARIANT) \
diff --git a/package/network/utils/ipset/Makefile b/package/network/utils/ipset/Makefile
index b0aac8fe36..a34c25f656 100644
--- a/package/network/utils/ipset/Makefile
+++ b/package/network/utils/ipset/Makefile
@@ -45,7 +45,7 @@ endef
 
 CONFIGURE_ARGS += \
 	--disable-static \
-	--with-kbuild="$(LINUX_DIR)"
+	--with-kbuild="$(LINUX_OBJ_DIR)"
 
 TARGET_LDFLAGS += -Wl,--gc-sections,--as-needed
 
-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |       ehem+openwrt at m5p.com     PGP 87145445       |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445





From ehem+openwrt at m5p.com  Sat Nov 11 22:51:08 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Sat, 11 Nov 2023 22:51:08 -0800
Subject: [PATCH 13/20] [WIP] build: point user_headers at $(LINUX_OBJ_DIR)
In-Reply-To: <cover.1700010286.git.ehem+openwrt@m5p.com>
References: <cover.1700010286.git.ehem+openwrt@m5p.com>
Message-ID: <5dd3fcc01db31ad1f27f044551340dcb2e0de91e.1700010293.git.ehem+openwrt@m5p.com>

These may be regenerated with every build.  As such they seem
appropriate for the object directory, rather than source.

Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>
---
 include/kernel-defaults.mk               | 6 +++---
 package/devel/strace/Makefile            | 2 +-
 package/network/config/swconfig/Makefile | 2 +-
 package/network/utils/iptables/Makefile  | 8 ++++----
 package/network/utils/linux-atm/Makefile | 2 +-
 5 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/include/kernel-defaults.mk b/include/kernel-defaults.mk
index 0b421d2cc3..10cd83712a 100644
--- a/include/kernel-defaults.mk
+++ b/include/kernel-defaults.mk
@@ -35,8 +35,8 @@ else
 		rmdir $(LINUX_DIR); \
 	fi
 	ln -s $(CONFIG_EXTERNAL_KERNEL_TREE) $(LINUX_DIR)
-	if [ -d $(LINUX_DIR)/user_headers ]; then \
-		rm -rf $(LINUX_DIR)/user_headers; \
+	if [ -d $(LINUX_OBJ_DIR)/user_headers ]; then \
+		rm -rf $(LINUX_OBJ_DIR)/user_headers; \
 	fi
   endef
 endif
@@ -111,7 +111,7 @@ define Kernel/Configure/Default
 		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
+	$(_SINGLE) [ -d $(LINUX_OBJ_DIR)/user_headers ] || $(KERNEL_MAKE) $(if $(findstring uml,$(BOARD)),ARCH=$(ARCH)) INSTALL_HDR_PATH=$(LINUX_OBJ_DIR)/user_headers headers_install
 	grep '=[ym]' $(LINUX_DIR)/.config.set | LC_ALL=C sort | $(MKHASH) md5 > $(LINUX_DIR)/.vermagic
 endef
 
diff --git a/package/devel/strace/Makefile b/package/devel/strace/Makefile
index 3343177c3e..fa5e5c0492 100644
--- a/package/devel/strace/Makefile
+++ b/package/devel/strace/Makefile
@@ -31,7 +31,7 @@ PKG_CONFIG_DEPENDS := \
 include $(INCLUDE_DIR)/package.mk
 include $(INCLUDE_DIR)/nls.mk
 
-HOST_CFLAGS += -I$(LINUX_DIR)/user_headers/include
+HOST_CFLAGS += -I$(LINUX_OBJ_DIR)/user_headers/include
 
 CONFIGURE_VARS+= \
 	LDFLAGS_FOR_BUILD="$(HOST_LDFLAGS)" \
diff --git a/package/network/config/swconfig/Makefile b/package/network/config/swconfig/Makefile
index 6549075e5c..69f795ce1e 100644
--- a/package/network/config/swconfig/Makefile
+++ b/package/network/config/swconfig/Makefile
@@ -30,7 +30,7 @@ TARGET_CPPFLAGS := \
 	-I$(STAGING_DIR)/usr/include/libnl-tiny \
 	-I$(PKG_BUILD_DIR) \
 	$(TARGET_CPPFLAGS) \
-	-I$(LINUX_DIR)/user_headers/include
+	-I$(LINUX_OBJ_DIR)/user_headers/include
 
 define Build/Compile
 	CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
diff --git a/package/network/utils/iptables/Makefile b/package/network/utils/iptables/Makefile
index 45a2b49070..f9e8d619fa 100644
--- a/package/network/utils/iptables/Makefile
+++ b/package/network/utils/iptables/Makefile
@@ -586,19 +586,19 @@ endef
 
 TARGET_CPPFLAGS := \
 	-I$(PKG_BUILD_DIR)/include \
-	-I$(LINUX_DIR)/user_headers/include \
+	-I$(LINUX_OBJ_DIR)/user_headers/include \
 	$(TARGET_CPPFLAGS)
 
 TARGET_CFLAGS += \
 	-I$(PKG_BUILD_DIR)/include \
-	-I$(LINUX_DIR)/user_headers/include \
+	-I$(LINUX_OBJ_DIR)/user_headers/include \
 	-DNO_LEGACY
 
 CONFIGURE_ARGS += \
 	--enable-shared \
 	--enable-static \
 	--enable-devel \
-	--with-kernel="$(LINUX_DIR)/user_headers" \
+	--with-kernel="$(LINUX_OBJ_DIR)/user_headers" \
 	--with-xtlibdir=/usr/lib/iptables \
 	--with-xt-lock-name=/var/run/xtables.lock \
 	$(if $(CONFIG_IPTABLES_CONNLABEL),,--disable-connlabel) \
@@ -607,7 +607,7 @@ CONFIGURE_ARGS += \
 MAKE_FLAGS := \
 	$(TARGET_CONFIGURE_OPTS) \
 	COPT_FLAGS="$(TARGET_CFLAGS)" \
-	KERNEL_DIR="$(LINUX_DIR)/user_headers/" PREFIX=/usr \
+	KERNEL_DIR="$(LINUX_OBJ_DIR)/user_headers/" PREFIX=/usr \
 	KBUILD_OUTPUT="$(LINUX_DIR)" \
 	BUILTIN_MODULES="$(patsubst ip6t_%,%,$(patsubst ipt_%,%,$(patsubst xt_%,%,$(IPT_BUILTIN) $(IPT_CONNTRACK-m) $(IPT_NAT-m))))"
 
diff --git a/package/network/utils/linux-atm/Makefile b/package/network/utils/linux-atm/Makefile
index 43f4b6556b..0bed1d6e6d 100644
--- a/package/network/utils/linux-atm/Makefile
+++ b/package/network/utils/linux-atm/Makefile
@@ -99,7 +99,7 @@ endef
 
 $(foreach t,$(ATM_DEBUG_TOOLS),$(eval $(call GenAtmPlugin,atm-$(t),$(t))))
 
-TARGET_CFLAGS += -I$(LINUX_DIR)/user_headers/include
+TARGET_CFLAGS += -I$(LINUX_OBJ_DIR)/user_headers/include
 
 define Build/Configure
 	$(call Build/Configure/Default)
-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |       ehem+openwrt at m5p.com     PGP 87145445       |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445





From ehem+openwrt at m5p.com  Sat Nov 11 22:51:08 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Sat, 11 Nov 2023 22:51:08 -0800
Subject: [PATCH 14/20] [WIP] build: update quilt references to use
 $(LINUX_SRC_DIR)
In-Reply-To: <cover.1700010286.git.ehem+openwrt@m5p.com>
References: <cover.1700010286.git.ehem+openwrt@m5p.com>
Message-ID: <73ef6e218d0835160597976ab499e92afa373c76.1700010293.git.ehem+openwrt@m5p.com>

Quilt is for handling patches, therefore needs to modify
$(LINUX_SRC_DIR).

Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>
---
 include/kernel-build.mk    |  2 +-
 include/kernel-defaults.mk |  2 +-
 include/quilt.mk           | 16 ++++++++--------
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/include/kernel-build.mk b/include/kernel-build.mk
index 5b332258f8..19284caa94 100644
--- a/include/kernel-build.mk
+++ b/include/kernel-build.mk
@@ -10,7 +10,7 @@ ifneq ($(DUMP),1)
 endif
 
 KERNEL_FILE_DEPENDS=$(GENERIC_BACKPORT_DIR) $(GENERIC_PATCH_DIR) $(GENERIC_HACK_DIR) $(PATCH_DIR) $(GENERIC_FILES_DIR) $(FILES_DIR)
-STAMP_PREPARED=$(LINUX_DIR)/.prepared$(if $(QUILT)$(DUMP),,_$(shell $(call $(if $(CONFIG_AUTOREMOVE),find_md5_reproducible,find_md5),$(KERNEL_FILE_DEPENDS),)))
+STAMP_PREPARED=$(LINUX_SRC_DIR)/.prepared$(if $(QUILT)$(DUMP),,_$(shell $(call $(if $(CONFIG_AUTOREMOVE),find_md5_reproducible,find_md5),$(KERNEL_FILE_DEPENDS),)))
 STAMP_CONFIGURED:=$(LINUX_DIR)/.configured
 include $(INCLUDE_DIR)/download.mk
 include $(INCLUDE_DIR)/quilt.mk
diff --git a/include/kernel-defaults.mk b/include/kernel-defaults.mk
index 10cd83712a..b7a3f484e1 100644
--- a/include/kernel-defaults.mk
+++ b/include/kernel-defaults.mk
@@ -25,7 +25,7 @@ ifeq ($(strip $(CONFIG_EXTERNAL_KERNEL_TREE)),"")
 	$(LINUX_CAT) $(DL_DIR)/$(LINUX_SOURCE) | $(TAR) -C $(KERNEL_BUILD_DIR) $(TAR_OPTIONS)
     ifeq ($(strip $(CONFIG_KERNEL_GIT_CLONE_URI)),"")
 	$(Kernel/Patch)
-	$(if $(QUILT),touch $(LINUX_DIR)/.quilt_used)
+	$(if $(QUILT),touch $(LINUX_SRC_DIR)/.quilt_used)
     endif
   endef
 else
diff --git a/include/quilt.mk b/include/quilt.mk
index a58390f6c5..ac37672c95 100644
--- a/include/quilt.mk
+++ b/include/quilt.mk
@@ -3,7 +3,7 @@
 # Copyright (C) 2007-2020 OpenWrt.org
 
 ifeq ($(TARGET_BUILD),1)
-  PKG_BUILD_DIR:=$(LINUX_DIR)
+  PKG_BUILD_DIR:=$(LINUX_SRC_DIR)
 endif
 
 ifneq ($(filter host-refresh refresh,$(MAKECMDGOALS)),)
@@ -92,17 +92,17 @@ endef
 
 kernel_files=$(foreach fdir,$(GENERIC_FILES_DIR) $(FILES_DIR),$(fdir)/.)
 define Kernel/Patch/Default
-	$(if $(QUILT),rm -rf $(LINUX_DIR)/patches; mkdir -p $(LINUX_DIR)/patches)
-	$(if $(kernel_files),$(CP) $(kernel_files) $(LINUX_DIR)/)
-	find $(LINUX_DIR)/ -name \*.rej -or -name \*.orig | $(XARGS) rm -f
+	$(if $(QUILT),rm -rf $(LINUX_SRC_DIR)/patches; mkdir -p $(LINUX_SRC_DIR)/patches)
+	$(if $(kernel_files),$(CP) $(kernel_files) $(LINUX_SRC_DIR)/)
+	find $(LINUX_SRC_DIR)/ -name \*.rej -or -name \*.orig | $(XARGS) rm -f
 	if [ -d $(GENERIC_PLATFORM_DIR)/patches$(if $(wildcard $(GENERIC_PLATFORM_DIR)/patches-$(KERNEL_PATCHVER)),-$(KERNEL_PATCHVER)) ]; then \
 		echo "generic patches directory is present. please move your patches to the pending directory" ; \
 		exit 1; \
 	fi
-	$(call PatchDir,$(LINUX_DIR),$(GENERIC_BACKPORT_DIR),generic-backport/)
-	$(call PatchDir,$(LINUX_DIR),$(GENERIC_PATCH_DIR),generic/)
-	$(call PatchDir,$(LINUX_DIR),$(GENERIC_HACK_DIR),generic-hack/)
-	$(call PatchDir,$(LINUX_DIR),$(PATCH_DIR),platform/)
+	$(call PatchDir,$(LINUX_SRC_DIR),$(GENERIC_BACKPORT_DIR),generic-backport/)
+	$(call PatchDir,$(LINUX_SRC_DIR),$(GENERIC_PATCH_DIR),generic/)
+	$(call PatchDir,$(LINUX_SRC_DIR),$(GENERIC_HACK_DIR),generic-hack/)
+	$(call PatchDir,$(LINUX_SRC_DIR),$(PATCH_DIR),platform/)
 endef
 
 define Quilt/RefreshDir
-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |       ehem+openwrt at m5p.com     PGP 87145445       |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445





From ehem+openwrt at m5p.com  Sat Nov 11 22:51:08 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Sat, 11 Nov 2023 22:51:08 -0800
Subject: [PATCH 15/20] [WIP] package: update packages with explicit make flags
In-Reply-To: <cover.1700010286.git.ehem+openwrt@m5p.com>
References: <cover.1700010286.git.ehem+openwrt@m5p.com>
Message-ID: <f5cd6591cf56383bde0abecd19f502b86ffa9639.1700010293.git.ehem+openwrt@m5p.com>

Identifying which variable to substitute in appropriate places is a
bit interesting here.  Since these set their own make flags, they
need to reference both.

Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>
---
I'm less than certain about perf.  I *hope* this matches the
requirements, but I'm worried about the comment.
---
 package/devel/perf/Makefile      | 4 ++--
 package/kernel/mac80211/Makefile | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/package/devel/perf/Makefile b/package/devel/perf/Makefile
index 31881c0136..f5290805fc 100644
--- a/package/devel/perf/Makefile
+++ b/package/devel/perf/Makefile
@@ -19,7 +19,7 @@ PKG_FLAGS:=nonshared
 
 # Perf's makefile and headers are not relocatable and must be built from the
 # Linux sources directory
-PKG_BUILD_DIR:=$(LINUX_DIR)/tools/perf-$(TARGET_DIR_NAME)
+PKG_BUILD_DIR:=$(LINUX_OBJ_DIR)/tools/perf-$(TARGET_DIR_NAME)
 
 include $(INCLUDE_DIR)/package.mk
 include $(INCLUDE_DIR)/nls.mk
@@ -70,7 +70,7 @@ MAKE_FLAGS = \
 define Build/Compile
 	+$(MAKE_FLAGS) $(MAKE) $(PKG_JOBS) \
 		--no-print-directory \
-		-C $(LINUX_DIR)/tools/perf
+		-C $(LINUX_SRC_DIR)/tools/perf
 endef
 
 define Package/perf/install
diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile
index d5e3171f94..e735040530 100644
--- a/package/kernel/mac80211/Makefile
+++ b/package/kernel/mac80211/Makefile
@@ -274,9 +274,9 @@ ifeq ($(BUILD_VARIANT),smallbuffers)
 endif
 
 MAKE_OPTS:= \
-	$(subst -C $(LINUX_DIR),-C "$(PKG_BUILD_DIR)",$(KERNEL_MAKEOPTS)) \
+	$(subst -C $(LINUX_SRC_DIR),-C "$(PKG_BUILD_DIR)",$(KERNEL_MAKEOPTS)) \
 	EXTRA_CFLAGS="-I$(PKG_BUILD_DIR)/include $(IREMAP_CFLAGS) $(C_DEFINES)" \
-	KLIB_BUILD="$(LINUX_DIR)" \
+	KLIB_BUILD="$(LINUX_OBJ_DIR)" \
 	MODPROBE=true \
 	KLIB=$(TARGET_MODULES_DIR) \
 	KERNEL_SUBLEVEL=$(lastword $(subst ., ,$(KERNEL_PATCHVER))) \
-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |       ehem+openwrt at m5p.com     PGP 87145445       |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445





From ehem+openwrt at m5p.com  Sat Nov 11 22:51:08 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Sat, 11 Nov 2023 22:51:08 -0800
Subject: [PATCH 16/20] [WIP] build: point kernel build tasks at
 $(LINUX_OBJ_DIR)
In-Reply-To: <cover.1700010286.git.ehem+openwrt@m5p.com>
References: <cover.1700010286.git.ehem+openwrt@m5p.com>
Message-ID: <3d3eb1a2177de0d72504978746e921341dab5794.1700010294.git.ehem+openwrt@m5p.com>

This points uses of .config, .modules, and vmlinux at the correct
place.  This is one portion of the source/build split.

Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>
---
Note for reviewers.  It is easy to miss the `mkdir` added to
Kernel/Configure/Default.  That was needed since the directory might
not have been created (bugfix while testing).
---
 include/kernel-build.mk                 |  36 ++++-----
 include/kernel-defaults.mk              | 101 ++++++++++++------------
 include/kernel.mk                       |   8 +-
 package/devel/kselftests-bpf/Makefile   |   2 +-
 package/kernel/linux/Makefile           |   6 +-
 package/network/utils/iptables/Makefile |   4 +-
 6 files changed, 79 insertions(+), 78 deletions(-)

diff --git a/include/kernel-build.mk b/include/kernel-build.mk
index 19284caa94..eb770ad5f4 100644
--- a/include/kernel-build.mk
+++ b/include/kernel-build.mk
@@ -11,7 +11,7 @@ endif
 
 KERNEL_FILE_DEPENDS=$(GENERIC_BACKPORT_DIR) $(GENERIC_PATCH_DIR) $(GENERIC_HACK_DIR) $(PATCH_DIR) $(GENERIC_FILES_DIR) $(FILES_DIR)
 STAMP_PREPARED=$(LINUX_SRC_DIR)/.prepared$(if $(QUILT)$(DUMP),,_$(shell $(call $(if $(CONFIG_AUTOREMOVE),find_md5_reproducible,find_md5),$(KERNEL_FILE_DEPENDS),)))
-STAMP_CONFIGURED:=$(LINUX_DIR)/.configured
+STAMP_CONFIGURED:=$(LINUX_OBJ_DIR)/.configured
 include $(INCLUDE_DIR)/download.mk
 include $(INCLUDE_DIR)/quilt.mk
 include $(INCLUDE_DIR)/kernel-defaults.mk
@@ -61,7 +61,7 @@ ifdef CONFIG_COLLECT_KERNEL_DEBUG
   define Kernel/CollectDebug
 	rm -rf $(KERNEL_BUILD_DIR)/debug
 	mkdir -p $(KERNEL_BUILD_DIR)/debug/modules
-	$(CP) $(LINUX_DIR)/vmlinux $(KERNEL_BUILD_DIR)/debug/
+	$(CP) $(LINUX_OBJ_DIR)/vmlinux $(KERNEL_BUILD_DIR)/debug/
 	-$(CP) \
 		$(STAGING_DIR_ROOT)/lib/modules/$(LINUX_VERSION)/* \
 		$(KERNEL_BUILD_DIR)/debug/modules/
@@ -99,11 +99,11 @@ define BuildKernel
 	rm -f $(KERNEL_BUILD_DIR)/symtab.h
 	touch $(KERNEL_BUILD_DIR)/symtab.h
 	+$(KERNEL_MAKE) vmlinux
-	find $(LINUX_DIR) $(STAGING_DIR_ROOT)/lib/modules -name \*.ko | \
+	find $(LINUX_OBJ_DIR) $(STAGING_DIR_ROOT)/lib/modules -name \*.ko | \
 		xargs $(TARGET_CROSS)nm | \
 		awk '$$$$1 == "U" { print $$$$2 } ' | \
 		sort -u > $(KERNEL_BUILD_DIR)/mod_symtab.txt
-	$(TARGET_CROSS)nm -n $(LINUX_DIR)/vmlinux.o | awk '/^[0-9a-f]+ [rR] __ksymtab_/ {print substr($$$$3,11)}' > $(KERNEL_BUILD_DIR)/kernel_symtab.txt
+	$(TARGET_CROSS)nm -n $(LINUX_OBJ_DIR)/vmlinux.o | awk '/^[0-9a-f]+ [rR] __ksymtab_/ {print substr($$$$3,11)}' > $(KERNEL_BUILD_DIR)/kernel_symtab.txt
 	grep -Ff $(KERNEL_BUILD_DIR)/mod_symtab.txt $(KERNEL_BUILD_DIR)/kernel_symtab.txt > $(KERNEL_BUILD_DIR)/sym_include.txt
 	grep -Fvf $(KERNEL_BUILD_DIR)/mod_symtab.txt $(KERNEL_BUILD_DIR)/kernel_symtab.txt > $(KERNEL_BUILD_DIR)/sym_exclude.txt
 	( \
@@ -129,18 +129,18 @@ define BuildKernel
 	$(Kernel/Configure)
 	touch $$@
 
-  $(LINUX_DIR)/.modules: export STAGING_PREFIX=$$(STAGING_DIR_HOST)
-  $(LINUX_DIR)/.modules: export PKG_CONFIG_PATH=$$(STAGING_DIR_HOST)/lib/pkgconfig
-  $(LINUX_DIR)/.modules: export PKG_CONFIG_LIBDIR=$$(STAGING_DIR_HOST)/lib/pkgconfig
-  $(LINUX_DIR)/.modules: export FAIL_ON_UNCONFIGURED=1
-  $(LINUX_DIR)/.modules: $(STAMP_CONFIGURED) $(LINUX_DIR)/.config FORCE
+  $(LINUX_OBJ_DIR)/.modules: export STAGING_PREFIX=$$(STAGING_DIR_HOST)
+  $(LINUX_OBJ_DIR)/.modules: export PKG_CONFIG_PATH=$$(STAGING_DIR_HOST)/lib/pkgconfig
+  $(LINUX_OBJ_DIR)/.modules: export PKG_CONFIG_LIBDIR=$$(STAGING_DIR_HOST)/lib/pkgconfig
+  $(LINUX_OBJ_DIR)/.modules: export FAIL_ON_UNCONFIGURED=1
+  $(LINUX_OBJ_DIR)/.modules: $(STAMP_CONFIGURED) $(LINUX_OBJ_DIR)/.config FORCE
 	$(Kernel/CompileModules)
 	touch $$@
 
-  $(LINUX_DIR)/.image: export STAGING_PREFIX=$$(STAGING_DIR_HOST)
-  $(LINUX_DIR)/.image: export PKG_CONFIG_PATH=$$(STAGING_DIR_HOST)/lib/pkgconfig
-  $(LINUX_DIR)/.image: export PKG_CONFIG_LIBDIR=$$(STAGING_DIR_HOST)/lib/pkgconfig
-  $(LINUX_DIR)/.image: $(STAMP_CONFIGURED) $(if $(CONFIG_STRIP_KERNEL_EXPORTS),$(KERNEL_BUILD_DIR)/symtab.h) FORCE
+  $(LINUX_OBJ_DIR)/.image: export STAGING_PREFIX=$$(STAGING_DIR_HOST)
+  $(LINUX_OBJ_DIR)/.image: export PKG_CONFIG_PATH=$$(STAGING_DIR_HOST)/lib/pkgconfig
+  $(LINUX_OBJ_DIR)/.image: export PKG_CONFIG_LIBDIR=$$(STAGING_DIR_HOST)/lib/pkgconfig
+  $(LINUX_OBJ_DIR)/.image: $(STAMP_CONFIGURED) $(if $(CONFIG_STRIP_KERNEL_EXPORTS),$(KERNEL_BUILD_DIR)/symtab.h) FORCE
 	$(Kernel/CompileImage)
 	$(Kernel/CollectDebug)
 	touch $$@
@@ -153,13 +153,13 @@ define BuildKernel
 
   download: $(if $(LINUX_SITE),$(DL_DIR)/$(LINUX_SOURCE))
   prepare: $(STAMP_PREPARED)
-  compile: $(LINUX_DIR)/.modules
+  compile: $(LINUX_OBJ_DIR)/.modules
 	$(MAKE) -C image compile TARGET_BUILD=
 
   oldconfig menuconfig nconfig xconfig: $(STAMP_PREPARED) $(STAMP_CHECKED) FORCE
-	rm -f $(LINUX_DIR)/.config.prev
+	rm -f $(LINUX_OBJ_DIR)/.config.prev
 	rm -f $(STAMP_CONFIGURED)
-	$(LINUX_RECONF_CMD) > $(LINUX_DIR)/.config
+	$(LINUX_RECONF_CMD) > $(LINUX_OBJ_DIR)/.config
 	$(_SINGLE)$(KERNEL_MAKE) \
 		$(if $(findstring Darwin,$(HOST_OS)), \
 			HOSTLDLIBS_mconf="-L$(STAGING_DIR_HOST)/lib -lncurses" \
@@ -167,9 +167,9 @@ define BuildKernel
 		) \
 		YACC=$(STAGING_DIR_HOST)/bin/bison \
 		$$@
-	$(call LINUX_RECONF_DIFF,$(LINUX_DIR)/.config) > $(LINUX_RECONFIG_TARGET)
+	$(call LINUX_RECONF_DIFF,$(LINUX_OBJ_DIR)/.config) > $(LINUX_RECONFIG_TARGET)
 
-  install: $(LINUX_DIR)/.image
+  install: $(LINUX_OBJ_DIR)/.image
 	+$(MAKE) -C image compile install TARGET_BUILD=
 
   clean: FORCE
diff --git a/include/kernel-defaults.mk b/include/kernel-defaults.mk
index b7a3f484e1..178d4c0a5d 100644
--- a/include/kernel-defaults.mk
+++ b/include/kernel-defaults.mk
@@ -44,75 +44,76 @@ endif
 ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
   ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS_SEPARATE),y)
     define Kernel/SetInitramfs/PreConfigure
-	grep -v -e CONFIG_BLK_DEV_INITRD $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config
-	echo 'CONFIG_BLK_DEV_INITRD=y' >> $(LINUX_DIR)/.config
-	echo 'CONFIG_INITRAMFS_SOURCE=""' >> $(LINUX_DIR)/.config
+	grep -v -e CONFIG_BLK_DEV_INITRD $(LINUX_OBJ_DIR)/.config.old > $(LINUX_OBJ_DIR)/.config
+	echo 'CONFIG_BLK_DEV_INITRD=y' >> $(LINUX_OBJ_DIR)/.config
+	echo 'CONFIG_INITRAMFS_SOURCE=""' >> $(LINUX_OBJ_DIR)/.config
     endef
   else
   ifeq ($(strip $(CONFIG_EXTERNAL_CPIO)),"")
     define Kernel/SetInitramfs/PreConfigure
-	grep -v -e INITRAMFS -e CONFIG_RD_ -e CONFIG_BLK_DEV_INITRD $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config
-	echo 'CONFIG_BLK_DEV_INITRD=y' >> $(LINUX_DIR)/.config
-	echo 'CONFIG_INITRAMFS_SOURCE="$(strip $(TARGET_DIR) $(INITRAMFS_EXTRA_FILES))"' >> $(LINUX_DIR)/.config
+	grep -v -e INITRAMFS -e CONFIG_RD_ -e CONFIG_BLK_DEV_INITRD $(LINUX_OBJ_DIR)/.config.old > $(LINUX_OBJ_DIR)/.config
+	echo 'CONFIG_BLK_DEV_INITRD=y' >> $(LINUX_OBJ_DIR)/.config
+	echo 'CONFIG_INITRAMFS_SOURCE="$(strip $(TARGET_DIR) $(INITRAMFS_EXTRA_FILES))"' >> $(LINUX_OBJ_DIR)/.config
     endef
   else
     define Kernel/SetInitramfs/PreConfigure
-	grep -v INITRAMFS $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config
-	echo 'CONFIG_INITRAMFS_SOURCE="$(call qstrip,$(CONFIG_EXTERNAL_CPIO))"' >> $(LINUX_DIR)/.config
+	grep -v INITRAMFS $(LINUX_OBJ_DIR)/.config.old > $(LINUX_OBJ_DIR)/.config
+	echo 'CONFIG_INITRAMFS_SOURCE="$(call qstrip,$(CONFIG_EXTERNAL_CPIO))"' >> $(LINUX_OBJ_DIR)/.config
     endef
   endif
 endif
 
   define Kernel/SetInitramfs
-	rm -f $(LINUX_DIR)/.config.prev
-	mv $(LINUX_DIR)/.config $(LINUX_DIR)/.config.old
+	rm -f $(LINUX_OBJ_DIR)/.config.prev
+	mv $(LINUX_OBJ_DIR)/.config $(LINUX_OBJ_DIR)/.config.old
 	$(call Kernel/SetInitramfs/PreConfigure)
-	echo "# CONFIG_INITRAMFS_PRESERVE_MTIME is not set" >> $(LINUX_DIR)/.config
+	echo "# CONFIG_INITRAMFS_PRESERVE_MTIME is not set" >> $(LINUX_OBJ_DIR)/.config
   ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS_SEPARATE),y)
-	echo 'CONFIG_INITRAMFS_ROOT_UID=$(shell id -u)' >> $(LINUX_DIR)/.config
-	echo 'CONFIG_INITRAMFS_ROOT_GID=$(shell id -g)' >> $(LINUX_DIR)/.config
-	echo "$(if $(CONFIG_TARGET_INITRAMFS_FORCE),CONFIG_INITRAMFS_FORCE=y,# CONFIG_INITRAMFS_FORCE is not set)" >> $(LINUX_DIR)/.config
+	echo 'CONFIG_INITRAMFS_ROOT_UID=$(shell id -u)' >> $(LINUX_OBJ_DIR)/.config
+	echo 'CONFIG_INITRAMFS_ROOT_GID=$(shell id -g)' >> $(LINUX_OBJ_DIR)/.config
+	echo "$(if $(CONFIG_TARGET_INITRAMFS_FORCE),CONFIG_INITRAMFS_FORCE=y,# CONFIG_INITRAMFS_FORCE is not set)" >> $(LINUX_OBJ_DIR)/.config
   else
-	echo "# CONFIG_INITRAMFS_FORCE is not set" >> $(LINUX_DIR)/.config
+	echo "# CONFIG_INITRAMFS_FORCE is not set" >> $(LINUX_OBJ_DIR)/.config
   endif
-	echo "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_NONE),CONFIG_INITRAMFS_COMPRESSION_NONE=y,# CONFIG_INITRAMFS_COMPRESSION_NONE is not set)" >> $(LINUX_DIR)/.config
-	echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_GZIP),CONFIG_INITRAMFS_COMPRESSION_GZIP=y\nCONFIG_RD_GZIP=y,# CONFIG_INITRAMFS_COMPRESSION_GZIP is not set\n# CONFIG_RD_GZIP is not set)" >> $(LINUX_DIR)/.config
-	echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_BZIP2),CONFIG_INITRAMFS_COMPRESSION_BZIP2=y\nCONFIG_RD_BZIP2=y,# CONFIG_INITRAMFS_COMPRESSION_BZIP2 is not set\n# CONFIG_RD_BZIP2 is not set)" >> $(LINUX_DIR)/.config
-	echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZMA),CONFIG_INITRAMFS_COMPRESSION_LZMA=y\nCONFIG_RD_LZMA=y,# CONFIG_INITRAMFS_COMPRESSION_LZMA is not set\n# CONFIG_RD_LZMA is not set)" >> $(LINUX_DIR)/.config
-	echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZO),CONFIG_INITRAMFS_COMPRESSION_LZO=y\nCONFIG_RD_LZO=y,# CONFIG_INITRAMFS_COMPRESSION_LZO is not set\n# CONFIG_RD_LZO is not set)" >> $(LINUX_DIR)/.config
-	echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_XZ),CONFIG_INITRAMFS_COMPRESSION_XZ=y\nCONFIG_RD_XZ=y,# CONFIG_INITRAMFS_COMPRESSION_XZ is not set\n# CONFIG_RD_XZ is not set)" >> $(LINUX_DIR)/.config
-	echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZ4),CONFIG_INITRAMFS_COMPRESSION_LZ4=y\nCONFIG_RD_LZ4=y,# CONFIG_INITRAMFS_COMPRESSION_LZ4 is not set\n# CONFIG_RD_LZ4 is not set)" >> $(LINUX_DIR)/.config
-	echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_ZSTD),CONFIG_INITRAMFS_COMPRESSION_ZSTD=y\nCONFIG_RD_ZSTD=y,# CONFIG_INITRAMFS_COMPRESSION_ZSTD is not set\n# CONFIG_RD_ZSTD is not set)" >> $(LINUX_DIR)/.config
+	echo "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_NONE),CONFIG_INITRAMFS_COMPRESSION_NONE=y,# CONFIG_INITRAMFS_COMPRESSION_NONE is not set)" >> $(LINUX_OBJ_DIR)/.config
+	echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_GZIP),CONFIG_INITRAMFS_COMPRESSION_GZIP=y\nCONFIG_RD_GZIP=y,# CONFIG_INITRAMFS_COMPRESSION_GZIP is not set\n# CONFIG_RD_GZIP is not set)" >> $(LINUX_OBJ_DIR)/.config
+	echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_BZIP2),CONFIG_INITRAMFS_COMPRESSION_BZIP2=y\nCONFIG_RD_BZIP2=y,# CONFIG_INITRAMFS_COMPRESSION_BZIP2 is not set\n# CONFIG_RD_BZIP2 is not set)" >> $(LINUX_OBJ_DIR)/.config
+	echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZMA),CONFIG_INITRAMFS_COMPRESSION_LZMA=y\nCONFIG_RD_LZMA=y,# CONFIG_INITRAMFS_COMPRESSION_LZMA is not set\n# CONFIG_RD_LZMA is not set)" >> $(LINUX_OBJ_DIR)/.config
+	echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZO),CONFIG_INITRAMFS_COMPRESSION_LZO=y\nCONFIG_RD_LZO=y,# CONFIG_INITRAMFS_COMPRESSION_LZO is not set\n# CONFIG_RD_LZO is not set)" >> $(LINUX_OBJ_DIR)/.config
+	echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_XZ),CONFIG_INITRAMFS_COMPRESSION_XZ=y\nCONFIG_RD_XZ=y,# CONFIG_INITRAMFS_COMPRESSION_XZ is not set\n# CONFIG_RD_XZ is not set)" >> $(LINUX_OBJ_DIR)/.config
+	echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZ4),CONFIG_INITRAMFS_COMPRESSION_LZ4=y\nCONFIG_RD_LZ4=y,# CONFIG_INITRAMFS_COMPRESSION_LZ4 is not set\n# CONFIG_RD_LZ4 is not set)" >> $(LINUX_OBJ_DIR)/.config
+	echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_ZSTD),CONFIG_INITRAMFS_COMPRESSION_ZSTD=y\nCONFIG_RD_ZSTD=y,# CONFIG_INITRAMFS_COMPRESSION_ZSTD is not set\n# CONFIG_RD_ZSTD is not set)" >> $(LINUX_OBJ_DIR)/.config
   endef
 else
 endif
 
 define Kernel/SetNoInitramfs
-	mv $(LINUX_DIR)/.config.set $(LINUX_DIR)/.config.old
-	grep -v INITRAMFS $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config.set
-	echo 'CONFIG_INITRAMFS_SOURCE=""' >> $(LINUX_DIR)/.config.set
-	echo '# CONFIG_INITRAMFS_FORCE is not set' >> $(LINUX_DIR)/.config.set
-	echo "# CONFIG_INITRAMFS_PRESERVE_MTIME is not set" >> $(LINUX_DIR)/.config.set
+	mv $(LINUX_OBJ_DIR)/.config.set $(LINUX_OBJ_DIR)/.config.old
+	grep -v INITRAMFS $(LINUX_OBJ_DIR)/.config.old > $(LINUX_OBJ_DIR)/.config.set
+	echo 'CONFIG_INITRAMFS_SOURCE=""' >> $(LINUX_OBJ_DIR)/.config.set
+	echo '# CONFIG_INITRAMFS_FORCE is not set' >> $(LINUX_OBJ_DIR)/.config.set
+	echo "# CONFIG_INITRAMFS_PRESERVE_MTIME is not set" >> $(LINUX_OBJ_DIR)/.config.set
 endef
 
 define Kernel/Configure/Default
-	rm -f $(LINUX_DIR)/localversion
-	$(LINUX_CONF_CMD) > $(LINUX_DIR)/.config.target
+	rm -f $(LINUX_OBJ_DIR)/localversion
+	mkdir -p $(LINUX_OBJ_DIR)
+	$(LINUX_CONF_CMD) > $(LINUX_OBJ_DIR)/.config.target
 # 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
+	awk '/^(#[[:space:]]+)?CONFIG_KERNEL/{sub("CONFIG_KERNEL_","CONFIG_");print}' $(TOPDIR)/.config >> $(LINUX_OBJ_DIR)/.config.target
+	echo "# CONFIG_KALLSYMS_EXTRA_PASS is not set" >> $(LINUX_OBJ_DIR)/.config.target
+	echo "# CONFIG_KALLSYMS_ALL is not set" >> $(LINUX_OBJ_DIR)/.config.target
+	echo "CONFIG_KALLSYMS_UNCOMPRESSED=y" >> $(LINUX_OBJ_DIR)/.config.target
+	$(SCRIPT_DIR)/package-metadata.pl kconfig $(TMP_DIR)/.packageinfo $(TOPDIR)/.config $(KERNEL_PATCHVER) > $(LINUX_OBJ_DIR)/.config.override
+	$(SCRIPT_DIR)/kconfig.pl 'm+' '+' $(LINUX_OBJ_DIR)/.config.target /dev/null $(LINUX_OBJ_DIR)/.config.override > $(LINUX_OBJ_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; \
+	cmp -s $(LINUX_OBJ_DIR)/.config.set $(LINUX_OBJ_DIR)/.config.prev || { \
+		cp $(LINUX_OBJ_DIR)/.config.set $(LINUX_OBJ_DIR)/.config; \
+		cp $(LINUX_OBJ_DIR)/.config.set $(LINUX_OBJ_DIR)/.config.prev; \
 	}
 	$(_SINGLE) [ -d $(LINUX_OBJ_DIR)/user_headers ] || $(KERNEL_MAKE) $(if $(findstring uml,$(BOARD)),ARCH=$(ARCH)) INSTALL_HDR_PATH=$(LINUX_OBJ_DIR)/user_headers headers_install
-	grep '=[ym]' $(LINUX_DIR)/.config.set | LC_ALL=C sort | $(MKHASH) md5 > $(LINUX_DIR)/.vermagic
+	grep '=[ym]' $(LINUX_OBJ_DIR)/.config.set | LC_ALL=C sort | $(MKHASH) md5 > $(LINUX_OBJ_DIR)/.vermagic
 endef
 
 define Kernel/Configure/Initramfs
@@ -120,12 +121,12 @@ define Kernel/Configure/Initramfs
 endef
 
 define Kernel/CompileModules/Default
-	rm -f $(LINUX_DIR)/vmlinux $(LINUX_DIR)/System.map
+	rm -f $(LINUX_OBJ_DIR)/vmlinux $(LINUX_OBJ_DIR)/System.map
 	+$(KERNEL_MAKE) $(if $(KERNELNAME),$(KERNELNAME),all) modules
 	# If .config did not change, use the previous timestamp to avoid package rebuilds
-	cmp -s $(LINUX_DIR)/.config $(LINUX_DIR)/.config.modules.save && \
-		mv $(LINUX_DIR)/.config.modules.save $(LINUX_DIR)/.config; \
-	$(CP) $(LINUX_DIR)/.config $(LINUX_DIR)/.config.modules.save
+	cmp -s $(LINUX_OBJ_DIR)/.config $(LINUX_OBJ_DIR)/.config.modules.save && \
+		mv $(LINUX_OBJ_DIR)/.config.modules.save $(LINUX_OBJ_DIR)/.config; \
+	$(CP) $(LINUX_OBJ_DIR)/.config $(LINUX_OBJ_DIR)/.config.modules.save
 endef
 
 OBJCOPY_STRIP = -R .reginfo -R .notes -R .note -R .comment -R .mdebug -R .note.gnu.build-id
@@ -136,13 +137,13 @@ IMAGES_DIR:=../../x86/boot
 endif
 
 define Kernel/CopyImage
-	cmp -s $(LINUX_DIR)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux$(1).debug || { \
-		$(KERNEL_CROSS)objcopy -O binary $(OBJCOPY_STRIP) -S $(LINUX_DIR)/vmlinux $(LINUX_KERNEL)$(1); \
-		$(KERNEL_CROSS)objcopy $(OBJCOPY_STRIP) -S $(LINUX_DIR)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux$(1).elf; \
-		$(CP) $(LINUX_DIR)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux$(1).debug; \
+	cmp -s $(LINUX_OBJ_DIR)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux$(1).debug || { \
+		$(KERNEL_CROSS)objcopy -O binary $(OBJCOPY_STRIP) -S $(LINUX_OBJ_DIR)/vmlinux $(LINUX_KERNEL)$(1); \
+		$(KERNEL_CROSS)objcopy $(OBJCOPY_STRIP) -S $(LINUX_OBJ_DIR)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux$(1).elf; \
+		$(CP) $(LINUX_OBJ_DIR)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux$(1).debug; \
 		$(foreach k, \
 			$(if $(KERNEL_IMAGES),$(KERNEL_IMAGES),$(filter-out vmlinux dtbs,$(KERNELNAME))), \
-			$(CP) $(LINUX_DIR)/arch/$(LINUX_KARCH)/boot/$(IMAGES_DIR)/$(k) $(KERNEL_BUILD_DIR)/$(k)$(1); \
+			$(CP) $(LINUX_OBJ_DIR)/arch/$(LINUX_KARCH)/boot/$(IMAGES_DIR)/$(k) $(KERNEL_BUILD_DIR)/$(k)$(1); \
 		) \
 	}
 endef
@@ -152,7 +153,7 @@ define Kernel/CompileImage/Default
 	+$(KERNEL_MAKE) $(KERNEL_MAKEOPTS_IMAGE) $(if $(KERNELNAME),$(KERNELNAME),all)
 	$(call Kernel/CopyImage)
 	+$(KERNEL_MAKE) $(KERNEL_MAKEOPTS_IMAGE) modules
-	find $(LINUX_DIR) -name \*.ko -a -links 1 -print0 | xargs -0 -r cp -lf -t $(TARGET_DIR)/lib/modules/$(LINUX_VERSION)
+	find $(LINUX_OBJ_DIR) -name \*.ko -a -links 1 -print0 | xargs -0 -r cp -lf -t $(TARGET_DIR)/lib/modules/$(LINUX_VERSION)
 endef
 
 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
diff --git a/include/kernel.mk b/include/kernel.mk
index 8362fa768b..7f236ece45 100644
--- a/include/kernel.mk
+++ b/include/kernel.mk
@@ -50,7 +50,7 @@ else
   # Location of kernel object files
   LINUX_OBJ_DIR ?= $(LINUX_DIR)
   LINUX_UAPI_DIR=uapi/
-  LINUX_VERMAGIC:=$(strip $(shell cat $(LINUX_DIR)/.vermagic 2>/dev/null))
+  LINUX_VERMAGIC:=$(strip $(shell cat $(LINUX_OBJ_DIR)/.vermagic 2>/dev/null))
   LINUX_VERMAGIC:=$(if $(LINUX_VERMAGIC),$(LINUX_VERMAGIC),unknown)
 
   LINUX_UNAME_VERSION:=$(KERNEL_BASE)
@@ -194,11 +194,11 @@ define ModuleAutoLoad
 endef
 
 ifeq ($(DUMP)$(TARGET_BUILD),)
-  -include $(LINUX_DIR)/.config
+  -include $(LINUX_OBJ_DIR)/.config
 endif
 
 define KernelPackage/depends
-  $(STAMP_BUILT): $(LINUX_DIR)/.config
+  $(STAMP_BUILT): $(LINUX_OBJ_DIR)/.config
   define KernelPackage/depends
   endef
 endef
@@ -248,7 +248,7 @@ $(call KernelPackage/$(1)/config)
   ifneq ($(if $(filter-out %=y %=n %=m,$(KCONFIG)),$(filter m y,$(foreach c,$(call version_filter,$(filter-out %=y %=n %=m,$(KCONFIG))),$($(c)))),.),)
     define Package/kmod-$(1)/install
 		  @for mod in $$(call version_filter,$$(FILES)); do \
-			if grep -q "$$$$$$$${mod##$(LINUX_DIR)/}" "$(LINUX_DIR)/modules.builtin"; then \
+			if grep -q "$$$$$$$${mod##$(LINUX_OBJ_DIR)/}" "$(LINUX_OBJ_DIR)/modules.builtin"; then \
 				echo "NOTICE: module '$$$$$$$$mod' is built-in."; \
 			elif [ -e $$$$$$$$mod ]; then \
 				mkdir -p $$(1)/$(MODULES_SUBDIR) ; \
diff --git a/package/devel/kselftests-bpf/Makefile b/package/devel/kselftests-bpf/Makefile
index 0a5b874e04..bb34f0ff5f 100644
--- a/package/devel/kselftests-bpf/Makefile
+++ b/package/devel/kselftests-bpf/Makefile
@@ -43,7 +43,7 @@ MAKE_VARS = \
 	SAN_CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
 	LDLIBS="$(TARGET_LDFLAGS)" \
 	TOOLCHAIN_INCLUDE="$(TOOLCHAIN_INC_DIRS)" \
-	VMLINUX_BTF="$(LINUX_DIR)/vmlinux"
+	VMLINUX_BTF="$(LINUX_OBJ_DIR)/vmlinux"
 
 MAKE_FLAGS = \
 	$(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='') \
diff --git a/package/kernel/linux/Makefile b/package/kernel/linux/Makefile
index c88b5c1b31..49587611f0 100644
--- a/package/kernel/linux/Makefile
+++ b/package/kernel/linux/Makefile
@@ -26,8 +26,8 @@ export SHELL:=/bin/sh
 include $(INCLUDE_DIR)/package.mk
 
 ifeq ($(DUMP),)
-  STAMP_BUILT:=$(STAMP_BUILT)_$(shell $(SCRIPT_DIR)/kconfig.pl $(LINUX_DIR)/.config | $(MKHASH) md5)
-  -include $(LINUX_DIR)/.config
+  STAMP_BUILT:=$(STAMP_BUILT)_$(shell $(SCRIPT_DIR)/kconfig.pl $(LINUX_OBJ_DIR)/.config | $(MKHASH) md5)
+  -include $(LINUX_OBJ_DIR)/.config
 endif
 
 define Build/Prepare
@@ -62,7 +62,7 @@ define Package/kernel/install
 endef
 
 define Package/kernel/extra_provides
-	sed -e 's,.*/,,' $(LINUX_DIR)/modules.builtin;
+	sed -e 's,.*/,,' $(LINUX_OBJ_DIR)/modules.builtin;
 endef
 
 $(eval $(if $(DUMP),,$(call BuildPackage,kernel)))
diff --git a/package/network/utils/iptables/Makefile b/package/network/utils/iptables/Makefile
index f9e8d619fa..f3477e8cac 100644
--- a/package/network/utils/iptables/Makefile
+++ b/package/network/utils/iptables/Makefile
@@ -27,9 +27,9 @@ PKG_CPE_ID:=cpe:/a:netfilter_core_team:iptables
 
 include $(INCLUDE_DIR)/package.mk
 ifeq ($(DUMP),)
-  -include $(LINUX_DIR)/.config
+  -include $(LINUX_OBJ_DIR)/.config
   include $(INCLUDE_DIR)/netfilter.mk
-  STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell grep 'NETFILTER' $(LINUX_DIR)/.config | $(MKHASH) md5)
+  STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell grep 'NETFILTER' $(LINUX_OBJ_DIR)/.config | $(MKHASH) md5)
 endif
 
 
-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |       ehem+openwrt at m5p.com     PGP 87145445       |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445





From ehem+openwrt at m5p.com  Sat Nov 11 22:51:08 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Sat, 11 Nov 2023 22:51:08 -0800
Subject: [PATCH 17/20] [WIP] build: split kernel object directory from kernel
 source directory
In-Reply-To: <cover.1700010286.git.ehem+openwrt@m5p.com>
References: <cover.1700010286.git.ehem+openwrt@m5p.com>
Message-ID: <8bf1146ead136c907ef22643dd0fcc2edd67e9c7.1700010294.git.ehem+openwrt@m5p.com>

Allows for reusing a kernel source directory for multiple builds.
Alternatively allows cleaning out an old kernel build without needing
to delete source files.

Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>
---
I'll confess I'm less than certain about several of these.  From
looking I *think* they need the object directory, but this needs
someone to check.
---
 package/kernel/bpf-headers/Makefile     | 4 ++--
 package/network/utils/iptables/Makefile | 2 +-
 package/utils/spidev_test/Makefile      | 4 ++--
 target/imagebuilder/Makefile            | 2 +-
 target/linux/uml/image/Makefile         | 2 +-
 5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/package/kernel/bpf-headers/Makefile b/package/kernel/bpf-headers/Makefile
index e000a1d56c..a8a5258c64 100644
--- a/package/kernel/bpf-headers/Makefile
+++ b/package/kernel/bpf-headers/Makefile
@@ -31,8 +31,8 @@ GENERIC_FILES_DIR := $(foreach dir,$(wildcard $(GENERIC_PLATFORM_DIR)/files $(GE
 PATCH_DIR := $(CURDIR)/patches
 FILES_DIR :=
 
-REAL_LINUX_DIR := $(LINUX_DIR)
-LINUX_DIR := $(PKG_BUILD_DIR)
+REAL_LINUX_DIR := $(LINUX_OBJ_DIR)
+LINUX_SRC_DIR := $(PKG_BUILD_DIR)
 
 include $(INCLUDE_DIR)/bpf.mk
 include $(INCLUDE_DIR)/package.mk
diff --git a/package/network/utils/iptables/Makefile b/package/network/utils/iptables/Makefile
index f3477e8cac..0362559513 100644
--- a/package/network/utils/iptables/Makefile
+++ b/package/network/utils/iptables/Makefile
@@ -608,7 +608,7 @@ MAKE_FLAGS := \
 	$(TARGET_CONFIGURE_OPTS) \
 	COPT_FLAGS="$(TARGET_CFLAGS)" \
 	KERNEL_DIR="$(LINUX_OBJ_DIR)/user_headers/" PREFIX=/usr \
-	KBUILD_OUTPUT="$(LINUX_DIR)" \
+	KBUILD_OUTPUT="$(LINUX_OBJ_DIR)" \
 	BUILTIN_MODULES="$(patsubst ip6t_%,%,$(patsubst ipt_%,%,$(patsubst xt_%,%,$(IPT_BUILTIN) $(IPT_CONNTRACK-m) $(IPT_NAT-m))))"
 
 ifneq ($(wildcard $(PKG_BUILD_DIR)/.config_*),$(subst .configured_,.config_,$(STAMP_CONFIGURED)))
diff --git a/package/utils/spidev_test/Makefile b/package/utils/spidev_test/Makefile
index fef5c8f646..c06c2f55a8 100644
--- a/package/utils/spidev_test/Makefile
+++ b/package/utils/spidev_test/Makefile
@@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/kernel.mk
 
 PKG_NAME:=spidev-test
 PKG_RELEASE:=$(LINUX_VERSION)
-PKG_BUILD_DIR:=$(LINUX_DIR)/tools/spi-$(TARGET_DIR_NAME)
+PKG_BUILD_DIR:=$(LINUX_OBJ_DIR)/tools/spi-$(TARGET_DIR_NAME)
 PKG_BUILD_PARALLEL:=1
 
 include $(INCLUDE_DIR)/package.mk
@@ -31,7 +31,7 @@ endef
 define Build/Prepare
 	# For SDK: Sources are copied by target/sdk/Makefile's
 	# USERSPACE_UTILS(_FILES)
-	$(CP) $(LINUX_DIR)/tools/spi/* $(PKG_BUILD_DIR)/
+	$(CP) $(LINUX_OBJ_DIR)/tools/spi/* $(PKG_BUILD_DIR)/
 endef
 
 MAKE_FLAGS = \
diff --git a/target/imagebuilder/Makefile b/target/imagebuilder/Makefile
index 59698d868c..c4910b6c4b 100644
--- a/target/imagebuilder/Makefile
+++ b/target/imagebuilder/Makefile
@@ -87,7 +87,7 @@ endif
 		$(PKG_BUILD_DIR)/target/linux/*/patches{,-*} \
 		$(PKG_BUILD_DIR)/target/linux/generic/{pending,backport,hack}{,-*}
 	-cp $(KERNEL_BUILD_DIR)/* $(IB_KDIR)/ # don't copy subdirectories here
-	-cp $(LINUX_DIR)/.config $(IB_LDIR)/
+	-cp $(LINUX_OBJ_DIR)/.config $(IB_LDIR)/
 	rm -f $(IB_KDIR)/root.*
 	rm -f $(IB_KDIR)/vmlinux.debug
 	if [ -x $(LINUX_OBJ_DIR)/scripts/dtc/dtc ]; then \
diff --git a/target/linux/uml/image/Makefile b/target/linux/uml/image/Makefile
index 45ab0cfbcd..225e6efa85 100644
--- a/target/linux/uml/image/Makefile
+++ b/target/linux/uml/image/Makefile
@@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
 include $(INCLUDE_DIR)/image.mk
 
 define Image/Prepare
-	cp $(LINUX_DIR)/linux $(KDIR)/vmlinux.elf
+	cp $(LINUX_OBJ_DIR)/linux $(KDIR)/vmlinux.elf
 endef
 
 define Image/Build/squashfs
-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |       ehem+openwrt at m5p.com     PGP 87145445       |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445





From ehem+openwrt at m5p.com  Sat Nov 11 22:51:08 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Sat, 11 Nov 2023 22:51:08 -0800
Subject: [PATCH 18/20] [WIP] build: point remaining obvious cases at
 $(LINUX_SRC_DIR)
In-Reply-To: <cover.1700010286.git.ehem+openwrt@m5p.com>
References: <cover.1700010286.git.ehem+openwrt@m5p.com>
Message-ID: <ced6e694a8259d64d6ca9ed3263448808f1990cc.1700010294.git.ehem+openwrt@m5p.com>

make -C is most often needs the kernel source.  The copyright files
come from the kernel source.

Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>
---
I'm running out of steam on this.  These seem fairly clear, but I'm
less than 100% certain.
---
 package/devel/kselftests-bpf/Makefile       | 2 +-
 package/kernel/broadcom-wl/Makefile         | 2 +-
 package/kernel/lantiq/ltq-adsl-mei/Makefile | 2 +-
 package/kernel/lantiq/ltq-atm/Makefile      | 2 +-
 package/kernel/lantiq/ltq-deu/Makefile      | 2 +-
 package/kernel/lantiq/ltq-ptm/Makefile      | 2 +-
 package/kernel/qca-nss-dp/Makefile          | 2 +-
 target/linux/bcm27xx/image/Makefile         | 2 +-
 target/linux/rockchip/image/Makefile        | 2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/package/devel/kselftests-bpf/Makefile b/package/devel/kselftests-bpf/Makefile
index bb34f0ff5f..ccb5aee465 100644
--- a/package/devel/kselftests-bpf/Makefile
+++ b/package/devel/kselftests-bpf/Makefile
@@ -51,7 +51,7 @@ MAKE_FLAGS = \
 
 define Build/Compile
 	+$(MAKE_VARS) \
-	$(MAKE) $(PKG_JOBS) -C $(LINUX_DIR)/$(MAKE_PATH) \
+	$(MAKE) $(PKG_JOBS) -C $(LINUX_SRC_DIR)/$(MAKE_PATH) \
 		$(MAKE_FLAGS) $(TEST_TARGET) ;
 endef
 
diff --git a/package/kernel/broadcom-wl/Makefile b/package/kernel/broadcom-wl/Makefile
index a1feacbe29..51aa5496ec 100644
--- a/package/kernel/broadcom-wl/Makefile
+++ b/package/kernel/broadcom-wl/Makefile
@@ -120,7 +120,7 @@ endef
 
 define Build/Compile
 	# Compile glue driver
-	$(MAKE_KMOD) -C "$(LINUX_DIR)" \
+	$(MAKE_KMOD) -C "$(LINUX_SRC_DIR)" \
 		M="$(PKG_BUILD_DIR)/glue" \
 		modules
 
diff --git a/package/kernel/lantiq/ltq-adsl-mei/Makefile b/package/kernel/lantiq/ltq-adsl-mei/Makefile
index e9db785960..647e449e11 100644
--- a/package/kernel/lantiq/ltq-adsl-mei/Makefile
+++ b/package/kernel/lantiq/ltq-adsl-mei/Makefile
@@ -35,7 +35,7 @@ endef
 
 define Build/Compile
 	ARCH=mips CROSS_COMPILE="$(KERNEL_CROSS)" \
-	$(MAKE) -C $(LINUX_DIR) BUILD_VARIANT=$(BUILD_VARIANT) M=$(PKG_BUILD_DIR)/ V=1 modules
+	$(MAKE) -C $(LINUX_SRC_DIR) BUILD_VARIANT=$(BUILD_VARIANT) M=$(PKG_BUILD_DIR)/ V=1 modules
 endef
 
 $(eval $(call KernelPackage,ltq-adsl-danube-mei))
diff --git a/package/kernel/lantiq/ltq-atm/Makefile b/package/kernel/lantiq/ltq-atm/Makefile
index af852e9a01..d3a34493d0 100644
--- a/package/kernel/lantiq/ltq-atm/Makefile
+++ b/package/kernel/lantiq/ltq-atm/Makefile
@@ -40,7 +40,7 @@ endef
 
 define Build/Compile
 	ARCH=mips CROSS_COMPILE="$(KERNEL_CROSS)" \
-	$(MAKE) -C $(LINUX_DIR) $(KERNEL_MAKE_FLAGS) BUILD_VARIANT=$(BUILD_VARIANT) M=$(PKG_BUILD_DIR) V=1 modules
+	$(MAKE) -C $(LINUX_SRC_DIR) $(KERNEL_MAKE_FLAGS) BUILD_VARIANT=$(BUILD_VARIANT) M=$(PKG_BUILD_DIR) V=1 modules
 endef
 
 $(eval $(call KernelPackage,ltq-atm-danube))
diff --git a/package/kernel/lantiq/ltq-deu/Makefile b/package/kernel/lantiq/ltq-deu/Makefile
index 4b8fae2766..5c151245bd 100644
--- a/package/kernel/lantiq/ltq-deu/Makefile
+++ b/package/kernel/lantiq/ltq-deu/Makefile
@@ -35,7 +35,7 @@ endef
 
 define Build/Compile
 	ARCH=mips CROSS_COMPILE="$(KERNEL_CROSS)" \
-	$(MAKE) -C $(LINUX_DIR) BUILD_VARIANT=$(BUILD_VARIANT) M=$(PKG_BUILD_DIR) V=1 modules
+	$(MAKE) -C $(LINUX_SRC_DIR) BUILD_VARIANT=$(BUILD_VARIANT) M=$(PKG_BUILD_DIR) V=1 modules
 endef
 
 $(eval $(call KernelPackage,ltq-deu-danube))
diff --git a/package/kernel/lantiq/ltq-ptm/Makefile b/package/kernel/lantiq/ltq-ptm/Makefile
index a1fb2250d2..6d7ba98086 100644
--- a/package/kernel/lantiq/ltq-ptm/Makefile
+++ b/package/kernel/lantiq/ltq-ptm/Makefile
@@ -44,7 +44,7 @@ endef
 
 define Build/Compile
 	ARCH=mips CROSS_COMPILE="$(KERNEL_CROSS)" \
-	$(MAKE) -C $(LINUX_DIR) $(KERNEL_MAKE_FLAGS) BUILD_VARIANT=$(BUILD_VARIANT) M=$(PKG_BUILD_DIR) V=1 modules
+	$(MAKE) -C $(LINUX_SRC_DIR) $(KERNEL_MAKE_FLAGS) BUILD_VARIANT=$(BUILD_VARIANT) M=$(PKG_BUILD_DIR) V=1 modules
 endef
 
 $(eval $(call KernelPackage,ltq-ptm-danube))
diff --git a/package/kernel/qca-nss-dp/Makefile b/package/kernel/qca-nss-dp/Makefile
index f9e992f246..e55cdc61e8 100644
--- a/package/kernel/qca-nss-dp/Makefile
+++ b/package/kernel/qca-nss-dp/Makefile
@@ -45,7 +45,7 @@ endef
 
 define Build/Compile
 	+$(KERNEL_MAKE) $(PKG_JOBS) \
-		-C "$(LINUX_DIR)" \
+		-C "$(LINUX_SRC_DIR)" \
 		M="$(PKG_BUILD_DIR)" \
 		EXTRA_CFLAGS="$(EXTRA_CFLAGS)" SoC="$(CONFIG_TARGET_SUBTARGET)" \
 		modules
diff --git a/target/linux/bcm27xx/image/Makefile b/target/linux/bcm27xx/image/Makefile
index 7fcb78c8f7..fa0633095b 100644
--- a/target/linux/bcm27xx/image/Makefile
+++ b/target/linux/bcm27xx/image/Makefile
@@ -10,7 +10,7 @@ FAT32_BLOCK_SIZE=1024
 FAT32_BLOCKS=$(shell echo $$(($(CONFIG_TARGET_KERNEL_PARTSIZE)*1024*1024/$(FAT32_BLOCK_SIZE))))
 
 define Build/Compile
-	$(CP) $(LINUX_DIR)/COPYING $(KDIR)/COPYING.linux
+	$(CP) $(LINUX_SRC_DIR)/COPYING $(KDIR)/COPYING.linux
 endef
 
 ### Image scripts ###
diff --git a/target/linux/rockchip/image/Makefile b/target/linux/rockchip/image/Makefile
index e7fe7178a6..0fedee33a4 100644
--- a/target/linux/rockchip/image/Makefile
+++ b/target/linux/rockchip/image/Makefile
@@ -6,7 +6,7 @@ include $(INCLUDE_DIR)/image.mk
 DEVICE_VARS += UBOOT_DEVICE_NAME
 
 define Build/Compile
-	$(CP) $(LINUX_DIR)/COPYING $(KDIR)/COPYING.linux
+	$(CP) $(LINUX_SRC_DIR)/COPYING $(KDIR)/COPYING.linux
 endef
 
 ### Image scripts ###
-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |       ehem+openwrt at m5p.com     PGP 87145445       |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445





From ehem+openwrt at m5p.com  Sat Nov 11 22:51:08 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Sat, 11 Nov 2023 22:51:08 -0800
Subject: [PATCH 19/20] [WIP] build: point remainder at $(LINUX_SRC_DIR)
In-Reply-To: <cover.1700010286.git.ehem+openwrt@m5p.com>
References: <cover.1700010286.git.ehem+openwrt@m5p.com>
Message-ID: <7155e3e04a01553c15cfb5ac36c27f8e4f90d845.1700010295.git.ehem+openwrt@m5p.com>

These appear to need the kernel source, but my confidence is less than
certain on several spots.

Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>
---
 include/kernel-defaults.mk               | 6 +++---
 package/kernel/cryptodev-linux/Makefile  | 2 +-
 package/kernel/linux/modules/w1.mk       | 4 ++--
 package/kernel/qca-ssdk/Makefile         | 2 +-
 package/network/utils/arptables/Makefile | 2 +-
 target/imagebuilder/Makefile             | 2 +-
 target/imagebuilder/files/Makefile       | 4 ++--
 target/sdk/Makefile                      | 6 +++---
 toolchain/kernel-headers/Makefile        | 2 +-
 9 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/include/kernel-defaults.mk b/include/kernel-defaults.mk
index 178d4c0a5d..a170e86cef 100644
--- a/include/kernel-defaults.mk
+++ b/include/kernel-defaults.mk
@@ -31,10 +31,10 @@ ifeq ($(strip $(CONFIG_EXTERNAL_KERNEL_TREE)),"")
 else
   define Kernel/Prepare/Default
 	mkdir -p $(KERNEL_BUILD_DIR)
-	if [ -d $(LINUX_DIR) ]; then \
-		rmdir $(LINUX_DIR); \
+	if [ -d $(LINUX_SRC_DIR) ]; then \
+		rmdir $(LINUX_SRC_DIR); \
 	fi
-	ln -s $(CONFIG_EXTERNAL_KERNEL_TREE) $(LINUX_DIR)
+	ln -s $(CONFIG_EXTERNAL_KERNEL_TREE) $(LINUX_SRC_DIR)
 	if [ -d $(LINUX_OBJ_DIR)/user_headers ]; then \
 		rm -rf $(LINUX_OBJ_DIR)/user_headers; \
 	fi
diff --git a/package/kernel/cryptodev-linux/Makefile b/package/kernel/cryptodev-linux/Makefile
index 0c1f63a605..40692eb060 100644
--- a/package/kernel/cryptodev-linux/Makefile
+++ b/package/kernel/cryptodev-linux/Makefile
@@ -47,7 +47,7 @@ endef
 define Build/Compile
 	$(MAKE) -C $(PKG_BUILD_DIR) \
 		$(KERNEL_MAKE_FLAGS) \
-		KERNEL_DIR="$(LINUX_DIR)"
+		KERNEL_DIR="$(LINUX_SRC_DIR)"
 endef
 
 define Build/InstallDev
diff --git a/package/kernel/linux/modules/w1.mk b/package/kernel/linux/modules/w1.mk
index e6b5263e2c..55d7e60cca 100644
--- a/package/kernel/linux/modules/w1.mk
+++ b/package/kernel/linux/modules/w1.mk
@@ -6,8 +6,8 @@
 #
 
 W1_MENU:=W1 support
-W1_MASTERS_DIR:=$(LINUX_DIR)/drivers/w1/masters
-W1_SLAVES_DIR:=$(LINUX_DIR)/drivers/w1/slaves
+W1_MASTERS_DIR:=$(LINUX_SRC_DIR)/drivers/w1/masters
+W1_SLAVES_DIR:=$(LINUX_SRC_DIR)/drivers/w1/slaves
 
 define KernelPackage/w1
   SUBMENU:=$(W1_MENU)
diff --git a/package/kernel/qca-ssdk/Makefile b/package/kernel/qca-ssdk/Makefile
index 3770d29e8c..69e1eff8b1 100644
--- a/package/kernel/qca-ssdk/Makefile
+++ b/package/kernel/qca-ssdk/Makefile
@@ -36,7 +36,7 @@ LNX_CONFIG_OPTS = LNX_MAKEOPTS='$(KERNEL_MAKEOPTS)' MODULE_TYPE=KSLIB modules
 MAKE_FLAGS+= \
 	TARGET_NAME=$(CONFIG_TARGET_NAME) \
 	TOOL_PATH=$(firstword $(TOOLCHAIN_BIN_DIRS)) \
-	SYS_PATH=$(LINUX_DIR) \
+	SYS_PATH=$(LINUX_SRC_DIR) \
 	TOOLPREFIX=$(TARGET_CROSS) \
 	KVER=$(LINUX_VERSION) \
 	ARCH=$(LINUX_KARCH) \
diff --git a/package/network/utils/arptables/Makefile b/package/network/utils/arptables/Makefile
index 7f32ed1395..520c7dcf27 100644
--- a/package/network/utils/arptables/Makefile
+++ b/package/network/utils/arptables/Makefile
@@ -32,7 +32,7 @@ endef
 
 MAKE_FLAGS += \
 	COPT_FLAGS="$(TARGET_CFLAGS) -D__OPTIMIZE__=1" \
-	KERNEL_DIR="$(LINUX_DIR)"
+	KERNEL_DIR="$(LINUX_SRC_DIR)"
 
 define Package/arptables-legacy/install
 	$(INSTALL_DIR) $(1)/usr/sbin
diff --git a/target/imagebuilder/Makefile b/target/imagebuilder/Makefile
index c4910b6c4b..1a68f6e374 100644
--- a/target/imagebuilder/Makefile
+++ b/target/imagebuilder/Makefile
@@ -15,7 +15,7 @@ override MAKEFLAGS=
 IB_NAME:=$(VERSION_DIST_SANITIZED)-imagebuilder-$(if $(CONFIG_VERSION_FILENAMES),$(VERSION_NUMBER)-)$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET)).$(HOST_OS)-$(HOST_ARCH)
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(IB_NAME)
 IB_KDIR:=$(patsubst $(TOPDIR)/%,$(PKG_BUILD_DIR)/%,$(KERNEL_BUILD_DIR))
-IB_LDIR:=$(patsubst $(TOPDIR)/%,$(PKG_BUILD_DIR)/%,$(LINUX_DIR))
+IB_LDIR:=$(patsubst $(TOPDIR)/%,$(PKG_BUILD_DIR)/%,$(LINUX_SRC_DIR))
 IB_DTSDIR:=$(patsubst $(TOPDIR)/%,$(PKG_BUILD_DIR)/%,$(LINUX_SRC_DIR))/arch/$(LINUX_KARCH)/boot/dts/
 IB_IDIR:=$(patsubst $(TOPDIR)/%,$(PKG_BUILD_DIR)/%,$(STAGING_DIR_IMAGE))
 
diff --git a/target/imagebuilder/files/Makefile b/target/imagebuilder/files/Makefile
index 78ec7e2e94..1e4d91324b 100644
--- a/target/imagebuilder/files/Makefile
+++ b/target/imagebuilder/files/Makefile
@@ -184,8 +184,8 @@ package_list: FORCE
 package_install: FORCE
 	@echo
 	@echo Installing packages...
-	$(OPKG) install $(firstword $(wildcard $(LINUX_DIR)/libc_*.ipk $(PACKAGE_DIR)/libc_*.ipk))
-	$(OPKG) install $(firstword $(wildcard $(LINUX_DIR)/kernel_*.ipk $(PACKAGE_DIR)/kernel_*.ipk))
+	$(OPKG) install $(firstword $(wildcard $(LINUX_SRC_DIR)/libc_*.ipk $(PACKAGE_DIR)/libc_*.ipk))
+	$(OPKG) install $(firstword $(wildcard $(LINUX_SRC_DIR)/kernel_*.ipk $(PACKAGE_DIR)/kernel_*.ipk))
 	$(OPKG) install $(BUILD_PACKAGES)
 
 prepare_rootfs: FORCE
diff --git a/target/sdk/Makefile b/target/sdk/Makefile
index 243d58bbaf..d118ff5ed6 100644
--- a/target/sdk/Makefile
+++ b/target/sdk/Makefile
@@ -49,7 +49,7 @@ BASE_FEED:=$(if $(BASE_FEED),$(BASE_FEED),$(shell cd $(TOPDIR); LC_ALL=C git svn
 BASE_FEED:=$(if $(BASE_FEED),$(BASE_FEED),$(shell cd $(TOPDIR); LC_ALL=C svn info 2>/dev/null | sed -ne 's/^URL: /src-svn base /p'))
 BASE_FEED:=$(if $(BASE_FEED),$(BASE_FEED),src-git-full base $(PROJECT_GIT)/openwrt/openwrt.git$(if $(GIT_BRANCH),;$(GIT_BRANCH),$(if $(GIT_TAGNAME),;$(GIT_TAGNAME))))
 
-KDIR_BASE = $(patsubst $(TOPDIR)/%,%,$(LINUX_DIR))
+KDIR_BASE = $(patsubst $(TOPDIR)/%,%,$(LINUX_SRC_DIR))
 KDIR_ARCHES = $(LINUX_KARCH)
 
 # arch/arm64/ includes reference files in arch/arm/, so we'll need both
@@ -78,7 +78,7 @@ KERNEL_FILES_BASE := \
 	modules.builtin \
 	$(foreach arch,$(KDIR_ARCHES),$(addprefix arch/$(arch)/,$(KERNEL_FILES_ARCH)))
 
-KERNEL_FILES := $(patsubst $(TOPDIR)/%,%,$(wildcard $(addprefix $(LINUX_DIR)/,$(KERNEL_FILES_BASE))))
+KERNEL_FILES := $(patsubst $(TOPDIR)/%,%,$(wildcard $(addprefix $(LINUX_SRC_DIR)/,$(KERNEL_FILES_BASE))))
 
 # The kernel source hosts various userspace utilities sources.
 # These are packaged separately from the kernel and kernel modules.
@@ -91,7 +91,7 @@ USERSPACE_UTILS_FILES := \
 	tools/spi \
 	tools/usb/usbip
 
-USERSPACE_FILES := $(patsubst $(TOPDIR)/%,%,$(wildcard $(addprefix $(LINUX_DIR)/,$(USERSPACE_UTILS_FILES))))
+USERSPACE_FILES := $(patsubst $(TOPDIR)/%,%,$(wildcard $(addprefix $(LINUX_SRC_DIR)/,$(USERSPACE_UTILS_FILES))))
 
 all: compile
 
diff --git a/toolchain/kernel-headers/Makefile b/toolchain/kernel-headers/Makefile
index dc70f32c90..4191173909 100644
--- a/toolchain/kernel-headers/Makefile
+++ b/toolchain/kernel-headers/Makefile
@@ -38,7 +38,7 @@ else
 endif
 HOST_BUILD_DIR:=$(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)
 PKG_HASH:=$(LINUX_KERNEL_HASH)
-LINUX_DIR := $(HOST_BUILD_DIR)
+LINUX_SRC_DIR := $(HOST_BUILD_DIR)
 FILES_DIR := 
 PATCH_DIR := ./patches$(if $(wildcard ./patches-$(LINUX_VERSION)),-$(LINUX_VERSION))
 
-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |       ehem+openwrt at m5p.com     PGP 87145445       |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445





From ehem+openwrt at m5p.com  Sun Nov 12 13:28:40 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Sun, 12 Nov 2023 13:28:40 -0800
Subject: [PATCH 20/20] [TEST] TESTING: try separating build from sources
In-Reply-To: <cover.1700010286.git.ehem+openwrt@m5p.com>
References: <cover.1700010286.git.ehem+openwrt@m5p.com>
Message-ID: <3c39ec02c837eacd2f5fcda0c14e8a39c7e0a1ab.1700010295.git.ehem+openwrt@m5p.com>

Check whether all the spots have been handled.  This hasn't been tried
in a long while, I doubt I've got everything right.

Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>
---
 include/kernel.mk | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/include/kernel.mk b/include/kernel.mk
index 7f236ece45..4afc9eaf4e 100644
--- a/include/kernel.mk
+++ b/include/kernel.mk
@@ -44,11 +44,10 @@ else
     FILES_DIR ?= $(foreach dir,$(wildcard $(CURDIR)/files $(CURDIR)/files-$(KERNEL_PATCHVER)),"$(dir)")
   endif
   KERNEL_BUILD_DIR ?= $(BUILD_DIR)/linux-$(BOARD)$(if $(SUBTARGET),_$(SUBTARGET))
-  LINUX_DIR ?= $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)
   # Location of kernel source files
-  LINUX_SRC_DIR ?= $(LINUX_DIR)
+  LINUX_SRC_DIR ?= $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)
   # Location of kernel object files
-  LINUX_OBJ_DIR ?= $(LINUX_DIR)
+  LINUX_OBJ_DIR ?= $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)-$(PROFILE)
   LINUX_UAPI_DIR=uapi/
   LINUX_VERMAGIC:=$(strip $(shell cat $(LINUX_OBJ_DIR)/.vermagic 2>/dev/null))
   LINUX_VERMAGIC:=$(if $(LINUX_VERMAGIC),$(LINUX_VERMAGIC),unknown)
-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |       ehem+openwrt at m5p.com     PGP 87145445       |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445





From s.l-h at gmx.de  Tue Nov 14 20:05:00 2023
From: s.l-h at gmx.de (Stefan Lippers-Hollmann)
Date: Wed, 15 Nov 2023 05:05:00 +0100
Subject: [PATCH 08/11] kernel/x86: move SCx200 support from generic to
 geode
In-Reply-To: <bd74745edf1050d345cdebc81c0a86d15d299a01.1700010534.git.ehem+openwrt@m5p.com>
References: <cover.1700010533.git.ehem+openwrt@m5p.com>
	<bd74745edf1050d345cdebc81c0a86d15d299a01.1700010534.git.ehem+openwrt@m5p.com>
Message-ID: <20231115050500.0426a7a6@mir>

Hi

On 2023-11-14, Elliott Mitchell wrote:
> Date: Thu, 13 Apr 2023 17:07:20 -0700
>
> The SCx200 is part of the Geode platform.  As such generic x86
> doesn't need the driver, but Geode does.

Not objecting against this patch, just taking it as an opportunity to ask
an orthogonal question...

Are three 32-bit x86 subtargets still needed/ warranted?
I mean all of these targets are basically obsolete and very low-end/
low-speed (hard to compete against mt7621a), so do the subtarget
specific optimizations really make sense anymore (are there any rough
performance comparisons or other reasons to keep them separate)?

Maintenance for three i386 subtargets is quite signficant, while at
the same time not very motivating to do the same steps three times
for e.g. kernel bumps.

/*
   Very much imho (and my opinion is not at all relevant), bumping the
   baseline to generic or dropping it down to legacy (geode?) would
   be preferable to the status quo (so one x86_64 subtarget and one
   combined i486/i586/i686 subtarget).
*/

Regards
	Stefan Lippers-Hollmann


From s.l-h at gmx.de  Tue Nov 14 20:35:11 2023
From: s.l-h at gmx.de (Stefan Lippers-Hollmann)
Date: Wed, 15 Nov 2023 05:35:11 +0100
Subject: [PATCH 11/11] kernel/x86: enable x32 support for amd64
In-Reply-To: <4388a0c540026486264dfe35efc4909743f4d5cc.1700010534.git.ehem+openwrt@m5p.com>
References: <cover.1700010533.git.ehem+openwrt@m5p.com>
	<4388a0c540026486264dfe35efc4909743f4d5cc.1700010534.git.ehem+openwrt@m5p.com>
Message-ID: <20231115053511.2fea768c@mir>

Hi

On 2023-11-14, Elliott Mitchell wrote:
> Date: Thu, 30 Mar 2023 16:30:49 -0700
>
> Full amd64 support isn't really appropriate for most situations
> OpenWRT is deployed.  Whereas x86-x32 seems extremely appropriate for
> these situations.  As such enable x86-x32 support.
>
> CONFIG_ARCH_MMAP_RND_COMPAT_BITS is required to follow along,
> otherwise the kernel build breaks.
>
> Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>
> ---
>
> I suggest OpenWRT should place some effort towards x86-x32.  x86-x32
> seems a rather superior generic target for OpenWRT.  Only issue is
> it could be valuable to have at least minimal amd64 userland support
> alongside the x86-x32 version.
>
> Note, this simply enables kernel support.  Until userspace building
> is added, this does almost nothing.

What would be the reason for enabling x32?
There is very little upstream buy-in for x32, when this question came
up for Debian, it was rejected to be enabled for -among other reasons-
concerns about the the system call ABI and its security hardening, as
well as concerns about the long term ABI compatibility (the later of
which probably not that relevant for OpenWrt, the former however is).

I do understand that this is a pet peeve among the high-density
virtualization crowd, but anywhere else, x32 as a concept is dead (and
never took off in the first place).

Talking about x86_64, as we have it right now, I don't see much of a
reason to change the current concept of 64-bit kernel and pure64
userland (and that's far from being a minimal setup, running on the
bare iron and having loaded quite bulky adblock lists):

# free -m
              total        used        free      shared  buff/cache   available
Mem:        3924052       75720     3640732        3424      207600     3768960
Swap:             0           0           0

*If* (and imho, again purely my own irrelevant opinion, that is a
big IF) x32 would really be deemed worthwhile for OpenWrt, it still
doesn't make sense to enable this whole userspace ABI for the x86_64
kernel now, before your desired additional patches are available
(and even then, you'd probably want a dedicated x32 subtarget instead
of  killing off the pure64 target for OpenWrt - something I'd
personally be even less in favour of).

What's the purpose for this patch now? OpenWrt doesn't ship anything
needing the x32 (yet), the only use for it would be running x32
binaries in a non-OpenWrt x32 chroot (and there aren't that many
general purpose distributions available to choose from) on top of
OpenWrt.

That aside, I may be confused by the config stacking order, but...
If I read it correctly, you enable CONFIG_X86_X32 in
target/linux/x86/config-*, while explicitly disabling it in the
only subtarget config (target/linux/x86/64/config-*) where it
would matter, is that really the intended way round and in line
with the commit description?

Regards
	Stefan Lippers-Hollmann


From s.l-h at gmx.de  Tue Nov 14 20:41:54 2023
From: s.l-h at gmx.de (Stefan Lippers-Hollmann)
Date: Wed, 15 Nov 2023 05:41:54 +0100
Subject: [PATCH 11/11] kernel/x86: enable x32 support for amd64
In-Reply-To: <20231115053511.2fea768c@mir>
References: <cover.1700010533.git.ehem+openwrt@m5p.com>
	<4388a0c540026486264dfe35efc4909743f4d5cc.1700010534.git.ehem+openwrt@m5p.com>
	<20231115053511.2fea768c@mir>
Message-ID: <20231115054154.6d3946d7@mir>

Hi

On 2023-11-15, Stefan Lippers-Hollmann wrote:
> On 2023-11-14, Elliott Mitchell wrote:
> > Date: Thu, 30 Mar 2023 16:30:49 -0700
> >
> > Full amd64 support isn't really appropriate for most situations
> > OpenWRT is deployed.  Whereas x86-x32 seems extremely appropriate for
> > these situations.  As such enable x86-x32 support.

[...]

> What would be the reason for enabling x32?
> There is very little upstream buy-in for x32, when this question came
> up for Debian, it was rejected to be enabled for -among other reasons-
> concerns about the the system call ABI and its security hardening, as
> well as concerns about the long term ABI compatibility (the later of
> which probably not that relevant for OpenWrt, the former however is).

Just to add some references to this:
- Can we drop upstream Linux x32 support?
  https://lkml.org/lkml/2018/12/10/1145
  the whole thread is interesting and doesn't display too much
  sympathy for x32
- information about the never merged/ defunct x32 port proposed for
  Debian
  https://wiki.debian.org/X32Port

Regards
	Stefan Lippers-Hollmann


From ehem+openwrt at m5p.com  Tue Nov 14 20:45:13 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Tue, 14 Nov 2023 20:45:13 -0800
Subject: [PATCH 08/11] kernel/x86: move SCx200 support from generic to
 geode
In-Reply-To: <20231115050500.0426a7a6@mir>
References: <cover.1700010533.git.ehem+openwrt@m5p.com>
 <bd74745edf1050d345cdebc81c0a86d15d299a01.1700010534.git.ehem+openwrt@m5p.com>
 <20231115050500.0426a7a6@mir>
Message-ID: <ZVRM2UUTprtVz0Ys@mattapan.m5p.com>

On Wed, Nov 15, 2023 at 05:05:00AM +0100, Stefan Lippers-Hollmann wrote:
> 
> On 2023-11-14, Elliott Mitchell wrote:
> > Date: Thu, 13 Apr 2023 17:07:20 -0700
> >
> > The SCx200 is part of the Geode platform.  As such generic x86
> > doesn't need the driver, but Geode does.
> 
> Not objecting against this patch, just taking it as an opportunity to ask
> an orthogonal question...
> 
> Are three 32-bit x86 subtargets still needed/ warranted?
> I mean all of these targets are basically obsolete and very low-end/
> low-speed (hard to compete against mt7621a), so do the subtarget
> specific optimizations really make sense anymore (are there any rough
> performance comparisons or other reasons to keep them separate)?

I stated this in a previous message.  In my view the current "generic"
target is worthless.  It is only useful to a small number of computers
and not worthy of having a specific target.

I would suggest it may be worthwhile splitting "64" besides having
virtual machine targets.  Early amd64 computers did feature AGP and PATA,
but those rapidly disappeared shortly after the architecture came into
existance.

Perhaps "old64" and "current64"?

Dunno.  "geode" seems worthwhile since the processors were manufactured
into 2019 and they are semi-embedded.  Having 2 generalized/desktop x86
targets seems too few, but 3 generalized/desktop x86 targets seems too
many.

Another way to evaluate is to consider the number of years covered by a
given target:

geode: 1999-2019
generic: 2000-2004
legacy: 1996-2007
64: 2003-2023

Which clearly paints "generic" as the one to eliminate.  Whereas "64"
should be under consideration for splitting.


-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |         ehem+sigmsg at m5p.com  PGP 87145445         |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445




From ehem+openwrt at m5p.com  Tue Nov 14 21:40:30 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Tue, 14 Nov 2023 21:40:30 -0800
Subject: [PATCH 11/11] kernel/x86: enable x32 support for amd64
In-Reply-To: <20231115054154.6d3946d7@mir>
References: <cover.1700010533.git.ehem+openwrt@m5p.com>
 <4388a0c540026486264dfe35efc4909743f4d5cc.1700010534.git.ehem+openwrt@m5p.com>
 <20231115053511.2fea768c@mir>
 <20231115054154.6d3946d7@mir>
Message-ID: <ZVRZzi1QZF3UIdXd@mattapan.m5p.com>

On Wed, Nov 15, 2023 at 05:35:11AM +0100, Stefan Lippers-Hollmann wrote:
> 
> On 2023-11-14, Elliott Mitchell wrote:
> > Date: Thu, 30 Mar 2023 16:30:49 -0700
> >
> > Full amd64 support isn't really appropriate for most situations
> > OpenWRT is deployed.  Whereas x86-x32 seems extremely appropriate for
> > these situations.  As such enable x86-x32 support.
> >
> > CONFIG_ARCH_MMAP_RND_COMPAT_BITS is required to follow along,
> > otherwise the kernel build breaks.
> >
> > Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>
> > ---
> >
> > I suggest OpenWRT should place some effort towards x86-x32.  x86-x32
> > seems a rather superior generic target for OpenWRT.  Only issue is
> > it could be valuable to have at least minimal amd64 userland support
> > alongside the x86-x32 version.
> >
> > Note, this simply enables kernel support.  Until userspace building
> > is added, this does almost nothing.
> 
> What would be the reason for enabling x32?
> There is very little upstream buy-in for x32, when this question came
> up for Debian, it was rejected to be enabled for -among other reasons-
> concerns about the the system call ABI and its security hardening, as
> well as concerns about the long term ABI compatibility (the later of
> which probably not that relevant for OpenWrt, the former however is).

What I see seems like x32 is still making progress on Debian.  I note
musl has a x32 target.  While it still isn't a release architecture for
Debian, I could see it becoming one.

> I do understand that this is a pet peeve among the high-density
> virtualization crowd, but anywhere else, x32 as a concept is dead (and
> never took off in the first place).

In my view x32 has some substantial use cases.  Have you ever seen `ls`,
`rm`, `grep`, `find`, or `test` needing more than 4GB of memory?  Any
of these needing that much memory would suggest something was wrong
(or perhaps someone was trying to abuse them in an impressive way).  For
quite a number of shell utilities being able to use more than 4GB of
memory is pointless.

This is speculation, but I suspect there would be substantial value in
having mixed systems where some utilities were x32 and some were amd64.

> *If* (and imho, again purely my own irrelevant opinion, that is a
> big IF) x32 would really be deemed worthwhile for OpenWrt, it still
> doesn't make sense to enable this whole userspace ABI for the x86_64
> kernel now, before your desired additional patches are available
> (and even then, you'd probably want a dedicated x32 subtarget instead
> of  killing off the pure64 target for OpenWrt - something I'd
> personally be even less in favour of).

Enabling the kernel support is always the first step.  How does one test
userspace if the kernel won't even load the executables?

> That aside, I may be confused by the config stacking order, but...
> If I read it correctly, you enable CONFIG_X86_X32 in
> target/linux/x86/config-*, while explicitly disabling it in the
> only subtarget config (target/linux/x86/64/config-*) where it
> would matter, is that really the intended way round and in line
> with the commit description?

Previously x32 was explicitly disabled in x86/64/config subtarget.  This
removes that, then enables it in x86/config target.


On Wed, Nov 15, 2023 at 05:41:54AM +0100, Stefan Lippers-Hollmann wrote:
> 
> On 2023-11-15, Stefan Lippers-Hollmann wrote:
> > What would be the reason for enabling x32?
> > There is very little upstream buy-in for x32, when this question came
> > up for Debian, it was rejected to be enabled for -among other reasons-
> > concerns about the the system call ABI and its security hardening, as
> > well as concerns about the long term ABI compatibility (the later of
> > which probably not that relevant for OpenWrt, the former however is).
> 
> Just to add some references to this:
> - Can we drop upstream Linux x32 support?
>   https://lkml.org/lkml/2018/12/10/1145
>   the whole thread is interesting and doesn't display too much
>   sympathy for x32

Yes, and did it get dropped?  No, it didn't.  At least some of the issues
brought up there have been fixed.

> - information about the never merged/ defunct x32 port proposed for
>   Debian
>   https://wiki.debian.org/X32Port

There are pointers to many bugs which were found and fixed.  There don't
appear to be that many unresolved ones.  Unfortunately I don't know
whether it is likely to be part of the next formal release.

I also note even the most extreme of the OpenWRT virtual machine
suggestions doesn't suggest more than 4GB of memory.

I don't know the future, but enabling kernel support is the first step.


-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |         ehem+sigmsg at m5p.com  PGP 87145445         |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445




From zajec5 at gmail.com  Wed Nov 15 00:04:47 2023
From: zajec5 at gmail.com (=?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?=)
Date: Wed, 15 Nov 2023 09:04:47 +0100
Subject: [PATCH] kernel: drop "mac-address-increment-byte" DT property support
Message-ID: <20231115080447.28292-1-zajec5@gmail.com>

From: Rafa? Mi?ecki <rafal at milecki.pl>

This downstream DT property is not used by any DTS file anymore.

Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
---
 ...net-add-mac-address-increment-support.patch | 18 ++++--------------
 ...683-of_net-add-mac-address-to-of-tree.patch |  2 +-
 ...et-do-mac-address-increment-only-once.patch |  9 ++++-----
 ...net-add-mac-address-increment-support.patch | 18 ++++--------------
 ...683-of_net-add-mac-address-to-of-tree.patch |  2 +-
 ...et-do-mac-address-increment-only-once.patch |  9 ++++-----
 6 files changed, 18 insertions(+), 40 deletions(-)

diff --git a/target/linux/generic/pending-5.15/682-of_net-add-mac-address-increment-support.patch b/target/linux/generic/pending-5.15/682-of_net-add-mac-address-increment-support.patch
index f6ae9f31f1..73eabf4f37 100644
--- a/target/linux/generic/pending-5.15/682-of_net-add-mac-address-increment-support.patch
+++ b/target/linux/generic/pending-5.15/682-of_net-add-mac-address-increment-support.patch
@@ -20,14 +20,12 @@ Signed-off-by: Ansuel Smith <ansuelsmth at gmail.com>
 
 --- a/net/core/of_net.c
 +++ b/net/core/of_net.c
-@@ -119,28 +119,63 @@ static int of_get_mac_addr_nvmem(struct
+@@ -119,10 +119,19 @@ static int of_get_mac_addr_nvmem(struct
   * this case, the real MAC is in 'local-mac-address', and 'mac-address' exists
   * but is all zeros.
   *
 + * DT can tell the system to increment the mac-address after is extracted by
 + * using:
-+ * - mac-address-increment-byte to decide what byte to increase
-+ *   (if not defined is increased the last byte)
 + * - mac-address-increment to decide how much to increase. The value WILL
 + *   overflow to other bytes if the increment is over 255 or the total
 + *   increment will exceed 255 of the current byte.
@@ -38,19 +36,11 @@ Signed-off-by: Ansuel Smith <ansuelsmth at gmail.com>
  */
  int of_get_mac_address(struct device_node *np, u8 *addr)
  {
-+	u32 inc_idx, mac_inc, mac_val;
++	u32 mac_inc, mac_val;
  	int ret;
  
-+	/* Check first if the increment byte is present and valid.
-+	 * If not set assume to increment the last byte if found.
-+	 */
-+	if (of_property_read_u32(np, "mac-address-increment-byte", &inc_idx))
-+		inc_idx = 5;
-+	if (inc_idx < 3 || inc_idx > 5)
-+		return -EINVAL;
-+
  	if (!np)
- 		return -ENODEV;
+@@ -130,17 +139,33 @@ int of_get_mac_address(struct device_nod
  
  	ret = of_get_mac_addr(np, "mac-address", addr);
  	if (!ret)
@@ -75,7 +65,7 @@ Signed-off-by: Ansuel Smith <ansuelsmth at gmail.com>
 +	if (!of_property_read_u32(np, "mac-address-increment", &mac_inc)) {
 +		/* Convert to a contiguous value */
 +		mac_val = (addr[3] << 16) + (addr[4] << 8) + addr[5];
-+		mac_val += mac_inc << 8 * (5-inc_idx);
++		mac_val += mac_inc;
 +
 +		/* Apply the incremented value handling overflow case */
 +		addr[3] = (mac_val >> 16) & 0xff;
diff --git a/target/linux/generic/pending-5.15/683-of_net-add-mac-address-to-of-tree.patch b/target/linux/generic/pending-5.15/683-of_net-add-mac-address-to-of-tree.patch
index f7ef06a14a..29144ce8b4 100644
--- a/target/linux/generic/pending-5.15/683-of_net-add-mac-address-to-of-tree.patch
+++ b/target/linux/generic/pending-5.15/683-of_net-add-mac-address-to-of-tree.patch
@@ -45,7 +45,7 @@ property. This way, the MAC address can be accessed using procfs.
  /**
   * of_get_mac_address()
   * @np:		Caller's Device Node
-@@ -175,6 +196,7 @@ found:
+@@ -165,6 +186,7 @@ found:
  		addr[5] = (mac_val >> 0) & 0xff;
  	}
  
diff --git a/target/linux/generic/pending-5.15/684-of_net-do-mac-address-increment-only-once.patch b/target/linux/generic/pending-5.15/684-of_net-do-mac-address-increment-only-once.patch
index 44d88e31a2..c37c451989 100644
--- a/target/linux/generic/pending-5.15/684-of_net-do-mac-address-increment-only-once.patch
+++ b/target/linux/generic/pending-5.15/684-of_net-do-mac-address-increment-only-once.patch
@@ -16,16 +16,15 @@ Signed-off-by: Will Moss <willormos at gmail.com>
 
 --- a/net/core/of_net.c
 +++ b/net/core/of_net.c
-@@ -194,6 +194,12 @@ found:
+@@ -184,6 +184,11 @@ found:
  		addr[3] = (mac_val >> 16) & 0xff;
  		addr[4] = (mac_val >> 8) & 0xff;
  		addr[5] = (mac_val >> 0) & 0xff;
 +
-+		/* Remove mac-address-increment and mac-address-increment-byte
-+		 * DT property to make sure MAC address would not get incremented
-+		 * more if this function is stared again. */
++		/* Remove mac-address-increment DT property to make sure MAC
++		 * address would not get incremented more if this function is
++		 * stared again. */
 +		of_remove_property(np, of_find_property(np, "mac-address-increment", NULL));
-+		of_remove_property(np, of_find_property(np, "mac-address-increment-byte", NULL));
  	}
  
  	of_add_mac_address(np, addr);
diff --git a/target/linux/generic/pending-6.1/682-of_net-add-mac-address-increment-support.patch b/target/linux/generic/pending-6.1/682-of_net-add-mac-address-increment-support.patch
index f6ae9f31f1..73eabf4f37 100644
--- a/target/linux/generic/pending-6.1/682-of_net-add-mac-address-increment-support.patch
+++ b/target/linux/generic/pending-6.1/682-of_net-add-mac-address-increment-support.patch
@@ -20,14 +20,12 @@ Signed-off-by: Ansuel Smith <ansuelsmth at gmail.com>
 
 --- a/net/core/of_net.c
 +++ b/net/core/of_net.c
-@@ -119,28 +119,63 @@ static int of_get_mac_addr_nvmem(struct
+@@ -119,10 +119,19 @@ static int of_get_mac_addr_nvmem(struct
   * this case, the real MAC is in 'local-mac-address', and 'mac-address' exists
   * but is all zeros.
   *
 + * DT can tell the system to increment the mac-address after is extracted by
 + * using:
-+ * - mac-address-increment-byte to decide what byte to increase
-+ *   (if not defined is increased the last byte)
 + * - mac-address-increment to decide how much to increase. The value WILL
 + *   overflow to other bytes if the increment is over 255 or the total
 + *   increment will exceed 255 of the current byte.
@@ -38,19 +36,11 @@ Signed-off-by: Ansuel Smith <ansuelsmth at gmail.com>
  */
  int of_get_mac_address(struct device_node *np, u8 *addr)
  {
-+	u32 inc_idx, mac_inc, mac_val;
++	u32 mac_inc, mac_val;
  	int ret;
  
-+	/* Check first if the increment byte is present and valid.
-+	 * If not set assume to increment the last byte if found.
-+	 */
-+	if (of_property_read_u32(np, "mac-address-increment-byte", &inc_idx))
-+		inc_idx = 5;
-+	if (inc_idx < 3 || inc_idx > 5)
-+		return -EINVAL;
-+
  	if (!np)
- 		return -ENODEV;
+@@ -130,17 +139,33 @@ int of_get_mac_address(struct device_nod
  
  	ret = of_get_mac_addr(np, "mac-address", addr);
  	if (!ret)
@@ -75,7 +65,7 @@ Signed-off-by: Ansuel Smith <ansuelsmth at gmail.com>
 +	if (!of_property_read_u32(np, "mac-address-increment", &mac_inc)) {
 +		/* Convert to a contiguous value */
 +		mac_val = (addr[3] << 16) + (addr[4] << 8) + addr[5];
-+		mac_val += mac_inc << 8 * (5-inc_idx);
++		mac_val += mac_inc;
 +
 +		/* Apply the incremented value handling overflow case */
 +		addr[3] = (mac_val >> 16) & 0xff;
diff --git a/target/linux/generic/pending-6.1/683-of_net-add-mac-address-to-of-tree.patch b/target/linux/generic/pending-6.1/683-of_net-add-mac-address-to-of-tree.patch
index f7ef06a14a..29144ce8b4 100644
--- a/target/linux/generic/pending-6.1/683-of_net-add-mac-address-to-of-tree.patch
+++ b/target/linux/generic/pending-6.1/683-of_net-add-mac-address-to-of-tree.patch
@@ -45,7 +45,7 @@ property. This way, the MAC address can be accessed using procfs.
  /**
   * of_get_mac_address()
   * @np:		Caller's Device Node
-@@ -175,6 +196,7 @@ found:
+@@ -165,6 +186,7 @@ found:
  		addr[5] = (mac_val >> 0) & 0xff;
  	}
  
diff --git a/target/linux/generic/pending-6.1/684-of_net-do-mac-address-increment-only-once.patch b/target/linux/generic/pending-6.1/684-of_net-do-mac-address-increment-only-once.patch
index 44d88e31a2..c37c451989 100644
--- a/target/linux/generic/pending-6.1/684-of_net-do-mac-address-increment-only-once.patch
+++ b/target/linux/generic/pending-6.1/684-of_net-do-mac-address-increment-only-once.patch
@@ -16,16 +16,15 @@ Signed-off-by: Will Moss <willormos at gmail.com>
 
 --- a/net/core/of_net.c
 +++ b/net/core/of_net.c
-@@ -194,6 +194,12 @@ found:
+@@ -184,6 +184,11 @@ found:
  		addr[3] = (mac_val >> 16) & 0xff;
  		addr[4] = (mac_val >> 8) & 0xff;
  		addr[5] = (mac_val >> 0) & 0xff;
 +
-+		/* Remove mac-address-increment and mac-address-increment-byte
-+		 * DT property to make sure MAC address would not get incremented
-+		 * more if this function is stared again. */
++		/* Remove mac-address-increment DT property to make sure MAC
++		 * address would not get incremented more if this function is
++		 * stared again. */
 +		of_remove_property(np, of_find_property(np, "mac-address-increment", NULL));
-+		of_remove_property(np, of_find_property(np, "mac-address-increment-byte", NULL));
  	}
  
  	of_add_mac_address(np, addr);
-- 
2.35.3



From s.l-h at gmx.de  Wed Nov 15 01:36:21 2023
From: s.l-h at gmx.de (Stefan Lippers-Hollmann)
Date: Wed, 15 Nov 2023 10:36:21 +0100
Subject: [PATCH 11/11] kernel/x86: enable x32 support for amd64
In-Reply-To: <ZVRZzi1QZF3UIdXd@mattapan.m5p.com>
References: <cover.1700010533.git.ehem+openwrt@m5p.com>
	<4388a0c540026486264dfe35efc4909743f4d5cc.1700010534.git.ehem+openwrt@m5p.com>
	<20231115053511.2fea768c@mir>
	<20231115054154.6d3946d7@mir>
	<ZVRZzi1QZF3UIdXd@mattapan.m5p.com>
Message-ID: <20231115103621.0da7eedb@mir>

Hi

On 2023-11-14, Elliott Mitchell wrote:
> On Wed, Nov 15, 2023 at 05:35:11AM +0100, Stefan Lippers-Hollmann wrote:
> > On 2023-11-14, Elliott Mitchell wrote:
[...]
> > What would be the reason for enabling x32?
> > There is very little upstream buy-in for x32, when this question came
> > up for Debian, it was rejected to be enabled for -among other reasons-
> > concerns about the the system call ABI and its security hardening, as
> > well as concerns about the long term ABI compatibility (the later of
> > which probably not that relevant for OpenWrt, the former however is).
>
> What I see seems like x32 is still making progress on Debian.  I note
> musl has a x32 target.  While it still isn't a release architecture for
> Debian, I could see it becoming one.

I wouldn't really consider this to be very likely, if at all, it has
become even less likely than it was over a decade ago.

> > I do understand that this is a pet peeve among the high-density
> > virtualization crowd, but anywhere else, x32 as a concept is dead (and
> > never took off in the first place).
>
> In my view x32 has some substantial use cases.  Have you ever seen `ls`,
> `rm`, `grep`, `find`, or `test` needing more than 4GB of memory?  Any
> of these needing that much memory would suggest something was wrong
> (or perhaps someone was trying to abuse them in an impressive way).  For
> quite a number of shell utilities being able to use more than 4GB of
> memory is pointless.

The counter question would be, does it hurt?
Yes, the x32 proponents (mostly from the high-density virtualization
crowd and, as Linus called it "extreme benchmarking" environments) will
point out that pure-x32 uses slightly less disk space and slightly less
RAM than pure64, but we are talking about very little in today's world.

> This is speculation, but I suspect there would be substantial value in
> having mixed systems where some utilities were x32 and some were amd64.

Please point out what exactly those would be, especially in the context
of OpenWrt.

If you really want to mix x32 and amd64 binaries, you will need a full
library set (binary packages - co-installable) for both x32 and x86_64
installed and in RAM - which is completely detrimental to any of the
gains promised above.

x32 only works, if you have (aside from the kernel itself) a pure-x32
userspace, or your losses in terms of additional disk space and RAM
usage outweigh your gains by an order of magnitude. In a general purpose
distribution you might ignore that by claiming that 'only' your big
database management system (and its dependencies) would have to be a 64
binary (or some other -very isolated, compared to the rest of the running
system- big component), but the situation for OpenWrt is different.

This kind of mixed userspace would be a nightmare for complexity on the
source side - and/or would require Debian-style multiarch support.
Neither of which is very likely to succeed for OpenWrt (let alone for
opkg).

> > *If* (and imho, again purely my own irrelevant opinion, that is a
> > big IF) x32 would really be deemed worthwhile for OpenWrt, it still
> > doesn't make sense to enable this whole userspace ABI for the x86_64
> > kernel now, before your desired additional patches are available
> > (and even then, you'd probably want a dedicated x32 subtarget instead
> > of  killing off the pure64 target for OpenWrt - something I'd
> > personally be even less in favour of).
>
> Enabling the kernel support is always the first step.  How does one test
> userspace if the kernel won't even load the executables?

In a general purpose distribution one might say that, however even there
one would expect quite a lot of testing having happened before enabling
a complete new/ additional ABI to userspace (duplicate to the native one),
something akin to the semi-official debian-ports infrastructure, used for
bootstrapping of new ports or retiring old ones that still have some form
of interest.

But in this case there is nothing to test in isolation, as there are
no x32 binaries compatible with OpenWrt (you could only test inside
a non-OpenWrt x32 chroot, but that's barely grounds for enabling x32
in OpenWrt's kernel, just in case; otherwise float emulation would be
enabled for mips, to facilitate Debian chroots - spoiler, it's not).

In contrast to the changes necessary (buildsystem, image generation,
kernel configs, etc.) to test an OpenWrt x32 subtarget, a lazy-man's
two-line patch of enabling X86_X32 && X86_X32_ABI would be trivial
in comparison to anything of the rest that would be needed.

Given that OpenWrt doesn't have any binary compatibility between
major versions and needs to get rebuilt in total for each new revision,
there is no need to stage- and phase in additions like this, add the
new sub-target in its entirety (or not).

[...]
> On Wed, Nov 15, 2023 at 05:41:54AM +0100, Stefan Lippers-Hollmann wrote:
> > On 2023-11-15, Stefan Lippers-Hollmann wrote:
> > > What would be the reason for enabling x32?
> > > There is very little upstream buy-in for x32, when this question came
> > > up for Debian, it was rejected to be enabled for -among other reasons-
> > > concerns about the the system call ABI and its security hardening, as
> > > well as concerns about the long term ABI compatibility (the later of
> > > which probably not that relevant for OpenWrt, the former however is).
> >
> > Just to add some references to this:
> > - Can we drop upstream Linux x32 support?
> >   https://lkml.org/lkml/2018/12/10/1145
> >   the whole thread is interesting and doesn't display too much
> >   sympathy for x32
>
> Yes, and did it get dropped?  No, it didn't.  At least some of the issues
> brought up there have been fixed.

It didn't get any more traction either, rather to the contrary (disk-
and RAM are growing in modern hardware, what would be the real gains
here).

> > - information about the never merged/ defunct x32 port proposed for
> >   Debian
> >   https://wiki.debian.org/X32Port
>
> There are pointers to many bugs which were found and fixed.  There don't
> appear to be that many unresolved ones.  Unfortunately I don't know
> whether it is likely to be part of the next formal release.

> I also note even the most extreme of the OpenWRT virtual machine
> suggestions doesn't suggest more than 4GB of memory.

and as show cased, a pure64 OpenWrt can get away with ~16 MB disk space
(using a sparse image, rather than the ~121 MB raw disk image) and easily
gets away with ~96 MB RAM with its default package set - how much do you
think x32 would improve that (we're talking about x86_64 hardware here,
not legacy i386 systems)?
Is it worth the effort depicted above?
(and yes, I've tested both with 23.05.0 on qemu; 12 MB qcow2 sparse
image, 96 MB RAM (64 MB throws OOM)).
Even the runtime performance improvements should be negligible, all the
routing happens in kernelspace (for the most part), which would remain
x86_64 - any speed improvements on the userspace would be (apart from
being minimal in isolation) completely irrelevant to routing performance.
dnsmasq, ls, cp, rm and friends being 5% faster or slower doesn't really
matter (and around 5% is the most even its proponents claim).

> I don't know the future, but enabling kernel support is the first step.

If you wanted to add it to Debian (with working a multi-arch
implementation and organically grown repositories (which aren't
rebuild aside from sourceful uploads or targeted binNMUs), you would
be right - for OpenWrt, no, there really is no need to enable it,
before you have the rest of the x32 subtarget ready to be merged (and
I can't imagine any reason to enable it for the current OpenWrt x86_64
subtarget at all).

For OpenWrt, I could imagine only two approaches to this:
- make the x86_64 subtarget x32-only
- add a new x32-only subtarget and leave x86_64 as it is
Neither would really be 'sensible', but the only workable approach
would imho be the later, even if the intention was (I hope not to
witness that) to kill off the old x86_64 target.

Yes, as laid out before, there isn't any strict need for OpenWrt to
remain binary compatible between releases, however this would seriously
mess up base vs. ports for (at least) a few weeks (broken packages,
package relations, implicit expectations by build recipes throughout
the tree) - and anyone doing this in one step (archive wide), without
prior testing, would be insane, so the later step of adding a new
subtarget in parallel to the old one would be necessary for multiple
months (if not at least a stable release cycle shipping both) either
way.

So I really don't see any reason to enable x32 for the x86_64 subtarget,
there's nothing to be gained, just major disadvantages.
While I'm not a proponent for a pure-x32 subtarget either (at all), this
would be the only workable approach to introduce it.

Regards
	Stefan Lippers-Hollmann


From bjorn at mork.no  Wed Nov 15 02:29:23 2023
From: bjorn at mork.no (=?utf-8?Q?Bj=C3=B8rn_Mork?=)
Date: Wed, 15 Nov 2023 11:29:23 +0100
Subject: [PATCH 06/20] kernel: remove drivers marked as modules
In-Reply-To: <afe0d6c0e51d0d6b7d41724a3a53e7fca6a8c7d1.1700010290.git.ehem+openwrt@m5p.com>
	(Elliott Mitchell's message of "Fri, 10 Nov 2023 16:51:25 -0800")
References: <cover.1700010286.git.ehem+openwrt@m5p.com>
	<afe0d6c0e51d0d6b7d41724a3a53e7fca6a8c7d1.1700010290.git.ehem+openwrt@m5p.com>
Message-ID: <877cmjia2k.fsf@miraculix.mork.no>

Elliott Mitchell <ehem+openwrt at m5p.com> writes:

> Previously these would get built, then simply omitted from the
> resultant image.

A kernel image built with a config symbol set to 'm' is sometimes
deliberately differerent from an image built with the same symbol set
to 'n'.  The kernel is sprinkled with IS_ENABLED() or similar open coded
tests. Some of the symbols you are removing are tested.

Did you verify that all these changes still produce the same kernel
images as before?


Bj?rn


From ehem+openwrt at m5p.com  Wed Nov 15 13:57:10 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Wed, 15 Nov 2023 13:57:10 -0800
Subject: [PATCH 11/11] kernel/x86: enable x32 support for amd64
In-Reply-To: <20231115103621.0da7eedb@mir>
References: <cover.1700010533.git.ehem+openwrt@m5p.com>
 <4388a0c540026486264dfe35efc4909743f4d5cc.1700010534.git.ehem+openwrt@m5p.com>
 <20231115053511.2fea768c@mir>
 <20231115054154.6d3946d7@mir>
 <ZVRZzi1QZF3UIdXd@mattapan.m5p.com>
 <20231115103621.0da7eedb@mir>
Message-ID: <ZVU+thx8fh+vDEW6@mattapan.m5p.com>

On Wed, Nov 15, 2023 at 10:36:21AM +0100, Stefan Lippers-Hollmann wrote:
> 
> On 2023-11-14, Elliott Mitchell wrote:
> 
> > I don't know the future, but enabling kernel support is the first step.
> 
> If you wanted to add it to Debian (with working a multi-arch
> implementation and organically grown repositories (which aren't
> rebuild aside from sourceful uploads or targeted binNMUs), you would
> be right - for OpenWrt, no, there really is no need to enable it,
> before you have the rest of the x32 subtarget ready to be merged (and
> I can't imagine any reason to enable it for the current OpenWrt x86_64
> subtarget at all).

So you would be against enabling the kernel support before userspace is
ready?  Meanwhile everyone else would be against working on userspace
without it being enabled in the kernel...

That doesn't really work too well.

> For OpenWrt, I could imagine only two approaches to this:
> - make the x86_64 subtarget x32-only
> - add a new x32-only subtarget and leave x86_64 as it is
> Neither would really be 'sensible', but the only workable approach
> would imho be the later, even if the intention was (I hope not to
> witness that) to kill off the old x86_64 target.

I agree with this.  One comment though, I suspect OpenWRT VM
installations will remain below 4GB of memory for quite some time.  As
such x32 would be a "free" performance boost/memory reduction if upstream
sources support x32 (yeah, this is a big if).

> So I really don't see any reason to enable x32 for the x86_64 subtarget,
> there's nothing to be gained, just major disadvantages.
> While I'm not a proponent for a pure-x32 subtarget either (at all), this
> would be the only workable approach to introduce it.

At a glance it looks like some useful gains for not too much cost.

>From my perspective though this isn't a crucial part of my goal.  So I'm
likely to drop further discussion as this the cost:benefit isn't there.


-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |         ehem+sigmsg at m5p.com  PGP 87145445         |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445




From ehem+openwrt at m5p.com  Wed Nov 15 14:44:19 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Wed, 15 Nov 2023 14:44:19 -0800
Subject: [PATCH 06/20] kernel: remove drivers marked as modules
In-Reply-To: <877cmjia2k.fsf@miraculix.mork.no>
References: <cover.1700010286.git.ehem+openwrt@m5p.com>
 <afe0d6c0e51d0d6b7d41724a3a53e7fca6a8c7d1.1700010290.git.ehem+openwrt@m5p.com>
 <877cmjia2k.fsf@miraculix.mork.no>
Message-ID: <ZVVJw00G73+r/lKs@mattapan.m5p.com>

On Wed, Nov 15, 2023 at 11:29:23AM +0100, Bj?rn Mork wrote:
> Elliott Mitchell <ehem+openwrt at m5p.com> writes:
> 
> > Previously these would get built, then simply omitted from the
> > resultant image.
> 
> A kernel image built with a config symbol set to 'm' is sometimes
> deliberately differerent from an image built with the same symbol set
> to 'n'.  The kernel is sprinkled with IS_ENABLED() or similar open coded
> tests. Some of the symbols you are removing are tested.
> 
> Did you verify that all these changes still produce the same kernel
> images as before?

No, I haven't.  I would tend to look at the git log to find out why
those were added (no mention would suggest accident), but the git log
is rather troublesome for the config files.

I'll try to take a look, but right now I'm spending time testing the
split of kernel source and kernel build.  OpenWRT appears to have quite a
number of issues there.

If enabling those as modules helps then something is very wrong.


-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |         ehem+sigmsg at m5p.com  PGP 87145445         |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445




From hauke at hauke-m.de  Wed Nov 15 14:57:48 2023
From: hauke at hauke-m.de (Hauke Mehrtens)
Date: Wed, 15 Nov 2023 23:57:48 +0100
Subject: OpenWrt 23.05.2 - Service Release
Message-ID: <e89bde7d-8d18-453f-90b8-5f20ee4cd1e9@hauke-m.de>

Hi,

The OpenWrt community is proud to announce the newest stable release of 
the OpenWrt 23.05 stable series. It improves device support and brings a 
few bug fixes.

Download firmware images using the OpenWrt Firmware Selector:
   * https://firmware-selector.openwrt.org/?version=23.05.2
Download firmware images directly from our download servers:
   * https://downloads.openwrt.org/releases/23.05.2/targets/

Main changes between OpenWrt 23.05.0 and OpenWrt 23.05.2
========================================================

23.05.1 was tagged, but not official release because we found a severe 
bug between tagging and announcing the release.

Device support
==============

   * Support for the following devices was added:
     * bcm53xx: ASUS RT-AC3100
     * mediatek: CMCC RAX3000M
     * mediatek: MT7981 RFB
     * ramips: ComFast CF-E390AX
     * ramips: ComFast CF-EW72 V2
     * ramips: MeiG SLT866 4G CPE
     * realtek: HPE 1920-8g-poe+ (65W)
   * apm821xx: Netgear WNDR4700: Fix broken sysupgrade, factory images
   * armsr: Preserve configuration during sysupgrade
   * ath79: Compex wpj563: Enable 2nd USB controller
   * ath79: TP-Link Archer C7 v2: Fix wifi shutdown and "irq 23: nobody
     cared" error
   * bcm53xx: Make Linux use correct switch ports again
   * bcm53xx: Linksys EA9200: nvram and 02_network fixes
   * ipq40xx: Switch to performance governor by default
   * lantiq: xrx200: Build target again
   * mediatek: Xiaomi Redmi Router AX6000: Fix Ethernet in U-Boot
   * realtek: HPE 1920-8g-poe: Rename to match hardware
   * ramips: HiWiFi HC5861: Fix Gigabit Ethernet port
   * ramips: ZyXEL NR7101: Fix bricking typo


Various fixes and improvements
==============================

   * Fix assignment of default MAC addresses on some targets
   * build: Hide kmod-zram config unless enabled
   * build: Fix lto build
   * build: Fix glibc build
   * build: Fix pkg-config detection when inside of a nix-shell
   * build: Add CycloneDX SBOM JSON support
   * hostapd: Do not trim trailing whitespace, except for newline
   * hostapd: Fix OWE association with mbedtls
   * hostapd: Fix broken WPS on broadcom-wl and ath11k
   * hostapd: Fix broken noscan option
   * wifi: Fix applying mesh parameters when wpa_supplicant is in use
   * iptables: backport patch fixing bug with string module
   * mbedtls: Activate secp521r1 curve by default
   * px5g-mbedtls: Fix permission of private key
   * px5g-wolfssl: Fix permission of private key
   * netifd: Fixed race condition in default gateway configuration

Core components update
======================

   * Update mbedtls from 2.28.4 to 2.28.5
   * Update openssl from 3.0.11 to 3.0.12
   * Update wolfssl from 5.6.3 to 5.6.4
   * Update Linux from 5.15.134 to 5.15.137
   * Update ipq-wifi from 2023-06-03 to 2023-11-10
   * Update uqmi from 2022-05-04 to 2022-10-20
   * Update umdns from 2023-01-16 to 2023-10-19
   * Update urngd from 2023-07-25 to 2023-11-01
   * Update ucode from 2023-06-06 to 2023-11-07
   * Update firewall4 from 2023-03-23 to 2023-09-01
   * Update odhcpd from 2023-06-24 to 2023-10-24
   * Update netifd from 2023-10-20 to 2023-11-10


Upgrading to 23.05.2
====================

Sysupgrade can be used to upgrade a device from 22.03 to 23.05, and 
configuration will be preserved in most cases.

  * Sysupgrade from 21.02 to 23.05 is not officially supported.
  * ipq40xx EA6350v3, EA8300, MR8300 and WHW01 require tweak to the
    U-Boot environment on update from 22.03 to 23.05. Refer to the Device
    wiki or the instruction on sysupgrade on how to do this change.
    Config needs to be reset on sysupgrade.


Known issues
============

   * lantiq/xrx200 target shows error messages in DSA switch
     configuration of the integrated GSWIP switch. (see:
     https://github.com/openwrt/openwrt/pull/13200)
   * OpenWrt 23.05.2 was signed with the wrong signing keys. The keys
     from OpenWrt snapshot were used for OpenWrt 23.05.2 including the
     release candidates. A later OpenWrt 23.05 service release will use a
     different key.

See up to date information here:
https://openwrt.org/releases/23.05/notes-23.05.2#known_issues


-----------------

Full release notes and upgrade instructions are available at
https://openwrt.org/releases/23.05/notes-23.05.2

In particular, make sure to read the regressions and known issues before 
upgrading:
https://openwrt.org/releases/23.05/notes-23.05.2#known_issues

For a detailed list of all changes since 23.05.0, refer to
https://openwrt.org/releases/23.05/changelog-23.05.2

To download the 23.05.2 images, navigate to:
https://downloads.openwrt.org/releases/23.05.2/targets/
Use OpenWrt Firmware Selector to download:
https://firmware-selector.openwrt.org/?version=23.05.2

As always, a big thank you goes to all our active package maintainers, 
testers, documenters and supporters.

Have fun!

The OpenWrt Community

---

To stay informed of new OpenWrt releases and security advisories, there 
are new channels available:

   * a low-volume mailing list for important announcements:
https://lists.openwrt.org/mailman/listinfo/openwrt-announce

   * a dedicated "announcements" section in the forum:
https://forum.openwrt.org/c/announcements/14

   * other announcement channels (such as RSS feeds) might be added in 
the future, they will be listed at https://openwrt.org/contact


From luca at ventoso.org  Thu Nov 16 01:52:43 2023
From: luca at ventoso.org (Luca Olivetti)
Date: Thu, 16 Nov 2023 09:52:43 +0000 (UTC)
Subject: [OpenWrt-Devel] [PATCH 2/2] ipq40xx: add support for Aruba AP-303
In-Reply-To: <20191217115204.9422-2-mail@david-bauer.net>
References: <20191217115204.9422-1-mail@david-bauer.net>
 <20191217115204.9422-2-mail@david-bauer.net>
Message-ID: <ed702791-e247-476b-94af-a2e1e9a7f837@ventoso.org>

El 17/12/19 a les 12:52, David Bauer ha escrit:

> 3. Configure the bootargs and bootcmd for OpenWrt.
>     $ setenv bootargs_openwrt "setenv bootargs console=ttyMSM1,9600n8"
>     $ setenv nandboot_openwrt "run bootargs_openwrt; ubi part aos1;
>       ubi read 0x85000000 kernel; bootm 0x85000000"
>     $ setenv ramboot_openwrt "run bootargs_openwrt;
>       setenv ipaddr 192.168.1.105; setenv serverip 192.168.1.75;
>       netget; set fdt_high 0x87000000; bootm"
>     $ setenv bootcmd "run nandboot_openwrt"
>     $ saveenv


Hello,

as explained here

https://forum.openwrt.org/t/aruba-iap-11-apboot-downgrade-invalid-instant-small-business-image/120921


it is no longer possible to install openwrt because they have removed 
the bootm command from apboot.

I asked here
https://forum.openwrt.org/t/apboot-dump-for-aruba-iap11-ap303-or-compatible-u-boot/177595/2

for the old apboot image (it's possible to flash the spi from the new 
apboot) but I'm wondering if it would be possible to compile a 
compatible u-boot for this AP?


Bye
-- 
Luca



From robimarko at gmail.com  Thu Nov 16 02:06:32 2023
From: robimarko at gmail.com (Robert Marko)
Date: Thu, 16 Nov 2023 11:06:32 +0100
Subject: [OpenWrt-Devel] [PATCH 2/2] ipq40xx: add support for Aruba AP-303
In-Reply-To: <ed702791-e247-476b-94af-a2e1e9a7f837@ventoso.org>
References: <20191217115204.9422-1-mail@david-bauer.net> <20191217115204.9422-2-mail@david-bauer.net>
 <ed702791-e247-476b-94af-a2e1e9a7f837@ventoso.org>
Message-ID: <CAOX2RU66kq5-xKrAspkTMjfO0nMNRC0VvLEevDChTXiY2QeK7g@mail.gmail.com>

On Thu, 16 Nov 2023 at 10:53, Luca Olivetti <luca at ventoso.org> wrote:
>
> El 17/12/19 a les 12:52, David Bauer ha escrit:
>
> > 3. Configure the bootargs and bootcmd for OpenWrt.
> >     $ setenv bootargs_openwrt "setenv bootargs console=ttyMSM1,9600n8"
> >     $ setenv nandboot_openwrt "run bootargs_openwrt; ubi part aos1;
> >       ubi read 0x85000000 kernel; bootm 0x85000000"
> >     $ setenv ramboot_openwrt "run bootargs_openwrt;
> >       setenv ipaddr 192.168.1.105; setenv serverip 192.168.1.75;
> >       netget; set fdt_high 0x87000000; bootm"
> >     $ setenv bootcmd "run nandboot_openwrt"
> >     $ saveenv
>
>
> Hello,
>
> as explained here
>
> https://forum.openwrt.org/t/aruba-iap-11-apboot-downgrade-invalid-instant-small-business-image/120921
>
>
> it is no longer possible to install openwrt because they have removed
> the bootm command from apboot.
>
> I asked here
> https://forum.openwrt.org/t/apboot-dump-for-aruba-iap11-ap303-or-compatible-u-boot/177595/2

I have shared a dump from my AP11 that worked with OpenWrt.

But please make sure they did not enable secure boot in the mean time.

Regards,
Robert
>
> for the old apboot image (it's possible to flash the spi from the new
> apboot) but I'm wondering if it would be possible to compile a
> compatible u-boot for this AP?
>
>
> Bye
> --
> Luca
>
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel


From luca at ventoso.org  Thu Nov 16 03:02:53 2023
From: luca at ventoso.org (Luca Olivetti)
Date: Thu, 16 Nov 2023 11:02:53 +0000 (UTC)
Subject: [OpenWrt-Devel] [PATCH 2/2] ipq40xx: add support for Aruba AP-303
In-Reply-To: <CAOX2RU66kq5-xKrAspkTMjfO0nMNRC0VvLEevDChTXiY2QeK7g@mail.gmail.com>
References: <20191217115204.9422-1-mail@david-bauer.net>
 <20191217115204.9422-2-mail@david-bauer.net>
 <ed702791-e247-476b-94af-a2e1e9a7f837@ventoso.org>
 <CAOX2RU66kq5-xKrAspkTMjfO0nMNRC0VvLEevDChTXiY2QeK7g@mail.gmail.com>
Message-ID: <864abec1-826b-4747-b5a5-f443f6d305f2@ventoso.org>

El 16/11/23 a les 11:06, Robert Marko ha escrit:

>>
>> I asked here
>> https://forum.openwrt.org/t/apboot-dump-for-aruba-iap11-ap303-or-compatible-u-boot/177595/2
> 
> I have shared a dump from my AP11 that worked with OpenWrt.
> 
> But please make sure they did not enable secure boot in the mean time.

Thank you, that worked. I'll update the forum post on how to flash it. I 
don't have a wiki account to update the device page though.

Bye
-- 
Luca


From psv_sridhar at yahoo.com  Thu Nov 16 08:29:37 2023
From: psv_sridhar at yahoo.com (Sridhar)
Date: Thu, 16 Nov 2023 10:29:37 -0600
Subject: [OpenWrt-Devel] [PATCH 2/2] ipq40xx: add support for Aruba AP-303
In-Reply-To: <864abec1-826b-4747-b5a5-f443f6d305f2@ventoso.org>
References: <864abec1-826b-4747-b5a5-f443f6d305f2@ventoso.org>
Message-ID: <FB270846-498A-471C-B51F-4F98130D02BC@yahoo.com>

Idiots 
Thanks 
Sridhar 

Sent from my iPhone

> On Nov 16, 2023, at 5:05?AM, Luca Olivetti <luca at ventoso.org> wrote:
> 
> ?El 16/11/23 a les 11:06, Robert Marko ha escrit:
> 
>>> 
>>> I asked here
>>> https://forum.openwrt.org/t/apboot-dump-for-aruba-iap11-ap303-or-compatible-u-boot/177595/2
>> I have shared a dump from my AP11 that worked with OpenWrt.
>> But please make sure they did not enable secure boot in the mean time.
> 
> Thank you, that worked. I'll update the forum post on how to flash it. I don't have a wiki account to update the device page though.
> 
> Bye
> --
> Luca
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel



From ehem+openwrt at m5p.com  Thu Nov 16 13:47:26 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Thu, 16 Nov 2023 13:47:26 -0800
Subject: Xen VM Configuration example
Message-ID: <ZVaN7vHK09N3gjWI@mattapan.m5p.com>

I'm sending this to the list to provide another approach to this type of
installation.  I feel this is better adapted to the situation than the
currently visible examples.  Feel free to use this information in the
OpenWRT wiki.  Hopefully this is also a better example of a real world
OpenWRT in VM usage will look like.

I suggest the information on containers should be split into a separate
section.  This could be a sub-section of Virtualization, but containers
are far more limited than VMs.  Notably containers won't use OpenWRT's
kernel or drivers.


My recommended template configuration for OpenWRT in a Xen domain (VM):

```
type = "pv"
name = "openwrt"

memory = 128
vcpus = 2

# For use with rootfs/kernel.bin:
kernel = "/location/of/openwrt/kernel.bin"
extra = "root=/dev/xvda"

disk = [
	'vdev=xvda,format=raw,access=ro,target=/location/of/openwrt/rootfs.img',
	'vdev=xvdb,format=raw,access=rw,target=/location/of/openwrt/data.img',
]

# For use with -combined image:
#kernel = "/usr/libexec/grub/pvgrub-pv.bin"
#extra = "(hd1,gpt1)/boot/grub/grub.cfg"
#
#disk = [
#	'vdev=xvda,format=raw,access=rw,target=/location/of/openwrt/combo.img',
#]

vif = [
	'bridge=br-lan',
#	'bridge=br-wan',
]
pci = [
#	'0000:04:00.0',
]

nographic = 1
serial = 'pty'
```

Installation is done by downloading the files
openwrt-<version>-rootfs.img.gz (match with xvda/rootfs.img line) and
openwrt-<version>-kernel.bin (match with "kernel =" line).  The file
"data.img" is created by `truncate -s 32M data.img`, on first boot run
`xl console openwrt` and at the shell in the VM run
`mke2fs -t ext4 /dev/xvdb`.  After that reboot and "data.img" functions
as the overlaid filesystem.

A crucial advantage of this is the root filesystem and kernel are
completely read-only inside the VM.  No persistent modification of them
is possible (though the in-memory image can be modified).  This both
enhances security, and allows sharing them between multiple VMs which
handle different network functions (splitting NAT off allows rebooting
the hardware without dropping connections).

The combined image can also be used, but the installation and
configuration are a bit different (see commented lines above).
The "kernel =" line should be adjusted to match where PvGRUB is
installed.  For some distributions, PvGRUB may be available packaged, but
the installation path may vary.  Also PVH VMs may require a distinct
build of PvGRUB from other VM types.

Presently I'm trying to figure out which approach should be preferred.
My suspicion is security updates will be easier with the combined image.
This would outweigh the above advantage.


During initial bring-up the user may want public interfaces disabled.
As such both potential methods have been left commentted in this example.
Once initial configuration (setting root's password!) is done, the
publically visible interfaces can be enabled.  This could be a bridge to
hardware handled by another VM, or could be a PCI device being passed-in.
Often one would pass-in an 802.11 interface to allow radio support.

As of Xen 4.17 passing PCI devices into "PVH" VMs hadn't been enabled.
Until this is addressed the configuration 'type = "pv"' will be needed if
PCI passthrough is used.


Things done here mostly apply to other hypervisors, though the
configuration mechanism will be different.  Qemu definitely allows
passing in storage devices as read-only, passing in PCI cards, and
removing all emulated graphics devices.  Most (if not all) hypervisors
will allow passing in storage devices as read-only and passing PCI
devices in.

As to why one would do this.  At least one reason is pretty
straightforward, just in the exact opposite direction from what most
have been thinking.

Many latest generation semi-embedded devices advertise being capable of
functioning as NAS, and/or handling server functions.  If one has a
decent server computer which includes IOMMU and hypervisor, then instead
of shedding server functions onto a router, the server can instead
swallow the router.  A second NIC is $10 (assuming no on-motherboard
spare), a good 802.11 card is $50.

This seems appropriate for a home or small office.  Just an issue of
whether there is a server with available processor, memory, and slot(s).
This doesn't need a particularly powerful computer, but with everything
virtual machine, memory is a severe limiter.


-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |         ehem+sigmsg at m5p.com  PGP 87145445         |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445




From ehem+openwrt at m5p.com  Thu Nov 16 16:34:26 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Thu, 16 Nov 2023 16:34:26 -0800
Subject: [PATCH 20/20] [TEST] TESTING: try separating build from sources
In-Reply-To: <3c39ec02c837eacd2f5fcda0c14e8a39c7e0a1ab.1700010295.git.ehem+openwrt@m5p.com>
References: <cover.1700010286.git.ehem+openwrt@m5p.com>
 <3c39ec02c837eacd2f5fcda0c14e8a39c7e0a1ab.1700010295.git.ehem+openwrt@m5p.com>
Message-ID: <ZVa1EunbHbMXZsQ8@mattapan.m5p.com>

In case anyone was wondering, the later patches are marked "WIP" since
they hadn't been sufficiently tested.

I had run into this a bit ago, but hadn't tracked down the issue.  Now
that I have, another patch is attached to this message.  This is an
outright bug in the patch and should be fixed.


-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |         ehem+sigmsg at m5p.com  PGP 87145445         |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-kernel-generic-fix-lzma-addition-patch.patch
Type: text/x-diff
Size: 2315 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20231116/7d710fa9/attachment.bin>

From nbd at nbd.name  Fri Nov 17 08:20:33 2023
From: nbd at nbd.name (Felix Fietkau)
Date: Fri, 17 Nov 2023 17:20:33 +0100
Subject: [PATCH 07/20] kernel: copy all built kernel modules to root
 filesystem image
In-Reply-To: <ee3fb185b494b4de05ca65725e0a96cffa307acb.1700010291.git.ehem+openwrt@m5p.com>
References: <cover.1700010286.git.ehem+openwrt@m5p.com>
 <ee3fb185b494b4de05ca65725e0a96cffa307acb.1700010291.git.ehem+openwrt@m5p.com>
Message-ID: <a4208395-30ad-4e90-8910-d52d1668db97@nbd.name>

On 11.11.23 01:21, Elliott Mitchell wrote:
> This removes the requirement for to create a package for all modules.
> Now devices can simply specify in-tree drivers/other to be built as
> modules and they will be present in the resultant image.
> 
> Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>

It seems to me that this completely ignores the use case of having 
release builds that ship a lot of kernel modules as installable 
packages. Did I misread something?
If not, this gets a strong NACK from me.

- Felix


From ehem+openwrt at m5p.com  Fri Nov 17 13:31:50 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Fri, 17 Nov 2023 13:31:50 -0800
Subject: [PATCH 07/20] kernel: copy all built kernel modules to root
 filesystem image
In-Reply-To: <a4208395-30ad-4e90-8910-d52d1668db97@nbd.name>
References: <cover.1700010286.git.ehem+openwrt@m5p.com>
 <ee3fb185b494b4de05ca65725e0a96cffa307acb.1700010291.git.ehem+openwrt@m5p.com>
 <a4208395-30ad-4e90-8910-d52d1668db97@nbd.name>
Message-ID: <ZVfbxhyjN7Y24Akh@mattapan.m5p.com>

On Fri, Nov 17, 2023 at 05:20:33PM +0100, Felix Fietkau wrote:
> On 11.11.23 01:21, Elliott Mitchell wrote:
> > This removes the requirement for to create a package for all modules.
> > Now devices can simply specify in-tree drivers/other to be built as
> > modules and they will be present in the resultant image.
> > 
> > Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>
> 
> It seems to me that this completely ignores the use case of having 
> release builds that ship a lot of kernel modules as installable 
> packages. Did I misread something?
> If not, this gets a strong NACK from me.

Should be completely orthogonal, though it could have bugs.

Using `cp -l` has two valuable effects:  First, it reduces storage space
usage.  Second, it serves to mark module files as belonging to a package.

My goal is previously setting a kernel option to "m" in a configuration
file, but not having a package causes it to be built, then ignored.  I
want this to do something sensible, not simply waste electricity
building a module and then tossing it in the garbage.

Hmm, come to think of it, that should be $(XARGS) (fix on commit?).


-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |         ehem+sigmsg at m5p.com  PGP 87145445         |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445




From ehem+openwrt at m5p.com  Fri Nov 17 17:20:49 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Fri, 17 Nov 2023 17:20:49 -0800
Subject: Adding a new x86 image or related packages to the default x86
 image
In-Reply-To: <ZVLtOZvmxFt8KKJK@makrotopia.org>
References: <8682698C-4740-430A-906D-B8DE1AA93C1A@aparcar.org>
 <20230915011955.1e12377f@mir>
 <E4E2EB72-FE41-436A-A4E2-D6716C4FCE68@redfish-solutions.com>
 <ZVGHrxxvqzJve0nf@mattapan.m5p.com>
 <334B1B53-A224-439C-94B7-F1F06BDB896E@aparcar.org>
 <ZVIbDvzYE4140iA4@makrotopia.org>
 <ZVLavGP70nbg5tOp@mattapan.m5p.com>
 <ZVLtOZvmxFt8KKJK@makrotopia.org>
Message-ID: <ZVgRcQF0nu6m6ivs@mattapan.m5p.com>

On Tue, Nov 14, 2023 at 03:44:57AM +0000, Daniel Golle wrote:
> On Mon, Nov 13, 2023 at 06:26:04PM -0800, Elliott Mitchell wrote:
> > 
> > Each hypervisor will have a small set of drivers guaranteed to be
> > present.  These though will be completely different between hypervisors.
> 
> Do you really think having just the (partially shared) drivers for 3
> hypervisors (KVM/virtio, Hyper-V, VMWare) present in one image is too
> much? Those drivers are very tiny...

Hopefully I can revise my opinion here.

Issue is some hypervisor drivers are small, some are not.  I could see
having two hypervisor kernel builds.  One featuring only the smaller
drivers, one featuring the jumbo drivers.

I note Virtio-block is fairly small.  It operates on top of the block
layer and shouldn't require too much extra.

The Fusion MPT driver, which VMware requires is a big driver.  Not only
is the driver itself large, but it then plugs into the SCSI layer which
itself is quite substantial.  This could be as much as 2-3MB total.  This
is enough not to want built-in for a kernel meant for other hypervisors.

I'm totally unfamiliar with Hyper-V, aside from knowing which company is
behind it.  I do find the idea of using OpenWRT in a VM on Hyper-V as
one's border firewall entertaining.  :-)  I suspect Hyper-V may require
ACPI support, in particular I suspect its virtual network and block
interfaces are provided by ACPI table.  I'm unsure exactly how much
overhead that is, but I suspect it is enough to want a separate kernel
(or everything in modules).
Additionally Hyper-V may insist upon a graphical console and USB.

Both Virtio-SCSI and Xen-pvSCSI rely on the SCSI layer, which is
relatively large.  Yet those hypervisors have block layer drivers which
are rather smaller.

So, there might need to be a few distinct kernels for hypervisors, or
perhaps an awful lot as initrd modules (enough to load the block drivers
for all hypervisors).


In case you haven't guessed, all patches I'm posting are headed in the
general direction of trying for a slimmer VM kernel build.

I'm trying to get CONFIG_HW_RANDOM_GEODE into the Geode build, since it
presently leaks into the "64" build and the "64" build would be the
obvious basis for a hypervisor kernel.  Similar situation for
CONFIG_SCx200.

I've got some initial patches for a slim VM kernel configuration, but
right now things are still at the pre-split cleanup phase.

CONFIG_X86_INTEL_LPSS=n seems unlikely for the present "64"
configuration, but will be appropriate for a VM kernel.


-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |         ehem+sigmsg at m5p.com  PGP 87145445         |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445




From nbd at nbd.name  Fri Nov 17 22:57:35 2023
From: nbd at nbd.name (Felix Fietkau)
Date: Sat, 18 Nov 2023 07:57:35 +0100
Subject: [PATCH 07/20] kernel: copy all built kernel modules to root
 filesystem image
In-Reply-To: <ZVfbxhyjN7Y24Akh@mattapan.m5p.com>
References: <cover.1700010286.git.ehem+openwrt@m5p.com>
 <ee3fb185b494b4de05ca65725e0a96cffa307acb.1700010291.git.ehem+openwrt@m5p.com>
 <a4208395-30ad-4e90-8910-d52d1668db97@nbd.name>
 <ZVfbxhyjN7Y24Akh@mattapan.m5p.com>
Message-ID: <a6c167a8-2f85-4e69-88e5-39fae2b1cd7f@nbd.name>

On 17.11.23 22:31, Elliott Mitchell wrote:
> On Fri, Nov 17, 2023 at 05:20:33PM +0100, Felix Fietkau wrote:
>> On 11.11.23 01:21, Elliott Mitchell wrote:
>> > This removes the requirement for to create a package for all modules.
>> > Now devices can simply specify in-tree drivers/other to be built as
>> > modules and they will be present in the resultant image.
>> > 
>> > Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>
>> 
>> It seems to me that this completely ignores the use case of having 
>> release builds that ship a lot of kernel modules as installable 
>> packages. Did I misread something?
>> If not, this gets a strong NACK from me.
> 
> Should be completely orthogonal, though it could have bugs.
> 
> Using `cp -l` has two valuable effects:  First, it reduces storage space
> usage.  Second, it serves to mark module files as belonging to a package.
> 
> My goal is previously setting a kernel option to "m" in a configuration
> file, but not having a package causes it to be built, then ignored.  I
> want this to do something sensible, not simply waste electricity
> building a module and then tossing it in the garbage.
> 
> Hmm, come to think of it, that should be $(XARGS) (fix on commit?).

Thanks for the explanation, it makes more sense to me now.
That said, I see a few pitfalls here:

1. If you select kernel modules that depend on other modules selected 
via kmod packages, you end up with non-functional modules with missing 
dependencies in the rootfs.
2. If the kmod package selection accidentally ends up selecting extra 
modules that aren't stored in the package, you end up with rootfs bloat.

I'm fine with the cp -l change, but I think adding all remaining modules 
to the rootfs is not something we should do by default (maybe opt-in?)

By the way, I still get bounces when replying to you, because your mail 
server is refusing my mail.

- Felix


From sven at narfation.org  Sat Nov 18 06:49:14 2023
From: sven at narfation.org (Sven Eckelmann)
Date: Sat, 18 Nov 2023 15:49:14 +0100
Subject: [PATCH] dnsmasq: mark global ubus context as closed after fork
Message-ID: <20231118-dnsmasq_drop_ubus_null-v1-1-a84754bd5c91@narfation.org>

If the dnsmasq process forks to handle TCP connections, it closes the ubus
context. But instead of changing the daemon wide pointer to NULL, only the
local variable was changed - and this code portion was even dropped as
dead-store by some optimizing compilers.

It makes more sense to change the daemon->ubus pointer to NULL because
various functions are already it for NULL. It is also the behavior which
ubus_destroy() implements.

Fixes: d8b33dad0bb7 ("dnsmasq: add support for monitoring and modifying dns lookup results via ubus")
Signed-off-by: Sven Eckelmann <sven at narfation.org>
---
 package/network/services/dnsmasq/patches/200-ubus_dns.patch | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/network/services/dnsmasq/patches/200-ubus_dns.patch b/package/network/services/dnsmasq/patches/200-ubus_dns.patch
index 8a70bb8bdf..ccbe70ab9c 100644
--- a/package/network/services/dnsmasq/patches/200-ubus_dns.patch
+++ b/package/network/services/dnsmasq/patches/200-ubus_dns.patch
@@ -210,7 +210,7 @@
 +    return;
 +
 +  ubus_free(ubus);
-+  ubus = NULL;
++  daemon->ubus = NULL;
 +}
 +
  static int ubus_handle_metrics(struct ubus_context *ctx, struct ubus_object *obj,

---
base-commit: 9062e5faaedc03823ee419fe34de1de73f48babc
change-id: 20231118-dnsmasq_drop_ubus_null-ae5b5f062cb7

Best regards,
-- 
Sven Eckelmann <sven at narfation.org>



From evil.function at proton.me  Sat Nov 18 07:20:25 2023
From: evil.function at proton.me (Eric)
Date: Sat, 18 Nov 2023 15:20:25 +0000
Subject: [PATCH] dnsmasq: mark global ubus context as closed after fork
In-Reply-To: <20231118-dnsmasq_drop_ubus_null-v1-1-a84754bd5c91@narfation.org>
References: <20231118-dnsmasq_drop_ubus_null-v1-1-a84754bd5c91@narfation.org>
Message-ID: <iDBfM7w2KEVHmpJYnh3l6ikIym8-R8_KkhSThwvqjHAD4iQUbu8eQHtGvwnEiqZJdzu4AUcvZSAB_Rb_8p_aPbSz45q2wBdIfCAhW_S-5gw=@proton.me>

On Saturday, November 18th, 2023 at 06:49, Sven Eckelmann <sven at narfation.org> wrote:
> If the dnsmasq process forks to handle TCP connections, it closes the ubus
> context. But instead of changing the daemon wide pointer to NULL, only the
> local variable was changed - and this code portion was even dropped as
> dead-store by some optimizing compilers.
> 
> It makes more sense to change the daemon->ubus pointer to NULL because
> 
> various functions are already it for NULL. It is also the behavior which

"already *checking* it"?

> ubus_destroy() implements.
> 
> Fixes: d8b33dad0bb7 ("dnsmasq: add support for monitoring and modifying dns lookup results via ubus")
> Signed-off-by: Sven Eckelmann sven at narfation.org
> 
> ---
> package/network/services/dnsmasq/patches/200-ubus_dns.patch | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/package/network/services/dnsmasq/patches/200-ubus_dns.patch b/package/network/services/dnsmasq/patches/200-ubus_dns.patch
> index 8a70bb8bdf..ccbe70ab9c 100644
> --- a/package/network/services/dnsmasq/patches/200-ubus_dns.patch
> +++ b/package/network/services/dnsmasq/patches/200-ubus_dns.patch
> @@ -210,7 +210,7 @@
> + return;
> +
> + ubus_free(ubus);
> -+ ubus = NULL;
> ++ daemon->ubus = NULL;
> 
> +}
> +
> static int ubus_handle_metrics(struct ubus_context *ctx, struct ubus_object *obj,
> 
> ---
> base-commit: 9062e5faaedc03823ee419fe34de1de73f48babc
> change-id: 20231118-dnsmasq_drop_ubus_null-ae5b5f062cb7
> 
> Best regards,
> --
> Sven Eckelmann sven at narfation.org



From sven at narfation.org  Sat Nov 18 07:29:09 2023
From: sven at narfation.org (Sven Eckelmann)
Date: Sat, 18 Nov 2023 16:29:09 +0100
Subject: [PATCH v2] dnsmasq: mark global ubus context as closed after fork
Message-ID: <20231118-dnsmasq_drop_ubus_null-v2-1-1e1f1f7ab251@narfation.org>

If the dnsmasq process forks to handle TCP connections, it closes the ubus
context. But instead of changing the daemon wide pointer to NULL, only the
local variable was adjusted - and this portion of the code was even dropped
(dead store) by some optimizing compilers.

It makes more sense to change the daemon->ubus pointer because various
functions are already checking it for NULL. It is also the behavior which
ubus_destroy() implements.

Fixes: d8b33dad0bb7 ("dnsmasq: add support for monitoring and modifying dns lookup results via ubus")
Signed-off-by: Sven Eckelmann <sven at narfation.org>
---
Changes in v2:
- added missing word "checking" in commit message. Thanks
  Eric <evil.function at proton.me>
---
 package/network/services/dnsmasq/patches/200-ubus_dns.patch | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/network/services/dnsmasq/patches/200-ubus_dns.patch b/package/network/services/dnsmasq/patches/200-ubus_dns.patch
index 8a70bb8bdf..ccbe70ab9c 100644
--- a/package/network/services/dnsmasq/patches/200-ubus_dns.patch
+++ b/package/network/services/dnsmasq/patches/200-ubus_dns.patch
@@ -210,7 +210,7 @@
 +    return;
 +
 +  ubus_free(ubus);
-+  ubus = NULL;
++  daemon->ubus = NULL;
 +}
 +
  static int ubus_handle_metrics(struct ubus_context *ctx, struct ubus_object *obj,

---
base-commit: 9062e5faaedc03823ee419fe34de1de73f48babc
change-id: 20231118-dnsmasq_drop_ubus_null-69661a68d342

Best regards,
-- 
Sven Eckelmann <sven at narfation.org>



From philipp_subx at redfish-solutions.com  Sat Nov 18 11:42:44 2023
From: philipp_subx at redfish-solutions.com (Philip Prindeville)
Date: Sat, 18 Nov 2023 12:42:44 -0700
Subject: Best practices for shell libraries (specifically error-checking)
Message-ID: <3104749F-14F3-4DC2-A05A-7A2C9AA8A551@redfish-solutions.com>

Hi all,

I'm trying to figure out what best practices are for shell libraries, as I'm working on changes to a pretty significant library which I envision being leveraged in a lot of places.

My questions are these:

* should a good library do error-checking for the caller, or expect the caller to have done his own validation? Given that most exploits are the result in insufficient input validation (more than 60% according to a study by the SEI), it seems that the library should do it.  Also, it's one-and-done, rather than duplicating error-checking in all the places that the library might be used.  And if a missing check is uncovered later?  I'd rather have one place to patch it than many.

* in my case, the library has both predicate tests that do validation and their only output is a true/false return value, as well as functions that perform a calculation on their inputs and echo an output to stdout.  So there's a mix of:

    if ! is_validity_check "$myarg"; then
        # do some stuff
    fi

as well as:

    var="$(compute_something "$n" "$m")"

and it's this later that is a little more thorny. The issue is that we're capturing itss output, but if it's also performing error-checking, then this will happen in a sub shell and the only way to indicate failure is either to generate no output, or to check the exit value of the sub shell.  So we can do:

    var="$(compute_something "$n" "$m")"
    if [ -z "$var" ]; then
        # handle the error
    fi

or else:

    var="$(compute_something "$n" "$m")" || { # handle the error ; }

And I'm inclined to go with the later, it's less wordy and the handling can often be something like a function that takes an argument which it then echos to stderr, and then exits non-zero.  Easy-peasy and simple to read and understand.

The hard part is when this function that writes its result to standard output is being used in a different, uncommon way that things get complicate.  Like:

    ( compute_something "$n" "$m" >> something.conf ) || { # handle the error ; }

where they aren't invoking the function via a sub shell unless they do so explicitly (and they might not have read the functions or accompanying comments and be aware of how to use them safely).

* so then there's a third option.  Always return a true/false status code, don't emit anything to standard output, and just set some unlikely global variables like __compute_something_ret_val1, etc.  Ugly, but potentially less disastrous if not invoked properly... but the flip-side is that the user might not check return values and continue on his bliss, perilous way.  It also avoids fork/exec pairs and everything runs in a single process, so that's nice (as an aside, an enhancement to shell might have been to have $(...) run in a separate thread if it only used built-ins, and you could still use a pipe to capture its output).

Yeah, shell is a 40+ year old language that we're asking to do more than it was ever intended to do.  It would have been nice if in the last 20 years someone had come up with a way to add new built-in functions via .so plugins that provided language extensions.  But they didn't and that's not on option.

What is the collective wisdom?  Coming from a security coding background, I prefer to make things blow up on invalid input unless the user (caller) takes steps to recover meaningfully from that failure.

But if I write a library that no one wants to use, then what's the purpose of that?

I put it to you: what's the best practice for writing shell libraries for OpenWRT and the limitations of busybox shell.

Thanks,

-Philip



From augustus_meyer at yahoo.de  Sat Nov 18 22:26:36 2023
From: augustus_meyer at yahoo.de (reiner otto)
Date: Sun, 19 Nov 2023 06:26:36 +0000 (UTC)
Subject: Best practices for shell libraries (specifically
 error-checking)
In-Reply-To: <1068881429.8269089.1700374979042@mail.yahoo.com>
References: <3104749F-14F3-4DC2-A05A-7A2C9AA8A551@redfish-solutions.com> <1068881429.8269089.1700374979042@mail.yahoo.com>
Message-ID: <1323586130.8300916.1700375196410@mail.yahoo.com>




... * should a good library do error-checking for the caller, ...
Of course. In my old days (I wrote my first machine code more than half a century ago) it was a basic requirement, that every software module/function has to be self contained, not doing any assumption regarding external environment. Which also includes internal validity checks.?
It is a pity, to read your statistics regarding so many exploits to be discovered because of wrong or even missing validity checks.
Looks like, old principles are forgotten.

Cheers,
Augustus


From gch981213 at gmail.com  Sun Nov 19 05:26:50 2023
From: gch981213 at gmail.com (Chuanhong Guo)
Date: Sun, 19 Nov 2023 21:26:50 +0800
Subject: [PATCH 1/2] kernel: usb: Autoprobe g_serial
In-Reply-To: <20231111-dns313-usb-serial-v1-1-6402033bcdfb@linaro.org>
References: <20231111-dns313-usb-serial-v1-0-6402033bcdfb@linaro.org> <20231111-dns313-usb-serial-v1-1-6402033bcdfb@linaro.org>
Message-ID: <CAJsYDVJpP_QMPBekeL0Or_ZS8WXLckPJxm_ej9O-9TKiCeq4cw@mail.gmail.com>

Hi!

On Sun, Nov 12, 2023 at 6:04?AM Linus Walleij <linus.walleij at linaro.org> wrote:
>
> For devices using USB gadget serial we need to probe the modules
> usb_f_acm and g_serial in order, then the available UDC (USB device
> controller) interface will be hooked up to a serial port as
> /dev/ttyGS0. (On the host side this appears as /dev/ttyACM0
> when plugging in the USB cable.)
>
> I don't quite understand why this wasn't done before for the
> module explicitly called kmod-usb-serial.

The g_*.ko gadget modules conflict with each other. I think
it isn't loaded by default to prevent that when users decided
to install multiple of them.

I made an init script to setup USB gadget using the "modern"
configfs approach:
https://github.com/openwrt/openwrt/pull/14005
Maybe you can make use of this one instead? :)

-- 
Regards,
Chuanhong Guo


From lech.perczak at gmail.com  Sun Nov 19 08:49:46 2023
From: lech.perczak at gmail.com (Lech Perczak)
Date: Sun, 19 Nov 2023 17:49:46 +0100
Subject: [PATCH 1/2] kernel: usb: Autoprobe g_serial
In-Reply-To: <20231111-dns313-usb-serial-v1-1-6402033bcdfb@linaro.org>
References: <20231111-dns313-usb-serial-v1-0-6402033bcdfb@linaro.org>
 <20231111-dns313-usb-serial-v1-1-6402033bcdfb@linaro.org>
Message-ID: <4abf1fe4-f899-418e-bbd0-6a5a7044862b@gmail.com>

Hi Linus,

W dniu 2023-11-11 o?23:02, Linus Walleij pisze:
> For devices using USB gadget serial we need to probe the modules
> usb_f_acm and g_serial in order, then the available UDC (USB device
> controller) interface will be hooked up to a serial port as
> /dev/ttyGS0. (On the host side this appears as /dev/ttyACM0
> when plugging in the USB cable.)
>
> I don't quite understand why this wasn't done before for the
> module explicitly called kmod-usb-serial.
>
> Before this patch we have to enter a console and type
>
>    modprobe g_serial
>
> To get a serial console on /dev/ttyGS0, after this it is
> automatic.
>
> Since you might only have the serial console, it is a bit
> catch 22 to have to use a serial console to activate the
> serial console.
>
> Signed-off-by: Linus Walleij <linus.walleij at linaro.org>
> ---
>   package/kernel/linux/modules/usb.mk | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/package/kernel/linux/modules/usb.mk b/package/kernel/linux/modules/usb.mk
> index 0a5f5a8993c9..f54dc4380737 100644
> --- a/package/kernel/linux/modules/usb.mk
> +++ b/package/kernel/linux/modules/usb.mk
> @@ -207,7 +207,7 @@ define KernelPackage/usb-gadget-serial
>   	$(LINUX_DIR)/drivers/usb/gadget/function/usb_f_obex.ko \
>   	$(LINUX_DIR)/drivers/usb/gadget/function/usb_f_serial.ko \
>   	$(LINUX_DIR)/drivers/usb/gadget/legacy/g_serial.ko
> -  AUTOLOAD:=$(call AutoLoad,52,usb_f_acm)
> +  AUTOLOAD:=$(call AutoLoad,52,usb_f_acm g_serial)
>     $(call AddDepends/usb)
>   endef
>   
>
I think I know the reason why it isn't the case. 
kmod-usb-gadget-cdc-composite which pulls both kmod-usb-gadget-serial 
and kmod-usb-gadget-eth packages, and including autoprobingf g_serial 
within this would clash with that. I think the gadget configuration 
itself (apart from implementation) could be packaged separately and 
included as device packages, pulling needed dependencies. And something 
like that just appeared on Github: 
https://github.com/openwrt/openwrt/pull/14005/

-- 
Pozdrawiam/Kind regards,
Lech



From noreply at github.com  Sun Nov 19 12:09:04 2023
From: noreply at github.com (Stephen Walker)
Date: Sun, 19 Nov 2023 12:09:04 -0800
Subject: [sdwalker/sdwalker.github.io] 7df39f: This week's update
Message-ID: <sdwalker/sdwalker.github.io/push/refs/heads/master/141bf6-7df39f@github.com>

  Branch: refs/heads/master
  Home:   https://github.com/sdwalker/sdwalker.github.io
  Commit: 7df39f1e18b624aa23b9ae4fe3514ea035dcc72d
      https://github.com/sdwalker/sdwalker.github.io/commit/7df39f1e18b624aa23b9ae4fe3514ea035dcc72d
  Author: Stephen Walker <stephendwalker+github at gmail.com>
  Date:   2023-11-19 (Sun, 19 Nov 2023)

  Changed paths:
    M uscan/index-22.03.html
    M uscan/index-23.05.html
    M uscan/index.html

  Log Message:
  -----------
  This week's update




From ehem+openwrt at m5p.com  Sun Nov 19 17:36:14 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Sun, 19 Nov 2023 17:36:14 -0800
Subject: [PATCH 07/20] kernel: copy all built kernel modules to root
 filesystem image
In-Reply-To: <a6c167a8-2f85-4e69-88e5-39fae2b1cd7f@nbd.name>
References: <cover.1700010286.git.ehem+openwrt@m5p.com>
 <ee3fb185b494b4de05ca65725e0a96cffa307acb.1700010291.git.ehem+openwrt@m5p.com>
 <a4208395-30ad-4e90-8910-d52d1668db97@nbd.name>
 <ZVfbxhyjN7Y24Akh@mattapan.m5p.com>
 <a6c167a8-2f85-4e69-88e5-39fae2b1cd7f@nbd.name>
Message-ID: <ZVq4Dp6vhOBpjKnS@mattapan.m5p.com>

On Sat, Nov 18, 2023 at 07:57:35AM +0100, Felix Fietkau wrote:
> On 17.11.23 22:31, Elliott Mitchell wrote:
> > On Fri, Nov 17, 2023 at 05:20:33PM +0100, Felix Fietkau wrote:
> >> On 11.11.23 01:21, Elliott Mitchell wrote:
> >> > This removes the requirement for to create a package for all modules.
> >> > Now devices can simply specify in-tree drivers/other to be built as
> >> > modules and they will be present in the resultant image.
> >> > 
> >> > Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>
> >> 
> >> It seems to me that this completely ignores the use case of having 
> >> release builds that ship a lot of kernel modules as installable 
> >> packages. Did I misread something?
> >> If not, this gets a strong NACK from me.
> > 
> > Should be completely orthogonal, though it could have bugs.
> > 
> > Using `cp -l` has two valuable effects:  First, it reduces storage space
> > usage.  Second, it serves to mark module files as belonging to a package.
> > 
> > My goal is previously setting a kernel option to "m" in a configuration
> > file, but not having a package causes it to be built, then ignored.  I
> > want this to do something sensible, not simply waste electricity
> > building a module and then tossing it in the garbage.
> > 
> > Hmm, come to think of it, that should be $(XARGS) (fix on commit?).
> 
> Thanks for the explanation, it makes more sense to me now.
> That said, I see a few pitfalls here:
> 
> 1. If you select kernel modules that depend on other modules selected 
> via kmod packages, you end up with non-functional modules with missing 
> dependencies in the rootfs.

Is this actually that much of a problem?  From what I've seen most kmod
packages handled during image build get preinstalled onto the root fs
image.  As such these would nominally function as long as the packages
weren't removed.

Wouldn't this also indicate breakage in the module package anyway?

> 2. If the kmod package selection accidentally ends up selecting extra 
> modules that aren't stored in the package, you end up with rootfs bloat.

Eww, that would be gross.  As with the above, wouldn't this be indicating
breakage in the module packaging anyway?

> I'm fine with the cp -l change, but I think adding all remaining modules 
> to the rootfs is not something we should do by default (maybe opt-in?)

Perhaps.  This could also be handled by the approach the series as a
whole is aiming for.  If kernel module building used a separate object
directory from the kernel build, then modules selected in the device
configuration could be isolated.

> By the way, I still get bounces when replying to you, because your mail 
> server is refusing my mail.

Ick.  Welcome to the world of 2023 and what spam has done to e-mail.
Alas, this is due to extreme measures being taken by the person who
handles this system.  We're at a point where small mailservers cannot
exist due to the shear amount of spam being generated.

I suppose OpenWRT might help by having a default rule to filter out port
25.  There is also that yet to be written kernel patch which disables
the interfering 2.45GHz channels.  There is also the default egress
filtering...   All those things I could get done if I ruled the world.


-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |         ehem+sigmsg at m5p.com  PGP 87145445         |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445




From ehem+openwrt at m5p.com  Sun Nov 19 20:17:37 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Sun, 19 Nov 2023 20:17:37 -0800
Subject: [PATCH 11/20] [WIP] package/target: update to get modules from
 $(LINUX_OBJ_DIR)
In-Reply-To: <652e94875c4be20b04855917a9f8b556cd59c71f.1700010292.git.ehem+openwrt@m5p.com>
References: <cover.1700010286.git.ehem+openwrt@m5p.com>
 <652e94875c4be20b04855917a9f8b556cd59c71f.1700010292.git.ehem+openwrt@m5p.com>
Message-ID: <ZVrd4UWFwc91MW73@mattapan.m5p.com>

On Sat, Nov 11, 2023 at 10:51:08PM -0800, Elliott Mitchell wrote:
> Modules built from kernel source will now be in $(LINUX_OBJ_DIR).
> 
> Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>
> ---
>  package/kernel/linux/modules/block.mk        | 106 +++----
>  package/kernel/linux/modules/can.mk          |  36 +--
>  package/kernel/linux/modules/crypto.mk       | 252 ++++++++--------
>  package/kernel/linux/modules/firewire.mk     |   8 +-
>  package/kernel/linux/modules/fs.mk           | 100 +++----
>  package/kernel/linux/modules/gpio-cascade.mk |   2 +-
>  package/kernel/linux/modules/hwmon.mk        |  98 +++----
>  package/kernel/linux/modules/i2c.mk          |   2 +-
>  package/kernel/linux/modules/iio.mk          |  80 +++---
>  package/kernel/linux/modules/input.mk        |  26 +-
>  package/kernel/linux/modules/leds.mk         |  20 +-
>  package/kernel/linux/modules/lib.mk          |  76 ++---
>  package/kernel/linux/modules/multiplexer.mk  |   4 +-
>  package/kernel/linux/modules/netdevices.mk   | 214 +++++++-------
>  package/kernel/linux/modules/netfilter.mk    | 168 +++++------
>  package/kernel/linux/modules/netsupport.mk   | 204 ++++++-------
>  package/kernel/linux/modules/nls.mk          |  44 +--
>  package/kernel/linux/modules/other.mk        | 202 ++++++-------
>  package/kernel/linux/modules/pcmcia.mk       |  14 +-
>  package/kernel/linux/modules/sound.mk        |  98 +++----
>  package/kernel/linux/modules/spi.mk          |  10 +-
>  package/kernel/linux/modules/usb.mk          | 288 +++++++++----------
>  package/kernel/linux/modules/video.mk        | 168 +++++------
>  package/kernel/linux/modules/virt.mk         |  24 +-
>  package/kernel/linux/modules/w1.mk           |   2 +-
>  package/kernel/linux/modules/wpan.mk         |  20 +-
>  target/linux/apm821xx/modules.mk             |   4 +-
>  target/linux/armsr/modules.mk                |  80 +++---
>  target/linux/at91/modules.mk                 |  18 +-
>  target/linux/ath79/modules.mk                |   2 +-
>  target/linux/bcm27xx/modules/hwmon.mk        |   2 +-
>  target/linux/bcm27xx/modules/other.mk        |   6 +-
>  target/linux/bcm27xx/modules/sound.mk        | 206 ++++++-------
>  target/linux/bcm27xx/modules/spi.mk          |   4 +-
>  target/linux/bcm27xx/modules/video.mk        |  16 +-
>  target/linux/bcm47xx/modules.mk              |   6 +-
>  target/linux/bcm53xx/modules.mk              |   6 +-
>  target/linux/bcm63xx/modules.mk              |   4 +-
>  target/linux/bmips/modules.mk                |   6 +-
>  target/linux/gemini/modules.mk               |   2 +-
>  target/linux/ipq806x/modules.mk              |  14 +-
>  target/linux/kirkwood/modules.mk             |   4 +-
>  target/linux/layerscape/modules.mk           |   4 +-
>  target/linux/mediatek/modules.mk             |   8 +-
>  target/linux/mvebu/modules.mk                |   4 +-
>  target/linux/oxnas/modules.mk                |   4 +-
>  target/linux/ramips/modules.mk               |  20 +-
>  target/linux/sunxi/modules.mk                |  16 +-
>  target/linux/x86/modules.mk                  |  22 +-
>  49 files changed, 1362 insertions(+), 1362 deletions(-)

The reason this patch ended up so huge was every kernel module package
was setting $(FILES) to the absolute path of the module.  If instead
$(FILES) is set relative to the kernel object directory, and converted
to an absolute path during KernelPackage/$(1)/config, this becomes MUCH
smaller.  Unfortunately in turn the patch to do that ends up jumbo.

Can't win.  The cleanup has been long needed, but never done.  Now it
ends up a gigantic patch.


-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |         ehem+sigmsg at m5p.com  PGP 87145445         |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445




From kamil.tralewski at commercesolutions.pl  Mon Nov 20 00:55:32 2023
From: kamil.tralewski at commercesolutions.pl (Kamil Tralewski)
Date: Mon, 20 Nov 2023 08:55:32 GMT
Subject: =?UTF-8?Q?S=C5=82owa_kluczowe_do_wypozycjonowania?=
Message-ID: <20231120074500-0.1.a0.21lby.0.7dl5c90p5r@commercesolutions.pl>

Dzie? dobry,

zapozna?em si? z Pa?stwa ofert? i z przyjemno?ci? przyznaj?, ?e przyci?ga uwag? i zach?ca do dalszych rozm?w. 

Pomy?la?em, ?e mo?e m?g?bym mie? sw?j wk?ad w Pa?stwa rozw?j i pom?c dotrze? z t? ofert? do wi?kszego grona odbiorc?w. Pozycjonuj? strony www, dzi?ki czemu generuj? ?wietny ruch w sieci.

Mo?emy porozmawia? w najbli?szym czasie?

Pozdrawiam
Kamil Tralewski


From zajec5 at gmail.com  Mon Nov 20 01:54:19 2023
From: zajec5 at gmail.com (=?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?=)
Date: Mon, 20 Nov 2023 10:54:19 +0100
Subject: Describing LEDs roles in device tree?
Message-ID: <ee912a89-4fd7-43c3-a79b-16659a035fe1@gmail.com>

Hi!

Our current binding Documentation/devicetree/bindings/leds/common.yaml
allows describing some generic LED parameters. Most common are color and
function.

Now, many systems will want further & more specialized description of
LEDs. Most common roles I can think of:
1. System is booting
2. System is running
3. System's failure

For kernel usage role we actually have a "panic-indicator" property.

Are those extra roles something we could put in DT?

Please note that "function" on its own is not sufficient as multiple
LEDs my share the same function name but its meaning may vary depending
on color.

OpenWrt developers started (ab?)using aliases in downstream/modified DT
files for such purposes. Example:

aliases {
	led-boot = &led_status_blue;
	led-running = &led_status_green;
	led-failsafe = &led_status_red;
};

Above could work with some adjustments but I'm not sure if it's
acceptable for upstream binding. Also what if OpenWrt wants to define
different roles than another project? Prefixes?

With Linux a problem is also a lack of mapping between
/proc/device-tree/leds/*
and
/sys/class/leds/*
With "label" present its simple but some guessing logic is needed for
function + color properties (it's actually missing in OpenWrt right now)

Any suggestions for DT-based solution?

-- 
Rafa? Mi?ecki


From zajec5 at gmail.com  Mon Nov 20 03:01:38 2023
From: zajec5 at gmail.com (=?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?=)
Date: Mon, 20 Nov 2023 12:01:38 +0100
Subject: [PATCH] mediatek: filogic: add Acelink EW-7886CAX support
Message-ID: <20231120110138.25476-1-zajec5@gmail.com>

From: Rafa? Mi?ecki <rafal at milecki.pl>

Acelink EW-7886CAX is an MT7986A (AKA Filogic 830) based access point.
It has 512 MiB of RAM, one 2.5 Gbps PoE (802.3at) Ethernet port and
on-SoC Wi-Fi.

My unit came with Mediatek's firmware (based on OpenWrt 21.02)
installed. It was possible to simply upgrade using OpenWrt's sysupgrade
tool.

Another verified upgrade method is using U-Boot (requires UART). During
every boot there is "U-Boot Boot Menu". Selecting option "2. Upgrade
firmware" allows using U-Boot's tftp client to load and flash factory
image.

Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
---
 .../dts/mt7986a-acelink-ew-7886cax.dts        | 236 ++++++++++++++++++
 target/linux/mediatek/image/filogic.mk        |  17 ++
 2 files changed, 253 insertions(+)
 create mode 100644 target/linux/mediatek/dts/mt7986a-acelink-ew-7886cax.dts

diff --git a/target/linux/mediatek/dts/mt7986a-acelink-ew-7886cax.dts b/target/linux/mediatek/dts/mt7986a-acelink-ew-7886cax.dts
new file mode 100644
index 0000000000..bdbcf1f364
--- /dev/null
+++ b/target/linux/mediatek/dts/mt7986a-acelink-ew-7886cax.dts
@@ -0,0 +1,236 @@
+// SPDX-License-Identifier: GPL-2.0-only OR MIT
+
+/dts-v1/;
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/leds/common.h>
+
+#include "mt7986a.dtsi"
+
+/ {
+	model = "Acelink EW-7886CAX";
+	compatible = "acelink,ew-7886cax", "mediatek,mt7986a";
+
+	aliases {
+		serial0 = &uart0;
+		led-boot = &led_status_blue;
+		led-running = &led_status_green;
+		led-upgrade = &led_status_red;
+		led-failsafe = &led_status_red;
+	};
+
+	chosen {
+		stdout-path = "serial0:115200n8";
+	};
+
+	memory at 40000000 {
+		reg = <0 0x40000000 0 0x20000000>;
+		device_type = "memory";
+	};
+
+	keys {
+		compatible = "gpio-keys";
+
+		key-restart {
+			label = "Reset";
+			gpios = <&pio 7 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_RESTART>;
+		};
+	};
+
+	leds {
+		compatible = "gpio-leds";
+
+		led_status_red: led-0 {
+			function = LED_FUNCTION_STATUS;
+			color = <LED_COLOR_ID_RED>;
+			gpios = <&pio 18 GPIO_ACTIVE_HIGH>;
+		};
+
+		led_status_green: led-1 {
+			function = LED_FUNCTION_STATUS;
+			color = <LED_COLOR_ID_GREEN>;
+			gpios = <&pio 19 GPIO_ACTIVE_HIGH>;
+		};
+
+		led_status_blue: led-2 {
+			function = LED_FUNCTION_STATUS;
+			color = <LED_COLOR_ID_BLUE>;
+			gpios = <&pio 20 GPIO_ACTIVE_HIGH>;
+		};
+	};
+};
+
+&watchdog {
+	status = "okay";
+};
+
+&pio {
+	spi_flash_pins: spi-flash-pins-33-to-38 {
+		mux {
+			function = "spi";
+			groups = "spi0", "spi0_wp_hold";
+		};
+		conf-pu {
+			pins = "SPI2_CS", "SPI2_HOLD", "SPI2_WP";
+			drive-strength = <8>;
+			mediatek,pull-up-adv = <0>; /* bias-disable */
+		};
+		conf-pd {
+			pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO";
+			drive-strength = <8>;
+			mediatek,pull-down-adv = <0>; /* bias-disable */
+		};
+	};
+
+	wf_2g_5g_pins: wf_2g_5g-pins {
+		mux {
+			function = "wifi";
+			groups = "wf_2g", "wf_5g";
+		};
+		conf {
+			pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4",
+			       "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6",
+			       "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10",
+			       "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1",
+			       "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0",
+			       "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8",
+			       "WF1_TOP_CLK", "WF1_TOP_DATA";
+			drive-strength = <4>;
+		};
+	};
+
+	wf_dbdc_pins: wf-dbdc-pins {
+		mux {
+			function = "wifi";
+			groups = "wf_dbdc";
+		};
+		conf {
+			pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4",
+				"WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6",
+				"WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10",
+				"WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1",
+				"WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0",
+				"WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8",
+				"WF1_TOP_CLK", "WF1_TOP_DATA";
+			drive-strength = <4>;
+		};
+	};
+};
+
+&trng {
+	status = "okay";
+};
+
+&crypto {
+	status = "okay";
+};
+
+&uart0 {
+	status = "okay";
+};
+
+&spi0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&spi_flash_pins>;
+	status = "okay";
+
+	flash at 0 {
+		compatible = "spi-nand";
+		reg = <0>;
+		spi-max-frequency = <52000000>;
+		spi-tx-bus-width = <4>;
+		spi-rx-bus-width = <4>;
+
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		partitions: partitions {
+			compatible = "fixed-partitions";
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			partition at 0 {
+				label = "bootloader";
+				reg = <0x0 0x100000>;
+				read-only;
+			};
+
+			partition at 100000 {
+				label = "u-boot-env";
+				reg = <0x100000 0x80000>;
+			};
+
+			factory: partition at 180000 {
+				label = "factory";
+				reg = <0x180000 0x200000>;
+				read-only;
+				compatible = "nvmem-cells";
+
+				nvmem-layout {
+					compatible = "fixed-layout";
+					#address-cells = <1>;
+					#size-cells = <1>;
+
+					eeprom: eeprom at 0 {
+						reg = <0x0 0x1000>;
+					};
+
+					macaddr: macaddr at 4 {
+						reg = <0x4 0x6>;
+					};
+				};
+			};
+
+			partition at 380000 {
+				label = "fip";
+				reg = <0x380000 0x200000>;
+			};
+
+			partition at 580000 {
+				label = "ubi";
+				reg = <0x580000 0x4000000>;
+			};
+		};
+	};
+};
+
+&pcie_phy {
+	status = "okay";
+};
+
+&eth {
+	status = "okay";
+
+	mac at 1 {
+		compatible = "mediatek,eth-mac";
+		reg = <1>;
+		phy-mode = "2500base-x";
+		phy-handle = <&phy6>;
+		nvmem-cells = <&macaddr>;
+		nvmem-cell-names = "mac-address";
+	};
+
+	mdio-bus {
+		reset-gpios = <&pio 6 GPIO_ACTIVE_LOW>;
+		reset-delay-us = <50000>;
+		reset-post-delay-us = <20000>;
+
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		phy6: phy at 6 {
+			compatible = "ethernet-phy-ieee802.3-c45";
+			reg = <6>;
+		};
+	};
+};
+
+&wifi {
+	status = "okay";
+	pinctrl-names = "default", "dbdc";
+	pinctrl-0 = <&wf_2g_5g_pins>;
+	pinctrl-1 = <&wf_dbdc_pins>;
+	nvmem-cells = <&eeprom>;
+	nvmem-cell-names = "eeprom";
+};
diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk
index 4d4f3b62a2..c04c952bc5 100644
--- a/target/linux/mediatek/image/filogic.mk
+++ b/target/linux/mediatek/image/filogic.mk
@@ -105,6 +105,23 @@ define Build/cetron-header
 	rm $@.tmp
 endef
 
+define Device/acelink_ew-7886cax
+  DEVICE_VENDOR := Acelink
+  DEVICE_MODEL := EW-7886CAX
+  DEVICE_DTS := mt7986a-acelink-ew-7886cax
+  DEVICE_DTS_DIR := ../dts
+  DEVICE_PACKAGES := kmod-mt7986-firmware mt7986-wo-firmware
+  UBINIZE_OPTS := -E 5
+  BLOCKSIZE := 128k
+  PAGESIZE := 2048
+  IMAGE_SIZE := 65536k
+  KERNEL_IN_UBI := 1
+  IMAGES += factory.bin
+  IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE)
+  IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
+endef
+TARGET_DEVICES += acelink_ew-7886cax
+
 define Device/asus_tuf-ax4200
   DEVICE_VENDOR := ASUS
   DEVICE_MODEL := TUF-AX4200
-- 
2.35.3



From daniel at makrotopia.org  Mon Nov 20 03:18:14 2023
From: daniel at makrotopia.org (Daniel Golle)
Date: Mon, 20 Nov 2023 11:18:14 +0000
Subject: [PATCH] mediatek: filogic: add Acelink EW-7886CAX support
In-Reply-To: <20231120110138.25476-1-zajec5@gmail.com>
References: <20231120110138.25476-1-zajec5@gmail.com>
Message-ID: <ZVtAdiyC5774EaqP@makrotopia.org>

Hi Rafal,

looks good in general, please see minor comments in line.

On Mon, Nov 20, 2023 at 12:01:38PM +0100, Rafa? Mi?ecki wrote:
> From: Rafa? Mi?ecki <rafal at milecki.pl>
> 
> Acelink EW-7886CAX is an MT7986A (AKA Filogic 830) based access point.
> It has 512 MiB of RAM, one 2.5 Gbps PoE (802.3at) Ethernet port and
> on-SoC Wi-Fi.
> 
> My unit came with Mediatek's firmware (based on OpenWrt 21.02)
> installed. It was possible to simply upgrade using OpenWrt's sysupgrade
> tool.
> 
> Another verified upgrade method is using U-Boot (requires UART). During
> every boot there is "U-Boot Boot Menu". Selecting option "2. Upgrade
> firmware" allows using U-Boot's tftp client to load and flash factory
> image.
> 
> Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
> ---
>  .../dts/mt7986a-acelink-ew-7886cax.dts        | 236 ++++++++++++++++++
>  target/linux/mediatek/image/filogic.mk        |  17 ++
>  2 files changed, 253 insertions(+)
>  create mode 100644 target/linux/mediatek/dts/mt7986a-acelink-ew-7886cax.dts
> 
> diff --git a/target/linux/mediatek/dts/mt7986a-acelink-ew-7886cax.dts b/target/linux/mediatek/dts/mt7986a-acelink-ew-7886cax.dts
> new file mode 100644
> index 0000000000..bdbcf1f364
> --- /dev/null
> +++ b/target/linux/mediatek/dts/mt7986a-acelink-ew-7886cax.dts
> @@ -0,0 +1,236 @@
> +// SPDX-License-Identifier: GPL-2.0-only OR MIT
> +
> +/dts-v1/;
> +#include <dt-bindings/input/input.h>
> +#include <dt-bindings/gpio/gpio.h>
> +#include <dt-bindings/leds/common.h>
> +
> +#include "mt7986a.dtsi"
> +
> +/ {
> +	model = "Acelink EW-7886CAX";
> +	compatible = "acelink,ew-7886cax", "mediatek,mt7986a";
> +
> +	aliases {
> +		serial0 = &uart0;
> +		led-boot = &led_status_blue;
> +		led-running = &led_status_green;
> +		led-upgrade = &led_status_red;
> +		led-failsafe = &led_status_red;
> +	};
> +
> +	chosen {
> +		stdout-path = "serial0:115200n8";
> +	};
> +
> +	memory at 40000000 {
> +		reg = <0 0x40000000 0 0x20000000>;
> +		device_type = "memory";
> +	};
> +
> +	keys {
> +		compatible = "gpio-keys";
> +
> +		key-restart {
> +			label = "Reset";
> +			gpios = <&pio 7 GPIO_ACTIVE_LOW>;
> +			linux,code = <KEY_RESTART>;
> +		};
> +	};
> +
> +	leds {
> +		compatible = "gpio-leds";
> +
> +		led_status_red: led-0 {
> +			function = LED_FUNCTION_STATUS;
> +			color = <LED_COLOR_ID_RED>;
> +			gpios = <&pio 18 GPIO_ACTIVE_HIGH>;
> +		};
> +
> +		led_status_green: led-1 {
> +			function = LED_FUNCTION_STATUS;
> +			color = <LED_COLOR_ID_GREEN>;
> +			gpios = <&pio 19 GPIO_ACTIVE_HIGH>;
> +		};
> +
> +		led_status_blue: led-2 {
> +			function = LED_FUNCTION_STATUS;
> +			color = <LED_COLOR_ID_BLUE>;
> +			gpios = <&pio 20 GPIO_ACTIVE_HIGH>;
> +		};
> +	};
> +};
> +
> +&watchdog {
> +	status = "okay";
> +};
> +
> +&pio {
> +	spi_flash_pins: spi-flash-pins-33-to-38 {
> +		mux {
> +			function = "spi";
> +			groups = "spi0", "spi0_wp_hold";
> +		};
> +		conf-pu {
> +			pins = "SPI2_CS", "SPI2_HOLD", "SPI2_WP";
> +			drive-strength = <8>;
> +			mediatek,pull-up-adv = <0>; /* bias-disable */
> +		};
> +		conf-pd {
> +			pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO";
> +			drive-strength = <8>;
> +			mediatek,pull-down-adv = <0>; /* bias-disable */
> +		};
> +	};
> +
> +	wf_2g_5g_pins: wf_2g_5g-pins {
> +		mux {
> +			function = "wifi";
> +			groups = "wf_2g", "wf_5g";
> +		};
> +		conf {
> +			pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4",
> +			       "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6",
> +			       "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10",
> +			       "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1",
> +			       "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0",
> +			       "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8",
> +			       "WF1_TOP_CLK", "WF1_TOP_DATA";
> +			drive-strength = <4>;
> +		};
> +	};
> +
> +	wf_dbdc_pins: wf-dbdc-pins {
> +		mux {
> +			function = "wifi";
> +			groups = "wf_dbdc";
> +		};
> +		conf {
> +			pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4",
> +				"WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6",
> +				"WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10",
> +				"WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1",
> +				"WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0",
> +				"WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8",
> +				"WF1_TOP_CLK", "WF1_TOP_DATA";
> +			drive-strength = <4>;
> +		};
> +	};
> +};
> +
> +&trng {
> +	status = "okay";
> +};
> +
> +&crypto {
> +	status = "okay";
> +};
> +
> +&uart0 {
> +	status = "okay";
> +};
> +
> +&spi0 {
> +	pinctrl-names = "default";
> +	pinctrl-0 = <&spi_flash_pins>;
> +	status = "okay";
> +
> +	flash at 0 {
> +		compatible = "spi-nand";
> +		reg = <0>;
> +		spi-max-frequency = <52000000>;
> +		spi-tx-bus-width = <4>;
> +		spi-rx-bus-width = <4>;

Did you check whether the stock bootloader is using MediaTek's NMBM bad
block relocation mechanism?
If so, you should enable it in Linux as well.

> +
> +		#address-cells = <1>;
> +		#size-cells = <1>;
> +
> +		partitions: partitions {
> +			compatible = "fixed-partitions";
> +			#address-cells = <1>;
> +			#size-cells = <1>;
> +
> +			partition at 0 {
> +				label = "bootloader";
> +				reg = <0x0 0x100000>;
> +				read-only;
> +			};
> +
> +			partition at 100000 {
> +				label = "u-boot-env";
> +				reg = <0x100000 0x80000>;
> +			};
> +
> +			factory: partition at 180000 {
> +				label = "factory";
> +				reg = <0x180000 0x200000>;
> +				read-only;
> +				compatible = "nvmem-cells";
> +
> +				nvmem-layout {
> +					compatible = "fixed-layout";
> +					#address-cells = <1>;
> +					#size-cells = <1>;
> +
> +					eeprom: eeprom at 0 {
> +						reg = <0x0 0x1000>;
> +					};
> +
> +					macaddr: macaddr at 4 {
> +						reg = <0x4 0x6>;
> +					};
> +				};
> +			};
> +
> +			partition at 380000 {
> +				label = "fip";
> +				reg = <0x380000 0x200000>;
> +			};
> +
> +			partition at 580000 {
> +				label = "ubi";
> +				reg = <0x580000 0x4000000>;
> +			};
> +		};
> +	};
> +};
> +
> +&pcie_phy {
> +	status = "okay";
> +};
> +
> +&eth {
> +	status = "okay";
> +
> +	mac at 1 {
> +		compatible = "mediatek,eth-mac";
> +		reg = <1>;
> +		phy-mode = "2500base-x";
> +		phy-handle = <&phy6>;
> +		nvmem-cells = <&macaddr>;
> +		nvmem-cell-names = "mac-address";

Is this the MAC address also printed on the device label?
If so, please reference it as label-mac-device in aliases.

> +	};
> +
> +	mdio-bus {
> +		reset-gpios = <&pio 6 GPIO_ACTIVE_LOW>;
> +		reset-delay-us = <50000>;
> +		reset-post-delay-us = <20000>;
> +
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +
> +		phy6: phy at 6 {

Maybe add comment here about which kind of PHY that is (MaxLinear? RealTek? Aquantia?).

> +			compatible = "ethernet-phy-ieee802.3-c45";
> +			reg = <6>;
> +		};
> +	};
> +};
> +
> +&wifi {
> +	status = "okay";
> +	pinctrl-names = "default", "dbdc";
> +	pinctrl-0 = <&wf_2g_5g_pins>;
> +	pinctrl-1 = <&wf_dbdc_pins>;
> +	nvmem-cells = <&eeprom>;
> +	nvmem-cell-names = "eeprom";
> +};
> diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk
> index 4d4f3b62a2..c04c952bc5 100644
> --- a/target/linux/mediatek/image/filogic.mk
> +++ b/target/linux/mediatek/image/filogic.mk
> @@ -105,6 +105,23 @@ define Build/cetron-header
>  	rm $@.tmp
>  endef
>  
> +define Device/acelink_ew-7886cax
> +  DEVICE_VENDOR := Acelink
> +  DEVICE_MODEL := EW-7886CAX
> +  DEVICE_DTS := mt7986a-acelink-ew-7886cax
> +  DEVICE_DTS_DIR := ../dts
> +  DEVICE_PACKAGES := kmod-mt7986-firmware mt7986-wo-firmware
> +  UBINIZE_OPTS := -E 5
> +  BLOCKSIZE := 128k
> +  PAGESIZE := 2048
> +  IMAGE_SIZE := 65536k
> +  KERNEL_IN_UBI := 1
> +  IMAGES += factory.bin
> +  IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE)
> +  IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
> +endef
> +TARGET_DEVICES += acelink_ew-7886cax
> +
>  define Device/asus_tuf-ax4200
>    DEVICE_VENDOR := ASUS
>    DEVICE_MODEL := TUF-AX4200
> -- 
> 2.35.3
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel


From newtwen at gmail.com  Mon Nov 20 07:03:31 2023
From: newtwen at gmail.com (Paul D)
Date: Mon, 20 Nov 2023 16:03:31 +0100
Subject: Best practices for shell libraries (specifically error-checking)
In-Reply-To: <3104749F-14F3-4DC2-A05A-7A2C9AA8A551@redfish-solutions.com>
References: <3104749F-14F3-4DC2-A05A-7A2C9AA8A551@redfish-solutions.com>
Message-ID: <fb79c668-fb58-4d0e-a380-98fe13ac919a@gmail.com>

On 2023-11-18 20:42, Philip Prindeville wrote:
> Hi all,
> 
> I'm trying to figure out what best practices are for shell libraries, as I'm working on changes to a pretty significant library which I envision being leveraged in a lot of places.
> 
> My questions are these:
> 
> * should a good library do error-checking for the caller, or expect the caller to have done his own validation? Given that most exploits are the result in insufficient input validation (more than 60% according to a study by the SEI), it seems that the library should do it.  Also, it's one-and-done, rather than duplicating error-checking in all the places that the library might be used.  And if a missing check is uncovered later?  I'd rather have one place to patch it than many.
> 


Error checking is best done in a single location, where it is relevant 
to do so. Always check input.


> * in my case, the library has both predicate tests that do validation and their only output is a true/false return value, as well as functions that perform a calculation on their inputs and echo an output to stdout.  So there's a mix of:
> 
>      if ! is_validity_check "$myarg"; then
>          # do some stuff
>      fi
> 
> as well as:
> 
>      var="$(compute_something "$n" "$m")"
> 
> and it's this later that is a little more thorny. The issue is that we're capturing itss output, but if it's also performing error-checking, then this will happen in a sub shell and the only way to indicate failure is either to generate no output, or to check the exit value of the sub shell.  So we can do:
> 
>      var="$(compute_something "$n" "$m")"
>      if [ -z "$var" ]; then
>          # handle the error
>      fi
> 
> or else:
> 
>      var="$(compute_something "$n" "$m")" || { # handle the error ; }
> 
> And I'm inclined to go with the later, it's less wordy and the handling can often be something like a function that takes an argument which it then echos to stderr, and then exits non-zero.  Easy-peasy and simple to read and understand.
> 
> The hard part is when this function that writes its result to standard output is being used in a different, uncommon way that things get complicate.  Like:
> 
>      ( compute_something "$n" "$m" >> something.conf ) || { # handle the error ; }
> 
> where they aren't invoking the function via a sub shell unless they do so explicitly (and they might not have read the functions or accompanying comments and be aware of how to use them safely).
> 
> * so then there's a third option.  Always return a true/false status code, don't emit anything to standard output, and just set some unlikely global variables like __compute_something_ret_val1, etc.  Ugly, but potentially less disastrous if not invoked properly... but the flip-side is that the user might not check return values and continue on his bliss, perilous way.  It also avoids fork/exec pairs and everything runs in a single process, so that's nice (as an aside, an enhancement to shell might have been to have $(...) run in a separate thread if it only used built-ins, and you could still use a pipe to capture its output).
> 
> Yeah, shell is a 40+ year old language that we're asking to do more than it was ever intended to do.  It would have been nice if in the last 20 years someone had come up with a way to add new built-in functions via .so plugins that provided language extensions.  But they didn't and that's not on option.
> 
> What is the collective wisdom?  Coming from a security coding background, I prefer to make things blow up on invalid input unless the user (caller) takes steps to recover meaningfully from that failure.


Blow up: This flags that an error potentially exists and should be 
fixed. Users describe this as a 'bug', even if it's better to fail 
closed than fail open. We typically do this in code with assert. The 
thing I dislike about this is that dependent processes may hang or crash 
and the user is none the wiser.

I would much prefer, however, that a meaningful, and helpful error 
message is emitted so that a user could manually recover from such an 
error or present a coherent bug report.

If possible, use (unique) return codes, and not just true/false. That's 
what libraries do.

If one cannot use unique return codes, until it's true, it's always 
false. Or in other words, lack of yes or no is still a no (fail closed).


Multiple return paths can ensure the caller depends on (okay, coupling, 
bad) specific values instead of simply true or false.






From legale.legale at gmail.com  Tue Nov 21 11:19:32 2023
From: legale.legale at gmail.com (Isaev Ruslan)
Date: Tue, 21 Nov 2023 22:19:32 +0300
Subject: [patch] ubox: logread: add option to filter priority (log level)
Message-ID: <CACDmYydW4_L0FwzZ7-w75MDELD3x9D_PAiQLvYWYzrDzmqug-Q@mail.gmail.com>

This adds an ability to filter log messages priority:
  -v  <log level> handle only messages with given log level (0-7), repeatable
  -V  <log level> ignore messages with given log level (0-7), repeatable

Signed-off-by: Isaev Ruslan <legale.legale at gmail.com>
---
 log/logread.c | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/log/logread.c b/log/logread.c
index f48dd4b..91aae00 100644
--- a/log/logread.c
+++ b/log/logread.c
@@ -66,6 +66,8 @@ static int log_type = LOG_STDOUT;
 static int log_size, log_udp, log_follow, log_trailer_null = 0;
 static int log_timestamp;
 static int logd_conn_tries = LOGD_CONNECT_RETRY;
+static int loglevel_include;
+static int loglevel_exclude;
 static int facility_include;
 static int facility_exclude;

@@ -79,6 +81,16 @@ static int check_facility_filter(int f)
  return 1;
 }

+/* check for loglevel filter; return 0 if message shall be dropped */
+static int check_loglevel_filter(int f)
+{
+ if (loglevel_include)
+   return !!(loglevel_include & (1 << f));
+ if (loglevel_exclude)
+   return !(loglevel_exclude & (1 << f));
+ return 1;
+}
+
 static const char* getcodetext(int value, CODE *codetable) {
  CODE *i;

@@ -155,6 +167,9 @@ static int log_notify(struct blob_attr *msg)

  if (!check_facility_filter(LOG_FAC(p)))
      return 0;
+
+  if (!check_loglevel_filter(LOG_PRI(p)))
+    return 0;

  m = blobmsg_get_string(tb[LOG_MSG]);
  if (regexp_pattern &&
@@ -233,6 +248,8 @@ static int usage(const char *prog)
    "    -p <file>    PID file\n"
    "    -h <hostname>  Add hostname to the message\n"
    "    -P <prefix>  Prefix custom text to streamed messages\n"
+   "    -v <log level> handle only messages with given log level
(0-7), repeatable\n"
+   "    -V <log level> ignore messages with given log level (0-7),
repeatable\n"
    "    -z <facility>  handle only messages with given facility
(0-23), repeatable\n"
    "    -Z <facility>  ignore messages with given facility (0-23),
repeatable\n"
    "    -f     Follow log messages\n"
@@ -313,7 +330,7 @@ int main(int argc, char **argv)

  signal(SIGPIPE, SIG_IGN);

- while ((ch = getopt(argc, argv, "u0fcs:l:z:Z:r:F:p:S:P:h:e:t")) != -1) {
+ while ((ch = getopt(argc, argv, "u0fcs:l:v:V:z:Z:r:F:p:S:P:h:e:t")) != -1) {
    switch (ch) {
    case 'u':
      log_udp = 1;
@@ -343,6 +360,14 @@ int main(int argc, char **argv)
    case 'l':
      lines = atoi(optarg);
      break;
+   case 'v':
+     id = strtoul(optarg, NULL, 0) & 0x1f;
+     loglevel_include |= (1 << id);
+     break;
+   case 'V':
+     id = strtoul(optarg, NULL, 0) & 0x1f;
+     loglevel_exclude |= (1 << id);
+     break;
    case 'z':
      id = strtoul(optarg, NULL, 0) & 0x1f;
      facility_include |= (1 << id);
-- 
2.30.2


From felix at felix-maurer.de  Tue Nov 21 15:37:16 2023
From: felix at felix-maurer.de (Felix Maurer)
Date: Wed, 22 Nov 2023 00:37:16 +0100
Subject: [PATCH] ipq40xx: add PCIe magic hack to improve VRX518
 compatibility
In-Reply-To: <20230130224020.473703-1-jan@3e8.eu>
References: <20230130224020.473703-1-jan@3e8.eu>
Message-ID: <8e1ac190-9d89-4c55-82f8-e5bbfe1b798c@felix-maurer.de>

On 30.01.23 23:40, Jan Hoffmann wrote:
> Some VRX518 modems fail to initialize properly with the error message
> "dc_ep_clk_on failed". As a result, the DSL data path doesn't work.
> 
> This hack, which is based on code from the FRITZ!Box 7530 GPL archive,
> fixes the issue. It changes the PCIe vendor/device ID to values matching
> a Lantiq SoC. It also appears to emulate a Lantiq CPU ID register for
> connected PCIe devices, by remapping the matching address area to a
> specially crafted buffer using the address translation unit.
> 
> The hack is only active if the "avm,host_magic" property is specified in
> the device tree, so this shouldn't affect any devices other than
> FRITZ!Box 7530/7520.
> 
> Signed-off-by: Jan Hoffmann <jan at 3e8.eu>

Sorry for digging up an old thread/patch. As I own one of these devices 
where the DSL modem can only work with this hack, I applied this patch 
on top of v23.05.0 and built an image with it. I had this running for 
the last three weeks and the DSL is stable with this patch.

I agree that it is very much a hack, but given that the OEM does the 
same thing and we have no other way of getting those versions of the DSL 
modem to work, I think it's worthwhile adding the patch.

Tested-by: Felix Maurer <felix at felix-maurer.de>


> ---
>   .../boot/dts/qcom-ipq4019-fritzbox-7530.dts   |   2 +
>   .../997-pcie-qcom-host-magic.patch            | 215 ++++++++++++++++++
>   2 files changed, 217 insertions(+)
>   create mode 100644 target/linux/ipq40xx/patches-5.15/997-pcie-qcom-host-magic.patch
> 
> diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-fritzbox-7530.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-fritzbox-7530.dts
> index 336da52f2724..bc167616d3dc 100644
> --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-fritzbox-7530.dts
> +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-fritzbox-7530.dts
> @@ -306,6 +306,8 @@
>   	perst-gpio = <&tlmm 38 GPIO_ACTIVE_LOW>;
>   	wake-gpio = <&tlmm 50 GPIO_ACTIVE_LOW>;
>   
> +	avm,host_magic;
> +
>   	bridge at 0,0 {
>   		reg = <0x00000000 0 0 0 0>;
>   		#address-cells = <3>;
> diff --git a/target/linux/ipq40xx/patches-5.15/997-pcie-qcom-host-magic.patch b/target/linux/ipq40xx/patches-5.15/997-pcie-qcom-host-magic.patch
> new file mode 100644
> index 000000000000..f427bccd2f4a
> --- /dev/null
> +++ b/target/linux/ipq40xx/patches-5.15/997-pcie-qcom-host-magic.patch
> @@ -0,0 +1,215 @@
> +This hack is based on code from the FRITZ!Box 7530 GPL archive for
> +firmware version 07.50.
> +
> +If the device tree contains the "avm,host_magic" property, it changes
> +the PCIe vendor/device ID to the values from Lantiq GRX500 SoCs. It also
> +programs the ATU to present a buffer containing a magic value to PCIe
> +devices. This appears to emulate a Lantiq CPU ID register.
> +
> +Without this hack, some VRX518 modems fail to initialize properly (error
> +"dc_ep_clk_on failed"), and the DSL data path doesn't work.
> +--- a/drivers/pci/controller/dwc/pcie-qcom.c
> ++++ b/drivers/pci/controller/dwc/pcie-qcom.c
> +@@ -27,6 +27,7 @@
> + #include <linux/reset.h>
> + #include <linux/slab.h>
> + #include <linux/types.h>
> ++#include <linux/version.h>
> +
> + #include "../../pci.h"
> + #include "pcie-designware.h"
> +@@ -102,6 +103,8 @@
> +
> + #define QCOM_PCIE_CRC8_POLYNOMIAL (BIT(2) | BIT(1) | BIT(0))
> +
> ++#define PCIE_MAGIC_SIZE		0x10000
> ++
> + struct qcom_pcie_resources_2_1_0 {
> + 	struct clk_bulk_data clks[QCOM_PCIE_2_1_0_MAX_CLOCKS];
> + 	struct reset_control *pci_reset;
> +@@ -197,6 +200,8 @@ struct qcom_pcie {
> + 	struct phy *phy;
> + 	struct gpio_desc *reset;
> + 	const struct qcom_pcie_ops *ops;
> ++	void *magic_cpu_addr;
> ++	dma_addr_t magic_dma_handle;
> + };
> +
> + #define to_qcom_pcie(x)		dev_get_drvdata((x)->dev)
> +@@ -1388,8 +1393,141 @@ err_deinit:
> + 	return ret;
> + }
> +
> ++static int qcom_pcie_magic_prog_atu(struct qcom_pcie *pcie,
> ++				     u32 addr, u32 limit, u32 phys)
> ++{
> ++	struct dw_pcie *pci = pcie->pci;
> ++	struct device *dev = pci->dev;
> ++	u32 retries, val;
> ++	int index;
> ++
> ++	if (!pci->num_ib_windows) {
> ++		dev_err(dev, "No inbound ATU window available for magic\n");
> ++		return -1;
> ++	}
> ++
> ++	/*
> ++	 * Use highest window index and reduce window count so the driver
> ++	 * won't overwrite the entry later.
> ++	 */
> ++	index = --pci->num_ib_windows;
> ++
> ++#if LINUX_VERSION_CODE < KERNEL_VERSION(6,0,0)
> ++	if (pci->iatu_unroll_enabled) {
> ++		dev_err(dev, "Programming ATU for magic not implemented for this hardware\n");
> ++		return -1;
> ++	}
> ++
> ++	dw_pcie_writel_dbi(pci, PCIE_ATU_VIEWPORT,
> ++			   PCIE_ATU_REGION_INBOUND | index);
> ++
> ++	dw_pcie_writel_dbi(pci, PCIE_ATU_LOWER_BASE, addr);
> ++	dw_pcie_writel_dbi(pci, PCIE_ATU_UPPER_BASE, 0);
> ++	dw_pcie_writel_dbi(pci, PCIE_ATU_LIMIT, limit);
> ++	dw_pcie_writel_dbi(pci, PCIE_ATU_LOWER_TARGET, phys);
> ++	dw_pcie_writel_dbi(pci, PCIE_ATU_UPPER_TARGET, 0);
> ++
> ++	dw_pcie_writel_dbi(pci, PCIE_ATU_CR1, PCIE_ATU_TYPE_MEM);
> ++	dw_pcie_writel_dbi(pci, PCIE_ATU_CR2, PCIE_ATU_ENABLE);
> ++
> ++	for (retries = 0; retries < LINK_WAIT_MAX_IATU_RETRIES; retries++) {
> ++		val = dw_pcie_readl_dbi(pci, PCIE_ATU_CR2);
> ++		if (val & PCIE_ATU_ENABLE)
> ++			return 0;
> ++
> ++		mdelay(LINK_WAIT_IATU);
> ++	}
> ++#else
> ++	dw_pcie_writel_atu_ib(pci, index, PCIE_ATU_LOWER_BASE, addr);
> ++	dw_pcie_writel_atu_ib(pci, index, PCIE_ATU_UPPER_BASE, 0);
> ++	dw_pcie_writel_atu_ib(pci, index, PCIE_ATU_LIMIT, limit);
> ++	dw_pcie_writel_atu_ib(pci, index, PCIE_ATU_LOWER_TARGET, phys);
> ++	dw_pcie_writel_atu_ib(pci, index, PCIE_ATU_UPPER_TARGET, 0);
> ++
> ++	dw_pcie_writel_atu_ib(pci, index, PCIE_ATU_REGION_CTRL1,
> ++			      PCIE_ATU_TYPE_MEM);
> ++	dw_pcie_writel_atu_ib(pci, index, PCIE_ATU_REGION_CTRL2,
> ++			      PCIE_ATU_ENABLE);
> ++
> ++	for (retries = 0; retries < LINK_WAIT_MAX_IATU_RETRIES; retries++) {
> ++		val = dw_pcie_readl_atu_ib(pci, index, PCIE_ATU_REGION_CTRL2);
> ++		if (val & PCIE_ATU_ENABLE)
> ++			return 0;
> ++
> ++		mdelay(LINK_WAIT_IATU);
> ++	}
> ++#endif
> ++
> ++	dev_err(dev, "Failed to program ATU for magic\n");
> ++	return -1;
> ++}
> ++
> ++static void qcom_pcie_magic_deinit(struct qcom_pcie *pcie)
> ++{
> ++	struct dw_pcie *pci = pcie->pci;
> ++	struct device *dev = pci->dev;
> ++
> ++	if (pcie->magic_cpu_addr) {
> ++		dma_free_coherent(dev, PCIE_MAGIC_SIZE,
> ++				  pcie->magic_cpu_addr,
> ++				  pcie->magic_dma_handle);
> ++
> ++		pcie->magic_cpu_addr = NULL;
> ++	}
> ++}
> ++
> ++static void qcom_pcie_magic_init(struct qcom_pcie *pcie)
> ++{
> ++	struct dw_pcie *pci = pcie->pci;
> ++	struct device *dev = pci->dev;
> ++	u32 *virt;
> ++	u32 phys;
> ++	int ret;
> ++
> ++	if (!of_property_read_bool(dev->of_node, "avm,host_magic"))
> ++		return;
> ++
> ++	dev_info(dev, "Applying PCIe host magic\n");
> ++
> ++	virt = dma_alloc_coherent(dev, PCIE_MAGIC_SIZE, &phys, GFP_ATOMIC);
> ++	BUG_ON(virt == NULL);
> ++
> ++	pcie->magic_cpu_addr = virt;
> ++	pcie->magic_dma_handle = phys;
> ++
> ++	/*
> ++	 * This value is the manufacturer ID of Lantiq. The address where
> ++	 * it will be visible for the PCIe device matches the location of
> ++	 * CPU ID registers on Lantiq SocS (MPS base address is 0x1f107000).
> ++	 */
> ++	virt[0x7340/4] = 0x389 << 5;
> ++
> ++	/* Make it visible to PCIe devices using address translation unit */
> ++	ret = qcom_pcie_magic_prog_atu(pcie, 0x1f100000, 0x1f10ffff, phys);
> ++
> ++	dw_pcie_dbi_ro_wr_en(pci);
> ++
> ++	/* Set vendor/device ID of GRX500 PCIe host */
> ++	dw_pcie_writew_dbi(pci, PCI_VENDOR_ID, 0x1bef);
> ++	dw_pcie_writew_dbi(pci, PCI_DEVICE_ID, 0x0030);
> ++
> ++	dw_pcie_dbi_ro_wr_dis(pci);
> ++
> ++	if (ret)
> ++		qcom_pcie_magic_deinit(pcie);
> ++}
> ++
> ++static void qcom_pcie_atu_hack(struct pcie_port *pp)
> ++{
> ++	struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
> ++	struct qcom_pcie *pcie = to_qcom_pcie(pci);
> ++
> ++	qcom_pcie_magic_init(pcie);
> ++}
> ++
> + static const struct dw_pcie_host_ops qcom_pcie_dw_ops = {
> + 	.host_init = qcom_pcie_host_init,
> ++	.atu_hack = qcom_pcie_atu_hack,
> + };
> +
> + /* Qcom IP rev.: 2.1.0	Synopsys IP rev.: 4.01a */
> +@@ -1536,6 +1674,7 @@ static int qcom_pcie_probe(struct platfo
> +
> + err_phy_exit:
> + 	phy_exit(pcie->phy);
> ++	qcom_pcie_magic_deinit(pcie);
> + err_pm_runtime_put:
> + 	pm_runtime_put(dev);
> + 	pm_runtime_disable(dev);
> +--- a/drivers/pci/controller/dwc/pcie-designware-host.c
> ++++ b/drivers/pci/controller/dwc/pcie-designware-host.c
> +@@ -400,6 +400,14 @@ int dw_pcie_host_init(struct pcie_port *
> + 	}
> + 	dw_pcie_iatu_detect(pci);
> +
> ++	/*
> ++	 * This needs to be called after ATU detection, but before the driver
> ++	 * sets up any ATU entries, to avoid any ATU entry programmed in the
> ++	 * hack being overwritten by the driver later.
> ++	 */
> ++	if (pp->ops->atu_hack)
> ++		pp->ops->atu_hack(pp);
> ++
> + 	dw_pcie_setup_rc(pp);
> +
> + 	if (!dw_pcie_link_up(pci) && pci->ops && pci->ops->start_link) {
> +--- a/drivers/pci/controller/dwc/pcie-designware.h
> ++++ b/drivers/pci/controller/dwc/pcie-designware.h
> +@@ -174,6 +174,7 @@ enum dw_pcie_device_mode {
> +
> + struct dw_pcie_host_ops {
> + 	int (*host_init)(struct pcie_port *pp);
> ++	void (*atu_hack)(struct pcie_port *pp);
> + 	int (*msi_host_init)(struct pcie_port *pp);
> + };
> +


From foss at volatilesystems.org  Wed Nov 22 09:39:55 2023
From: foss at volatilesystems.org (Stijn Segers)
Date: Wed, 22 Nov 2023 18:39:55 +0100
Subject: [PATCH] firmware-utils: bump compat_level for EAP615-Wall
Message-ID: <20231122173955.4912-1-foss@volatilesystems.org>

Newer EAP615-Walls come with more recent firmware that requires a
higher soft_ver_compat_level. Bump ours from 1 to 2 to keep in step.
Tested on a newer EA615-Wall by grauheier - see forum topic:
https://forum.openwrt.org/t/173424/13.

Tested-by: Danny Scherer <graureiher at kaputtmachen.jetzt>
Signed-off-by: Stijn Segers <foss at volatilesystems.org>
---
 src/tplink-safeloader.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/tplink-safeloader.c b/src/tplink-safeloader.c
index 994aed5..695550f 100644
--- a/src/tplink-safeloader.c
+++ b/src/tplink-safeloader.c
@@ -2160,7 +2160,7 @@ static struct device_info boards[] = {
 	{
 		.id = "EAP615-WALL-V1",
 		.soft_ver = SOFT_VER_DEFAULT,
-		.soft_ver_compat_level = 1,
+		.soft_ver_compat_level = 2,
 		.support_list =
 			"SupportList:\r\n"
 			"EAP615-Wall(TP-Link|UN|AX1800-D):1.0\r\n"
-- 
2.39.2



From sander at svanheule.net  Thu Nov 23 10:16:43 2023
From: sander at svanheule.net (Sander Vanheule)
Date: Thu, 23 Nov 2023 19:16:43 +0100
Subject: [PATCH] firmware-utils: bump compat_level for EAP615-Wall
In-Reply-To: <20231122173955.4912-1-foss@volatilesystems.org>
References: <20231122173955.4912-1-foss@volatilesystems.org>
Message-ID: <cd35271207166efde5b8d863657112e9f8f87dc8.camel@svanheule.net>

Hi Stijn,

On Wed, 2023-11-22 at 18:39 +0100, Stijn Segers wrote:
> Newer EAP615-Walls come with more recent firmware that requires a
> higher soft_ver_compat_level. Bump ours from 1 to 2 to keep in step.
> Tested on a newer EA615-Wall by grauheier - see forum topic:
> https://forum.openwrt.org/t/173424/13.
> 
> Tested-by: Danny Scherer <graureiher at kaputtmachen.jetzt>
> Signed-off-by: Stijn Segers <foss at volatilesystems.org>
> ---

Thanks for the patch! Applied to firmware-utils with one minor change.

I've updated the title to
	tplink-safeloader: bump EAP615-Wall compat_level

so it's in line with other commits on the firmware-utils repository.

Best,
Sander


From mail at aparcar.org  Thu Nov 23 13:54:16 2023
From: mail at aparcar.org (Paul Spooren)
Date: Thu, 23 Nov 2023 22:54:16 +0100
Subject: Battlemesh x OpenWrt meeting in Cyprus?
Message-ID: <51C0D325-E509-4D24-8B7B-3024230EB0F7@aparcar.org>

Hi all,

While attending this years Battlemesh in Spain some fellow mesh people asked why there weren?t more OpenWrt people around. I?m guessing it was mostly due to the lack of communication in advance, so I?d like to raise the topic here: Are people from the OpenWrt community, specially members and maintainers interested in collaborating with and attending the Battlemesh next year?

They?d do most of the heavy lifting and would offer us to take some slots/space to do our own little OpenWrt meeting (remember the good and productive days in Hamburg anno 2019). Ideally at least one OpenWrt member would join their organizing team, I could do it but would also be happy if someone else jumps in.

The general idea is to have a week long Battlemesh event in Cyprus, the OpenWrt part could happen both within the week, before or after, the full length or only a weekend etc. To my knowledge Cyprus offers an easier VISA process so more folks could join, I remember last time people wouldn?t get a VISA in time.

If we participate we should raise some donations to offer travel stipends and come up with some (lighting) talks and presentations.

I think the timeframe is ?somewhen in May 2024?, this will be further discussed on the Battlemesh mailing list.

Looking forward to meet you all again!

Sunshine,
Paul

From foss at volatilesystems.org  Thu Nov 23 10:48:56 2023
From: foss at volatilesystems.org (Stijn Segers)
Date: Thu, 23 Nov 2023 19:48:56 +0100
Subject: [PATCH] firmware-utils: bump compat_level for EAP615-Wall
In-Reply-To: <cd35271207166efde5b8d863657112e9f8f87dc8.camel@svanheule.net>
References: <20231122173955.4912-1-foss@volatilesystems.org>
	<cd35271207166efde5b8d863657112e9f8f87dc8.camel@svanheule.net>
Message-ID: <KXAL4S.TZSQ774HQED22@volatilesystems.org>

Thanks!

Stijn

Op donderdag 23 november 2023 om 19:16:43 +01:00:00 schreef Sander 
Vanheule <sander at svanheule.net>:
> Hi Stijn,
> 
> On Wed, 2023-11-22 at 18:39 +0100, Stijn Segers wrote:
>>  Newer EAP615-Walls come with more recent firmware that requires a
>>  higher soft_ver_compat_level. Bump ours from 1 to 2 to keep in step.
>>  Tested on a newer EA615-Wall by grauheier - see forum topic:
>>  https://forum.openwrt.org/t/173424/13.
>> 
>>  Tested-by: Danny Scherer <graureiher at kaputtmachen.jetzt>
>>  Signed-off-by: Stijn Segers <foss at volatilesystems.org>
>>  ---
> 
> Thanks for the patch! Applied to firmware-utils with one minor change.
> 
> I've updated the title to
> 	tplink-safeloader: bump EAP615-Wall compat_level
> 
> so it's in line with other commits on the firmware-utils repository.
> 
> Best,
> Sander
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel




From linus.walleij at linaro.org  Fri Nov 24 01:56:36 2023
From: linus.walleij at linaro.org (Linus Walleij)
Date: Fri, 24 Nov 2023 10:56:36 +0100
Subject: [PATCH 1/2] kernel: usb: Autoprobe g_serial
In-Reply-To: <CAJsYDVJpP_QMPBekeL0Or_ZS8WXLckPJxm_ej9O-9TKiCeq4cw@mail.gmail.com>
References: <20231111-dns313-usb-serial-v1-0-6402033bcdfb@linaro.org>
 <20231111-dns313-usb-serial-v1-1-6402033bcdfb@linaro.org> <CAJsYDVJpP_QMPBekeL0Or_ZS8WXLckPJxm_ej9O-9TKiCeq4cw@mail.gmail.com>
Message-ID: <CACRpkdYMc9tywSJFbWYojMOi=_0qt-Anos36iwr70A9hARrCWw@mail.gmail.com>

On Sun, Nov 19, 2023 at 2:27?PM Chuanhong Guo <gch981213 at gmail.com> wrote:
> On Sun, Nov 12, 2023 at 6:04?AM Linus Walleij <linus.walleij at linaro.org> wrote:
> >
> > For devices using USB gadget serial we need to probe the modules
> > usb_f_acm and g_serial in order, then the available UDC (USB device
> > controller) interface will be hooked up to a serial port as
> > /dev/ttyGS0. (On the host side this appears as /dev/ttyACM0
> > when plugging in the USB cable.)
> >
> > I don't quite understand why this wasn't done before for the
> > module explicitly called kmod-usb-serial.
>
> The g_*.ko gadget modules conflict with each other. I think
> it isn't loaded by default to prevent that when users decided
> to install multiple of them.
>
> I made an init script to setup USB gadget using the "modern"
> configfs approach:
> https://github.com/openwrt/openwrt/pull/14005
> Maybe you can make use of this one instead? :)

This is a step in the right direction as it moves toward using configfs
as is custom these days, approved.

I think I would need an example of how to utilize this for the serial
gadget though...

Yours,
Linus Walleij


From jonas.gorski at gmail.com  Fri Nov 24 04:53:01 2023
From: jonas.gorski at gmail.com (Jonas Gorski)
Date: Fri, 24 Nov 2023 13:53:01 +0100
Subject: [PATCH 07/20] kernel: copy all built kernel modules to root
 filesystem image
In-Reply-To: <ZVq4Dp6vhOBpjKnS@mattapan.m5p.com>
References: <cover.1700010286.git.ehem+openwrt@m5p.com> <ee3fb185b494b4de05ca65725e0a96cffa307acb.1700010291.git.ehem+openwrt@m5p.com>
 <a4208395-30ad-4e90-8910-d52d1668db97@nbd.name> <ZVfbxhyjN7Y24Akh@mattapan.m5p.com>
 <a6c167a8-2f85-4e69-88e5-39fae2b1cd7f@nbd.name> <ZVq4Dp6vhOBpjKnS@mattapan.m5p.com>
Message-ID: <CAOiHx=nygkx7uA6ERSFjBaa3R51YxzGqYzC6DHAhVorY8OifUQ@mail.gmail.com>

Hi,

On Mon, 20 Nov 2023 at 02:37, Elliott Mitchell <ehem+openwrt at m5p.com> wrote:
>
> On Sat, Nov 18, 2023 at 07:57:35AM +0100, Felix Fietkau wrote:
> > On 17.11.23 22:31, Elliott Mitchell wrote:
> > > On Fri, Nov 17, 2023 at 05:20:33PM +0100, Felix Fietkau wrote:
> > >> On 11.11.23 01:21, Elliott Mitchell wrote:
> > >> > This removes the requirement for to create a package for all modules.
> > >> > Now devices can simply specify in-tree drivers/other to be built as
> > >> > modules and they will be present in the resultant image.
> > >> >
> > >> > Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>
> > >>
> > >> It seems to me that this completely ignores the use case of having
> > >> release builds that ship a lot of kernel modules as installable
> > >> packages. Did I misread something?
> > >> If not, this gets a strong NACK from me.
> > >
> > > Should be completely orthogonal, though it could have bugs.
> > >
> > > Using `cp -l` has two valuable effects:  First, it reduces storage space
> > > usage.  Second, it serves to mark module files as belonging to a package.
> > >
> > > My goal is previously setting a kernel option to "m" in a configuration
> > > file, but not having a package causes it to be built, then ignored.  I
> > > want this to do something sensible, not simply waste electricity
> > > building a module and then tossing it in the garbage.
> > >
> > > Hmm, come to think of it, that should be $(XARGS) (fix on commit?).
> >
> > Thanks for the explanation, it makes more sense to me now.
> > That said, I see a few pitfalls here:
> >
> > 1. If you select kernel modules that depend on other modules selected
> > via kmod packages, you end up with non-functional modules with missing
> > dependencies in the rootfs.
>
> Is this actually that much of a problem?  From what I've seen most kmod
> packages handled during image build get preinstalled onto the root fs
> image.  As such these would nominally function as long as the packages
> weren't removed.

If you do a build with ALL_KMODS=y because you don't know which kmods
you may need later on, and want to avoid having to reflash in this
case, there will be plenty of kmod packages build but not installed
into the rootfs.

>
> Wouldn't this also indicate breakage in the module package anyway?

No, not necessarily. Let's say there is a kmod-foo that packages FOO
(foo.ko). This is selected as =m.

Then you run kernel_*config and select BAR=m (bar.ko), since there is
no kmod defined for it. bar.ko has a dependency on foo.ko

With your patch (AFAIU) the bar.ko would be then installed in the
rootfs, but since foo.ko is packaged separately as a m-package, it
won't be in the rootfs => bar.ko is missing its dependencies in the
rootfs.

> > 2. If the kmod package selection accidentally ends up selecting extra
> > modules that aren't stored in the package, you end up with rootfs bloat.
>
> Eww, that would be gross.  As with the above, wouldn't this be indicating
> breakage in the module packaging anyway?

Maybe, but sometimes modules/drivers in the kernel default to =m for
silly reasons. And again as the above example, if the triggering kmod
package is selected as =m, then the additional modules land in the
rootfs without their dependencies.

> > I'm fine with the cp -l change, but I think adding all remaining modules
> > to the rootfs is not something we should do by default (maybe opt-in?)
>
> Perhaps.  This could also be handled by the approach the series as a
> whole is aiming for.  If kernel module building used a separate object
> directory from the kernel build, then modules selected in the device
> configuration could be isolated.

Maybe instead of putting them into the rootfs, we could wrap them in a
special package? Then you can select it if you want to include them in
your image or not. No idea what to name it, kmod-remaining?
kmod-unaccounted-for? kmod-not-appearing-in-the-definitions?

We could also try to wrap any unexpected .kos into autogenerated kmod
packages based in their names (e.g. if we find a foo.ko, we
autogenerate a kmod-foo.ipk for it), but these wouldn't be selectable
then in menuconfig. Also not sure how well the build system would
handle dynamic package generation.

Also going the other way around, maybe the build system should
warn/complain about any .ko found that isn't wrapped in a kmod-*
package.

WARNING: unpackaged kernel module found: foo/bar.ko

etc.

Regards,
Jonas


From ehem+openwrt at m5p.com  Fri Nov 24 18:28:32 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Fri, 24 Nov 2023 18:28:32 -0800
Subject: [PATCH 07/20] kernel: copy all built kernel modules to root
 filesystem image
In-Reply-To: <CAOiHx=nygkx7uA6ERSFjBaa3R51YxzGqYzC6DHAhVorY8OifUQ@mail.gmail.com>
References: <cover.1700010286.git.ehem+openwrt@m5p.com>
 <ee3fb185b494b4de05ca65725e0a96cffa307acb.1700010291.git.ehem+openwrt@m5p.com>
 <a4208395-30ad-4e90-8910-d52d1668db97@nbd.name>
 <ZVfbxhyjN7Y24Akh@mattapan.m5p.com>
 <a6c167a8-2f85-4e69-88e5-39fae2b1cd7f@nbd.name>
 <ZVq4Dp6vhOBpjKnS@mattapan.m5p.com>
 <CAOiHx=nygkx7uA6ERSFjBaa3R51YxzGqYzC6DHAhVorY8OifUQ@mail.gmail.com>
Message-ID: <ZWFb0OdSHwIZCyiN@mattapan.m5p.com>

On Fri, Nov 24, 2023 at 01:53:01PM +0100, Jonas Gorski wrote:
> 
> On Mon, 20 Nov 2023 at 02:37, Elliott Mitchell <ehem+openwrt at m5p.com> wrote:
> >
> > On Sat, Nov 18, 2023 at 07:57:35AM +0100, Felix Fietkau wrote:
> > > On 17.11.23 22:31, Elliott Mitchell wrote:
> > > > On Fri, Nov 17, 2023 at 05:20:33PM +0100, Felix Fietkau wrote:
> > > >> On 11.11.23 01:21, Elliott Mitchell wrote:
> > > >> > This removes the requirement for to create a package for all modules.
> > > >> > Now devices can simply specify in-tree drivers/other to be built as
> > > >> > modules and they will be present in the resultant image.
> > > >> >
> > > >> > Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>
> > > >>
> > > >> It seems to me that this completely ignores the use case of having
> > > >> release builds that ship a lot of kernel modules as installable
> > > >> packages. Did I misread something?
> > > >> If not, this gets a strong NACK from me.
> > > >
> > > > Should be completely orthogonal, though it could have bugs.
> > > >
> > > > Using `cp -l` has two valuable effects:  First, it reduces storage space
> > > > usage.  Second, it serves to mark module files as belonging to a package.
> > > >
> > > > My goal is previously setting a kernel option to "m" in a configuration
> > > > file, but not having a package causes it to be built, then ignored.  I
> > > > want this to do something sensible, not simply waste electricity
> > > > building a module and then tossing it in the garbage.
> > > >
> > > > Hmm, come to think of it, that should be $(XARGS) (fix on commit?).
> > >
> > > Thanks for the explanation, it makes more sense to me now.
> > > That said, I see a few pitfalls here:
> > >
> > > 1. If you select kernel modules that depend on other modules selected
> > > via kmod packages, you end up with non-functional modules with missing
> > > dependencies in the rootfs.
> >
> > Is this actually that much of a problem?  From what I've seen most kmod
> > packages handled during image build get preinstalled onto the root fs
> > image.  As such these would nominally function as long as the packages
> > weren't removed.
> 
> If you do a build with ALL_KMODS=y because you don't know which kmods
> you may need later on, and want to avoid having to reflash in this
> case, there will be plenty of kmod packages build but not installed
> into the rootfs.
> 
> >
> > Wouldn't this also indicate breakage in the module package anyway?
> 
> No, not necessarily. Let's say there is a kmod-foo that packages FOO
> (foo.ko). This is selected as =m.
> 
> Then you run kernel_*config and select BAR=m (bar.ko), since there is
> no kmod defined for it. bar.ko has a dependency on foo.ko
> 
> With your patch (AFAIU) the bar.ko would be then installed in the
> rootfs, but since foo.ko is packaged separately as a m-package, it
> won't be in the rootfs => bar.ko is missing its dependencies in the
> rootfs.

Yet isn't this breakage in the module package?  It has stolen a module
away from the kernel configuration.

Certainly this is a problem and I've got a rough idea how to solve it.
(simply take advantage of what the patch series is aiming for)

> > > 2. If the kmod package selection accidentally ends up selecting extra
> > > modules that aren't stored in the package, you end up with rootfs bloat.
> >
> > Eww, that would be gross.  As with the above, wouldn't this be indicating
> > breakage in the module packaging anyway?
> 
> Maybe, but sometimes modules/drivers in the kernel default to =m for
> silly reasons. And again as the above example, if the triggering kmod
> package is selected as =m, then the additional modules land in the
> rootfs without their dependencies.

The inverse is also a problem.  If the kernel selected CONFIG_USB=m,
then kmod-chaoskey was built, it would be impossible to load the module
since usbcore.ko would be unavailable.

Both directions currently have breakage.

> > > I'm fine with the cp -l change, but I think adding all remaining modules
> > > to the rootfs is not something we should do by default (maybe opt-in?)
> >
> > Perhaps.  This could also be handled by the approach the series as a
> > whole is aiming for.  If kernel module building used a separate object
> > directory from the kernel build, then modules selected in the device
> > configuration could be isolated.
> 
> Maybe instead of putting them into the rootfs, we could wrap them in a
> special package? Then you can select it if you want to include them in
> your image or not. No idea what to name it, kmod-remaining?
> kmod-unaccounted-for? kmod-not-appearing-in-the-definitions?
> 
> We could also try to wrap any unexpected .kos into autogenerated kmod
> packages based in their names (e.g. if we find a foo.ko, we
> autogenerate a kmod-foo.ipk for it), but these wouldn't be selectable
> then in menuconfig. Also not sure how well the build system would
> handle dynamic package generation.
> 
> Also going the other way around, maybe the build system should
> warn/complain about any .ko found that isn't wrapped in a kmod-*
> package.

All of these are plausible.  I think modules selected in device
configurations should get built and installed into the root filesystem.
Otherwise setting a device kernel configuration option to =m is broken.

Whereas forcing the explicit creation of packages for each and every
kernel module forces duplication of Kconfig functionality.


-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |         ehem+sigmsg at m5p.com  PGP 87145445         |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445




From nbd at nbd.name  Fri Nov 24 22:08:20 2023
From: nbd at nbd.name (Felix Fietkau)
Date: Sat, 25 Nov 2023 07:08:20 +0100
Subject: [PATCH 07/20] kernel: copy all built kernel modules to root
 filesystem image
In-Reply-To: <ZWFb0OdSHwIZCyiN@mattapan.m5p.com>
References: <cover.1700010286.git.ehem+openwrt@m5p.com>
 <ee3fb185b494b4de05ca65725e0a96cffa307acb.1700010291.git.ehem+openwrt@m5p.com>
 <a4208395-30ad-4e90-8910-d52d1668db97@nbd.name>
 <ZVfbxhyjN7Y24Akh@mattapan.m5p.com>
 <a6c167a8-2f85-4e69-88e5-39fae2b1cd7f@nbd.name>
 <ZVq4Dp6vhOBpjKnS@mattapan.m5p.com>
 <CAOiHx=nygkx7uA6ERSFjBaa3R51YxzGqYzC6DHAhVorY8OifUQ@mail.gmail.com>
 <ZWFb0OdSHwIZCyiN@mattapan.m5p.com>
Message-ID: <2c9616e5-bd42-4bd3-9c09-5fb9064e04c3@nbd.name>

On 25.11.23 03:28, Elliott Mitchell wrote:
> On Fri, Nov 24, 2023 at 01:53:01PM +0100, Jonas Gorski wrote:
>> > > I'm fine with the cp -l change, but I think adding all remaining modules
>> > > to the rootfs is not something we should do by default (maybe opt-in?)
>> >
>> > Perhaps.  This could also be handled by the approach the series as a
>> > whole is aiming for.  If kernel module building used a separate object
>> > directory from the kernel build, then modules selected in the device
>> > configuration could be isolated.
>> 
>> Maybe instead of putting them into the rootfs, we could wrap them in a
>> special package? Then you can select it if you want to include them in
>> your image or not. No idea what to name it, kmod-remaining?
>> kmod-unaccounted-for? kmod-not-appearing-in-the-definitions?
>> 
>> We could also try to wrap any unexpected .kos into autogenerated kmod
>> packages based in their names (e.g. if we find a foo.ko, we
>> autogenerate a kmod-foo.ipk for it), but these wouldn't be selectable
>> then in menuconfig. Also not sure how well the build system would
>> handle dynamic package generation.
>> 
>> Also going the other way around, maybe the build system should
>> warn/complain about any .ko found that isn't wrapped in a kmod-*
>> package.
> 
> All of these are plausible.  I think modules selected in device
> configurations should get built and installed into the root filesystem.
> Otherwise setting a device kernel configuration option to =m is broken.
> 
> Whereas forcing the explicit creation of packages for each and every
> kernel module forces duplication of Kconfig functionality.
The duplication you wish to avoid is there for a reason. The way the 
kernel build system is set up, it makes it easy to build a highly 
customized build for one target, or make a distribution build with 
pretty much everything built as module. What it offers no solution for 
is to maintain and keep in sync kernel configurations for a wide array 
of different (often storage constrained) targets, while keeping a lot of 
extra features/drivers optionally installable.
That's exactly what our packaging around kernel modules + our kernel 
config handling scripts were made for.

Since there is no perfect solution, there are always some trade-offs 
involved. One of these trade-offs was our choice to not support adding 
kernel modules in the device kernel config by selecting them as =m 
there. I didn't consider that feature useful enough to justify the cost 
of dealing with all the corner cases.

I still don't fully understand your motivation for adding this feature. 
Is it just because you're bothered by having to write some extra 
boilerplate code for adding kernel modules? Are there some cases where 
the existing system cannot work for what you're trying to do?
Or is there some other reason why you need this?

Just to be clear, I'm not opposed to the feature you're proposing in any 
way. What I want to avoid is adding something that works for your 
special case but quickly breaks in weird ways when other people start 
using it.

- Felix


From arinc.unal at arinc9.com  Sat Nov 25 03:59:58 2023
From: arinc.unal at arinc9.com (=?UTF-8?B?QXLEsW7DpyDDnE5BTA==?=)
Date: Sat, 25 Nov 2023 13:59:58 +0200
Subject: Battlemesh x OpenWrt meeting in Cyprus?
In-Reply-To: <51C0D325-E509-4D24-8B7B-3024230EB0F7@aparcar.org>
References: <51C0D325-E509-4D24-8B7B-3024230EB0F7@aparcar.org>
Message-ID: <C61404F9-47BA-4DC5-AB4E-2EBD91FA6144@arinc9.com>

Hello!

I am the head organiser of the next Battlemesh. I will also be involved
the most on organising the OpenWrt summit. Let me know if you've got any
questions. My website from my email address includes the channels other
than email to reach me more easily.

Ar?n?

On 23 November 2023 23:54:16 EET, Paul Spooren <mail at aparcar.org> wrote:
>Hi all,
>
>While attending this years Battlemesh in Spain some fellow mesh people asked why there weren?t more OpenWrt people around. I?m guessing it was mostly due to the lack of communication in advance, so I?d like to raise the topic here: Are people from the OpenWrt community, specially members and maintainers interested in collaborating with and attending the Battlemesh next year?
>
>They?d do most of the heavy lifting and would offer us to take some slots/space to do our own little OpenWrt meeting (remember the good and productive days in Hamburg anno 2019). Ideally at least one OpenWrt member would join their organizing team, I could do it but would also be happy if someone else jumps in.
>
>The general idea is to have a week long Battlemesh event in Cyprus, the OpenWrt part could happen both within the week, before or after, the full length or only a weekend etc. To my knowledge Cyprus offers an easier VISA process so more folks could join, I remember last time people wouldn?t get a VISA in time.
>
>If we participate we should raise some donations to offer travel stipends and come up with some (lighting) talks and presentations.
>
>I think the timeframe is ?somewhen in May 2024?, this will be further discussed on the Battlemesh mailing list.
>
>Looking forward to meet you all again!
>
>Sunshine,
>Paul
>_______________________________________________
>openwrt-devel mailing list
>openwrt-devel at lists.openwrt.org
>https://lists.openwrt.org/mailman/listinfo/openwrt-devel


From a.valentin at ddimension.net  Sat Nov 25 04:26:02 2023
From: a.valentin at ddimension.net (=?UTF-8?Q?Andr=C3=A9_Valentin?=)
Date: Sat, 25 Nov 2023 13:26:02 +0100
Subject: unreliable AP VLAN Interfaces 23.05
Message-ID: <b9c28d51-bb72-46dd-97b8-0eab82c4ded4@ddimension.net>

Hi!

Currently I try to use AP VLAN interfaces, but it seems to be very unstable. Directly after reboot, only some interfaces are created. If I do wifi down and wifi up, the all come up.
It does not depend on hardware, I have these problemes with ath10k and ath11k (with AP VLAN patch), ipq806x, ipq807x and ath79.

  I also tested this patch because of the netlink erros:
https://patchwork.ozlabs.org/project/hostap/patch/1341593561-14090-5-git-send-email-greearb at candelatech.com/
But it does not help.
Another test I did was disabling wpad on system boot, start it later and run a wifi up. Same problem. Also in this case fixable with wifi down; wifi up.

This is a log:
Sat Nov 25 12:12:01 2023 kern.info kernel: [   25.936801] IPv6: ADDRCONF(NETDEV_CHANGE): switch1: link becomes ready
Sat Nov 25 12:12:01 2023 kern.info kernel: [   25.942203] IPv6: ADDRCONF(NETDEV_CHANGE): switch1.1: link becomes ready
Sat Nov 25 12:12:08 2023 kern.info kernel: [   33.126292] l11: disabling
Sat Nov 25 12:13:05 2023 daemon.notice hostapd: Set new config for phy phy1:
Sat Nov 25 12:13:05 2023 daemon.notice hostapd: Set new config for phy phy0:
Sat Nov 25 12:13:06 2023 daemon.notice hostapd: Set new config for phy phy1:
Sat Nov 25 12:13:07 2023 daemon.notice hostapd: Set new config for phy phy0:
Sat Nov 25 12:13:42 2023 daemon.notice hostapd: Set new config for phy phy1: /var/run/hostapd-phy1.conf
Sat Nov 25 12:13:42 2023 daemon.notice hostapd: Restart interface for phy phy1
Sat Nov 25 12:13:42 2023 daemon.notice hostapd: Configuration file: data: driver=nl80211 logger_syslog=127 logger_syslog_level=0 logger_stdout=127 logger_stdout_level=0 country_code=DE ieee80211d=1 hw_mode=g supported_rates=60 120 180 240 360 480 540 basic_rates=60 120 180 240 360 480 540 beacon_int=100 chanlist=1 tx_queue_data2_burst=2.0 #num_global_macaddr=1 ieee80211n=1 ht_coex=0 ht_capab=[LDPC][SHORT-GI-20][SHORT-GI-40][TX-STBC][RX-STBC1][DSSS_CCK-40] ieee80211ac=1 vht_oper_chwidth=0 vht_oper_centr_freq_seg0_idx= vht_capab=[MAX-A-MPDU-LEN-EXP0] ieee80211ax=1 he_su_beamformer=1 he_su_beamformee=1 he_mu_beamformer=1 he_bss_color=128 he_spr_sr_control=3 he_default_pe_duration=4 he_rts_threshold=1023 he_mu_edca_qos_info_param_count=0 he_mu_edca_qos_info_q_ack=0 he_mu_edca_qos_info_queue_request=0 he_mu_edca_qos_info_txop_request=0 he_mu_edca_ac_be_aifsn=8 he_mu_edca_ac_be_aci=0 he_mu_edca_ac_be_ecwmin=9 he_mu_edca_ac_be_ecwmax=10 he_mu_edca_ac_be_timer=255 he_mu_edca_ac_bk_aifsn=15 he_mu_edca_ac_bk_aci=1 he_mu_edca_ac_bk_ecwmi
Sat Nov 25 12:13:42 2023 kern.info kernel: [   92.529694] switch1: port 5(wap-onet2) entered blocking state
Sat Nov 25 12:13:42 2023 kern.info kernel: [   92.529740] switch1: port 5(wap-onet2) entered disabled state
Sat Nov 25 12:13:42 2023 kern.info kernel: [   92.534663] device wap-onet2 entered promiscuous mode
Sat Nov 25 12:13:42 2023 daemon.warn hostapd: nl80211: Failed to add interface wap-onet2 into bridge switch1: Resource busy
Sat Nov 25 12:13:42 2023 daemon.notice hostapd: wap-onet2: interface state UNINITIALIZED->COUNTRY_UPDATE
Sat Nov 25 12:13:42 2023 kern.info kernel: [   92.541794] device wap-onet2 left promiscuous mode
Sat Nov 25 12:13:42 2023 kern.info kernel: [   92.545287] switch1: port 5(wap-onet2) entered disabled state
Sat Nov 25 12:13:43 2023 kern.info kernel: [   92.628221] switch1: port 5(wap-onet2) entered blocking state
Sat Nov 25 12:13:43 2023 kern.info kernel: [   92.628269] switch1: port 5(wap-onet2) entered disabled state
Sat Nov 25 12:13:43 2023 kern.info kernel: [   92.633226] device wap-onet2 entered promiscuous mode
Sat Nov 25 12:13:43 2023 kern.info kernel: [   92.659012] switch1: port 6(wap-knet2) entered blocking state
Sat Nov 25 12:13:43 2023 kern.info kernel: [   92.659061] switch1: port 6(wap-knet2) entered disabled state
Sat Nov 25 12:13:43 2023 kern.info kernel: [   92.664018] device wap-knet2 entered promiscuous mode
Sat Nov 25 12:13:43 2023 kern.info kernel: [   92.671837] switch1: port 6(wap-knet2) entered blocking state
Sat Nov 25 12:13:43 2023 kern.info kernel: [   92.674521] switch1: port 6(wap-knet2) entered forwarding state
Sat Nov 25 12:13:43 2023 kern.info kernel: [   92.709805] device wap-knet2 left promiscuous mode
Sat Nov 25 12:13:43 2023 kern.info kernel: [   92.709914] switch1: port 6(wap-knet2) entered disabled state
Sat Nov 25 12:13:43 2023 kern.info kernel: [   92.827919] switch1: port 6(wap-knet2) entered blocking state
Sat Nov 25 12:13:43 2023 kern.info kernel: [   92.827968] switch1: port 6(wap-knet2) entered disabled state
Sat Nov 25 12:13:43 2023 kern.info kernel: [   92.832924] device wap-knet2 entered promiscuous mode
Sat Nov 25 12:13:43 2023 kern.info kernel: [   92.838597] switch1: port 6(wap-knet2) entered blocking state
Sat Nov 25 12:13:43 2023 kern.info kernel: [   92.843427] switch1: port 6(wap-knet2) entered forwarding state
Sat Nov 25 12:13:43 2023 kern.info kernel: [   93.238376] switch1: port 7(wap-fl2) entered blocking state
Sat Nov 25 12:13:43 2023 kern.info kernel: [   93.238426] switch1: port 7(wap-fl2) entered disabled state
Sat Nov 25 12:13:43 2023 kern.info kernel: [   93.243043] device wap-fl2 entered promiscuous mode
Sat Nov 25 12:13:43 2023 kern.info kernel: [   93.250028] switch1: port 7(wap-fl2) entered blocking state
Sat Nov 25 12:13:43 2023 kern.info kernel: [   93.253201] switch1: port 7(wap-fl2) entered forwarding state
Sat Nov 25 12:13:43 2023 daemon.info hostapd: wap-fl2: RADIUS Authentication server 192.168.203.5:1812
Sat Nov 25 12:13:43 2023 kern.info kernel: [   93.324126] device wap-fl2 left promiscuous mode
Sat Nov 25 12:13:43 2023 kern.info kernel: [   93.324243] switch1: port 7(wap-fl2) entered disabled state
Sat Nov 25 12:13:43 2023 kern.info kernel: [   93.388161] switch1: port 7(wap-fl2) entered blocking state
Sat Nov 25 12:13:43 2023 kern.info kernel: [   93.388204] switch1: port 7(wap-fl2) entered disabled state
Sat Nov 25 12:13:43 2023 kern.info kernel: [   93.392808] device wap-fl2 entered promiscuous mode
Sat Nov 25 12:13:43 2023 kern.info kernel: [   93.398241] switch1: port 7(wap-fl2) entered blocking state
Sat Nov 25 12:13:43 2023 kern.info kernel: [   93.402967] switch1: port 7(wap-fl2) entered forwarding state
Sat Nov 25 12:13:43 2023 kern.info kernel: [   93.498442] switch1: port 8(kinfra2) entered blocking state
Sat Nov 25 12:13:43 2023 kern.info kernel: [   93.498493] switch1: port 8(kinfra2) entered disabled state
Sat Nov 25 12:13:43 2023 kern.info kernel: [   93.503108] device kinfra2 entered promiscuous mode
Sat Nov 25 12:13:43 2023 kern.info kernel: [   93.509931] switch1: port 8(kinfra2) entered blocking state
Sat Nov 25 12:13:43 2023 kern.info kernel: [   93.513259] switch1: port 8(kinfra2) entered forwarding state
Sat Nov 25 12:13:43 2023 kern.info kernel: [   93.553292] device kinfra2 left promiscuous mode
Sat Nov 25 12:13:43 2023 kern.info kernel: [   93.553394] switch1: port 8(kinfra2) entered disabled state
Sat Nov 25 12:13:44 2023 kern.info kernel: [   93.588829] switch1: port 8(kinfra2) entered blocking state
Sat Nov 25 12:13:44 2023 kern.info kernel: [   93.588877] switch1: port 8(kinfra2) entered disabled state
Sat Nov 25 12:13:44 2023 kern.info kernel: [   93.593531] device kinfra2 entered promiscuous mode
Sat Nov 25 12:13:44 2023 kern.info kernel: [   93.598971] switch1: port 8(kinfra2) entered blocking state
Sat Nov 25 12:13:44 2023 kern.info kernel: [   93.603638] switch1: port 8(kinfra2) entered forwarding state
Sat Nov 25 12:13:44 2023 kern.info kernel: [   93.609492] switch1: port 6(wap-knet2) entered disabled state
Sat Nov 25 12:13:44 2023 kern.info kernel: [   93.615629] switch1: port 7(wap-fl2) entered disabled state
Sat Nov 25 12:13:44 2023 kern.info kernel: [   93.621099] switch1: port 8(kinfra2) entered disabled state
Sat Nov 25 12:13:44 2023 kern.info kernel: [   93.754678] IPv6: ADDRCONF(NETDEV_CHANGE): kinfra2: link becomes ready
Sat Nov 25 12:13:44 2023 kern.info kernel: [   93.754862] switch1: port 8(kinfra2) entered blocking state
Sat Nov 25 12:13:44 2023 kern.info kernel: [   93.760144] switch1: port 8(kinfra2) entered forwarding state
Sat Nov 25 12:13:44 2023 kern.info kernel: [   93.868525] switch1: port 9(wap-ops2) entered blocking state
Sat Nov 25 12:13:44 2023 kern.info kernel: [   93.868579] switch1: port 9(wap-ops2) entered disabled state
Sat Nov 25 12:13:44 2023 kern.info kernel: [   93.873551] device wap-ops2 entered promiscuous mode
Sat Nov 25 12:13:44 2023 kern.info kernel: [   93.880529] switch1: port 9(wap-ops2) entered blocking state
Sat Nov 25 12:13:44 2023 kern.info kernel: [   93.883865] switch1: port 9(wap-ops2) entered forwarding state
Sat Nov 25 12:13:44 2023 daemon.notice hostapd: wap-onet2: interface state COUNTRY_UPDATE->ENABLED
Sat Nov 25 12:13:44 2023 kern.info kernel: [   94.008275] device wap-ops2 left promiscuous mode
Sat Nov 25 12:13:44 2023 kern.info kernel: [   94.008418] switch1: port 9(wap-ops2) entered disabled state
Sat Nov 25 12:13:44 2023 kern.info kernel: [   94.066629] switch1: port 5(wap-onet2) entered blocking state
Sat Nov 25 12:13:44 2023 kern.info kernel: [   94.066681] switch1: port 5(wap-onet2) entered forwarding state
Sat Nov 25 12:13:44 2023 kern.info kernel: [   94.072278] switch1: port 9(wap-ops2) entered blocking state
Sat Nov 25 12:13:44 2023 kern.info kernel: [   94.077141] switch1: port 9(wap-ops2) entered disabled state
Sat Nov 25 12:13:44 2023 kern.info kernel: [   94.083297] device wap-ops2 entered promiscuous mode
Sat Nov 25 12:13:44 2023 kern.info kernel: [   94.088798] switch1: port 9(wap-ops2) entered blocking state
Sat Nov 25 12:13:44 2023 kern.info kernel: [   94.093594] switch1: port 9(wap-ops2) entered forwarding state
Sat Nov 25 12:13:44 2023 daemon.notice hostapd: wap-onet2: AP-ENABLED
Sat Nov 25 12:13:44 2023 daemon.notice hostapd: Set new config for phy phy0: /var/run/hostapd-phy0.conf
Sat Nov 25 12:13:44 2023 daemon.notice hostapd: Restart interface for phy phy0
Sat Nov 25 12:13:44 2023 daemon.notice hostapd: Configuration file: data: driver=nl80211 logger_syslog=127 logger_syslog_level=0 logger_stdout=127 logger_stdout_level=0 country_code=DE ieee80211d=1 ieee80211h=1 hw_mode=a supported_rates=120 180 240 360 480 540 basic_rates=120 180 240 360 480 540 beacon_int=100 chanlist=52 100 116 tx_queue_data2_burst=2.0 #num_global_macaddr=1 ieee80211n=1 ht_coex=0 ht_capab=[HT40+][LDPC][SHORT-GI-20][SHORT-GI-40][TX-STBC][RX-STBC1][MAX-AMSDU-7935][DSSS_CCK-40] ieee80211ac=1 vht_oper_chwidth=1 vht_oper_centr_freq_seg0_idx=106 vht_capab=[RXLDPC][SHORT-GI-80][SHORT-GI-160][TX-STBC-2BY1][SU-BEAMFORMER][SU-BEAMFORMEE][MU-BEAMFORMER][MU-BEAMFORMEE][RX-ANTENNA-PATTERN][TX-ANTENNA-PATTERN][RX-STBC-1][SOUNDING-DIMENSION-4][BF-ANTENNA-4][VHT160-80PLUS80][MAX-MPDU-11454][MAX-A-MPDU-LEN-EXP7] ieee80211ax=1 he_oper_chwidth=1 he_oper_centr_freq_seg0_idx=106 he_su_beamformer=1 he_su_beamformee=1 he_mu_beamformer=1 he_bss_color=128 he_spr_sr_control=3 he_default_pe_duration=4 he_rts_threshold=1023 he_mu_edca_
Sat Nov 25 12:13:44 2023 kern.info kernel: [   94.443836] switch1: port 10(wap-onet1) entered blocking state
Sat Nov 25 12:13:44 2023 kern.info kernel: [   94.443896] switch1: port 10(wap-onet1) entered disabled state
Sat Nov 25 12:13:44 2023 kern.info kernel: [   94.448981] device wap-onet1 entered promiscuous mode
Sat Nov 25 12:13:44 2023 kern.info kernel: [   94.454618] switch1: port 10(wap-onet1) entered blocking state
Sat Nov 25 12:13:44 2023 kern.info kernel: [   94.459610] switch1: port 10(wap-onet1) entered forwarding state
Sat Nov 25 12:13:44 2023 daemon.notice hostapd: wap-onet1: interface state UNINITIALIZED->COUNTRY_UPDATE
Sat Nov 25 12:13:44 2023 daemon.notice hostapd: wap-onet1: interface state COUNTRY_UPDATE->HT_SCAN
Sat Nov 25 12:13:44 2023 daemon.err hostapd: VLAN: vlan_event_receive: recvfrom failed: No buffer space available
Sat Nov 25 12:13:44 2023 daemon.err hostapd: VLAN: vlan_event_receive: recvfrom failed: No buffer space available
Sat Nov 25 12:13:45 2023 kern.info kernel: [   94.590687] device wap-onet1 left promiscuous mode
Sat Nov 25 12:13:45 2023 kern.info kernel: [   94.590817] switch1: port 10(wap-onet1) entered disabled state
Sat Nov 25 12:13:45 2023 daemon.err hostapd: VLAN: ifconfig_helper: ioctl(SIOCGIFFLAGS) failed for interface wap-knet2-ops: No such device
Sat Nov 25 12:13:45 2023 daemon.err hostapd: VLAN: ifconfig_helper: ioctl(SIOCGIFFLAGS) failed for interface wap-knet2-ops: No such device
Sat Nov 25 12:13:45 2023 kern.info kernel: [   94.659362] switch1: port 10(wap-onet1) entered blocking state
Sat Nov 25 12:13:45 2023 kern.info kernel: [   94.659420] switch1: port 10(wap-onet1) entered disabled state
Sat Nov 25 12:13:45 2023 kern.info kernel: [   94.664447] device wap-onet1 entered promiscuous mode
Sat Nov 25 12:13:45 2023 daemon.err hostapd: VLAN: ifconfig_helper: ioctl(SIOCGIFFLAGS) failed for interface wap-knet2-ops: No such device
Sat Nov 25 12:13:45 2023 daemon.err hostapd: VLAN: ifconfig_helper: ioctl(SIOCSIFFLAGS) failed for interface wap-knet2-prv (up=1): No such device
Sat Nov 25 12:13:45 2023 daemon.err hostapd: VLAN: ifconfig_helper: ioctl(SIOCGIFFLAGS) failed for interface wap-knet2-ops: No such device
Sat Nov 25 12:13:45 2023 daemon.notice hostapd: wap-onet1: interface state HT_SCAN->DFS
Sat Nov 25 12:13:45 2023 daemon.notice hostapd: wap-onet1: DFS-CAC-START freq=5500 chan=100 sec_chan=1, width=1, seg0=106, seg1=0, cac_time=60s
Sat Nov 25 12:13:51 2023 daemon.notice hostapd: handle_probe_req: send failed
Sat Nov 25 12:13:51 2023 daemon.notice hostapd: handle_probe_req: send failed
Sat Nov 25 12:13:52 2023 daemon.notice hostapd: handle_probe_req: send failed
Sat Nov 25 12:13:52 2023 daemon.notice hostapd: handle_probe_req: send failed
Sat Nov 25 12:13:52 2023 daemon.notice hostapd: handle_probe_req: send failed
Sat Nov 25 12:13:52 2023 daemon.notice hostapd: handle_probe_req: send failed
Sat Nov 25 12:13:53 2023 daemon.notice hostapd: handle_probe_req: send failed
Sat Nov 25 12:13:53 2023 daemon.notice hostapd: handle_probe_req: send failed
Sat Nov 25 12:13:54 2023 daemon.notice hostapd: handle_probe_req: send failed
Sat Nov 25 12:13:54 2023 daemon.notice hostapd: handle_probe_req: send failed
Sat Nov 25 12:13:54 2023 daemon.notice hostapd: handle_probe_req: send failed
Sat Nov 25 12:13:54 2023 daemon.notice hostapd: handle_probe_req: send failed
Sat Nov 25 12:13:54 2023 daemon.notice hostapd: handle_probe_req: send failed
Sat Nov 25 12:13:54 2023 daemon.notice hostapd: handle_probe_req: send failed
Sat Nov 25 12:13:54 2023 daemon.notice hostapd: handle_probe_req: send failed
Sat Nov 25 12:13:54 2023 daemon.notice hostapd: handle_probe_req: send failed
Sat Nov 25 12:14:09 2023 daemon.notice hostapd: handle_probe_req: send failed
Sat Nov 25 12:14:09 2023 daemon.notice hostapd: handle_probe_req: send failed
Sat Nov 25 12:14:10 2023 daemon.notice hostapd: handle_probe_req: send failed
Sat Nov 25 12:14:10 2023 daemon.notice hostapd: handle_probe_req: send failed
Sat Nov 25 12:14:17 2023 daemon.notice hostapd: handle_probe_req: send failed
Sat Nov 25 12:14:18 2023 daemon.notice hostapd: handle_probe_req: send failed
Sat Nov 25 12:14:18 2023 daemon.notice hostapd: handle_probe_req: send failed
Sat Nov 25 12:14:31 2023 daemon.notice hostapd: handle_probe_req: send failed
Sat Nov 25 12:14:31 2023 daemon.notice hostapd: handle_probe_req: send failed
Sat Nov 25 12:14:32 2023 daemon.notice hostapd: handle_probe_req: send failed
Sat Nov 25 12:14:32 2023 daemon.notice hostapd: handle_probe_req: send failed
Sat Nov 25 12:14:33 2023 daemon.notice hostapd: handle_probe_req: send failed
Sat Nov 25 12:14:33 2023 daemon.notice hostapd: handle_probe_req: send failed
Sat Nov 25 12:14:47 2023 daemon.notice hostapd: wap-onet1: DFS-CAC-COMPLETED success=1 freq=5500 ht_enabled=0 chan_offset=0 chan_width=3 cf1=5530 cf2=0
Sat Nov 25 12:14:47 2023 kern.info kernel: [  156.651392] switch1: port 11(wap-knet1) entered blocking state
Sat Nov 25 12:14:47 2023 kern.info kernel: [  156.651447] switch1: port 11(wap-knet1) entered disabled state
Sat Nov 25 12:14:47 2023 kern.info kernel: [  156.656480] device wap-knet1 entered promiscuous mode
Sat Nov 25 12:14:47 2023 kern.info kernel: [  156.663884] switch1: port 11(wap-knet1) entered blocking state
Sat Nov 25 12:14:47 2023 kern.info kernel: [  156.667118] switch1: port 11(wap-knet1) entered forwarding state
Sat Nov 25 12:14:47 2023 kern.info kernel: [  156.673214] switch1: port 11(wap-knet1) entered disabled state
Sat Nov 25 12:14:47 2023 kern.info kernel: [  156.711477] device wap-knet1 left promiscuous mode
Sat Nov 25 12:14:47 2023 kern.info kernel: [  156.711604] switch1: port 11(wap-knet1) entered disabled state
Sat Nov 25 12:14:47 2023 kern.info kernel: [  156.738449] switch1: port 11(wap-knet1) entered blocking state
Sat Nov 25 12:14:47 2023 kern.info kernel: [  156.738491] switch1: port 11(wap-knet1) entered disabled state
Sat Nov 25 12:14:47 2023 kern.info kernel: [  156.743455] device wap-knet1 entered promiscuous mode
Sat Nov 25 12:14:47 2023 kern.info kernel: [  156.865703] switch1: port 12(wap-knet1-prv) entered blocking state
Sat Nov 25 12:14:47 2023 kern.info kernel: [  156.865747] switch1: port 12(wap-knet1-prv) entered disabled state
Sat Nov 25 12:14:47 2023 kern.info kernel: [  156.871329] device wap-knet1-prv entered promiscuous mode
Sat Nov 25 12:14:47 2023 kern.info kernel: [  156.877190] switch1: port 12(wap-knet1-prv) entered blocking state
Sat Nov 25 12:14:47 2023 kern.info kernel: [  156.882420] switch1: port 12(wap-knet1-prv) entered forwarding state
Sat Nov 25 12:14:47 2023 kern.info kernel: [  156.892652] switch1: port 13(wap-knet1-ops) entered blocking state
Sat Nov 25 12:14:47 2023 kern.info kernel: [  156.895007] switch1: port 13(wap-knet1-ops) entered disabled state
Sat Nov 25 12:14:47 2023 kern.info kernel: [  156.901671] device wap-knet1-ops entered promiscuous mode
Sat Nov 25 12:14:47 2023 kern.info kernel: [  156.907327] switch1: port 13(wap-knet1-ops) entered blocking state
Sat Nov 25 12:14:47 2023 kern.info kernel: [  156.912627] switch1: port 13(wap-knet1-ops) entered forwarding state
Sat Nov 25 12:14:47 2023 kern.info kernel: [  156.920813] device wap-knet1-prv left promiscuous mode
Sat Nov 25 12:14:47 2023 kern.info kernel: [  156.925279] switch1: port 12(wap-knet1-prv) entered disabled state
Sat Nov 25 12:14:47 2023 kern.info kernel: [  156.998044] switch1: port 12(wap-knet1-prv) entered blocking state
Sat Nov 25 12:14:47 2023 kern.info kernel: [  156.998123] switch1: port 12(wap-knet1-prv) entered disabled state
Sat Nov 25 12:14:47 2023 kern.info kernel: [  157.003715] device wap-knet1-prv entered promiscuous mode
Sat Nov 25 12:14:47 2023 kern.info kernel: [  157.009498] switch1: port 12(wap-knet1-prv) entered blocking state
Sat Nov 25 12:14:47 2023 kern.info kernel: [  157.014805] switch1: port 12(wap-knet1-prv) entered forwarding state
Sat Nov 25 12:14:47 2023 kern.info kernel: [  157.149147] switch1: port 14(wap-fl1) entered blocking state
Sat Nov 25 12:14:47 2023 kern.info kernel: [  157.149194] switch1: port 14(wap-fl1) entered disabled state
Sat Nov 25 12:14:47 2023 kern.info kernel: [  157.154260] device wap-fl1 entered promiscuous mode
Sat Nov 25 12:14:47 2023 kern.info kernel: [  157.161223] switch1: port 14(wap-fl1) entered blocking state
Sat Nov 25 12:14:47 2023 kern.info kernel: [  157.164133] switch1: port 14(wap-fl1) entered forwarding state
Sat Nov 25 12:14:47 2023 daemon.info hostapd: wap-fl1: RADIUS Authentication server 192.168.203.5:1812
Sat Nov 25 12:14:47 2023 kern.info kernel: [  157.174143] device wap-knet1-ops left promiscuous mode
Sat Nov 25 12:14:47 2023 kern.info kernel: [  157.175788] switch1: port 13(wap-knet1-ops) entered disabled state
Sat Nov 25 12:14:47 2023 kern.info kernel: [  157.257892] switch1: port 13(wap-knet1-ops) entered blocking state
Sat Nov 25 12:14:47 2023 kern.info kernel: [  157.257943] switch1: port 13(wap-knet1-ops) entered disabled state
Sat Nov 25 12:14:47 2023 kern.info kernel: [  157.263280] device wap-knet1-ops entered promiscuous mode
Sat Nov 25 12:14:47 2023 kern.info kernel: [  157.269312] switch1: port 13(wap-knet1-ops) entered blocking state
Sat Nov 25 12:14:47 2023 kern.info kernel: [  157.274617] switch1: port 13(wap-knet1-ops) entered forwarding state
Sat Nov 25 12:14:47 2023 kern.info kernel: [  157.448560] device wap-fl1 left promiscuous mode
Sat Nov 25 12:14:47 2023 kern.info kernel: [  157.448679] switch1: port 14(wap-fl1) entered disabled state
Sat Nov 25 12:14:47 2023 kern.info kernel: [  157.518847] switch1: port 14(kinfra1) entered blocking state
Sat Nov 25 12:14:47 2023 kern.info kernel: [  157.518897] switch1: port 14(kinfra1) entered disabled state
Sat Nov 25 12:14:47 2023 kern.info kernel: [  157.523798] device kinfra1 entered promiscuous mode
Sat Nov 25 12:14:47 2023 kern.info kernel: [  157.529449] switch1: port 15(wap-fl1) entered blocking state
Sat Nov 25 12:14:47 2023 kern.info kernel: [  157.534099] switch1: port 15(wap-fl1) entered disabled state
Sat Nov 25 12:14:47 2023 kern.info kernel: [  157.540343] device wap-fl1 entered promiscuous mode
Sat Nov 25 12:14:47 2023 kern.info kernel: [  157.545486] switch1: port 15(wap-fl1) entered blocking state
Sat Nov 25 12:14:47 2023 kern.info kernel: [  157.550007] switch1: port 15(wap-fl1) entered forwarding state
Sat Nov 25 12:14:48 2023 kern.info kernel: [  157.557580] switch1: port 14(kinfra1) entered blocking state
Sat Nov 25 12:14:48 2023 kern.info kernel: [  157.561527] switch1: port 14(kinfra1) entered forwarding state
Sat Nov 25 12:14:48 2023 kern.info kernel: [  157.572770] device kinfra1 left promiscuous mode
Sat Nov 25 12:14:48 2023 kern.info kernel: [  157.573092] switch1: port 14(kinfra1) entered disabled state
Sat Nov 25 12:14:48 2023 kern.info kernel: [  157.628310] switch1: port 14(kinfra1) entered blocking state
Sat Nov 25 12:14:48 2023 kern.info kernel: [  157.628356] switch1: port 14(kinfra1) entered disabled state
Sat Nov 25 12:14:48 2023 kern.info kernel: [  157.633433] device kinfra1 entered promiscuous mode
Sat Nov 25 12:14:48 2023 kern.info kernel: [  157.638870] switch1: port 14(kinfra1) entered blocking state
Sat Nov 25 12:14:48 2023 kern.info kernel: [  157.643323] switch1: port 14(kinfra1) entered forwarding state
Sat Nov 25 12:14:48 2023 kern.info kernel: [  157.665980] IPv6: ADDRCONF(NETDEV_CHANGE): kinfra1: link becomes ready
Sat Nov 25 12:14:48 2023 kern.info kernel: [  157.666575] switch1: port 12(wap-knet1-prv) entered disabled state
Sat Nov 25 12:14:48 2023 kern.info kernel: [  157.671692] switch1: port 13(wap-knet1-ops) entered disabled state
Sat Nov 25 12:14:48 2023 kern.info kernel: [  157.677813] switch1: port 15(wap-fl1) entered disabled state
Sat Nov 25 12:14:48 2023 kern.info kernel: [  158.148477] switch1: port 16(wap-ops1) entered blocking state
Sat Nov 25 12:14:48 2023 kern.info kernel: [  158.148524] switch1: port 16(wap-ops1) entered disabled state
Sat Nov 25 12:14:48 2023 kern.info kernel: [  158.153435] device wap-ops1 entered promiscuous mode
Sat Nov 25 12:14:48 2023 kern.info kernel: [  158.160383] switch1: port 16(wap-ops1) entered blocking state
Sat Nov 25 12:14:48 2023 kern.info kernel: [  158.163979] switch1: port 16(wap-ops1) entered forwarding state
Sat Nov 25 12:14:48 2023 kern.info kernel: [  158.172247] device wap-ops1 left promiscuous mode
Sat Nov 25 12:14:48 2023 kern.info kernel: [  158.175443] switch1: port 16(wap-ops1) entered disabled state
Sat Nov 25 12:14:48 2023 kern.info kernel: [  158.227983] switch1: port 16(wap-ops1) entered blocking state
Sat Nov 25 12:14:48 2023 kern.info kernel: [  158.228024] switch1: port 16(wap-ops1) entered disabled state
Sat Nov 25 12:14:48 2023 kern.info kernel: [  158.233077] device wap-ops1 entered promiscuous mode
Sat Nov 25 12:14:48 2023 kern.info kernel: [  158.238642] switch1: port 16(wap-ops1) entered blocking state
Sat Nov 25 12:14:48 2023 kern.info kernel: [  158.243491] switch1: port 16(wap-ops1) entered forwarding state
Sat Nov 25 12:14:48 2023 daemon.notice hostapd: wap-onet1: interface state DFS->ENABLED
Sat Nov 25 12:14:48 2023 kern.info kernel: [  158.288842] switch1: port 10(wap-onet1) entered blocking state
Sat Nov 25 12:14:48 2023 kern.info kernel: [  158.288901] switch1: port 10(wap-onet1) entered forwarding state
Sat Nov 25 12:14:48 2023 kern.info kernel: [  158.295303] IPv6: ADDRCONF(NETDEV_CHANGE): wap-ops1: link becomes ready
Sat Nov 25 12:14:48 2023 daemon.notice hostapd: wap-onet1: AP-ENABLED
Sat Nov 25 12:14:48 2023 kern.info kernel: [  158.302151] IPv6: ADDRCONF(NETDEV_CHANGE): wap-knet1: link becomes ready
Sat Nov 25 12:14:48 2023 kern.info kernel: [  158.306544] switch1: port 11(wap-knet1) entered blocking state
Sat Nov 25 12:14:48 2023 kern.info kernel: [  158.313056] switch1: port 11(wap-knet1) entered forwarding state
Sat Nov 25 12:14:48 2023 kern.info kernel: [  158.319875] IPv6: ADDRCONF(NETDEV_CHANGE): wap-knet1-ops: link becomes ready
Sat Nov 25 12:14:48 2023 kern.info kernel: [  158.324984] switch1: port 13(wap-knet1-ops) entered blocking state
Sat Nov 25 12:14:48 2023 kern.info kernel: [  158.331944] switch1: port 13(wap-knet1-ops) entered forwarding state
Sat Nov 25 12:14:48 2023 kern.info kernel: [  158.338651] IPv6: ADDRCONF(NETDEV_CHANGE): wap-knet1-prv: link becomes ready
Sat Nov 25 12:14:48 2023 kern.info kernel: [  158.344487] switch1: port 12(wap-knet1-prv) entered blocking state
Sat Nov 25 12:14:48 2023 kern.info kernel: [  158.351446] switch1: port 12(wap-knet1-prv) entered forwarding state
Sat Nov 25 12:14:48 2023 kern.info kernel: [  158.360502] IPv6: ADDRCONF(NETDEV_CHANGE): wap-fl1: link becomes ready
Sat Nov 25 12:14:48 2023 kern.info kernel: [  158.364134] switch1: port 15(wap-fl1) entered blocking state
Sat Nov 25 12:14:48 2023 kern.info kernel: [  158.370296] switch1: port 15(wap-fl1) entered forwarding state
Sat Nov 25 12:14:48 2023 daemon.err hostapd: VLAN: vlan_event_receive: recvfrom failed: No buffer space available
Sat Nov 25 12:14:48 2023 daemon.err hostapd: VLAN: vlan_event_receive: recvfrom failed: No buffer space available
Sat Nov 25 12:14:48 2023 daemon.err hostapd: VLAN: vlan_event_receive: recvfrom failed: No buffer space available
Sat Nov 25 12:14:48 2023 daemon.err hostapd: VLAN: vlan_event_receive: recvfrom failed: No buffer space available
Sat Nov 25 12:14:48 2023 daemon.err hostapd: VLAN: vlan_event_receive: recvfrom failed: No buffer space available
Sat Nov 25 12:14:48 2023 daemon.err hostapd: VLAN: vlan_event_receive: recvfrom failed: No buffer space available
Sat Nov 25 12:14:48 2023 daemon.err hostapd: VLAN: vlan_event_receive: recvfrom failed: No buffer space available
Sat Nov 25 12:14:48 2023 daemon.err hostapd: VLAN: vlan_event_receive: recvfrom failed: No buffer space available
Sat Nov 25 12:14:51 2023 daemon.notice hostapd: handle_probe_req: send failed
Sat Nov 25 12:14:51 2023 daemon.notice hostapd: handle_probe_req: send failed
Sat Nov 25 12:14:51 2023 daemon.notice hostapd: handle_probe_req: send failed
Sat Nov 25 12:14:51 2023 daemon.notice hostapd: handle_probe_req: send failed
Sat Nov 25 12:14:55 2023 daemon.notice hostapd: handle_probe_req: send failed
Sat Nov 25 12:14:55 2023 daemon.notice hostapd: handle_probe_req: send failed
Sat Nov 25 12:14:59 2023 kern.info kernel: [  169.385986] switch1: port 6(wap-knet2) entered blocking state
Sat Nov 25 12:14:59 2023 kern.info kernel: [  169.386053] switch1: port 6(wap-knet2) entered forwarding state
Sat Nov 25 12:14:59 2023 kern.info kernel: [  169.414231] switch1: port 7(wap-fl2) entered blocking state
Sat Nov 25 12:14:59 2023 kern.info kernel: [  169.414289] switch1: port 7(wap-fl2) entered forwarding state

handle_probe_req: send failed is because the interface are started without beaconing (start_disabled=1).

My network setup:
###################

config interface 'loopback'
	option device 'lo'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'

config device
	option type 'bridge'
	option name 'switch1'
	option multicast_to_unicast '0'

config bridge-vlan
	option device 'switch1'
	option vlan '1'
	list ports 'wan'

config bridge-vlan
	option device 'switch1'
	option vlan '22'
	list ports 'wan:t'

config bridge-vlan
	option device 'switch1'
	option vlan '26'
	list ports 'wan:t'

config bridge-vlan
	option device 'switch1'
	option vlan '27'
	list ports 'wan:t'
	list ports 'lan1'
	list ports 'lan2'
	list ports 'lan3'

config interface 'lan'
	option device 'switch1.1'
	option proto 'static'
	option ipaddr '192.168.203.240'
	option netmask '255.255.255.0'
	option gateway '192.168.203.254'
	option dns '192.168.203.5'
	option ip6assign '0'

config interface 'opennet'
	option device 'switch1.22'
	option proto 'none'
	option ip6assign '0'
	option ipv6 '0'

config interface 'clients'
	option device 'switch1.27'
	option proto 'none'
	option ip6assign '0'
	option ipv6 '0'

config interface 'privacy'
	option device 'switch1.26'
	option proto 'none'
	option ip6assign '0'
	option ipv6 '0'
###################

Wireless config
###################
config wifi-device 'radio0'
	option type 'mac80211'
	option disabled '1'
	option country 'DE'
	option txpower '27'
	option supported_rates '12000 18000 24000 36000 48000 54000'
	option channel '36'
	option path 'soc/20000000.pci/pci0000:00/0000:00:00.0/0000:01:00.0'
	option htmode 'VHT80'
	option basic_rate '12000 18000 24000 36000 48000 54000'

config wifi-device 'radio1'
	option band '5g'
	option path 'platform/soc/c000000.wifi'
	option disabled '0'
	option channels '52 100 116'
	option type 'mac80211'
	option hwmode '11a'
	option txpower '27'
	option supported_rates '12000 18000 24000 36000 48000 54000'
	option channel '100'
	option country 'DE'
	option log_level '0'
	option htmode 'HE80'
	option basic_rate '12000 18000 24000 36000 48000 54000'

config wifi-iface 'radio1_OpenNet'
	option ifname 'wap-onet1'
         ...

config wifi-iface 'radio1_kalnet'
	option ifname 'wap-knet1'
	option dynamic_vlan '1'
         ...

config wifi-vlan
	option vid '22'
	option network 'opennet'
	option name 'ops'
	option iface 'radio1_kalnet'

config wifi-vlan
	option vid '26'
	option network 'privacy'
	option name 'prv'
	option iface 'radio1_kalnet'

config wifi-station
	option vid '22'
	option mac '00:00:00:00:00:00'
	option key 'freewifi'
	option iface 'radio1_kalnet'

config wifi-station
	option vid '26'
	option mac '00:00:00:00:00:00'
	option key 'privatewifi'
	option iface 'radio1_kalnet'

config wifi-iface 'radio1_kalnet6'
	option ifname 'wap-fl1'
         ....

config wifi-iface 'radio1_kalinfra'
	option wds '1'
	option ifname 'kinfra1'
         ...

config wifi-iface 'radio1_OpenNet_Secure'
	option ifname 'wap-ops1'
         ...

config wifi-device 'radio2'
	option band '2g'
	option path 'platform/soc/c000000.wifi+1'
	option disabled '0'
	option country 'DE'
	option hwmode '11g'
	option txpower '27'
	option supported_rates '6000 12000 18000 24000 36000 48000 54000'
	option channel '1'
	option type 'mac80211'
	option log_level '0'
	option htmode 'HE20'
	option basic_rate '6000 12000 18000 24000 36000 48000 54000'

config wifi-iface 'radio2_OpenNet'
	option ifname 'wap-onet2'
         ...

config wifi-iface 'radio2_kalnet'
	option ifname 'wap-knet2'
	option dynamic_vlan '1'
         ...

config wifi-vlan
	option vid '22'
	option network 'opennet'
	option name 'ops'
	option iface 'radio2_kalnet'

config wifi-vlan
	option vid '26'
	option network 'privacy'
	option name 'prv'
	option iface 'radio2_kalnet'

config wifi-station
	option vid '22'
	option mac '00:00:00:00:00:00'
	option key 'freewifi'
	option iface 'radio2_kalnet'

config wifi-station
	option vid '26'
	option mac '00:00:00:00:00:00'
	option key 'privatewifi'
	option iface 'radio2_kalnet'

config wifi-iface 'radio2_kalnet6'
	option ifname 'wap-fl2'
         ...

config wifi-iface 'radio2_kalinfra'
	option wds '1'
	option ifname 'kinfra2'
         ...

config wifi-iface 'radio2_OpenNet_Secure'
	option ifname 'wap-ops2'
         ...
###################

Does anybody have similiar problems with AP-VLAN usage?

From hauke at hauke-m.de  Sat Nov 25 08:14:30 2023
From: hauke at hauke-m.de (Hauke Mehrtens)
Date: Sat, 25 Nov 2023 17:14:30 +0100
Subject: Battlemesh x OpenWrt meeting in Cyprus?
In-Reply-To: <C61404F9-47BA-4DC5-AB4E-2EBD91FA6144@arinc9.com>
References: <51C0D325-E509-4D24-8B7B-3024230EB0F7@aparcar.org>
 <C61404F9-47BA-4DC5-AB4E-2EBD91FA6144@arinc9.com>
Message-ID: <e7a2f079-df20-445c-8e7c-5008254dd8fb@hauke-m.de>

Hi Ar?n? and Paul,

Thank you Ar?n? for organizing the Battlemesh in Cyprus.

I will probably join the Battlemesh again, but I wont have much time to 
organize stuff.

The following dates are currently proposed:
May 15 - 19
May 22 - 26
Wednesday - Sunday, 5 days.

Everyone who wants to join, please take part in the poll:
https://framadate.org/M4I9AYvKYypQTmGB

It is hard to get people together. I would suggest to plan an OpenWrt 
track on the last 2 days of Battlemesh in parallel.

Who would like to join?

Hauke

On 11/25/23 12:59, Ar?n? ?NAL wrote:
> Hello!
> 
> I am the head organiser of the next Battlemesh. I will also be involved
> the most on organising the OpenWrt summit. Let me know if you've got any
> questions. My website from my email address includes the channels other
> than email to reach me more easily.
> 
> Ar?n?
> 
> On 23 November 2023 23:54:16 EET, Paul Spooren <mail at aparcar.org> wrote:
>> Hi all,
>>
>> While attending this years Battlemesh in Spain some fellow mesh people asked why there weren?t more OpenWrt people around. I?m guessing it was mostly due to the lack of communication in advance, so I?d like to raise the topic here: Are people from the OpenWrt community, specially members and maintainers interested in collaborating with and attending the Battlemesh next year?
>>
>> They?d do most of the heavy lifting and would offer us to take some slots/space to do our own little OpenWrt meeting (remember the good and productive days in Hamburg anno 2019). Ideally at least one OpenWrt member would join their organizing team, I could do it but would also be happy if someone else jumps in.
>>
>> The general idea is to have a week long Battlemesh event in Cyprus, the OpenWrt part could happen both within the week, before or after, the full length or only a weekend etc. To my knowledge Cyprus offers an easier VISA process so more folks could join, I remember last time people wouldn?t get a VISA in time.
>>
>> If we participate we should raise some donations to offer travel stipends and come up with some (lighting) talks and presentations.
>>
>> I think the timeframe is ?somewhen in May 2024?, this will be further discussed on the Battlemesh mailing list.
>>
>> Looking forward to meet you all again!
>>
>> Sunshine,
>> Paul


From ehem+openwrtf at m5p.com  Sat Nov 25 09:36:33 2023
From: ehem+openwrtf at m5p.com (Elliott Mitchell)
Date: Sat, 25 Nov 2023 09:36:33 -0800
Subject: [PATCH 07/20] kernel: copy all built kernel modules to root
 filesystem image
In-Reply-To: <2c9616e5-bd42-4bd3-9c09-5fb9064e04c3@nbd.name>
References: <cover.1700010286.git.ehem+openwrt@m5p.com>
 <ee3fb185b494b4de05ca65725e0a96cffa307acb.1700010291.git.ehem+openwrt@m5p.com>
 <a4208395-30ad-4e90-8910-d52d1668db97@nbd.name>
 <ZVfbxhyjN7Y24Akh@mattapan.m5p.com>
 <a6c167a8-2f85-4e69-88e5-39fae2b1cd7f@nbd.name>
 <ZVq4Dp6vhOBpjKnS@mattapan.m5p.com>
 <CAOiHx=nygkx7uA6ERSFjBaa3R51YxzGqYzC6DHAhVorY8OifUQ@mail.gmail.com>
 <ZWFb0OdSHwIZCyiN@mattapan.m5p.com>
 <2c9616e5-bd42-4bd3-9c09-5fb9064e04c3@nbd.name>
Message-ID: <ZWIwoT4reAX9EluG@mattapan.m5p.com>

On Sat, Nov 25, 2023 at 07:08:20AM +0100, Felix Fietkau wrote:
> On 25.11.23 03:28, Elliott Mitchell wrote:
> > On Fri, Nov 24, 2023 at 01:53:01PM +0100, Jonas Gorski wrote:
> >> > > I'm fine with the cp -l change, but I think adding all remaining modules
> >> > > to the rootfs is not something we should do by default (maybe opt-in?)
> >> >
> >> > Perhaps.  This could also be handled by the approach the series as a
> >> > whole is aiming for.  If kernel module building used a separate object
> >> > directory from the kernel build, then modules selected in the device
> >> > configuration could be isolated.
> >> 
> >> Maybe instead of putting them into the rootfs, we could wrap them in a
> >> special package? Then you can select it if you want to include them in
> >> your image or not. No idea what to name it, kmod-remaining?
> >> kmod-unaccounted-for? kmod-not-appearing-in-the-definitions?
> >> 
> >> We could also try to wrap any unexpected .kos into autogenerated kmod
> >> packages based in their names (e.g. if we find a foo.ko, we
> >> autogenerate a kmod-foo.ipk for it), but these wouldn't be selectable
> >> then in menuconfig. Also not sure how well the build system would
> >> handle dynamic package generation.
> >> 
> >> Also going the other way around, maybe the build system should
> >> warn/complain about any .ko found that isn't wrapped in a kmod-*
> >> package.
> > 
> > All of these are plausible.  I think modules selected in device
> > configurations should get built and installed into the root filesystem.
> > Otherwise setting a device kernel configuration option to =m is broken.
> > 
> > Whereas forcing the explicit creation of packages for each and every
> > kernel module forces duplication of Kconfig functionality.

> The duplication you wish to avoid is there for a reason. The way the 
> kernel build system is set up, it makes it easy to build a highly 
> customized build for one target, or make a distribution build with 
> pretty much everything built as module. What it offers no solution for 
> is to maintain and keep in sync kernel configurations for a wide array 
> of different (often storage constrained) targets, while keeping a lot of 
> extra features/drivers optionally installable.
> That's exactly what our packaging around kernel modules + our kernel 
> config handling scripts were made for.
> 
> Since there is no perfect solution, there are always some trade-offs 
> involved. One of these trade-offs was our choice to not support adding 
> kernel modules in the device kernel config by selecting them as =m 
> there. I didn't consider that feature useful enough to justify the cost 
> of dealing with all the corner cases.
> 
> I still don't fully understand your motivation for adding this feature. 
> Is it just because you're bothered by having to write some extra 
> boilerplate code for adding kernel modules? Are there some cases where 
> the existing system cannot work for what you're trying to do?
> Or is there some other reason why you need this?

Mostly I strongly dislike setting =m wasting build time and having near-
zero effect on the resultant output.  In particular I see a
build/configuration targetting VMs to likely want to build/include many
modules, yet many of those not really deserving their own packages (since
many would be unneeded in many cases).

> Just to be clear, I'm not opposed to the feature you're proposing in any 
> way. What I want to avoid is adding something that works for your 
> special case but quickly breaks in weird ways when other people start 
> using it.

That is quite reasonable.  I've pushed this later in my queue since I
concluded the aim of the later patches will make a more acceptable
approach possible.

Hopefully I'll be able to resend the series in a few days, just need
some build testing to ensure I didn't break anything.  The first two
patches are going to remain unchanged as there simply isn't anything
which can be done to them.


-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |         ehem+sigmsg at m5p.com  PGP 87145445         |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445




From mrkiko.rs at gmail.com  Sun Nov 26 07:11:13 2023
From: mrkiko.rs at gmail.com (Enrico Mioso)
Date: Sun, 26 Nov 2023 16:11:13 +0100
Subject: [PATCH] mediatek: filogic: add support for GL.iNet GL-MT2500
Message-ID: <20231126151232.2244760-1-mrkiko.rs@gmail.com>

The GL-MT2500 is a Security Gateway based on MediaTek MT7981. It comes in
two variants: one with a plastic case, the other with an alluminium one. Both
variants run the same firmware.

Hardware specifications:
- SoC: MediaTek MT7981B
- CPU: 2x 1.3 GHz Cortex-A53
- Flash: 8GB EMMC
- RAM: 1 GB
- Ethernet:
	- 1x 10/100/1000 Mbps built-in PHY (LAN)
	- 1x 10/100/1000/2500 Mbps MaxLinear GPY211 PHY (WAN)
- USB 3.0 port
- Buttons: RESET button
- LEDs: 1x light-blue, 1x warm-white, 1x VPN
- Serial console: internal 4-pin header, 115200 8n1
- Power: 5 VDC, 3 A (USB Type-C)

MAC addresses assignment:
The label on the back of the device reports WAN (eth0) interface MAC address.
LAN interface (eth1) has WAN MAC address incremented by 1.

Installation:
-------------
Method 1 - via GL.iNet bootloader web failsafe UI
1. Connect to the LAN interface of the device (the one that's farther from
USB-C power supply connector).
2. Assign static IP 192.168.1.2/24 to the host.
3. Hold the reset button for at least 5 seconds while powering on the device.
If all went well, the bootloader should be responding to ICMP ping packets
and listening for web connections at 192.168.1.1. Upload the
*sysupgrade-squashfs image, then press the Update button. The device should
restart to OpenWrt.

Method 2 - via UART connection
1. Connect to device serial port.
2. Interrupt the boot process typing "gl".
3. Connect your host to the LAN port of the device and assign it static IP
192.168.1.2/24.
4. Start a TFTP server in your artifacts folder (e.g.:
openwrt/bin/targets/mediatek/filogic).
5. In the bootloader, issue these commands:
tftpboot openwrt-mediatek-filogic-glinet_gl-mt2500-initramfs-kernel.bin && bootm
this should bring you to the OpenWrt prompt where you can transfer a
sysupgrade image and proceed with the usual sysupgrade process.

Notes
-----
1. This port might not work on all hardware samples: in some cases, the unit
might just hang when probing EMMC.
2. The U-Boot environment might not be populated (empty EMMC partition) until
a "saveenv" command is issued. Do not initialize the environment from within
OpenWrt as this might cause problems due to the fact fw_printenv's default env
will not match the vendor's U-Boot one.

Untested features
-----------------
Flashing from stock web UI wasn't tested, but is expected to work, being stock
firmware shipped as a sysupgrade tar image as well.
Furthermore, going back to stock firmware wasn't tested, but should be possible
via U-Boot failsafe web UI.

CREDITS
------
Daniel Golle did the hard part of this port, so thank you!

Signed-off-by: Daniel Golle <daniel at makrotopia.org>
Signed-off-by: Enrico Mioso <mrkiko.rs at gmail.com>
---
 .../uboot-envtools/files/mediatek_filogic     |   1 +
 .../mediatek/dts/mt7981b-glinet-gl-mt2500.dts | 209 ++++++++++++++++++
 .../filogic/base-files/etc/board.d/02_network |   6 +
 .../base-files/lib/upgrade/platform.sh        |   2 +
 target/linux/mediatek/image/filogic.mk        |  11 +
 5 files changed, 229 insertions(+)
 create mode 100644 target/linux/mediatek/dts/mt7981b-glinet-gl-mt2500.dts

diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic
index ae8e1589a0..d678e1fcbd 100644
--- a/package/boot/uboot-envtools/files/mediatek_filogic
+++ b/package/boot/uboot-envtools/files/mediatek_filogic
@@ -77,6 +77,7 @@ xiaomi,redmi-router-ax6000-ubootmod)
 glinet,gl-mt3000)
 	ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x20000"
 	;;
+glinet,gl-mt2500|\
 glinet,gl-mt6000)
 	local envdev=$(find_mmc_part "u-boot-env")
 	ubootenv_add_uci_config "$envdev" "0x0" "0x80000"
diff --git a/target/linux/mediatek/dts/mt7981b-glinet-gl-mt2500.dts b/target/linux/mediatek/dts/mt7981b-glinet-gl-mt2500.dts
new file mode 100644
index 0000000000..58d4200d6c
--- /dev/null
+++ b/target/linux/mediatek/dts/mt7981b-glinet-gl-mt2500.dts
@@ -0,0 +1,209 @@
+/dts-v1/;
+#include "mt7981.dtsi"
+/ {
+	model = "GL.iNet GL-MT2500";
+	compatible = "glinet,gl-mt2500", "mediatek,mt7981";
+
+	chosen {
+		stdout-path = "serial0:115200n8";
+		bootargs-append = " root=PARTLABEL=rootfs rootwait";
+	};
+
+	aliases {
+		led-boot = &led_blue;
+		led-failsafe = &led_blue;
+		led-running = &led_white;
+		led-upgrade = &led_blue;
+		serial0 = &uart0;
+	};
+
+	reg_3p3v: regulator-3p3v {
+		compatible = "regulator-fixed";
+		regulator-name = "fixed-3.3V";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		regulator-boot-on;
+		regulator-always-on;
+	};
+
+	gpio-keys {
+		compatible = "gpio-keys";
+
+		reset {
+			label = "reset";
+			linux,code = <KEY_RESTART>;
+			gpios = <&pio 1 GPIO_ACTIVE_LOW>;
+		};
+	};
+
+	gpio-export {
+		compatible = "gpio-export";
+
+		usb_power {
+			gpio-export,name = "usb_power";
+			gpio-export,output = <1>;
+			gpios = <&pio 12 GPIO_ACTIVE_HIGH>;
+		};
+	};
+
+	leds {
+		compatible = "gpio-leds";
+
+		led at 0 {
+			label = "vpn";
+			gpios = <&pio 31 GPIO_ACTIVE_LOW>;
+		};
+
+		led_white: led at 1 {
+			label = "white:system";
+			gpios = <&pio 30 GPIO_ACTIVE_LOW>;
+		};
+
+		led_blue: led at 2 {
+			label = "blue:system";
+			gpios = <&pio 29 GPIO_ACTIVE_LOW>;
+			default-state = "on";
+		};
+	};
+};
+
+&uart0 {
+	status = "okay";
+};
+
+&watchdog {
+	status = "okay";
+};
+
+&mmc0 {
+	pinctrl-names = "default", "state_uhs";
+	pinctrl-0 = <&mmc0_pins_default>;
+	pinctrl-1 = <&mmc0_pins_uhs>;
+	bus-width = <8>;
+	max-frequency = <52000000>;
+	cap-mmc-highspeed;
+	vmmc-supply = <&reg_3p3v>;
+	non-removable;
+	status = "okay";
+	#address-cells = <1>;
+	#size-cells = <0>;
+
+	card at 0 {
+		compatible = "mmc-card";
+		reg = <0>;
+
+		block {
+			partitions {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				partition at 2 {
+					reg = <2>;
+					partname = "u-boot-env";
+					compatible = "nvmem-cells";
+				};
+
+				partition at 3 {
+					reg = <3>;
+					partname = "rf";
+					compatible = "nvmem-cells";
+				};
+			};
+		};
+
+		boot1 {
+			compatible = "nvmem-cells";
+
+			nvmem-layout {
+				compatible = "fixed-layout";
+				#address-cells = <1>;
+				#size-cells = <1>;
+
+				macaddr: macaddr at a {
+					compatible = "mac-base";
+					reg = <0xa 0x6>;
+					#nvmem-cell-cells = <1>;
+				};
+
+				ddns at 10 {
+					reg = <0x10 0x10>;
+				};
+
+				sn-bak at 20 {
+					reg = <0x20 0x10>;
+				};
+
+				sn at 30 {
+					reg = <0x30 0x10>;
+				};
+
+				country-code at 88 {
+					reg = <0x88 0x10>;
+				};
+			};
+		};
+	};
+};
+
+&eth {
+	pinctrl-names = "default";
+	pinctrl-0 = <&mdio_pins>;
+
+	status = "okay";
+
+	gmac0: mac at 0 {
+		compatible = "mediatek,eth-mac";
+		reg = <0>;
+		phy-mode = "2500base-x";
+		phy-handle = <&phy0>;
+//		nvmem-cells = <&macaddr 0>;
+//		nvmem-cell-names = "mac-address";
+	};
+
+	gmac1: mac at 1 {
+		compatible = "mediatek,eth-mac";
+		reg = <1>;
+		phy-mode = "gmii";
+		phy-handle = <&int_gbe_phy>;
+//		nvmem-cells = <&macaddr 1>;
+//		nvmem-cell-names = "mac-address";
+	};
+};
+
+&mdio_bus {
+	reset-gpios = <&pio 14 GPIO_ACTIVE_LOW>;
+	reset-delay-us = <600>;
+	reset-post-delay-us = <20000>;
+
+	phy0: ethernet-phy at 5 {
+		reg = <5>;
+		compatible = "ethernet-phy-ieee802.3-c45";
+		phy-mode = "2500base-x";
+	};
+};
+
+&pio {
+	mmc0_pins_default: mmc0-pins-default {
+		mux {
+			function = "flash";
+			groups = "emmc_45";
+		};
+	};
+	mmc0_pins_uhs: mmc0-pins-uhs {
+		mux {
+			function = "flash";
+			groups = "emmc_45";
+		};
+	};
+};
+
+&usb_phy {
+	status = "okay";
+};
+
+&xhci {
+	mediatek,u3p-dis-msk = <0x0>;
+	phys = <&u2port0 PHY_TYPE_USB2>,
+	       <&u3port0 PHY_TYPE_USB3>;
+	status = "okay";
+};
diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network
index 5153c156f6..ef0dab38d0 100644
--- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network
+++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network
@@ -32,6 +32,7 @@ mediatek_setup_interfaces()
 	h3c,magic-nx30-pro)
 		ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" eth1
 		;;
+	glinet,gl-mt2500|\
 	glinet,gl-mt3000)
 		ucidef_set_interfaces_lan_wan eth1 eth0
 		;;
@@ -109,6 +110,11 @@ mediatek_setup_macs()
 		;;
 		esac
 		;;
+	glinet,gl-mt2500)
+		label_mac=$(get_mac_binary /dev/mmcblk0boot1 0xa)
+		wan_mac=$label_mac
+		lan_mac=$(macaddr_add "$label_mac" 1)
+		;;
 	glinet,gl-mt6000)
 		label_mac=$(mmc_get_mac_binary factory 0x0a)
 		wan_mac=$label_mac
diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
index 3c278d5faf..6130768cb4 100755
--- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
+++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
@@ -97,6 +97,7 @@ platform_do_upgrade() {
 	cudy,wr3000-v1)
 		default_do_upgrade "$1"
 		;;
+	glinet,gl-mt2500|\
 	glinet,gl-mt6000)
 		CI_KERNPART="kernel"
 		CI_ROOTPART="rootfs"
@@ -176,6 +177,7 @@ platform_copy_config() {
 			;;
 		esac
 		;;
+	glinet,gl-mt2500|\
 	glinet,gl-mt6000|\
 	ubnt,unifi-6-plus)
 		emmc_copy_config
diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk
index 4886db1141..2adad62962 100644
--- a/target/linux/mediatek/image/filogic.mk
+++ b/target/linux/mediatek/image/filogic.mk
@@ -274,6 +274,17 @@ define Device/cudy_wr3000-v1
 endef
 TARGET_DEVICES += cudy_wr3000-v1
 
+define Device/glinet_gl-mt2500
+  DEVICE_VENDOR := GL.iNet
+  DEVICE_MODEL := GL-MT2500
+  DEVICE_DTS := mt7981b-glinet-gl-mt2500
+  DEVICE_DTS_DIR := ../dts
+  SUPPORTED_DEVICES += glinet,mt2500-emmc
+  DEVICE_PACKAGES := e2fsprogs f2fsck mkf2fs kmod-usb3 -kmod-mt7915e -wpad-basic-mbedtls
+  IMAGE/sysupgrade.bin := sysupgrade-tar | append-gl-metadata
+endef
+TARGET_DEVICES += glinet_gl-mt2500
+
 define Device/glinet_gl-mt3000
   DEVICE_VENDOR := GL.iNet
   DEVICE_MODEL := GL-MT3000
-- 
2.42.1



From daniel at makrotopia.org  Sun Nov 26 07:35:09 2023
From: daniel at makrotopia.org (Daniel Golle)
Date: Sun, 26 Nov 2023 15:35:09 +0000
Subject: [PATCH] mediatek: filogic: add support for GL.iNet GL-MT2500
In-Reply-To: <20231126151232.2244760-1-mrkiko.rs@gmail.com>
References: <20231126151232.2244760-1-mrkiko.rs@gmail.com>
Message-ID: <ZWNlrfDQOIlLVzag@makrotopia.org>

Hi Enrico,

thank you for advancing with support for this device!

See comments inline, mostly about left-overs from earlier draft
implementations of nvmem-on-MMC.

On Sun, Nov 26, 2023 at 04:11:13PM +0100, Enrico Mioso wrote:
> The GL-MT2500 is a Security Gateway based on MediaTek MT7981. It comes in
> two variants: one with a plastic case, the other with an alluminium one. Both
> variants run the same firmware.
> 
> Hardware specifications:
> - SoC: MediaTek MT7981B
> - CPU: 2x 1.3 GHz Cortex-A53
> - Flash: 8GB EMMC
> - RAM: 1 GB
> - Ethernet:
> 	- 1x 10/100/1000 Mbps built-in PHY (LAN)
> 	- 1x 10/100/1000/2500 Mbps MaxLinear GPY211 PHY (WAN)
> - USB 3.0 port
> - Buttons: RESET button
> - LEDs: 1x light-blue, 1x warm-white, 1x VPN
> - Serial console: internal 4-pin header, 115200 8n1
> - Power: 5 VDC, 3 A (USB Type-C)
> 
> MAC addresses assignment:
> The label on the back of the device reports WAN (eth0) interface MAC address.
> LAN interface (eth1) has WAN MAC address incremented by 1.
> 
> Installation:
> -------------
> Method 1 - via GL.iNet bootloader web failsafe UI
> 1. Connect to the LAN interface of the device (the one that's farther from
> USB-C power supply connector).
> 2. Assign static IP 192.168.1.2/24 to the host.
> 3. Hold the reset button for at least 5 seconds while powering on the device.
> If all went well, the bootloader should be responding to ICMP ping packets
> and listening for web connections at 192.168.1.1. Upload the
> *sysupgrade-squashfs image, then press the Update button. The device should
> restart to OpenWrt.
> 
> Method 2 - via UART connection
> 1. Connect to device serial port.
> 2. Interrupt the boot process typing "gl".
> 3. Connect your host to the LAN port of the device and assign it static IP
> 192.168.1.2/24.
> 4. Start a TFTP server in your artifacts folder (e.g.:
> openwrt/bin/targets/mediatek/filogic).
> 5. In the bootloader, issue these commands:
> tftpboot openwrt-mediatek-filogic-glinet_gl-mt2500-initramfs-kernel.bin && bootm
> this should bring you to the OpenWrt prompt where you can transfer a
> sysupgrade image and proceed with the usual sysupgrade process.
> 
> Notes
> -----
> 1. This port might not work on all hardware samples: in some cases, the unit
> might just hang when probing EMMC.
> 2. The U-Boot environment might not be populated (empty EMMC partition) until
> a "saveenv" command is issued. Do not initialize the environment from within
> OpenWrt as this might cause problems due to the fact fw_printenv's default env
> will not match the vendor's U-Boot one.
> 
> Untested features
> -----------------
> Flashing from stock web UI wasn't tested, but is expected to work, being stock
> firmware shipped as a sysupgrade tar image as well.
> Furthermore, going back to stock firmware wasn't tested, but should be possible
> via U-Boot failsafe web UI.
> 
> CREDITS
> ------
> Daniel Golle did the hard part of this port, so thank you!
> 
> Signed-off-by: Daniel Golle <daniel at makrotopia.org>
> Signed-off-by: Enrico Mioso <mrkiko.rs at gmail.com>
> ---
>  .../uboot-envtools/files/mediatek_filogic     |   1 +
>  .../mediatek/dts/mt7981b-glinet-gl-mt2500.dts | 209 ++++++++++++++++++
>  .../filogic/base-files/etc/board.d/02_network |   6 +
>  .../base-files/lib/upgrade/platform.sh        |   2 +
>  target/linux/mediatek/image/filogic.mk        |  11 +
>  5 files changed, 229 insertions(+)
>  create mode 100644 target/linux/mediatek/dts/mt7981b-glinet-gl-mt2500.dts
> 
> diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic
> index ae8e1589a0..d678e1fcbd 100644
> --- a/package/boot/uboot-envtools/files/mediatek_filogic
> +++ b/package/boot/uboot-envtools/files/mediatek_filogic
> @@ -77,6 +77,7 @@ xiaomi,redmi-router-ax6000-ubootmod)
>  glinet,gl-mt3000)
>  	ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x20000"
>  	;;
> +glinet,gl-mt2500|\
>  glinet,gl-mt6000)
>  	local envdev=$(find_mmc_part "u-boot-env")
>  	ubootenv_add_uci_config "$envdev" "0x0" "0x80000"
> diff --git a/target/linux/mediatek/dts/mt7981b-glinet-gl-mt2500.dts b/target/linux/mediatek/dts/mt7981b-glinet-gl-mt2500.dts
> new file mode 100644
> index 0000000000..58d4200d6c
> --- /dev/null
> +++ b/target/linux/mediatek/dts/mt7981b-glinet-gl-mt2500.dts
> @@ -0,0 +1,209 @@
> +/dts-v1/;
> +#include "mt7981.dtsi"
> +/ {
> +	model = "GL.iNet GL-MT2500";
> +	compatible = "glinet,gl-mt2500", "mediatek,mt7981";
> +
> +	chosen {
> +		stdout-path = "serial0:115200n8";
> +		bootargs-append = " root=PARTLABEL=rootfs rootwait";
> +	};
> +
> +	aliases {
> +		led-boot = &led_blue;
> +		led-failsafe = &led_blue;
> +		led-running = &led_white;
> +		led-upgrade = &led_blue;
> +		serial0 = &uart0;
> +	};
> +
> +	reg_3p3v: regulator-3p3v {
> +		compatible = "regulator-fixed";
> +		regulator-name = "fixed-3.3V";
> +		regulator-min-microvolt = <3300000>;
> +		regulator-max-microvolt = <3300000>;
> +		regulator-boot-on;
> +		regulator-always-on;
> +	};
> +
> +	gpio-keys {
> +		compatible = "gpio-keys";
> +
> +		reset {
> +			label = "reset";
> +			linux,code = <KEY_RESTART>;
> +			gpios = <&pio 1 GPIO_ACTIVE_LOW>;
> +		};
> +	};
> +
> +	gpio-export {
> +		compatible = "gpio-export";
> +
> +		usb_power {
> +			gpio-export,name = "usb_power";
> +			gpio-export,output = <1>;
> +			gpios = <&pio 12 GPIO_ACTIVE_HIGH>;
> +		};
> +	};
> +
> +	leds {
> +		compatible = "gpio-leds";
> +
> +		led at 0 {
> +			label = "vpn";
> +			gpios = <&pio 31 GPIO_ACTIVE_LOW>;
> +		};
> +
> +		led_white: led at 1 {
> +			label = "white:system";
> +			gpios = <&pio 30 GPIO_ACTIVE_LOW>;
> +		};
> +
> +		led_blue: led at 2 {
> +			label = "blue:system";
> +			gpios = <&pio 29 GPIO_ACTIVE_LOW>;
> +			default-state = "on";
> +		};
> +	};
> +};
> +
> +&uart0 {
> +	status = "okay";
> +};
> +
> +&watchdog {
> +	status = "okay";
> +};
> +
> +&mmc0 {
> +	pinctrl-names = "default", "state_uhs";
> +	pinctrl-0 = <&mmc0_pins_default>;
> +	pinctrl-1 = <&mmc0_pins_uhs>;
> +	bus-width = <8>;
> +	max-frequency = <52000000>;
> +	cap-mmc-highspeed;
> +	vmmc-supply = <&reg_3p3v>;
> +	non-removable;
> +	status = "okay";
> +	#address-cells = <1>;
> +	#size-cells = <0>;
> +
> +	card at 0 {

Please remove card at 0 from DT, it is not needed not and was for testing
future support of NVMEM on MMC (which I'd like to first get approved
upstream before starting to use it in OpenWrt).

In case you are interested, the WIP patches for that are here:

https://github.com/dangowrt/linux/commit/296ecde1da4d83e24c81dcc50a71d0db27e41088
https://github.com/dangowrt/linux/commit/fb68168efaeab49202c36e38e7771bfc53bb5067
https://github.com/dangowrt/linux/commit/d83b29b7d8a722b82f17bcdbf2d9b778460f12d4
https://github.com/dangowrt/linux/commit/109053c04b366dca1e0e006b60714e4a07ba441f
https://github.com/dangowrt/linux/commit/65122ec7c436254f1f72958be0272c54a5022b83
https://github.com/dangowrt/linux/commit/70e6bdcb818157b6261c3905edee94e0c1d39b9d
https://github.com/dangowrt/linux/commit/bfea727f2d27d9131417c619d449b67673308381


> +		compatible = "mmc-card";
> +		reg = <0>;
> +
> +		block {
> +			partitions {
> +				#address-cells = <1>;
> +				#size-cells = <0>;
> +
> +				partition at 2 {
> +					reg = <2>;
> +					partname = "u-boot-env";
> +					compatible = "nvmem-cells";
> +				};
> +
> +				partition at 3 {
> +					reg = <3>;
> +					partname = "rf";
> +					compatible = "nvmem-cells";
> +				};
> +			};
> +		};
> +
> +		boot1 {
> +			compatible = "nvmem-cells";
> +
> +			nvmem-layout {
> +				compatible = "fixed-layout";
> +				#address-cells = <1>;
> +				#size-cells = <1>;
> +
> +				macaddr: macaddr at a {
> +					compatible = "mac-base";
> +					reg = <0xa 0x6>;
> +					#nvmem-cell-cells = <1>;
> +				};
> +
> +				ddns at 10 {
> +					reg = <0x10 0x10>;
> +				};
> +
> +				sn-bak at 20 {
> +					reg = <0x20 0x10>;
> +				};
> +
> +				sn at 30 {
> +					reg = <0x30 0x10>;
> +				};
> +
> +				country-code at 88 {
> +					reg = <0x88 0x10>;
> +				};
> +			};
> +		};
> +	};
> +};
> +
> +&eth {
> +	pinctrl-names = "default";
> +	pinctrl-0 = <&mdio_pins>;
> +
> +	status = "okay";
> +
> +	gmac0: mac at 0 {
> +		compatible = "mediatek,eth-mac";
> +		reg = <0>;
> +		phy-mode = "2500base-x";
> +		phy-handle = <&phy0>;
> +//		nvmem-cells = <&macaddr 0>;
> +//		nvmem-cell-names = "mac-address";

Also the commented-out lines here and below referencing nvmem-cells
should be removed for now. Once NVMEM-on-MMC is supported, we should
re-add them.

> +	};
> +
> +	gmac1: mac at 1 {
> +		compatible = "mediatek,eth-mac";
> +		reg = <1>;
> +		phy-mode = "gmii";
> +		phy-handle = <&int_gbe_phy>;
> +//		nvmem-cells = <&macaddr 1>;
> +//		nvmem-cell-names = "mac-address";
> +	};
> +};
> +
> +&mdio_bus {
> +	reset-gpios = <&pio 14 GPIO_ACTIVE_LOW>;
> +	reset-delay-us = <600>;
> +	reset-post-delay-us = <20000>;
> +
> +	phy0: ethernet-phy at 5 {
> +		reg = <5>;
> +		compatible = "ethernet-phy-ieee802.3-c45";
> +		phy-mode = "2500base-x";
> +	};
> +};
> +
> +&pio {
> +	mmc0_pins_default: mmc0-pins-default {
> +		mux {
> +			function = "flash";
> +			groups = "emmc_45";
> +		};
> +	};
> +	mmc0_pins_uhs: mmc0-pins-uhs {
> +		mux {
> +			function = "flash";
> +			groups = "emmc_45";
> +		};
> +	};
> +};
> +
> +&usb_phy {
> +	status = "okay";
> +};
> +
> +&xhci {
> +	mediatek,u3p-dis-msk = <0x0>;
> +	phys = <&u2port0 PHY_TYPE_USB2>,
> +	       <&u3port0 PHY_TYPE_USB3>;
> +	status = "okay";
> +};
> diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network
> index 5153c156f6..ef0dab38d0 100644
> --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network
> +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network
> @@ -32,6 +32,7 @@ mediatek_setup_interfaces()
>  	h3c,magic-nx30-pro)
>  		ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" eth1
>  		;;
> +	glinet,gl-mt2500|\
>  	glinet,gl-mt3000)
>  		ucidef_set_interfaces_lan_wan eth1 eth0
>  		;;
> @@ -109,6 +110,11 @@ mediatek_setup_macs()
>  		;;
>  		esac
>  		;;
> +	glinet,gl-mt2500)
> +		label_mac=$(get_mac_binary /dev/mmcblk0boot1 0xa)
> +		wan_mac=$label_mac
> +		lan_mac=$(macaddr_add "$label_mac" 1)
> +		;;
>  	glinet,gl-mt6000)
>  		label_mac=$(mmc_get_mac_binary factory 0x0a)
>  		wan_mac=$label_mac
> diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
> index 3c278d5faf..6130768cb4 100755
> --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
> +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
> @@ -97,6 +97,7 @@ platform_do_upgrade() {
>  	cudy,wr3000-v1)
>  		default_do_upgrade "$1"
>  		;;
> +	glinet,gl-mt2500|\
>  	glinet,gl-mt6000)
>  		CI_KERNPART="kernel"
>  		CI_ROOTPART="rootfs"
> @@ -176,6 +177,7 @@ platform_copy_config() {
>  			;;
>  		esac
>  		;;
> +	glinet,gl-mt2500|\
>  	glinet,gl-mt6000|\
>  	ubnt,unifi-6-plus)
>  		emmc_copy_config
> diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk
> index 4886db1141..2adad62962 100644
> --- a/target/linux/mediatek/image/filogic.mk
> +++ b/target/linux/mediatek/image/filogic.mk
> @@ -274,6 +274,17 @@ define Device/cudy_wr3000-v1
>  endef
>  TARGET_DEVICES += cudy_wr3000-v1
>  
> +define Device/glinet_gl-mt2500
> +  DEVICE_VENDOR := GL.iNet
> +  DEVICE_MODEL := GL-MT2500
> +  DEVICE_DTS := mt7981b-glinet-gl-mt2500
> +  DEVICE_DTS_DIR := ../dts
> +  SUPPORTED_DEVICES += glinet,mt2500-emmc
> +  DEVICE_PACKAGES := e2fsprogs f2fsck mkf2fs kmod-usb3 -kmod-mt7915e -wpad-basic-mbedtls
> +  IMAGE/sysupgrade.bin := sysupgrade-tar | append-gl-metadata
> +endef
> +TARGET_DEVICES += glinet_gl-mt2500
> +
>  define Device/glinet_gl-mt3000
>    DEVICE_VENDOR := GL.iNet
>    DEVICE_MODEL := GL-MT3000
> -- 
> 2.42.1
> 


From mrkiko.rs at gmail.com  Sun Nov 26 10:51:41 2023
From: mrkiko.rs at gmail.com (Enrico Mioso)
Date: Sun, 26 Nov 2023 19:51:41 +0100
Subject: [PATCH] mediatek: filogic: add support for GL.iNet GL-MT2500
In-Reply-To: <ZWNlrfDQOIlLVzag@makrotopia.org>
References: <20231126151232.2244760-1-mrkiko.rs@gmail.com>
 <ZWNlrfDQOIlLVzag@makrotopia.org>
Message-ID: <ZWOTvbj403hRVTU0@rivendell>

On Sun, Nov 26, 2023 at 03:35:09PM +0000, Daniel Golle wrote:
> Hi Enrico,
> 
> thank you for advancing with support for this device!
> 
> See comments inline, mostly about left-overs from earlier draft
> implementations of nvmem-on-MMC.
> 
> On Sun, Nov 26, 2023 at 04:11:13PM +0100, Enrico Mioso wrote:
> > The GL-MT2500 is a Security Gateway based on MediaTek MT7981. It comes in
> > two variants: one with a plastic case, the other with an alluminium one. Both
> > variants run the same firmware.
> > 
> > Hardware specifications:
> > - SoC: MediaTek MT7981B
> > - CPU: 2x 1.3 GHz Cortex-A53
> > - Flash: 8GB EMMC
> > - RAM: 1 GB
> > - Ethernet:
> > 	- 1x 10/100/1000 Mbps built-in PHY (LAN)
> > 	- 1x 10/100/1000/2500 Mbps MaxLinear GPY211 PHY (WAN)
> > - USB 3.0 port
> > - Buttons: RESET button
> > - LEDs: 1x light-blue, 1x warm-white, 1x VPN
> > - Serial console: internal 4-pin header, 115200 8n1
> > - Power: 5 VDC, 3 A (USB Type-C)
> > 
> > MAC addresses assignment:
> > The label on the back of the device reports WAN (eth0) interface MAC address.
> > LAN interface (eth1) has WAN MAC address incremented by 1.
> > 
> > Installation:
> > -------------
> > Method 1 - via GL.iNet bootloader web failsafe UI
> > 1. Connect to the LAN interface of the device (the one that's farther from
> > USB-C power supply connector).
> > 2. Assign static IP 192.168.1.2/24 to the host.
> > 3. Hold the reset button for at least 5 seconds while powering on the device.
> > If all went well, the bootloader should be responding to ICMP ping packets
> > and listening for web connections at 192.168.1.1. Upload the
> > *sysupgrade-squashfs image, then press the Update button. The device should
> > restart to OpenWrt.
> > 
> > Method 2 - via UART connection
> > 1. Connect to device serial port.
> > 2. Interrupt the boot process typing "gl".
> > 3. Connect your host to the LAN port of the device and assign it static IP
> > 192.168.1.2/24.
> > 4. Start a TFTP server in your artifacts folder (e.g.:
> > openwrt/bin/targets/mediatek/filogic).
> > 5. In the bootloader, issue these commands:
> > tftpboot openwrt-mediatek-filogic-glinet_gl-mt2500-initramfs-kernel.bin && bootm
> > this should bring you to the OpenWrt prompt where you can transfer a
> > sysupgrade image and proceed with the usual sysupgrade process.
> > 
> > Notes
> > -----
> > 1. This port might not work on all hardware samples: in some cases, the unit
> > might just hang when probing EMMC.
> > 2. The U-Boot environment might not be populated (empty EMMC partition) until
> > a "saveenv" command is issued. Do not initialize the environment from within
> > OpenWrt as this might cause problems due to the fact fw_printenv's default env
> > will not match the vendor's U-Boot one.
> > 
> > Untested features
> > -----------------
> > Flashing from stock web UI wasn't tested, but is expected to work, being stock
> > firmware shipped as a sysupgrade tar image as well.
> > Furthermore, going back to stock firmware wasn't tested, but should be possible
> > via U-Boot failsafe web UI.
> > 
> > CREDITS
> > ------
> > Daniel Golle did the hard part of this port, so thank you!
> > 
> > Signed-off-by: Daniel Golle <daniel at makrotopia.org>
> > Signed-off-by: Enrico Mioso <mrkiko.rs at gmail.com>
> > ---
> >  .../uboot-envtools/files/mediatek_filogic     |   1 +
> >  .../mediatek/dts/mt7981b-glinet-gl-mt2500.dts | 209 ++++++++++++++++++
> >  .../filogic/base-files/etc/board.d/02_network |   6 +
> >  .../base-files/lib/upgrade/platform.sh        |   2 +
> >  target/linux/mediatek/image/filogic.mk        |  11 +
> >  5 files changed, 229 insertions(+)
> >  create mode 100644 target/linux/mediatek/dts/mt7981b-glinet-gl-mt2500.dts
> > 
> > diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic
> > index ae8e1589a0..d678e1fcbd 100644
> > --- a/package/boot/uboot-envtools/files/mediatek_filogic
> > +++ b/package/boot/uboot-envtools/files/mediatek_filogic
> > @@ -77,6 +77,7 @@ xiaomi,redmi-router-ax6000-ubootmod)
> >  glinet,gl-mt3000)
> >  	ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x20000"
> >  	;;
> > +glinet,gl-mt2500|\
> >  glinet,gl-mt6000)
> >  	local envdev=$(find_mmc_part "u-boot-env")
> >  	ubootenv_add_uci_config "$envdev" "0x0" "0x80000"
> > diff --git a/target/linux/mediatek/dts/mt7981b-glinet-gl-mt2500.dts b/target/linux/mediatek/dts/mt7981b-glinet-gl-mt2500.dts
> > new file mode 100644
> > index 0000000000..58d4200d6c
> > --- /dev/null
> > +++ b/target/linux/mediatek/dts/mt7981b-glinet-gl-mt2500.dts
> > @@ -0,0 +1,209 @@
> > +/dts-v1/;
> > +#include "mt7981.dtsi"
> > +/ {
> > +	model = "GL.iNet GL-MT2500";
> > +	compatible = "glinet,gl-mt2500", "mediatek,mt7981";
> > +
> > +	chosen {
> > +		stdout-path = "serial0:115200n8";
> > +		bootargs-append = " root=PARTLABEL=rootfs rootwait";
> > +	};
> > +
> > +	aliases {
> > +		led-boot = &led_blue;
> > +		led-failsafe = &led_blue;
> > +		led-running = &led_white;
> > +		led-upgrade = &led_blue;
> > +		serial0 = &uart0;
> > +	};
> > +
> > +	reg_3p3v: regulator-3p3v {
> > +		compatible = "regulator-fixed";
> > +		regulator-name = "fixed-3.3V";
> > +		regulator-min-microvolt = <3300000>;
> > +		regulator-max-microvolt = <3300000>;
> > +		regulator-boot-on;
> > +		regulator-always-on;
> > +	};
> > +
> > +	gpio-keys {
> > +		compatible = "gpio-keys";
> > +
> > +		reset {
> > +			label = "reset";
> > +			linux,code = <KEY_RESTART>;
> > +			gpios = <&pio 1 GPIO_ACTIVE_LOW>;
> > +		};
> > +	};
> > +
> > +	gpio-export {
> > +		compatible = "gpio-export";
> > +
> > +		usb_power {
> > +			gpio-export,name = "usb_power";
> > +			gpio-export,output = <1>;
> > +			gpios = <&pio 12 GPIO_ACTIVE_HIGH>;
> > +		};
> > +	};
> > +
> > +	leds {
> > +		compatible = "gpio-leds";
> > +
> > +		led at 0 {
> > +			label = "vpn";
> > +			gpios = <&pio 31 GPIO_ACTIVE_LOW>;
> > +		};
> > +
> > +		led_white: led at 1 {
> > +			label = "white:system";
> > +			gpios = <&pio 30 GPIO_ACTIVE_LOW>;
> > +		};
> > +
> > +		led_blue: led at 2 {
> > +			label = "blue:system";
> > +			gpios = <&pio 29 GPIO_ACTIVE_LOW>;
> > +			default-state = "on";
> > +		};
> > +	};
> > +};
> > +
> > +&uart0 {
> > +	status = "okay";
> > +};
> > +
> > +&watchdog {
> > +	status = "okay";
> > +};
> > +
> > +&mmc0 {
> > +	pinctrl-names = "default", "state_uhs";
> > +	pinctrl-0 = <&mmc0_pins_default>;
> > +	pinctrl-1 = <&mmc0_pins_uhs>;
> > +	bus-width = <8>;
> > +	max-frequency = <52000000>;
> > +	cap-mmc-highspeed;
> > +	vmmc-supply = <&reg_3p3v>;
> > +	non-removable;
> > +	status = "okay";
> > +	#address-cells = <1>;
> > +	#size-cells = <0>;
> > +
> > +	card at 0 {
> 
> Please remove card at 0 from DT, it is not needed not and was for testing
> future support of NVMEM on MMC (which I'd like to first get approved
> upstream before starting to use it in OpenWrt).
> 
> In case you are interested, the WIP patches for that are here:
> 
> https://github.com/dangowrt/linux/commit/296ecde1da4d83e24c81dcc50a71d0db27e41088
> https://github.com/dangowrt/linux/commit/fb68168efaeab49202c36e38e7771bfc53bb5067
> https://github.com/dangowrt/linux/commit/d83b29b7d8a722b82f17bcdbf2d9b778460f12d4
> https://github.com/dangowrt/linux/commit/109053c04b366dca1e0e006b60714e4a07ba441f
> https://github.com/dangowrt/linux/commit/65122ec7c436254f1f72958be0272c54a5022b83
> https://github.com/dangowrt/linux/commit/70e6bdcb818157b6261c3905edee94e0c1d39b9d
> https://github.com/dangowrt/linux/commit/bfea727f2d27d9131417c619d449b67673308381
> 
> 
> > +		compatible = "mmc-card";
> > +		reg = <0>;
> > +
> > +		block {
> > +			partitions {
> > +				#address-cells = <1>;
> > +				#size-cells = <0>;
> > +
> > +				partition at 2 {
> > +					reg = <2>;
> > +					partname = "u-boot-env";
> > +					compatible = "nvmem-cells";
> > +				};
> > +
> > +				partition at 3 {
> > +					reg = <3>;
> > +					partname = "rf";
> > +					compatible = "nvmem-cells";
> > +				};
> > +			};
> > +		};
> > +
> > +		boot1 {
> > +			compatible = "nvmem-cells";
> > +
> > +			nvmem-layout {
> > +				compatible = "fixed-layout";
> > +				#address-cells = <1>;
> > +				#size-cells = <1>;
> > +
> > +				macaddr: macaddr at a {
> > +					compatible = "mac-base";
> > +					reg = <0xa 0x6>;
> > +					#nvmem-cell-cells = <1>;
> > +				};
> > +
> > +				ddns at 10 {
> > +					reg = <0x10 0x10>;
> > +				};
> > +
> > +				sn-bak at 20 {
> > +					reg = <0x20 0x10>;
> > +				};
> > +
> > +				sn at 30 {
> > +					reg = <0x30 0x10>;
> > +				};
> > +
> > +				country-code at 88 {
> > +					reg = <0x88 0x10>;
> > +				};
> > +			};
> > +		};
> > +	};
> > +};
> > +
> > +&eth {
> > +	pinctrl-names = "default";
> > +	pinctrl-0 = <&mdio_pins>;
> > +
> > +	status = "okay";
> > +
> > +	gmac0: mac at 0 {
> > +		compatible = "mediatek,eth-mac";
> > +		reg = <0>;
> > +		phy-mode = "2500base-x";
> > +		phy-handle = <&phy0>;
> > +//		nvmem-cells = <&macaddr 0>;
> > +//		nvmem-cell-names = "mac-address";
> 
> Also the commented-out lines here and below referencing nvmem-cells
> should be removed for now. Once NVMEM-on-MMC is supported, we should
> re-add them.
> 
> > +	};
> > +
> > +	gmac1: mac at 1 {
> > +		compatible = "mediatek,eth-mac";
> > +		reg = <1>;
> > +		phy-mode = "gmii";
> > +		phy-handle = <&int_gbe_phy>;
> > +//		nvmem-cells = <&macaddr 1>;
> > +//		nvmem-cell-names = "mac-address";
> > +	};
> > +};
> > +
> > +&mdio_bus {
> > +	reset-gpios = <&pio 14 GPIO_ACTIVE_LOW>;
> > +	reset-delay-us = <600>;
> > +	reset-post-delay-us = <20000>;
> > +
> > +	phy0: ethernet-phy at 5 {
> > +		reg = <5>;
> > +		compatible = "ethernet-phy-ieee802.3-c45";
> > +		phy-mode = "2500base-x";
> > +	};
> > +};
> > +
> > +&pio {
> > +	mmc0_pins_default: mmc0-pins-default {
> > +		mux {
> > +			function = "flash";
> > +			groups = "emmc_45";
> > +		};
> > +	};
> > +	mmc0_pins_uhs: mmc0-pins-uhs {
> > +		mux {
> > +			function = "flash";
> > +			groups = "emmc_45";
> > +		};
> > +	};
> > +};
> > +
> > +&usb_phy {
> > +	status = "okay";
> > +};
> > +
> > +&xhci {
> > +	mediatek,u3p-dis-msk = <0x0>;
> > +	phys = <&u2port0 PHY_TYPE_USB2>,
> > +	       <&u3port0 PHY_TYPE_USB3>;
> > +	status = "okay";
> > +};
> > diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network
> > index 5153c156f6..ef0dab38d0 100644
> > --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network
> > +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network
> > @@ -32,6 +32,7 @@ mediatek_setup_interfaces()
> >  	h3c,magic-nx30-pro)
> >  		ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" eth1
> >  		;;
> > +	glinet,gl-mt2500|\
> >  	glinet,gl-mt3000)
> >  		ucidef_set_interfaces_lan_wan eth1 eth0
> >  		;;
> > @@ -109,6 +110,11 @@ mediatek_setup_macs()
> >  		;;
> >  		esac
> >  		;;
> > +	glinet,gl-mt2500)
> > +		label_mac=$(get_mac_binary /dev/mmcblk0boot1 0xa)
> > +		wan_mac=$label_mac
> > +		lan_mac=$(macaddr_add "$label_mac" 1)
> > +		;;
> >  	glinet,gl-mt6000)
> >  		label_mac=$(mmc_get_mac_binary factory 0x0a)
> >  		wan_mac=$label_mac
> > diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
> > index 3c278d5faf..6130768cb4 100755
> > --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
> > +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
> > @@ -97,6 +97,7 @@ platform_do_upgrade() {
> >  	cudy,wr3000-v1)
> >  		default_do_upgrade "$1"
> >  		;;
> > +	glinet,gl-mt2500|\
> >  	glinet,gl-mt6000)
> >  		CI_KERNPART="kernel"
> >  		CI_ROOTPART="rootfs"
> > @@ -176,6 +177,7 @@ platform_copy_config() {
> >  			;;
> >  		esac
> >  		;;
> > +	glinet,gl-mt2500|\
> >  	glinet,gl-mt6000|\
> >  	ubnt,unifi-6-plus)
> >  		emmc_copy_config
> > diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk
> > index 4886db1141..2adad62962 100644
> > --- a/target/linux/mediatek/image/filogic.mk
> > +++ b/target/linux/mediatek/image/filogic.mk
> > @@ -274,6 +274,17 @@ define Device/cudy_wr3000-v1
> >  endef
> >  TARGET_DEVICES += cudy_wr3000-v1
> >  
> > +define Device/glinet_gl-mt2500
> > +  DEVICE_VENDOR := GL.iNet
> > +  DEVICE_MODEL := GL-MT2500
> > +  DEVICE_DTS := mt7981b-glinet-gl-mt2500
> > +  DEVICE_DTS_DIR := ../dts
> > +  SUPPORTED_DEVICES += glinet,mt2500-emmc
> > +  DEVICE_PACKAGES := e2fsprogs f2fsck mkf2fs kmod-usb3 -kmod-mt7915e -wpad-basic-mbedtls
> > +  IMAGE/sysupgrade.bin := sysupgrade-tar | append-gl-metadata
> > +endef
> > +TARGET_DEVICES += glinet_gl-mt2500
> > +
> >  define Device/glinet_gl-mt3000
> >    DEVICE_VENDOR := GL.iNet
> >    DEVICE_MODEL := GL-MT3000
> > -- 
> > 2.42.1
> > 

Hi Daniel,
thanks a lot for the help and time reviewing this.
I am going to submit a new version shortly. 
BTW - how should we proceed with the VPN led name? May we leave it as it is or should we include a colour spec?

Thanks,
Enrico


From arinc.unal at arinc9.com  Sun Nov 26 11:06:44 2023
From: arinc.unal at arinc9.com (=?UTF-8?B?QXLEsW7DpyDDnE5BTA==?=)
Date: Sun, 26 Nov 2023 21:06:44 +0200
Subject: Battlemesh x OpenWrt meeting in Cyprus?
In-Reply-To: <e7a2f079-df20-445c-8e7c-5008254dd8fb@hauke-m.de>
References: <51C0D325-E509-4D24-8B7B-3024230EB0F7@aparcar.org>
 <C61404F9-47BA-4DC5-AB4E-2EBD91FA6144@arinc9.com>
 <e7a2f079-df20-445c-8e7c-5008254dd8fb@hauke-m.de>
Message-ID: <e466aa8a-9f7a-476c-a97e-87f5a182ec1f@arinc9.com>

I've just created a poll to decide the OpenWrt summit dates, see below. 
I also aim to see how many people are interested in the summit with this 
poll so please vote to decide the dates for the OpenWrt summit.

https://framadate.org/oGXhCQkygdpXGiTh

The "with Battlemesh" option represents the suggestion Hauke has made, 
the last 2 days of Battlemesh in parallel.

Beware if you're on mobile, there are 6 choices.

On 11/25/23 18:14, Hauke Mehrtens wrote:
> Hi Ar?n? and Paul,
> 
> Thank you Ar?n? for organizing the Battlemesh in Cyprus.
> 
> I will probably join the Battlemesh again, but I wont have much time to 
> organize stuff.
> 
> The following dates are currently proposed:
> May 15 - 19
> May 22 - 26
> Wednesday - Sunday, 5 days.
> 
> Everyone who wants to join, please take part in the poll:
> https://framadate.org/M4I9AYvKYypQTmGB
> 
> It is hard to get people together. I would suggest to plan an OpenWrt 
> track on the last 2 days of Battlemesh in parallel.
> 
> Who would like to join?
> 
> Hauke
> 
> On 11/25/23 12:59, Ar?n? ?NAL wrote:
>> Hello!
>>
>> I am the head organiser of the next Battlemesh. I will also be involved
>> the most on organising the OpenWrt summit. Let me know if you've got any
>> questions. My website from my email address includes the channels other
>> than email to reach me more easily.
>>
>> Ar?n?
>>
>> On 23 November 2023 23:54:16 EET, Paul Spooren <mail at aparcar.org> wrote:
>>> Hi all,
>>>
>>> While attending this years Battlemesh in Spain some fellow mesh 
>>> people asked why there weren?t more OpenWrt people around. I?m 
>>> guessing it was mostly due to the lack of communication in advance, 
>>> so I?d like to raise the topic here: Are people from the OpenWrt 
>>> community, specially members and maintainers interested in 
>>> collaborating with and attending the Battlemesh next year?
>>>
>>> They?d do most of the heavy lifting and would offer us to take some 
>>> slots/space to do our own little OpenWrt meeting (remember the good 
>>> and productive days in Hamburg anno 2019). Ideally at least one 
>>> OpenWrt member would join their organizing team, I could do it but 
>>> would also be happy if someone else jumps in.
>>>
>>> The general idea is to have a week long Battlemesh event in Cyprus, 
>>> the OpenWrt part could happen both within the week, before or after, 
>>> the full length or only a weekend etc. To my knowledge Cyprus offers 
>>> an easier VISA process so more folks could join, I remember last time 
>>> people wouldn?t get a VISA in time.
>>>
>>> If we participate we should raise some donations to offer travel 
>>> stipends and come up with some (lighting) talks and presentations.
>>>
>>> I think the timeframe is ?somewhen in May 2024?, this will be further 
>>> discussed on the Battlemesh mailing list.
>>>
>>> Looking forward to meet you all again!
>>>
>>> Sunshine,
>>> Paul


From mrkiko.rs at gmail.com  Sun Nov 26 11:23:42 2023
From: mrkiko.rs at gmail.com (Enrico Mioso)
Date: Sun, 26 Nov 2023 20:23:42 +0100
Subject: [PATCH V2] mediatek: filogic: add support for GL.iNet GL-MT2500
Message-ID: <20231126192356.2278513-1-mrkiko.rs@gmail.com>

The GL-MT2500 is a Security Gateway based on MediaTek MT7981. It comes in
two variants: one with a plastic case, the other with an alluminium one. Both
variants run the same firmware.

Hardware specifications:
- SoC: MediaTek MT7981B
- CPU: 2x 1.3 GHz Cortex-A53
- Flash: 8GB EMMC
- RAM: 1 GB
- Ethernet:
	- 1x 10/100/1000 Mbps built-in PHY (LAN)
	- 1x 10/100/1000/2500 Mbps MaxLinear GPY211 PHY (WAN)
- USB 3.0 port
- Buttons: RESET button
- LEDs: 1x light-blue, 1x warm-white, 1x VPN
- Serial console: internal 4-pin header, 115200 8n1
- Power: 5 VDC, 3 A (USB Type-C)

MAC addresses assignment:
The label on the back of the device reports WAN (eth0) interface MAC address.
LAN interface (eth1) has WAN MAC address incremented by 1.

Installation:
-------------
Method 1 - via GL.iNet bootloader web failsafe UI
1. Connect to the LAN interface of the device (the one that's farther from
USB-C power supply connector).
2. Assign static IP 192.168.1.2/24 to the host.
3. Hold the reset button for at least 5 seconds while powering on the device.
If all went well, the bootloader should be responding to ICMP ping packets
and listening for web connections at 192.168.1.1. Upload the
*sysupgrade-squashfs image, then press the Update button. The device should
restart to OpenWrt.

Method 2 - via UART connection
1. Connect to device serial port.
2. Interrupt the boot process typing "gl".
3. Connect your host to the LAN port of the device and assign it static IP
192.168.1.2/24.
4. Start a TFTP server in your artifacts folder (e.g.:
openwrt/bin/targets/mediatek/filogic).
5. In the bootloader, issue these commands:
tftpboot openwrt-mediatek-filogic-glinet_gl-mt2500-initramfs-kernel.bin && bootm
this should bring you to the OpenWrt prompt where you can transfer a
sysupgrade image and proceed with the usual sysupgrade process.

Notes
-----
1. This port might not work on all hardware samples: in some cases, the unit
might just hang when probing EMMC.
2. The U-Boot environment might not be populated (empty EMMC partition) until
a "saveenv" command is issued. Do not initialize the environment from within
OpenWrt as this might cause problems due to the fact fw_printenv's default env
will not match the vendor's U-Boot one.

Untested features
-----------------
Flashing from stock web UI wasn't tested, but is expected to work, being stock
firmware shipped as a sysupgrade tar image as well.
Furthermore, going back to stock firmware wasn't tested, but should be possible
via U-Boot failsafe web UI.

CREDITS
------
Daniel Golle did the hard part of this port, so thank you!

Signed-off-by: Daniel Golle <daniel at makrotopia.org>
Signed-off-by: Enrico Mioso <mrkiko.rs at gmail.com>
---
 .../uboot-envtools/files/mediatek_filogic     |   1 +
 .../mediatek/dts/mt7981b-glinet-gl-mt2500.dts | 149 ++++++++++++++++++
 .../filogic/base-files/etc/board.d/02_network |   6 +
 .../base-files/lib/upgrade/platform.sh        |   2 +
 target/linux/mediatek/image/filogic.mk        |  11 ++
 5 files changed, 169 insertions(+)
 create mode 100644 target/linux/mediatek/dts/mt7981b-glinet-gl-mt2500.dts

diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic
index ae8e1589a0..d678e1fcbd 100644
--- a/package/boot/uboot-envtools/files/mediatek_filogic
+++ b/package/boot/uboot-envtools/files/mediatek_filogic
@@ -77,6 +77,7 @@ xiaomi,redmi-router-ax6000-ubootmod)
 glinet,gl-mt3000)
 	ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x20000"
 	;;
+glinet,gl-mt2500|\
 glinet,gl-mt6000)
 	local envdev=$(find_mmc_part "u-boot-env")
 	ubootenv_add_uci_config "$envdev" "0x0" "0x80000"
diff --git a/target/linux/mediatek/dts/mt7981b-glinet-gl-mt2500.dts b/target/linux/mediatek/dts/mt7981b-glinet-gl-mt2500.dts
new file mode 100644
index 0000000000..0287fb7bc0
--- /dev/null
+++ b/target/linux/mediatek/dts/mt7981b-glinet-gl-mt2500.dts
@@ -0,0 +1,149 @@
+/dts-v1/;
+#include "mt7981.dtsi"
+/ {
+	model = "GL.iNet GL-MT2500";
+	compatible = "glinet,gl-mt2500", "mediatek,mt7981";
+
+	chosen {
+		stdout-path = "serial0:115200n8";
+		bootargs-append = " root=PARTLABEL=rootfs rootwait";
+	};
+
+	aliases {
+		led-boot = &led_blue;
+		led-failsafe = &led_blue;
+		led-running = &led_white;
+		led-upgrade = &led_blue;
+		serial0 = &uart0;
+	};
+
+	reg_3p3v: regulator-3p3v {
+		compatible = "regulator-fixed";
+		regulator-name = "fixed-3.3V";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		regulator-boot-on;
+		regulator-always-on;
+	};
+
+	gpio-keys {
+		compatible = "gpio-keys";
+
+		reset {
+			label = "reset";
+			linux,code = <KEY_RESTART>;
+			gpios = <&pio 1 GPIO_ACTIVE_LOW>;
+		};
+	};
+
+	gpio-export {
+		compatible = "gpio-export";
+
+		usb_power {
+			gpio-export,name = "usb_power";
+			gpio-export,output = <1>;
+			gpios = <&pio 12 GPIO_ACTIVE_HIGH>;
+		};
+	};
+
+	leds {
+		compatible = "gpio-leds";
+
+		led at 0 {
+			label = "vpn";
+			gpios = <&pio 31 GPIO_ACTIVE_LOW>;
+		};
+
+		led_white: led at 1 {
+			label = "white:system";
+			gpios = <&pio 30 GPIO_ACTIVE_LOW>;
+		};
+
+		led_blue: led at 2 {
+			label = "blue:system";
+			gpios = <&pio 29 GPIO_ACTIVE_LOW>;
+			default-state = "on";
+		};
+	};
+};
+
+&uart0 {
+	status = "okay";
+};
+
+&watchdog {
+	status = "okay";
+};
+
+&mmc0 {
+	pinctrl-names = "default", "state_uhs";
+	pinctrl-0 = <&mmc0_pins_default>;
+	pinctrl-1 = <&mmc0_pins_uhs>;
+	bus-width = <8>;
+	max-frequency = <52000000>;
+	cap-mmc-highspeed;
+	vmmc-supply = <&reg_3p3v>;
+	non-removable;
+	status = "okay";
+	#address-cells = <1>;
+	#size-cells = <0>;
+};
+
+&eth {
+	pinctrl-names = "default";
+	pinctrl-0 = <&mdio_pins>;
+
+	status = "okay";
+
+	gmac0: mac at 0 {
+		compatible = "mediatek,eth-mac";
+		reg = <0>;
+		phy-mode = "2500base-x";
+		phy-handle = <&phy0>;
+	};
+
+	gmac1: mac at 1 {
+		compatible = "mediatek,eth-mac";
+		reg = <1>;
+		phy-mode = "gmii";
+		phy-handle = <&int_gbe_phy>;
+	};
+};
+
+&mdio_bus {
+	reset-gpios = <&pio 14 GPIO_ACTIVE_LOW>;
+	reset-delay-us = <600>;
+	reset-post-delay-us = <20000>;
+
+	phy0: ethernet-phy at 5 {
+		reg = <5>;
+		compatible = "ethernet-phy-ieee802.3-c45";
+		phy-mode = "2500base-x";
+	};
+};
+
+&pio {
+	mmc0_pins_default: mmc0-pins-default {
+		mux {
+			function = "flash";
+			groups = "emmc_45";
+		};
+	};
+	mmc0_pins_uhs: mmc0-pins-uhs {
+		mux {
+			function = "flash";
+			groups = "emmc_45";
+		};
+	};
+};
+
+&usb_phy {
+	status = "okay";
+};
+
+&xhci {
+	mediatek,u3p-dis-msk = <0x0>;
+	phys = <&u2port0 PHY_TYPE_USB2>,
+	       <&u3port0 PHY_TYPE_USB3>;
+	status = "okay";
+};
diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network
index 5153c156f6..ef0dab38d0 100644
--- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network
+++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network
@@ -32,6 +32,7 @@ mediatek_setup_interfaces()
 	h3c,magic-nx30-pro)
 		ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" eth1
 		;;
+	glinet,gl-mt2500|\
 	glinet,gl-mt3000)
 		ucidef_set_interfaces_lan_wan eth1 eth0
 		;;
@@ -109,6 +110,11 @@ mediatek_setup_macs()
 		;;
 		esac
 		;;
+	glinet,gl-mt2500)
+		label_mac=$(get_mac_binary /dev/mmcblk0boot1 0xa)
+		wan_mac=$label_mac
+		lan_mac=$(macaddr_add "$label_mac" 1)
+		;;
 	glinet,gl-mt6000)
 		label_mac=$(mmc_get_mac_binary factory 0x0a)
 		wan_mac=$label_mac
diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
index 3c278d5faf..6130768cb4 100755
--- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
+++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
@@ -97,6 +97,7 @@ platform_do_upgrade() {
 	cudy,wr3000-v1)
 		default_do_upgrade "$1"
 		;;
+	glinet,gl-mt2500|\
 	glinet,gl-mt6000)
 		CI_KERNPART="kernel"
 		CI_ROOTPART="rootfs"
@@ -176,6 +177,7 @@ platform_copy_config() {
 			;;
 		esac
 		;;
+	glinet,gl-mt2500|\
 	glinet,gl-mt6000|\
 	ubnt,unifi-6-plus)
 		emmc_copy_config
diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk
index 4886db1141..2adad62962 100644
--- a/target/linux/mediatek/image/filogic.mk
+++ b/target/linux/mediatek/image/filogic.mk
@@ -274,6 +274,17 @@ define Device/cudy_wr3000-v1
 endef
 TARGET_DEVICES += cudy_wr3000-v1
 
+define Device/glinet_gl-mt2500
+  DEVICE_VENDOR := GL.iNet
+  DEVICE_MODEL := GL-MT2500
+  DEVICE_DTS := mt7981b-glinet-gl-mt2500
+  DEVICE_DTS_DIR := ../dts
+  SUPPORTED_DEVICES += glinet,mt2500-emmc
+  DEVICE_PACKAGES := e2fsprogs f2fsck mkf2fs kmod-usb3 -kmod-mt7915e -wpad-basic-mbedtls
+  IMAGE/sysupgrade.bin := sysupgrade-tar | append-gl-metadata
+endef
+TARGET_DEVICES += glinet_gl-mt2500
+
 define Device/glinet_gl-mt3000
   DEVICE_VENDOR := GL.iNet
   DEVICE_MODEL := GL-MT3000
-- 
2.42.1



From zajec5 at gmail.com  Sun Nov 26 12:24:28 2023
From: zajec5 at gmail.com (=?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?=)
Date: Sun, 26 Nov 2023 21:24:28 +0100
Subject: [PATCH RFC] base-files: execute package's "postinst" after executing uci-defaults
Message-ID: <20231126202428.1158-1-zajec5@gmail.com>

From: Rafa? Mi?ecki <rafal at milecki.pl>

With this change "postinst" scripts can perform extra actions after
applying all kind of fixups implemented using uci-defaults.

This is needed e.g. by uhttpd-mod-ubus which after installation in a
running systems needs to:
1. Update uhttpd config using its uci-defaults script
2. Reload uhttpd

Cc: Hauke Mehrtens <hauke at hauke-m.de>
Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
---
I noticed that kind of hacky code was added in the commit d25d281fd668
("uhttpd: Reload config after uhttpd-mod-ubus was added") to reload
uhttpd after "opkg install". It abuses uci-defaults script to call
init.d script. It's a wrong idea as uci-defaults should run before
running services during first boot. It doesn't allow further config
adjustments by other uci-defaults as uhttpd gets started early.

This change would allow moving uhttpd-mod-ubus's reload to postinst.

The question is: can this change break anything?

 package/base-files/files/lib/functions.sh | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh
index d9628dbb7a..851d2f1791 100644
--- a/package/base-files/files/lib/functions.sh
+++ b/package/base-files/files/lib/functions.sh
@@ -270,11 +270,6 @@ default_postinst() {
 
 	add_group_and_user "${pkgname}"
 
-	if [ -f "$root/usr/lib/opkg/info/${pkgname}.postinst-pkg" ]; then
-		( . "$root/usr/lib/opkg/info/${pkgname}.postinst-pkg" )
-		ret=$?
-	fi
-
 	if [ -d "$root/rootfs-overlay" ]; then
 		cp -R $root/rootfs-overlay/. $root/
 		rm -fR $root/rootfs-overlay/
@@ -300,6 +295,11 @@ default_postinst() {
 		rm -f /tmp/luci-indexcache
 	fi
 
+	if [ -f "$root/usr/lib/opkg/info/${pkgname}.postinst-pkg" ]; then
+		( . "$root/usr/lib/opkg/info/${pkgname}.postinst-pkg" )
+		ret=$?
+	fi
+
 	local shell="$(command -v bash)"
 	for i in $(grep -s "^/etc/init.d/" "$root$filelist"); do
 		if [ -n "$root" ]; then
-- 
2.35.3



From zajec5 at gmail.com  Sun Nov 26 12:47:39 2023
From: zajec5 at gmail.com (=?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?=)
Date: Sun, 26 Nov 2023 21:47:39 +0100
Subject: [PATCH] uhttpd: uhttpd-mod-ubus: reload uhttpd only if it's runtime install
Message-ID: <20231126204739.14315-1-zajec5@gmail.com>

From: Rafa? Mi?ecki <rafal at milecki.pl>

Reloading service from uci-defaults script is a hack to workaround
postinst limitation. It should not be executed during boot as other
uci-defaults scripts may want to adjust uhttpd's config too.

Cc: Hauke Mehrtens <hauke at hauke-m.de>
Fixes: d25d281fd668 ("uhttpd: Reload config after uhttpd-mod-ubus was added")
Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
---
 package/network/services/uhttpd/Makefile           |  2 +-
 package/network/services/uhttpd/files/ubus.default | 13 ++++++++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/package/network/services/uhttpd/Makefile b/package/network/services/uhttpd/Makefile
index 02a02405fd..9405070626 100644
--- a/package/network/services/uhttpd/Makefile
+++ b/package/network/services/uhttpd/Makefile
@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=uhttpd
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL=$(PROJECT_GIT)/project/uhttpd.git
diff --git a/package/network/services/uhttpd/files/ubus.default b/package/network/services/uhttpd/files/ubus.default
index 474016c1c5..e2240a1018 100644
--- a/package/network/services/uhttpd/files/ubus.default
+++ b/package/network/services/uhttpd/files/ubus.default
@@ -12,6 +12,17 @@ fi
 	commit=1
 }
 
-[ "$commit" = 1 ] && uci commit uhttpd && /etc/init.d/uhttpd reload
+# Normally (when executing this script during boot) we want to adjust config
+# only. Actual uhttpd start will happen later.
+#
+# If this is package installation in a running system however then we need to
+# reload uhttpd to make ubus access work right after. Ideally this should be
+# handled by a "postinst" script but those get executed *before* uci-defaults
+# scripts. For that reason we abuse uci-defaults to call init.d script.
+#
+# Check for $PKG_ROOT to detect "opkg install" case in a running system.
+if [ -n "$PKG_ROOT" ]; then
+	[ "$commit" = 1 ] && uci commit uhttpd && /etc/init.d/uhttpd reload
+fi
 
 exit 0
-- 
2.35.3



From noreply at github.com  Sun Nov 26 13:31:54 2023
From: noreply at github.com (Stephen Walker)
Date: Sun, 26 Nov 2023 13:31:54 -0800
Subject: [sdwalker/sdwalker.github.io] 12bc2b: This week's update
Message-ID: <sdwalker/sdwalker.github.io/push/refs/heads/master/7df39f-12bc2b@github.com>

  Branch: refs/heads/master
  Home:   https://github.com/sdwalker/sdwalker.github.io
  Commit: 12bc2b6ba9ce70d746b2b452a149a9ccab153e39
      https://github.com/sdwalker/sdwalker.github.io/commit/12bc2b6ba9ce70d746b2b452a149a9ccab153e39
  Author: Stephen Walker <stephendwalker+github at gmail.com>
  Date:   2023-11-26 (Sun, 26 Nov 2023)

  Changed paths:
    M uscan/index-22.03.html
    M uscan/index-23.05.html
    M uscan/index.html

  Log Message:
  -----------
  This week's update




From daniel at makrotopia.org  Sun Nov 26 13:54:32 2023
From: daniel at makrotopia.org (Daniel Golle)
Date: Sun, 26 Nov 2023 21:54:32 +0000
Subject: Battlemesh x OpenWrt meeting in Cyprus?
In-Reply-To: <e7a2f079-df20-445c-8e7c-5008254dd8fb@hauke-m.de>
References: <51C0D325-E509-4D24-8B7B-3024230EB0F7@aparcar.org>
 <C61404F9-47BA-4DC5-AB4E-2EBD91FA6144@arinc9.com>
 <e7a2f079-df20-445c-8e7c-5008254dd8fb@hauke-m.de>
Message-ID: <ZWO-mOQW1F7pk_LT@makrotopia.org>

Hi Everyone,

On Sat, Nov 25, 2023 at 05:14:30PM +0100, Hauke Mehrtens wrote:
> Hi Ar?n? and Paul,
> 
> Thank you Ar?n? for organizing the Battlemesh in Cyprus.
> 
> I will probably join the Battlemesh again, but I wont have much time to
> organize stuff.
> 
> The following dates are currently proposed:
> May 15 - 19
> May 22 - 26
> Wednesday - Sunday, 5 days.
> 
> Everyone who wants to join, please take part in the poll:
> https://framadate.org/M4I9AYvKYypQTmGB
> 
> It is hard to get people together. I would suggest to plan an OpenWrt track
> on the last 2 days of Battlemesh in parallel.
> 
> Who would like to join?

I think that a dedicated OpenWrt meeting like in 2019 would be very
good, like a mini-summit for OpenWrt devs to present ongoing work and
recent achievements, but also just meet and talk in person and
possibly even ending up hacking on stuff together.

An official invitation to the OpenWrt meeting/mini-summit and
endorsement of Battlemesh should happen early via all OpenWrt channels
(*-adm mailing list, IRC, Web, Forums). Also, as it's going to be
OpenWrt's 20th anniversary in 2024, we should use that opportunity to
also reach out to a wider audience, ie. prepare some more layer 8/9
talks about the OpenWrt project or the role of free software in the
context of both, protocol research and grassroots networks.

I'm ready to be involved in organizational aspects and also take care
of reaching out to the wider community once we decided on the date.


Cheers

Daniel

> 
> Hauke
> 
> On 11/25/23 12:59, Ar?n? ?NAL wrote:
> > Hello!
> > 
> > I am the head organiser of the next Battlemesh. I will also be involved
> > the most on organising the OpenWrt summit. Let me know if you've got any
> > questions. My website from my email address includes the channels other
> > than email to reach me more easily.
> > 
> > Ar?n?
> > 
> > On 23 November 2023 23:54:16 EET, Paul Spooren <mail at aparcar.org> wrote:
> > > Hi all,
> > > 
> > > While attending this years Battlemesh in Spain some fellow mesh people asked why there weren?t more OpenWrt people around. I?m guessing it was mostly due to the lack of communication in advance, so I?d like to raise the topic here: Are people from the OpenWrt community, specially members and maintainers interested in collaborating with and attending the Battlemesh next year?
> > > 
> > > They?d do most of the heavy lifting and would offer us to take some slots/space to do our own little OpenWrt meeting (remember the good and productive days in Hamburg anno 2019). Ideally at least one OpenWrt member would join their organizing team, I could do it but would also be happy if someone else jumps in.
> > > 
> > > The general idea is to have a week long Battlemesh event in Cyprus, the OpenWrt part could happen both within the week, before or after, the full length or only a weekend etc. To my knowledge Cyprus offers an easier VISA process so more folks could join, I remember last time people wouldn?t get a VISA in time.
> > > 
> > > If we participate we should raise some donations to offer travel stipends and come up with some (lighting) talks and presentations.
> > > 
> > > I think the timeframe is ?somewhen in May 2024?, this will be further discussed on the Battlemesh mailing list.
> > > 
> > > Looking forward to meet you all again!
> > > 
> > > Sunshine,
> > > Paul
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel


From zajec5 at gmail.com  Sun Nov 26 22:28:35 2023
From: zajec5 at gmail.com (=?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?=)
Date: Mon, 27 Nov 2023 07:28:35 +0100
Subject: [PATCH] kernel: force atomic renames in ubifs
In-Reply-To: <1385203476.101372.1646163444601.JavaMail.zimbra@nod.at>
References: <20220301191329.22329-1-zajec5@gmail.com>
 <1385203476.101372.1646163444601.JavaMail.zimbra@nod.at>
Message-ID: <4207f9a0-701f-4909-8c3c-41085ba51398@gmail.com>

Hi Richard,

On 1.03.2022 20:37, Richard Weinberger wrote:
> ----- Urspr?ngliche Mail -----
>> Von: "Rafa? Mi?ecki" <zajec5 at gmail.com>
>> An: "OpenWrt Development List" <openwrt-devel at lists.openwrt.org>
>> CC: "Koen Vandeputte" <koen.vandeputte at ncentric.com>, "richard" <richard at nod.at>, "Rafa? Mi?ecki" <rafal at milecki.pl>
>> Gesendet: Dienstag, 1. M?rz 2022 20:13:29
>> Betreff: [PATCH] kernel: force atomic renames in ubifs
> 
>> From: Rafa? Mi?ecki <rafal at milecki.pl>
>>
>> This deals with user-spaces apps that don't handle all syncing
>> correctly. It prevents user ending up with an empty file.
>>
>> Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
>> ---
>> .../510-ubifs-force-atomic-renames.patch      | 46 +++++++++++++++++++
>> .../510-ubifs-force-atomic-renames.patch      | 46 +++++++++++++++++++
>> 2 files changed, 92 insertions(+)
>> create mode 100644
>> target/linux/generic/pending-5.10/510-ubifs-force-atomic-renames.patch
>> create mode 100644
>> target/linux/generic/pending-5.4/510-ubifs-force-atomic-renames.patch
>>
>> diff --git
>> a/target/linux/generic/pending-5.10/510-ubifs-force-atomic-renames.patch
>> b/target/linux/generic/pending-5.10/510-ubifs-force-atomic-renames.patch
>> new file mode 100644
>> index 0000000000..80f5f1b910
>> --- /dev/null
>> +++ b/target/linux/generic/pending-5.10/510-ubifs-force-atomic-renames.patch
>> @@ -0,0 +1,46 @@
>> +From: Richard Weinberger <richard at nod.at>
>> +Date: Mon, 28 Feb 2022 16:07:41 +0100
>> +Subject: [PATCH] ubifs: force atomic renames
>> +MIME-Version: 1.0
>> +Content-Type: text/plain; charset=UTF-8
>> +Content-Transfer-Encoding: 8bit
>> +
>> +Before actual rename make sure that the old inode data has been flash
>> +written. This is similar to what other filesystems do and workarounds
>> +bugs in some user-space apps.
>> +
>> +With this change updating file using tmpfile & rename() will never
>> +result in losing all content e.g. on power cut.
> 
> Please slow down a bit. :-)
> The commit message is not written by me and also not entirely correct.
> 
> The patch is not about making rename atomic. rename is already atomic
> on UBIFS.
> It is about syncing in flight pages when a file is overwritten by rename.
> 
> While I plan to upstream this change it still needs more testing.
> I'm also not sure about the overhead it causes. Flushing the write buffers
> can cause more garbage collection and may trigger write amplification.

I didn't end up pushing this change to OpenWrt since your e-mail. I use
it however in my project in production in thousands of devices. I'd very
much like to see a proper change upstream.

Could you take a look at it, please?



From xiaojun.liu at silicom.co.il  Mon Nov 27 22:20:17 2023
From: xiaojun.liu at silicom.co.il (Xiaojun Liu)
Date: Tue, 28 Nov 2023 06:20:17 +0000
Subject: [PATCH] kernel: add kernel module support for input sparse devices
Message-ID: <DU0PR04MB9660C07F56C674AD6DCD68C3BDBCA@DU0PR04MB9660.eurprd04.prod.outlook.com>

add kernel module support for input sparse devices
    
Signed-off-by: Xiaojun Liu mailto:xiaojun.liu at silicom.co.il
--

 package/kernel/linux/modules/input.mk | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/package/kernel/linux/modules/input.mk b/package/kernel/linux/modules/input.mk
index 92587b1874..26c0007c1c 100644
--- a/package/kernel/linux/modules/input.mk
+++ b/package/kernel/linux/modules/input.mk
@@ -157,6 +157,21 @@ endef
 
 $(eval $(call KernelPackage,input-matrixkmap))
 
+define KernelPackage/input-sparsekmap
+  SUBMENU:=$(INPUT_MODULES_MENU)
+  TITLE:=Input sparse devices support
+  DEPENDS:=+kmod-input-core
+  KCONFIG:= \
+	CONFIG_INPUT_SPARSEKMAP=y
+  FILES:=$(LINUX_DIR)/drivers/input/sparse-keymap.ko
+  AUTOLOAD:=$(call AutoProbe,sparse-keymap)
+endef
+
+define KernelPackage/input-sparsekmap/description
+ Kernel module support for input sparse devices
+endef
+
+$(eval $(call KernelPackage,input-sparsekmap))
 
 define KernelPackage/input-touchscreen-ads7846
   SUBMENU:=$(INPUT_MODULES_MENU)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kernel add kernel module support for input sparse devices.patch
Type: application/octet-stream
Size: 827 bytes
Desc: kernel add kernel module support for input sparse devices.patch
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20231128/8bcb4d7c/attachment.obj>

From e9hack at gmail.com  Tue Nov 28 08:00:05 2023
From: e9hack at gmail.com (e9hack)
Date: Tue, 28 Nov 2023 17:00:05 +0100
Subject: libubox compile issue
Message-ID: <a9056d13-7492-42fd-9366-450cf0833ae0@gmail.com>

Hi,

since commit 'libubox: update to Git HEAD (2023-11-27)', I've trouble to compile libubox:

[43/46] Building C object CMakeFiles/jshn.dir/jshn.c.o
[44/46] Linking C executable jshn
FAILED: jshn
: && /data/src/LEDE/RT-AX53U-5.15.x/staging_dir/host/bin/gcc -O2 -I/data/src/LEDE/RT-AX53U-5.15.x/staging_dir/host/include -I/data/src/LEDE/RT-AX53U-5.15.x/staging_dir/hostpkg/include -I/data/src/LEDE/RT-AX53U-5.15.x/staging_dir/target-mipsel_1004kc_musl/host/include -DNDEBUG -L/data/src/LEDE/RT-AX53U-5.15.x/staging_dir/host/lib -L/data/src/LEDE/RT-AX53U-5.15.x/staging_dir/hostpkg/lib -L/data/src/LEDE/RT-AX53U-5.15.x/staging_dir/target-mipsel_1004kc_musl/host/lib   -rdynamic CMakeFiles/jshn.dir/jshn.c.o -o jshn  -Wl,-rpath,/data/src/LEDE/RT-AX53U-5.15.x/build_dir/hostpkg/libubox-2023-11-27-d4c3066e:  libblobmsg_json.so  -Wl,-Bstatic  -ljson-c  -Wl,-Bdynamic  libubox.so && :
/usr/bin/ld: libubox.so: undefined reference to `shm_unlink'
/usr/bin/ld: libubox.so: undefined reference to `shm_open'
collect2: error: ld returned 1 exit status
[45/46] Building C object CMakeFiles/json_script.dir/json_script.c.o
ninja: build stopped: subcommand failed.
make[2]: *** [Makefile:117: /data/src/LEDE/RT-AX53U-5.15.x/build_dir/hostpkg/libubox-2023-11-27-d4c3066e/.built] Error 1
make[2]: Leaving directory '/data/src/LEDE/RT-AX53U-5.15.x/package/libs/libubox'

Regards,
Hartmut


From nbd at nbd.name  Tue Nov 28 13:13:31 2023
From: nbd at nbd.name (Felix Fietkau)
Date: Tue, 28 Nov 2023 22:13:31 +0100
Subject: libubox compile issue
In-Reply-To: <a9056d13-7492-42fd-9366-450cf0833ae0@gmail.com>
References: <a9056d13-7492-42fd-9366-450cf0833ae0@gmail.com>
Message-ID: <85ceff31-dcdb-4a65-a965-70a4d73b515e@nbd.name>

On 28.11.23 17:00, e9hack wrote:
> Hi,
> 
> since commit 'libubox: update to Git HEAD (2023-11-27)', I've trouble to compile libubox:
> 
> [43/46] Building C object CMakeFiles/jshn.dir/jshn.c.o
> [44/46] Linking C executable jshn
> FAILED: jshn
> : && /data/src/LEDE/RT-AX53U-5.15.x/staging_dir/host/bin/gcc -O2 -I/data/src/LEDE/RT-AX53U-5.15.x/staging_dir/host/include -I/data/src/LEDE/RT-AX53U-5.15.x/staging_dir/hostpkg/include -I/data/src/LEDE/RT-AX53U-5.15.x/staging_dir/target-mipsel_1004kc_musl/host/include -DNDEBUG -L/data/src/LEDE/RT-AX53U-5.15.x/staging_dir/host/lib -L/data/src/LEDE/RT-AX53U-5.15.x/staging_dir/hostpkg/lib -L/data/src/LEDE/RT-AX53U-5.15.x/staging_dir/target-mipsel_1004kc_musl/host/lib   -rdynamic CMakeFiles/jshn.dir/jshn.c.o -o jshn  -Wl,-rpath,/data/src/LEDE/RT-AX53U-5.15.x/build_dir/hostpkg/libubox-2023-11-27-d4c3066e:  libblobmsg_json.so  -Wl,-Bstatic  -ljson-c  -Wl,-Bdynamic  libubox.so && :
> /usr/bin/ld: libubox.so: undefined reference to `shm_unlink'
> /usr/bin/ld: libubox.so: undefined reference to `shm_open'
> collect2: error: ld returned 1 exit status
> [45/46] Building C object CMakeFiles/json_script.dir/json_script.c.o
> ninja: build stopped: subcommand failed.
> make[2]: *** [Makefile:117: /data/src/LEDE/RT-AX53U-5.15.x/build_dir/hostpkg/libubox-2023-11-27-d4c3066e/.built] Error 1
> make[2]: Leaving directory '/data/src/LEDE/RT-AX53U-5.15.x/package/libs/libubox'

Fixed now. Thanks for reporting and sorry for the noise.

- Felix


From arinc.unal at arinc9.com  Wed Nov 29 07:14:09 2023
From: arinc.unal at arinc9.com (=?UTF-8?B?QXLEsW7DpyDDnE5BTA==?=)
Date: Wed, 29 Nov 2023 18:14:09 +0300
Subject: United Nations Announcement for Battlemesh x OpenWrt summit
Message-ID: <9F10B7DB-1A3C-4365-991A-6114AC1560E0@arinc9.com>

Hey everyone.

For the joint Battlemesh and OpenWrt summit event in May 2024, I, as the
head organiser, have requested from the United Nations Peacekeeping Force
in Cyprus (UNFICYP) to have a tour of the old Nicosia International
Airport on the date of the event. For those of you who are not aware, the
Nicosia International Airport is stuck in the buffer zone controlled by
UNFICYP. It's like a time capsule in there, the ad posters from the 70s
are still there.

Today, I have received word from UNFICYP. They'd like to know which date
and how many people we would like to bring with us on the tour.

If you haven't done it yet, please vote on the poll which will determine
the date and the amount of people joining the event.

https://framadate.org/M4I9AYvKYypQTmGB

Please vote also on this poll to determine when the OpenWrt summit should
be done in coordination with Battlemesh.

https://framadate.org/oGXhCQkygdpXGiTh

Ar?n?


From ehem+openwrt at m5p.com  Wed Nov 29 21:34:11 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Wed, 29 Nov 2023 21:34:11 -0800
Subject: [PATCH 1/5] scripts/kconfig.pl: fixup subroutine style
In-Reply-To: <cover.1701746457.git.ehem+openwrt@m5p.com>
References: <cover.1701746457.git.ehem+openwrt@m5p.com>
Message-ID: <4c18693243c6485cd08ad5f8d962cf6e11ad22b0.1701746457.git.ehem+openwrt@m5p.com>

Match usual Perl style to make the operation of the script easier
to understand for future developers.

Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>
---
 scripts/kconfig.pl | 27 ++++++++-------------------
 1 file changed, 8 insertions(+), 19 deletions(-)

diff --git a/scripts/kconfig.pl b/scripts/kconfig.pl
index 392f1d5841..f7b3814cdd 100755
--- a/scripts/kconfig.pl
+++ b/scripts/kconfig.pl
@@ -13,10 +13,7 @@ my @arg;
 my $PREFIX = "CONFIG_";
 
 sub set_config($$$$) {
-	my $config = shift;
-	my $idx = shift;
-	my $newval = shift;
-	my $mod_plus = shift;
+	my ($config, $idx, $newval, $mod_plus) = @_;
 
 	if (!defined($config->{$idx}) or !$mod_plus or
 	    $config->{$idx} eq '#undef' or $newval eq 'y') {
@@ -25,8 +22,7 @@ sub set_config($$$$) {
 }
 
 sub load_config($$) {
-	my $file = shift;
-	my $mod_plus = shift;
+	my ($file, $mod_plus) = @_;
 	my %config;
 
 	open FILE, "$file" or die "can't open file '$file'";
@@ -48,8 +44,7 @@ sub load_config($$) {
 
 
 sub config_and($$) {
-	my $cfg1 = shift;
-	my $cfg2 = shift;
+	my ($cfg1, $cfg2) = @_;
 	my %config;
 
 	foreach my $config (keys %$cfg1) {
@@ -64,9 +59,7 @@ sub config_and($$) {
 
 
 sub config_add($$$) {
-	my $cfg1 = shift;
-	my $cfg2 = shift;
-	my $mod_plus = shift;
+	my ($cfg1, $cfg2, $mod_plus) = @_;
 	my %config;
 	
 	for ($cfg1, $cfg2) {
@@ -84,9 +77,7 @@ sub config_add($$$) {
 }
 
 sub config_diff($$$) {
-	my $cfg1 = shift;
-	my $cfg2 = shift;
-	my $new_only = shift;
+	my ($cfg1, $cfg2, $new_only) = @_;
 	my %config;
 	
 	foreach my $config (keys %$cfg2) {
@@ -99,8 +90,7 @@ sub config_diff($$$) {
 }
 
 sub config_sub($$) {
-	my $cfg1 = shift;
-	my $cfg2 = shift;
+	my ($cfg1, $cfg2) = @_;
 	my %config = %{$cfg1};
 	my @keys = map {
 		my $expr = $_;
@@ -117,8 +107,7 @@ sub config_sub($$) {
 }
 
 sub print_cfgline($$) {
-	my $name = shift;
-	my $val = shift;
+	my ($name, $val) = @_;
 	if ($val eq '#undef' or $val eq 'n') {
 		print "# $PREFIX$name is not set\n";
 	} else {
@@ -128,7 +117,7 @@ sub print_cfgline($$) {
 
 
 sub dump_config($) {
-	my $cfg = shift;
+	my ($cfg) = @_;
 	die "argument error in dump_config" unless ($cfg);
 	my %config = %$cfg;
 	foreach my $config (sort keys %config) {
-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |       ehem+openwrt at m5p.com     PGP 87145445       |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445





From ehem+openwrt at m5p.com  Thu Nov 30 15:23:02 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Thu, 30 Nov 2023 15:23:02 -0800
Subject: [PATCH 2/5] scripts/kconfig.pl: modify config_and()/config_sub() to
 match other ops
In-Reply-To: <cover.1701746457.git.ehem+openwrt@m5p.com>
References: <cover.1701746457.git.ehem+openwrt@m5p.com>
Message-ID: <1167e7b408ffb248710b64502435f53bbd5b11f9.1701746457.git.ehem+openwrt@m5p.com>

Having all operator-handling functions match the same prototype has
advantages.

Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>
---
 scripts/kconfig.pl | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/scripts/kconfig.pl b/scripts/kconfig.pl
index f7b3814cdd..dd286479b3 100755
--- a/scripts/kconfig.pl
+++ b/scripts/kconfig.pl
@@ -43,8 +43,8 @@ sub load_config($$) {
 }
 
 
-sub config_and($$) {
-	my ($cfg1, $cfg2) = @_;
+sub config_and($$$) {
+	my ($cfg1, $cfg2, $mod_plus_discarded) = @_;
 	my %config;
 
 	foreach my $config (keys %$cfg1) {
@@ -89,8 +89,8 @@ sub config_diff($$$) {
 	return \%config
 }
 
-sub config_sub($$) {
-	my ($cfg1, $cfg2) = @_;
+sub config_sub($$$) {
+	my ($cfg1, $cfg2, $mod_plus_discarded) = @_;
 	my %config = %{$cfg1};
 	my @keys = map {
 		my $expr = $_;
@@ -135,7 +135,7 @@ sub parse_expr {
 	if ($arg eq '&') {
 		my $arg1 = parse_expr($pos);
 		my $arg2 = parse_expr($pos);
-		return config_and($arg1, $arg2);
+		return config_and($arg1, $arg2, undef);
 	} elsif ($arg =~ /^\+/) {
 		my $arg1 = parse_expr($pos);
 		my $arg2 = parse_expr($pos);
@@ -155,7 +155,7 @@ sub parse_expr {
 	} elsif ($arg eq '-') {
 		my $arg1 = parse_expr($pos);
 		my $arg2 = parse_expr($pos);
-		return config_sub($arg1, $arg2);
+		return config_sub($arg1, $arg2, undef);
 	} else {
 		return load_config($arg, $mod_plus);
 	}
-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |       ehem+openwrt at m5p.com     PGP 87145445       |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445





From ehem+openwrt at m5p.com  Thu Nov 30 15:33:21 2023
From: ehem+openwrt at m5p.com (Elliott Mitchell)
Date: Thu, 30 Nov 2023 15:33:21 -0800
Subject: [PATCH 3/5] scripts/kconfig.pl: switch to using function
 references/hash for operators
In-Reply-To: <cover.1701746457.git.ehem+openwrt@m5p.com>
References: <cover.1701746457.git.ehem+openwrt@m5p.com>
Message-ID: <038cf8705f41ab960d573ab96f73afecfbdae9f4.1701746457.git.ehem+openwrt@m5p.com>

Ah, the wonders of pointers.  Simplifies the configuration parsing
as all these cases are otherwise identical.

Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>
---
Oy vey.  I only spotted passing the second arg to parse_expr() *just*
before I was initially planning to send this.  That is quite the boody
trap lurking there.
---
 scripts/kconfig.pl | 35 ++++++++++++-----------------------
 1 file changed, 12 insertions(+), 23 deletions(-)

diff --git a/scripts/kconfig.pl b/scripts/kconfig.pl
index dd286479b3..5a53e2154b 100755
--- a/scripts/kconfig.pl
+++ b/scripts/kconfig.pl
@@ -130,32 +130,21 @@ sub parse_expr {
 	my $mod_plus = shift;
 	my $arg = $arg[$$pos++];
 
+	my %ops = (
+		'&'	=> [\&config_and, undef],
+		'+'	=> [\&config_add, 0],
+		'm+'	=> [\&config_add, 1],
+		'>'	=> [\&config_diff, 0],
+		'>+'	=> [\&config_diff, 1],
+		'-'	=> [\&config_sub, undef],
+	);
+
 	die "Parse error" if (!$arg);
 
-	if ($arg eq '&') {
-		my $arg1 = parse_expr($pos);
-		my $arg2 = parse_expr($pos);
-		return config_and($arg1, $arg2, undef);
-	} elsif ($arg =~ /^\+/) {
-		my $arg1 = parse_expr($pos);
-		my $arg2 = parse_expr($pos);
-		return config_add($arg1, $arg2, 0);
-	} elsif ($arg =~ /^m\+/) {
-		my $arg1 = parse_expr($pos);
-		my $arg2 = parse_expr($pos, 1);
-		return config_add($arg1, $arg2, 1);
-	} elsif ($arg eq '>') {
-		my $arg1 = parse_expr($pos);
-		my $arg2 = parse_expr($pos);
-		return config_diff($arg1, $arg2, 0);
-	} elsif ($arg eq '>+') {
-		my $arg1 = parse_expr($pos);
-		my $arg2 = parse_expr($pos);
-		return config_diff($arg1, $arg2, 1);
-	} elsif ($arg eq '-') {
+	if (exists($ops{$arg})) {
 		my $arg1 = parse_expr($pos);
-		my $arg2 = parse_expr($pos);
-		return config_sub($arg1, $arg2, undef);
+		my $arg2 = parse_expr($pos, ($arg eq 'm+') ? 1 : 0);
+		return &{$ops{$arg}->[0]}($arg1, $arg2, $ops{$arg}->[1]);
 	} else {
 		return load_config($arg, $mod_plus);
 	}
-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |       ehem+openwrt at m5p.com     PGP 87145445       |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445





From zajec5 at gmail.com  Wed Nov 29 13:20:49 2023
From: zajec5 at gmail.com (=?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?=)
Date: Wed, 29 Nov 2023 21:20:49 -0000
Subject: ARM BCM53573 SoC hangs/lockups caused by locks/clock/random
 changes
In-Reply-To: <CACRpkdahWm9aP+UasDx=s3th+vyjAfuWrKB5HS9BKEbz90ZmKw@mail.gmail.com>
References: <a03a6e1d-e99c-40a3-bdac-0075b5339beb@gmail.com>
 <CACRpkdahWm9aP+UasDx=s3th+vyjAfuWrKB5HS9BKEbz90ZmKw@mail.gmail.com>
Message-ID: <ec17c6c8-e697-4a5a-a705-bff24daae7b2@gmail.com>

Hi,

it's a late reply but I didn't find enough determination earlier.

On 8.09.2023 10:10, Linus Walleij wrote:
> On Mon, Sep 4, 2023 at 10:34?AM Rafa? Mi?ecki <zajec5 at gmail.com> wrote:
> 
>> I'm clueless at this point.
>> Maybe someone can come up with an idea of actual issue & ideally a
>> solution.
> 
> Damn this is frustrating.
> 
>> 2. Clock (arm,armv7-timer)
>>
>> While comparing main clock in Broadcom's SDK with upstream one I noticed
>> a tiny difference: mask value. I don't know it it makes any sense but
>> switching from CLOCKSOURCE_MASK(56) to CLOCKSOURCE_MASK(64) in
>> arm_arch_timer.c (to match SDK) increases average uptime (time before a
>> hang/lockup happens) from 4 minutes to 36 minutes.
> 
> This could be related to how often the system goes to idle.
> 
>> +       if (cpu_idle_force_poll == 1234)
>> +               arch_cpu_idle();
>> +       if (cpu_idle_force_poll == 5678)
>> +               arch_cpu_idle();
>> +       if (cpu_idle_force_poll == 1234)
>> +               arch_cpu_idle();
>> +       if (cpu_idle_force_poll == 5678)
>> +               arch_cpu_idle();
>> +       if (cpu_idle_force_poll == 1234)
>> +               arch_cpu_idle();
>> +       if (cpu_idle_force_poll == 5678)
>> +               arch_cpu_idle();
>> +       if (cpu_idle_force_poll == 1234)
>> +               arch_cpu_idle();
> 
> Idle again.
> 
> I would have tried to see what arch_cpu_idle() is doing.
> 
> arm_pm_idle() or cpu_do_idle()?

In my case arm_pm_idle is NULL.


> What happens if you just put return in arch_cpu_idle()
> so it does nothing?

Doesn't help. I also tried putting:
udelay(10);
and
udelay(1000);
at the arch_cpu_idle() beginning. None helped.


Here comes more interesting experiment though. Putting there:

if (!(foo++ % 10000)) {
	pr_info("[%s] arm_pm_idle:%ps\n", __func__, arm_pm_idle);
}

doesn't seem to help.


Putting following however seems to make kernel/device stable:

if (!(foo++ % 100)) {
	pr_info("[%s] arm_pm_idle:%ps\n", __func__, arm_pm_idle);
}


I think I'm just going to assume those chipsets are simply hw broken.


From linus.walleij at linaro.org  Wed Nov 29 13:33:15 2023
From: linus.walleij at linaro.org (Linus Walleij)
Date: Wed, 29 Nov 2023 21:33:15 -0000
Subject: ARM BCM53573 SoC hangs/lockups caused by locks/clock/random changes
In-Reply-To: <ec17c6c8-e697-4a5a-a705-bff24daae7b2@gmail.com>
References: <a03a6e1d-e99c-40a3-bdac-0075b5339beb@gmail.com>
 <CACRpkdahWm9aP+UasDx=s3th+vyjAfuWrKB5HS9BKEbz90ZmKw@mail.gmail.com> <ec17c6c8-e697-4a5a-a705-bff24daae7b2@gmail.com>
Message-ID: <CACRpkdZp=4sP_1a=u6c7DGbPWA8WRee4J8Wpsw7Y57S2FT5GFw@mail.gmail.com>

On Wed, Nov 29, 2023 at 10:20?PM Rafa? Mi?ecki <zajec5 at gmail.com> wrote:

> Here comes more interesting experiment though. Putting there:
>
> if (!(foo++ % 10000)) {
>         pr_info("[%s] arm_pm_idle:%ps\n", __func__, arm_pm_idle);
> }
>
> doesn't seem to help.
>
>
> Putting following however seems to make kernel/device stable:
>
> if (!(foo++ % 100)) {
>         pr_info("[%s] arm_pm_idle:%ps\n", __func__, arm_pm_idle);
> }

That's just too weird.

> I think I'm just going to assume those chipsets are simply hw broken.

If disabling CPU idle on these altogether stabilize them, then maybe that
is what we need to do?

Yours,
Linus Walleij


