Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instructions to compile modules for the kernel used on the Cybook Muse #5

Open
arthurlutz opened this issue Jan 26, 2024 · 8 comments

Comments

@arthurlutz
Copy link

I'm trying to get tailscaled to run on the Cybook Muse

# ./tailscaled
logtail started
Program starting: v1.56.1-t906f85d10-g34ed54c8c, Go 1.21.5: []string{"./tailscaled"}
LogID: 46de133be4fbd81dc43cc0d7893f1ef3a724955140dab0d63cb62362be400230
logpolicy: using system state directory "/var/lib/tailscale"
wgengine.NewUserspaceEngine(tun "tailscale0") ...
Linux kernel version: 3.0.8+
is CONFIG_TUN enabled in your kernel? `modprobe tun` failed with: modprobe: can't open 'modules.dep': No such file or directory
wgengine.NewUserspaceEngine(tun "tailscale0") error: tstun.New("tailscale0"): CreateTUN("tailscale0") failed; /dev/net/tun does not exist
flushing log.
logger closing down
tlsdial: error: server cert for "log.tailscale.io" failed to verify and is not a Let's Encrypt cert
logtail: upload: log upload of 484 bytes compressed failed: Post "https://log.tailscale.io/c/tailnode.log.tailscale.io/c825ce7798c1e02a393dfb584fa65074f5fb6c5e259720fbb4b20705c389697b": x509: certificate has expired or is not yet valid: current time 1970-01-01T00:30:30Z is before 2024-01-23T01:36:13Z
getLocalBackend error: createEngine: tstun.New("tailscale0"): CreateTUN("tailscale0") failed; /dev/net/tun does not exist
# modprobe tun
modprobe: can't open 'modules.dep': No such file or directory
# ls /lib/modules/3.0.8\+/
8188eu.ko                 cyttsp4_core.ko           cyttsp4_i2c.ko            cyttsp4_mt_b.ko           gt9xx_ts.ko
ctp.ko                    cyttsp4_device_access.ko  cyttsp4_loader.ko         elan_touch.ko             kfusd.ko

I'd like to compile the modules for this kernel, but I get

❯ git diff
diff --git a/arch/arm/configs/sun4i_defconfig b/arch/arm/configs/sun4i_defconfig
index 606fd3ea..9dbbb69e 100755
--- a/arch/arm/configs/sun4i_defconfig
+++ b/arch/arm/configs/sun4i_defconfig
@@ -657,7 +657,7 @@ CONFIG_NETDEVICES=y
 # CONFIG_DUMMY is not set
 # CONFIG_BONDING is not set
 # CONFIG_EQUALIZER is not set
-# CONFIG_TUN is not set
+CONFIG_TUN=m
 # CONFIG_VETH is not set
 CONFIG_MII=y
 CONFIG_PHYLIB=y

kernel-linux-3.0 on  master [!?] 
❯ ./scripts/build_sun4i.sh modules
Building modules
make: Entering directory '/home/arthur/local/kernel-linux-3.0/modules/example'
/home/arthur/local/kernel-linux-3.0
make -C /home/arthur/local/kernel-linux-3.0 M=/home/arthur/local/kernel-linux-3.0/modules/example
make[1]: Entering directory '/home/arthur/local/kernel-linux-3.0'
make[1]: arm-none-linux-gnueabi-gcc: No such file or directory

  WARNING: Symbol version dump /home/arthur/local/kernel-linux-3.0/Module.symvers
           is missing; modules will have no dependencies and modversions.

  LD      /home/arthur/local/kernel-linux-3.0/modules/example/built-in.o
/bin/sh: 1: arm-none-linux-gnueabi-ar: not found
make[2]: *** [scripts/Makefile.build:373: /home/arthur/local/kernel-linux-3.0/modules/example/built-in.o] Error 127
make[1]: *** [Makefile:1360: _module_/home/arthur/local/kernel-linux-3.0/modules/example] Error 2
make[1]: Leaving directory '/home/arthur/local/kernel-linux-3.0'
make: *** [Makefile:20: build] Error 2
make: Leaving directory '/home/arthur/local/kernel-linux-3.0/modules/example'

@arthurlutz
Copy link
Author

After downloading the arm gcc build follow theses instructions https://askubuntu.com/a/1243405 I get :

uilding modules
make: Entering directory '/home/arthur/local/kernel-linux-3.0/modules/example'
/home/arthur/local/kernel-linux-3.0
make -C /home/arthur/local/kernel-linux-3.0 M=/home/arthur/local/kernel-linux-3.0/modules/example
make[1]: Entering directory '/home/arthur/local/kernel-linux-3.0'

  WARNING: Symbol version dump /home/arthur/local/kernel-linux-3.0/Module.symvers
           is missing; modules will have no dependencies and modversions.

  CC [M]  /home/arthur/local/kernel-linux-3.0/modules/example/example.o
