Conversation

Lorenzo Stoakes

I made a bunch of kernel scripts to make life easier working with configuring/building/running a kernel in qemu etc.

They're a bit arch-specific and rough but in case anybody might find them useful :)

https://github.com/lorenzo-stoakes/kernel-scripts
3
8
11

@ljs

"kerndev-module-headers - Generates a stripped version of the kernel source for building external modules."

would be lovely to have support for that in the upstream Makefiles; pondering with the idea to give it a shot for 10+ years now, but never got around to it

1
0
1
@kernellogger Yeah it might be tricky to 100% cover all cases and arches though, then again distros do tend to do their own thing for this quite often.

All a bit of a mess, in reality we should probably have a kernel mechanism to identify stuff that's needed for kernel module builds and stuff that isn't.

But official position is and always has been as I gather that technically you need all the source to build modules.

BTW I've not touched that script for yeeeears so not sure if currently working :>)
1
0
1

@ljs

yeah, mostly agree. But I suspect the official position would be something along the lines "all the distros do that, hence it's better if we support this, as some of the distros for sure will have things messed up" *if* you would ask Linus

1
0
1
@kernellogger yeah maybe :) might revisit once book is done (sort of the refrain for everything really)
0
0
1

@ljs If you need to debug early boot code, use ‘qemu -S’. From the man page:

-S Do not start CPU at startup (you must type 'c' in the monitor).

1
0
0

@ljs Of course, you also want to add a suitable ‘-monitor’ option in that case.

1
0
0
@ptesarik yeah I know, have done this before, however you can also kick things off by connecting a debugger (I have a script for this ofc, kerndev-debug). Which is often something you want to do when debugging this code :)

The scripts are scrappy so when I've done this I've just manually edited kerndev-run locally.
1
0
1

@ljs This looks interesting, but I will probably stay with my fancy libvirt setup and sharing my build directory with the VM as a Plan 9 filesystem.

1
0
2
@ptesarik yeah tbh it's probably better, there are things I'd like to fix in mine, but I just don't have time.

More a case of writing them for me and sharing in case useful to anybody else
1
0
1

@ljs OK, then you may want to change this sentence in the kernel-scripts README:

If you need to debug early boot code, you'll need to investigate how to work around this issue :(

0
0
0

@ljs Oh, don't get me wrong. Kudos to you for transforming your setup into a repository of scripts that can be published. For example, I haven't got this far (yet).

0
0
1