monome / norns-image

79 stars 16 forks source link

Kernel config #13

Closed simonvanderveldt closed 6 years ago

simonvanderveldt commented 6 years ago

As the first part of #9 I'd like to start with automatically building the kernel image. To be sure I'm building the right thing I'd like to check the requirements I've gathered so far, mainly from image.txt and looking through the issues:

Also there was mention of using https://github.com/raspberrypi/linux/blob/5433720f3e8d6d06a59b30cce44210d814f34b0b/drivers/input/misc/rotary_encoder.c in the norns repo, is this still something we want?

Ideally I'd like to build a kernel that works on the RPi3 as well as when using QEMU, but I'll have to look into if that still requires any patches or changes to the config.

simonvanderveldt commented 6 years ago

From https://github.com/tehn/norns-image/issues/9#issuecomment-362768068

also-- way long ago when we were doing the sound codec driver, murray attempted a travis CI for the kernel and it ran up against travis' time limit for the process-- perhaps there's a way around this with a cross-compiling config.

I've got something basic working that automatically compiles the (stock) raspbian kernel and (currently) creates deb packages (which probably won't work on raspbian/arm because of a different device tree structure):

$ ls -ahl
total 28M
drwxr-xr-x 2 root root    7 Feb  3 21:30 .
drwxr-xr-x 3 root root    3 Feb  3 21:15 ..
-rw-r--r-- 1 root root 143K Feb  3 21:17 4.9.79-v7+.config
-rw-r--r-- 1 root root 179K Feb  3 21:30 linux-firmware-image-4.9.79-v7+_4.9.79-v7+-1_armhf.deb
-rw-r--r-- 1 root root  11M Feb  3 21:30 linux-headers-4.9.79-v7+_4.9.79-v7+-1_armhf.deb
-rw-r--r-- 1 root root  16M Feb  3 21:30 linux-image-4.9.79-v7+_4.9.79-v7+-1_armhf.deb
-rw-r--r-- 1 root root 830K Feb  3 21:30 linux-libc-dev_4.9.79-v7+-1_armhf.deb

This takes +-14 minutes from scratch on my machine whilst I'm doing other stuff.

It includes cloning the https://github.com/raspberrypi/linux.git repo (with --depth 1) which takes over 3 minutes.

Also, it includes a gazillion modules, many of which we don't need because they can never be used with the norns hardware (shields for example, but there are many more things in there).

I think we should be able to get all of this working within the 50 mins Travis time limit without a lot of problems.

simonvanderveldt commented 6 years ago

So the basics are working, build took 41 minutes on Travis, quiet a bit longer than I was expecting, but still within the 50 minutes mark :) https://travis-ci.org/simonvanderveldt/rpi3-kernel/builds/337069175 Full log here https://api.travis-ci.org/v3/job/337069176/log.txt

Will have a look at cleaning up the config tomorrow and figuring out how to build something that can be run using QEMU

simonvanderveldt commented 6 years ago

Tried to get a minimal kernel build going today, but (of course :P) the defconfig provided by the raspberry foundation then creates a config that doesn't compile. Fun times! ;) For reference https://github.com/raspberrypi/linux/issues/2366

simonvanderveldt commented 6 years ago

All right, got the minimal config working as well, building that took 23minutes on travis :) https://travis-ci.org/simonvanderveldt/rpi3-kernel/builds/337258984

This still includes some modules we don't need, but it's probably also missing some modules we do need. Still, quiet a good start :)

tehn commented 6 years ago

great! one thing that is imperative to getting anything out of the norns:

inside /boot/config.txt: enable_uart=1

otherwise it'll appear bricked. i'm not sure if they made this a default in more recent builds (they may have)

tehn commented 6 years ago

see https://github.com/tehn/norns-image/blob/master/readme-hardware.md for exhaustive peripheral information, please let me know if you see any holes or need further details

tehn commented 6 years ago

Also there was mention of using https://github.com/raspberrypi/linux/blob/5433720f3e8d6d06a59b30cce44210d814f34b0b/drivers/input/misc/rotary_encoder.c in the norns repo, is this still something we want?

i believe yes--- i need to test the approach. i'm not sure immediately how to do multiple encoders, but i haven't looked hard at this yet.

simonvanderveldt commented 6 years ago

@tehn I believe you mentioned something about the encoders on Slack the other day. Is there anything that needs to be done for this? Or is it enough to enable CONFIG_INPUT_GPIO_ROTARY_ENCODER?

tehn commented 6 years ago

i believe that should be sufficient at this point. eventually i'll have some dtoverlay files to be included once i test thoroughly.

simonvanderveldt commented 6 years ago

@tehn OK. Are the three enc overlay files in https://github.com/tehn/norns-image/tree/master/overlays necessary till that point?

tehn commented 6 years ago

that is them. i'm certain there's a way to combine all three definitions into one file, but i haven't gotten that far into the DTS syntax, so for now this is fine.

not that if these are loaded, the GPIOs will be claimed and then the norns software (via init-norns.sh) won't be able to use them... so i have to get the norns reading the events instead/first

simonvanderveldt commented 6 years ago

I think we can close this one. The current kernel including config lives here https://github.com/simonvanderveldt/linux/tree/norns-20171029-1 I'll transfer ownership and make public once norns is released/at the moment we decide to make all sources public :)