In file included from include/linux/compiler.h:48,
                 from include/linux/linkage.h:4,
                 from include/linux/kernel.h:13,
                 from /home/arthur/local/kernel-linux-3.0/modules/example/example.c:1:
include/linux/compiler-gcc.h:94:1: fatal error: linux/compiler-gcc13.h: No such file or directory
   94 | #include gcc_header(__GNUC__)
      | ^~~~~
compilation terminated.
make[2]: *** [scripts/Makefile.build:312: /home/arthur/local/kernel-linux-3.0/modules/example/example.o] Error 1
make[1]: *** [Makefile:1360: _module_/home/arthur/local/kernel-linux-3.0/modules/example] Error 2
make[1]: Leaving directory '/home/arthur/local/kernel-linux-3.0'
make: *** [Makefile:20: build] Error 2
make: Leaving directory '/home/arthur/local/kernel-linux-3.0/modules/example'

@devbrones
Copy link

devbrones commented Jan 27, 2024

What gcc are you using?
A dirty option could be:
cp include/linux/compiler-gcc4.h include/linux/compiler-gcc13.h but it feels like make probably isnt using the arm gcc here but rather your builtin gcc

You need to be using a gcc older than 5

@arthurlutz
Copy link
Author

❯ gcc --version
gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

I'm going to look into options to get "gcc older than 5" running on my machine. If you have any tips, I'll take them.

@liamHowatt
Copy link

The compiler that needs to be <5 in this case is the arm-linux-gnueabihf-gcc cross compiler to get past this step.

https://linux-sunxi.org/Toolchain#Standalone_toolchain_installation

See also:
lvgl/lv_port_linux#46 (comment)

@arthurlutz
Copy link
Author

Thanks for the input @liamHowatt

diff --git a/scripts/build_sun4i.sh b/scripts/build_sun4i.sh
index e9758469..987a720d 100755
--- a/scripts/build_sun4i.sh
+++ b/scripts/build_sun4i.sh
@@ -9,7 +9,7 @@ set -e
 
 #Setup common variables
 export ARCH=arm
-export CROSS_COMPILE=arm-none-linux-gnueabi-
+export CROSS_COMPILE=/home/arthur/local/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-
 export AS=${CROSS_COMPILE}as
 export LD=${CROSS_COMPILE}ld
 export CC=${CROSS_COMPILE}gcc

trying that out I get different errors :

❯ ./scripts/build_sun4i.sh modules
Building modules
make: Entering directory '/home/arthur/local/kernel-linux-3.0/modules/example'
/home/arthur/local/kernel-linux-3.0
make -C /home/arthur/local/kernel-linux-3.0 M=/home/arthur/local/kernel-linux-3.0/modules/example
make[1]: Entering directory '/home/arthur/local/kernel-linux-3.0'

  WARNING: Symbol version dump /home/arthur/local/kernel-linux-3.0/Module.symvers
           is missing; modules will have no dependencies and modversions.

  CC [M]  /home/arthur/local/kernel-linux-3.0/modules/example/example.o
In file included from include/linux/gfp.h:4:0,
                 from include/linux/kmod.h:22,
                 from include/linux/module.h:13,
                 from /home/arthur/local/kernel-linux-3.0/modules/example/example.c:3:
include/linux/mmzone.h:18:30: fatal error: generated/bounds.h: No such file or directory
 #include <generated/bounds.h>
                              ^
compilation terminated.
make[2]: *** [scripts/Makefile.build:312: /home/arthur/local/kernel-linux-3.0/modules/example/example.o] Error 1
make[1]: *** [Makefile:1360: _module_/home/arthur/local/kernel-linux-3.0/modules/example] Error 2
make[1]: Leaving directory '/home/arthur/local/kernel-linux-3.0'
make: *** [Makefile:20: build] Error 2
make: Leaving directory '/home/arthur/local/kernel-linux-3.0/modules/example'
❯ find . | grep bounds
./kernel/bounds.c
❯ ./scripts/build_sun4i.sh kernel
make: *** /home/arthur/local/kernel-linux-3.0/arch/arm/mach-sun4i/pm/standby: No such file or directory.  Stop.

@liamHowatt
Copy link

@liamHowatt
Copy link

@arthurlutz ignore my last message - I didn't realize you were using the script to build it. An idea is to try the script with the arg kenel first, and then modules. If that fails, run it with clean and/or delete the build directory and start fresh since you changed compilers etc.

@arthurlutz
Copy link
Author

@liamHowatt yep, I tried that. But I'm stuck on that last error, it can't find /home/arthur/local/kernel-linux-3.0/arch/arm/mach-sun4i/pm/standby (see comment above). I need to figure out what could build the generated folder mentioned in the log.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants