Kernel Headers (rooter)

Hi,

I am trying to compile a wifi driver on my OpenWrt runing on my pc. I have installed bash, make, gcc, automake. When I start make I get the following error:

/lib/modules/4.14.167/build: No such file or directory.

I asume that is because I dont have Kernel Headers installed but the question ist how do I install them?

Anyone a Idea?

Thanks

There are no kernel headers packaged, nor enough of a buildsystem available at runtime even if you had them.

If you do need to build kernel module, you must cross-compile them through the buildsystem (or SDK), OpenWrt isn't self hosting and doesn't provide the necessary bits and pieces at runtime (while your x86 system might be different, >98% of all devices running OpenWrt wouldn't have the space for doing so in the first place).

3 Likes

Hi,

thank you for you answer.
Is there maybe a step by step Instruction for diong that?
I have compiled drivers on linux but I never had a buildsystem for anything....

Thank you

https://openwrt.org/docs/guide-developer/build-system/start

1 Like

Hi,
I am using the Rooter Software on a PC which I use as router.
I have two Wi-Fi „USB Cards“ for which I need to compile the driver. As I found out the only way to do that is to setup a build system.
I did that as described, Linux Mint 18 in a virtual machine. I wanted also to upgrade my Rooter software so I went with “BUILD SYSTEM FOR ROOTER USING OPENWRT 19.07.2“
Everything went fine (at least I think so) but when I execute the script I get a error. I then tried 18.06.7 but I get the same error.

This is what I get when I execute the script:

checking whether mknod can create fifo without root privileges... configure: error: in `/home/lordrayden/OpenWrt/Rooter19072/rooter1907-2/build_dir/host/tar-1.32':
configure: error: you should not run configure as root (set FORCE_UNSAFE_CONFIGURE=1 in environment to bypass this check)
See `config.log' for more details
Makefile:31: recipe for target '/home/lordrayden/OpenWrt/Rooter19072/rooter1907-2/build_dir/host/tar-1.32/.configured' failed
make[3]: *** [/home/lordrayden/OpenWrt/Rooter19072/rooter1907-2/build_dir/host/tar-1.32/.configured] Error 1
make[3]: Leaving directory '/home/lordrayden/OpenWrt/Rooter19072/rooter1907-2/tools/tar'
time: tools/tar/compile#9.80#2.18#21.53
tools/Makefile:157: recipe for target 'tools/tar/compile' failed
make[2]: *** [tools/tar/compile] Error 2
make[2]: Leaving directory '/home/lordrayden/OpenWrt/Rooter19072/rooter1907-2'
tools/Makefile:155: recipe for target '/home/lordrayden/OpenWrt/Rooter19072/rooter1907-2/staging_dir/target-x86_64_musl/stamp/.tools_compile_yyyyynnyyynyyyyynyynnyyyynyyyyyyyyyyyyyyyyyynynnyyynnyyy' failed
make[1]: *** [/home/lordrayden/OpenWrt/Rooter19072/rooter1907-2/staging_dir/target-x86_64_musl/stamp/.tools_compile_yyyyynnyyynyyyyynyynnyyyynyyyyyyyyyyyyyyyyyynynnyyynnyyy] Error 2
make[1]: Leaving directory '/home/lordrayden/OpenWrt/Rooter19072/rooter1907-2'
/home/lordrayden/OpenWrt/Rooter19072/rooter1907-2/include/toplevel.mk:225: die Regel für Ziel „world“ scheiterte
make: *** [world] Fehler 2

“die Regel für Ziel „world“ scheiterte” is german and means “the rule for the Target “world” has failed” Error 2.

What can I do?
Can someone help me?

Thanks

LordRayden

P.S. Rooter is OpenWrt with some extra packages, the whole buildsystem is from OpenWrt.

Log says enough:

Log as ordinary user and DO NOT use sudo.

1 Like

Hi Wally,

tried that, then I cannot start the build script. It stops immediately with a permission error...

Some other idea maybe?

I also tried to build the system with Ubuntu 18.04 but I get the same error. I thought maybe the script fails because something is missing in the OS but no. I’m also setting up Debian, just in case (those are the three recommended distros)….

Thanks

Then check the permissions of the location where you placed the files.

Hi IIeachii,

OK, now I did a "chmod -R 777" on the whole build directory. Now the scripts starts running but I get almost the same error....

install -d -m0755 /home/lordrayden/OpenWrt/Rooter19072/rooter1907-2/staging_dir/host/bin
install: cannot change permissions of '/home/lordrayden/OpenWrt/Rooter19072/rooter1907-2/staging_dir/host/bin': Operation not permitted
Makefile:28: recipe for target '/home/lordrayden/OpenWrt/Rooter19072/rooter1907-2/staging_dir/host/stamp/.missing-macros_installed' failed
make[3]: *** [/home/lordrayden/OpenWrt/Rooter19072/rooter1907-2/staging_dir/host/stamp/.missing-macros_installed] Error 1
make[3]: Leaving directory '/home/lordrayden/OpenWrt/Rooter19072/rooter1907-2/tools/missing-macros'
time: tools/missing-macros/compile#0.00#0.00#0.11
tools/Makefile:157: recipe for target 'tools/missing-macros/compile' failed
make[2]: *** [tools/missing-macros/compile] Error 2
make[2]: Leaving directory '/home/lordrayden/OpenWrt/Rooter19072/rooter1907-2'
tools/Makefile:155: recipe for target '/home/lordrayden/OpenWrt/Rooter19072/rooter1907-2/staging_dir/target-x86_64_musl/stamp/.tools_compile_yyyyynnyyynyyyyynyynnyyyynyyyyyyyyyyyyyyyyyynynnyyynnyyy' failed
make[1]: *** [/home/lordrayden/OpenWrt/Rooter19072/rooter1907-2/staging_dir/target-x86_64_musl/stamp/.tools_compile_yyyyynnyyynyyyyynyynnyyyynyyyyyyyyyyyyyyyyyynynnyyynnyyy] Error 2
make[1]: Leaving directory '/home/lordrayden/OpenWrt/Rooter19072/rooter1907-2'
/home/lordrayden/OpenWrt/Rooter19072/rooter1907-2/include/toplevel.mk:225: die Regel für Ziel „world“ scheiterte
make: *** [world] Fehler 2

Is 777 to much? Should I try it with 755?

Thanks

OK, just tried it with 755 and the script stops Immediately. It has to be 777....

What else could I try?

Just tried chmod a+x but no luck.
This are the permissions on the directory:

-rwxr-xr-x  1 root       root            179 Sep 25 00:30 BSDmakefile
drwxr-xr-x  4 root       root           4096 Sep 25 00:54 build_dir
drwxr-xr-x  2 root       root           4096 Sep 25 00:32 config
drwxr-xr-x 17 root       root           4096 Sep 25 00:53 configfiles
-rwxr-xr-x  1 root       root            576 Sep 25 00:30 Config.in
drwxr-xr-x  2 root       root           4096 Sep 25 15:06 dl
drwxr-xr-x 10 root       root           4096 Sep 25 00:31 feeds
-rwxr-xr-x  1 root       root            395 Sep 25 00:30 feeds.conf.default
drwxr-xr-x  3 lordrayden lordrayden     4096 Sep 25 15:25 files
-rwxr-xr-x  1 lordrayden lordrayden    14808 Jän 14  2020 imagecopy
drwxr-xr-x  2 root       root           4096 Sep 25 00:32 images
drwxr-xr-x  3 root       root           4096 Sep 25 00:30 include
-rwxr-xr-x  1 root       root          17992 Sep 25 00:30 LICENSE
-rwxr-xr-x  1 root       root           3466 Sep 25 00:30 Makefile
-rwxr-xr-x  1 lordrayden lordrayden     1340 Sep 25 00:52 mkimage
drwxr-xr-x 14 root       root           4096 Sep 25 00:32 package
-rwxr-xr-x  1 root       root           1295 Sep 25 00:30 README
-rwxr-xr-x  1 root       root       68998918 Sep 25 00:30 rooter-master.tar.gz
-rwxr-xr-x  1 root       root          13347 Sep 25 00:30 rules.mk
drwxr-xr-x  4 root       root           4096 Sep 25 00:30 scripts
drwxr-xr-x  5 root       root           4096 Sep 25 00:54 staging_dir
drwxr-xr-x  6 root       root           4096 Sep 25 00:30 target
drwxr-xr-x  3 root       root           4096 Sep 25 15:07 tmp
drwxr-xr-x 12 root       root           4096 Sep 25 00:30 toolchain
drwxr-xr-x 61 root       root           4096 Sep 25 00:30 tools
-rwxr-xr-x  1 root       root             18 Sep 25 00:30 version
-rwxr-xr-x  1 root       root             11 Sep 25 00:30 version.date

Maybe it's because there are two owners?
Should I do a chown? But who should be the owner root or the user?

Thanks

Delete the whole build folder, and start again from scratch, but now do everything as an unprivileged user.

1 Like

Hi,

thank you, that did it. I could start the build script, but after about 6 hours of compiling I get this:

/home/lordrayden/OpenWrt/Rooter19072/rooter1907-2/staging_dir/toolchain-x86_64_gcc-7.5.0_musl/lib/gcc/x86_64-openwrt-linux-musl/7.5.0/../../../../x86_64-openwrt-linux-musl/bin/ld: dialogboxes.o:dialogboxes.c:(.text+0x1220): more undefined references to `libintl_dgettext' follow
collect2: error: ld returned 1 exit status
Makefile:101: recipe for target 'whiptail' failed
make[4]: *** [whiptail] Error 1
make[4]: Leaving directory '/home/lordrayden/OpenWrt/Rooter19072/rooter1907-2/build_dir/target-x86_64_musl/newt-python3/newt-0.52.21'
Makefile:120: recipe for target '/home/lordrayden/OpenWrt/Rooter19072/rooter1907-2/build_dir/target-x86_64_musl/newt-python3/newt-0.52.21/.built' failed
make[3]: *** [/home/lordrayden/OpenWrt/Rooter19072/rooter1907-2/build_dir/target-x86_64_musl/newt-python3/newt-0.52.21/.built] Error 2
make[3]: Leaving directory '/home/lordrayden/OpenWrt/Rooter19072/rooter1907-2/feeds/packages/libs/newt'
time: package/feeds/packages/newt/python3/compile#4.63#0.36#7.77
package/Makefile:111: recipe for target 'package/feeds/packages/newt/compile' failed
make[2]: *** [package/feeds/packages/newt/compile] Error 2
make[2]: Leaving directory '/home/lordrayden/OpenWrt/Rooter19072/rooter1907-2'
package/Makefile:107: recipe for target '/home/lordrayden/OpenWrt/Rooter19072/rooter1907-2/staging_dir/target-x86_64_musl/stamp/.package_compile' failed
make[1]: *** [/home/lordrayden/OpenWrt/Rooter19072/rooter1907-2/staging_dir/target-x86_64_musl/stamp/.package_compile] Error 2
make[1]: Leaving directory '/home/lordrayden/OpenWrt/Rooter19072/rooter1907-2'
/home/lordrayden/OpenWrt/Rooter19072/rooter1907-2/include/toplevel.mk:225: die Regel für Ziel „world“ scheiterte
make: *** [world] Fehler 2

How to fix this?

Thank you

I tried to start over but I can't unselect "whiptail" and "newt" and after a few hours I get the same error as above

Anyone a idea? What can I do to fix the error?

Is there a way disable "newt"?
Maybe I can edit a config file to disable it?
As far as I can see "newt" and "whiptail" belong together so if I disable the first the second should be disabled to?

Just tried to editing the .config file and uncommenting "newt" but I still get the same error.
Do I have to start over every time I change something like that?

If I am not mistaken, this is filing while building the tool chain, which is used to build the packages that make OpenWrt, thus you cannot just disable any part of this.

Either there is something wrong with your build environment, or there is something wrong with the Rooter sources.

The Router ist a PC, SO Target is x86 and the Subtarget is x86_64. Then I select the wireless drivers and leave everything else by default. I just want to get a test build to see if the two wireless drivers I need are working on the router PC. After that I wanted to build a Image like I want it. But I always get the error. The Build enviroment is setuo by a script.

#!/bin/sh

all commands involving downloads are run twice to ensure all files are downloaded
uncomment the two lines below if you are using Linux Mint 18
sudo apt-get install build-essential subversion git-core libncurses5-dev zlib1g-dev gawk flex quilt libssl-dev xsltproc libxml-parser-perl quilt
sudo apt-get install build-essential subversion git-core libncurses5-dev zlib1g-dev gawk flex quilt libssl-dev xsltproc libxml-parser-perl quilt

uncomment the two lines below if you are using Ubuntu 18.04.1
#sudo apt -y install build-essential libncurses5-dev python unzip gawk git curl
#sudo apt -y install build-essential libncurses5-dev python unzip gawk git curl

uncomment the two lines below if you are using Debian
#sudo apt install build-essential git unzip ncurses-dev libz-dev libssl-dev openssl-1.0-dev python python3-dev python3.5 libelf-dev subversion gettext gawk wget curl rsync perl
#sudo apt install build-essential git unzip ncurses-dev libz-dev libssl-dev openssl-1.0-dev python python3-dev python3.5 libelf-dev subversion gettext gawk wget curl rsync perl

other versions of Linux will need different dependancies added in order to work
git clone https://git.openwrt.org/openwrt/openwrt.git rooter1907-2
git clone https://git.openwrt.org/openwrt/openwrt.git rooter1907-2
cp rooter-master.tar.gz ./rooter1907-2
cd rooter1907-2
git fetch --tags
git tag -l
git checkout v19.07.2
./scripts/feeds update -a
./scripts/feeds update -a
./scripts/feeds install -a

untar the rooter-master.tgz into the new build directory
tar -zxvf ../rooter-master.tar.gz -C ./

I don't know what could go wrong there. After everything is setup I do "make menuconfig" and after that I start the make script...

Where is my mistake?

If you share a link to the driver sources, I'll have a go at it. I recently had to do this (cross-compile a kernel driver) for a different platform. I'll try to share any insight.