Welcome to the Linux Foundation Forum!

How to setup hardware for Linux Kernel development (not the obvious way)

Since one needs to use the browser and follow along video tutorials while learning; having to reboot the laptop frequently to install a new kernel makes things difficult. And since I have only one laptop, I was wondering if I could install my development kernel in another device like a Rapberry Pi (https://www.raspberrypi.org/) or similar. I was also wondering if it can be done on an AWS instance (https://aws.amazon.com/ec2/) (or any other cloud providers).

Thanks for your help.

Best Answers

  • drv
    drv Posts: 5
    edited September 2023 Answer ✓

    I have a Debian-12 as my host machine and Fedora38 inside qemu kvm as my guest. It was fairly easy to set up and works very well for me. I suggest you try something similar to start with and then you can add more VMs inside qemu as needed.

  • picoteando
    picoteando Posts: 6
    Answer ✓

    +1 to qemu for kernel development. You can even set it up to run the kernel with a minimal rootfs and boot in less than a second if you just need a lightweight kernel and nothing else, which also speeds up compilation. vmware, virtualbox and friends are handy if you need a fully-featured distro with additions to share resources with the host. That is also possible with qemu but not that user-friendly, at least at the beginning.

Answers

  • @ghanshyam1898 you can use vmware. You can install ubuntu instead inside vmware and do all kinds of things while your host machine is running smoothly, thus allowing you to not restart your whole laptop when tinkering with kernel goes wrong.

  • @suab123 said:
    @ghanshyam1898 you can use vmware. You can install ubuntu instead inside vmware and do all kinds of things while your host machine is running smoothly, thus allowing you to not restart your whole laptop when tinkering with kernel goes wrong.

    Thanks for your response. I was wondering if running in vmware will cause any trouble testing the kernel? Like, will the new kernel work a bit differently because of vm?

    Also, is there a faster way than vm? How is qemu? And what about electronic boards like raspberry pi etc?

  • @ghanshyam1898 not sure about qemu, never used it. Regarding pi, it is arm based machine, and I m certainly sure you are using x86 based system :) So I think linux compiled on your host machine wont boot in your pi, or if you want to compile the whole kernel on pi that will be quite slow due to less powerful resources.

  • @suab123 said:
    @ghanshyam1898 not sure about qemu, never used it. Regarding pi, it is arm based machine, and I m certainly sure you are using x86 based system :) So I think linux compiled on your host machine wont boot in your pi, or if you want to compile the whole kernel on pi that will be quite slow due to less powerful resources.

    I was thinking maybe I can compile in my laptop and just run the kernel in Pi. I have seen some youtube videos where developers use different kinds of boards in a similar way. Should be worth a try. Maybe we can collaborate online sometime and give it a shot.

    And regarding the arm-x86 thing, we can bring in the default config first from the Pi itself and then compile the kernel so that it's Pi ready.

    Thoughts?

  • Yup go ahead give it a try and do share the result.

Categories

Upcoming Training