Jump to content

Prepare a kernel tree so I can build a module I need (ath9k_htc)


Gro-Tsen

Recommended Posts

I got Armbian 23.8.2 Bookworm with Linux 5.10.160-legacy-rk35xx successfully running on a couple of NanoPi R6S boxes. So far so good.

 

Now I would like to use Wifi dongles (USB sticks) that I have on these machines. They use the `ath9k_htc` kernel driver. I have used this successfully on ARM-based machines earlier.

 

However, Armbian does not provide this module. So I need to compile it myself (either obtain the exact sources that were used in the kernel I'm currently running, so I can recompile this single module or, perhaps more realistically, start a custom tree with the Armbian patches and config, from which I can rebuild on my own).

 

I'm familiar with Linux kernel compilation from the mainline kernel sources (and cross-compilation is no issue here since I can run the compilation on the ARM box itself), but not the way Armbian does it. So my question is: how do I obtain a copy of the sources (and config file!) that were used to compile the precise kernel that I installed?

 

I read on https://docs.armbian.com/Developer-Guide_Build-Preparation/ that one can regenerate the Armbian kernel by cloning https://github.com/armbian/build and then running something like this:

./compile.sh BRANCH=legacy BOARD=nanopi-r6s kernel

However there are a number of issues with this: first it requires root access which is something making me quite uneasy¹ (I just want to recompile a kernel), second it proceeds to the full build without letting me stop to examine the config, review the patches; third, I'm not even sure the parameters I passed are the exact right ones to recreate the kernel that's currently running on my system.

 

So, question: how can I produce an Armbian kernel tree for 5.10.160-legacy-rk35xx for the nanopi-r6s board with the patches and config that are running on my system, and then pause so I tweak the config and do whatever I feel necessary before starting the compilation? And if possible, in a way that does not require root access.

 

Many thanks in advance!

 

Footnote: 1. Just to be clear, my uneasiness is not about security issues per se (I'm running Armbian anyway, so of course I have to trust the Armbian devs), but once something starts running as root, there's no telling what it modifies where. For example, I just discovered it had written lots of junk in /root/.cache which has very little storage place, and I'd like to avoid this sort of problems.

Link to comment
Share on other sites

Just a followup to make my question perhaps clearer:

 

The ideal form answer for me would be something like this: “to reconstruct the 5.10.160-legacy-rk35xx kernel for Armbian 23.8.2 Bookworm on nanopi-r6s, check out branch `rk-5.10-rkr6` of https://github.com/armbian/linux-rockchip and run `make deb-pkg` in this tree: then just install the resulting .deb files to install the new kernel”.

 

This can't be quite right, though, because this doesn't tell me where the config file comes from, and I suspect a little bit more than `make deb-pkg` is needed. But this is the sort of answer I'm looking for.

Link to comment
Share on other sites

Another followup to say that `/usr/share/doc/linux-image-legacy-rk35xx/changelog.gz` gives my kernel version as:

 

5.10.160-S5279-D6ad0-P0000-C42aaHfe66-HK01ba-Vc222-Bc698-R448a

 

So I guess my question is what these numbers mean and how I can use them to reconstruct the exact kernel tree (or at least check that I have the right kernel tree). None of them seems to be a Git commit number, so I don't know what they are.

Link to comment
Share on other sites

@Gro-Tsen  One way you can compile the driver is by running `./compile.sh BRANCH=legacy BOARD=nanopi-r6s kernel-config`. That will show the menuconfig interface to configure the kernel. You can enable the driver you need and when exiting choose to save the config file. Then you can run `./compile.sh BRANCH=legacy BOARD=nanopi-r6s kernel`. to compile the kernel. The resultant deb file will be in output/debs folder. The modified config file will be in config/kernel folder. I will suggest to open a PR with the same so that it will get enabled in the official Armbian kernel as well.

 

8 hours ago, Gro-Tsen said:

Another followup to say that `/usr/share/doc/linux-image-legacy-rk35xx/changelog.gz` gives my kernel version as:

 

5.10.160-S5279-D6ad0-P0000-C42aaHfe66-HK01ba-Vc222-Bc698-R448a

 

So I guess my question is what these numbers mean and how I can use them to reconstruct the exact kernel tree (or at least check that I have the right kernel tree). None of them seems to be a Git commit number, so I don't know what they are.

 

Those numbers are generated by hashing various files present in armbian source tree. For example C42aa means that the hash for kernel config file starts with 42aa. For more information see artifact_kernel_prepare_version function in lib/functions/artifacts/artifact-kernel.sh file.

Link to comment
Share on other sites

11 часов назад, Gro-Tsen сказал:

 

5.10.160-S5279-D6ad0-P0000-C42aaHfe66-HK01ba-Vc222-Bc698-R448a

 

So I guess my question is what these numbers mean and how I can use them to reconstruct the exact kernel tree (or at least check that I have the right kernel tree). None of them seems to be a Git commit number, so I don't know what they are.

Please don't make sense of it. Take care of your health.

Just build the kernel with your configuration. Developer-Guide_Build-Preparation/#executing-any-bash-statement

If you need to make kernel debugging symbols or utilities, you will have to abandon the build system and build the kernel in the traditional way.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines