Rebootless development

Submitted by Anonymous
on May 23, 2008 - 8:06am

Hi there,

I was wondering if one wants to modify a specific part of the linux kernel which is not "critical" to the functioning of the computer such as for example the firewire stack or a driver for a webcam, can the modify source, compile, run cycle be achieved without having to reboot the machine? Can the subsystem be compiled as a kernel module and then unloaded/loaded after each compile and therefore not be forced to reboot at all to test the changes applied to the code?

Thanks in advance!

Carles

sure, if

olecom
on
May 23, 2008 - 9:51am

Sure, if:

* subsystem is modular and can be built as a kernel module

and you don't

* trash kernel data structures (in RAM, like filesystem, etc)
* OOPs the kernel
* ...

maybe UML or `qemu` can be used? It's better and safe (on early development stages).

But using UML or QEMU still

Carles (not verified)
on
May 23, 2008 - 8:07pm

But using UML or QEMU still entails rebooting the image inside the emulator every time changes are made to the code, correct?

(again) It depends

olecom
on
May 23, 2008 - 8:41pm

(again) It depends on how big changes are, if there is a plug-in infrastructure and how correct one can write the code, so it doesn't do things, monolitic kernel can't survive.

Emulators in this case are used for one's real hardware or data safety in first place. Minor bugs, unless they are in core functionality or basic hardware setup code, can be fixed even with simple userspace
echo "$BINARY_PATCH" | dd seek="$OFFSET" bs="$B" count="$N" /dev/kmem

Well, here I am talking long

Carles (not verified)
on
May 24, 2008 - 10:20am

Well, here I am talking long term development, such as adding new features to an already existing driver or protocol stack. So in this case echoing into /dev/kmem really wouldn't do the trick, as changes would be relatively big. What I meant is that when you develop in QEMU or UML, you usually compile outside the virtual machine, in the natively running kernel, right? And that's why I think that it would imply a reboot of the virtualized kernel every time a change to the code is made. If, on the other hand, modules are modified directly then it kind of becomes like developing a normal user space app: compile, run without rebooting anything outside or inside a virtual machine. However, I do understand that given that the code you are modifying is in kernel space, bad things can happen if there's a bug.
So if I went for UML or QEMU, what's the most used among kernel developers? What do most people that code things like protocol stacks or drivers use?

Thanks!

> What do most people that

olecom
on
May 24, 2008 - 2:55pm

> What do most people that code things like protocol stacks or drivers use?

It's know-how with some hints on <development-mailing-lists@vger.kernel.org>.

There is a project to add such a feature

sileNT (not verified)
on
May 23, 2008 - 1:13pm

There is a project to add such a feature to the Linux kernel - see "A system for rebootless kernel security updates" thread on LKML (end of April 2008).

http://web.mit.edu/ksplice/ h

Anonymous (not verified)
on
May 24, 2008 - 12:25pm

http://web.mit.edu/ksplice/
here is what you are searching for.

kernel development

Anonymous (not verified)
on
May 25, 2008 - 12:53am

Hi Carles,

Depending on the kind of development you are doing, you may simply be able to run your new kernel in an emulator like VirtualPC. I took an Operating Systems class where all of our development was done in VirtualPC, and it was very easy to reboot the system when it was virtual. Of course, this may not be an option if you have to deal with hardware not controlled by VirtualPC.

One easy thing to do is to get two computers, and hook the serial port from one to the serial port of another. When you are connected on the serial port, you will always see kernel oopses and have time to react to them.

Finally, you can load your own kernel modules using insmod or modprobe, and remove them with rmmod. Of course, if your module is wrong, you might explode. So I would recommend the two-computer setup even in this case. Most kernel subsystems can be compiled as modules, check out "make menuconfig" or "make xconfig".

RareCactus

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.