Hello everyone,
I have done some linux kernel hacking where the development process I used is as follow:
Now for FreeBSD, I am trying to do the same thing however what I am able to do so far:
I know already that FreeBSD is different than linux, you don't need to mention this here because all the search results show me a discussion on this topic instead of talking about an actual solution to this problem.
I need to know please what is the best way, best practice to develop the FreeBSD kernel. I need to create my own process scheduler on FreeBSD, I already did in linux it is not a matter of how to do your own scheduler, but how to debug or run your changes in a virtual machine for testing and development.
I need to know whether I can do with FreeBSD what I did with linux. If yes, how? If no, then what is the best way to do it in FreeBSD.
So far I have two options:
I have done some linux kernel hacking where the development process I used is as follow:
- Install buildroot and make
- Change some kernel code and compile it in host machine
- run qemu with setting kernel path and buildroot directory with this command:
Code:
qemu-system-x86_64 -kernel arch/x86/boot/bzImage \
-boot c -m 2049M -hda ../buildroot/output/images/rootfs.ext4 \
-append "root=/dev/sda rw console=ttyS0,115200 acpi=off nokaslr" \
-serial stdio -display none -smp $1
Now for FreeBSD, I am trying to do the same thing however what I am able to do so far:
- I am running FreeBSD as host in my machine
- I did some test changes, compile, and install the freebsd kernel on my host machine
- I also installed FreeBSD in guest virtual machine and able to run it in qeme
I know already that FreeBSD is different than linux, you don't need to mention this here because all the search results show me a discussion on this topic instead of talking about an actual solution to this problem.
I need to know please what is the best way, best practice to develop the FreeBSD kernel. I need to create my own process scheduler on FreeBSD, I already did in linux it is not a matter of how to do your own scheduler, but how to debug or run your changes in a virtual machine for testing and development.
I need to know whether I can do with FreeBSD what I did with linux. If yes, how? If no, then what is the best way to do it in FreeBSD.
So far I have two options:
- Either test the new kernel on my host, and restart my machine every time, which is not a good solution.
- Or setup the guest FreeBSD to do the kernel development inside the guest (change code, compile, and install) all inside the guest machine. Which is not that good too but it is better than option 1