Page 1 of 1
How to compile latest, stable Linux Kernel for Remastered FatDog?
Posted: Tue Oct 25, 2022 8:37 pm
by Neo_78
I would like to use the latest, stable Linux kernel 6.0.3 with a remastered FatDog64:
https://kernel.org/
Regarding the use of a different kernel, the documentation states the following:
https://distro.ibiblio.org/fatdog/web/faqs/kernel.html
"This instruction is for using one of the pre-packaged Fatdog kernels, replacing the current one that comes with your version of Fatdog. If instead, you just want to add some additional kernel modules you've built yourself; or if you compile a totally new kernel, please follow the instructions in here to rebuild and replace the kernel-modules.sfs in initrd."
If I see this correctly, the latest pre-compiled kernel that is aivailable for FatFog is vmlinuz-5.19.14, right?
https://distro.ibiblio.org/fatdog/kernels/810/
This means that I would have to compile 6.0.3 myself, correct?
So the guide mentioned in the docs is the following one:
https://distro.ibiblio.org/fatdog/web/faqs/initrd.html
Correct me if I am wrong, but this only explains kernel module replacement but does not seem to describe the complete kernel compilation process on its own.
Could you guide me how to approach this?
Thank you! 
Re: How to compile latest, stable Linux Kernel for Remastered FatDog?
Posted: Thu Oct 27, 2022 2:47 pm
by jamesbond
There is nothing special about Fatdog kernel build process. It's just standard kernel compilation process, of which there are many guides on the Net. Basically, get the kernel tarball, unpack it, patch it with aufs, and apply the kernel config.
Fatdog's running kernel config file is always available in /proc/config.gz and you can use this as a starting point for your own build. We tweak the config file when we upgrade to a major kernel release (5.4.xx, 5.10.xx, etc) but usually keep it as is for minor releases unless there is a need to do it otherwise.
The difference about our kernel build compared to others is the packaging: what we do after the kernel is finished. The kernel itself has no need for packaging (just rename from bzImage to vmlinuz), it's only the modules and the firmware that needs to be packaged into an SFS file.
If you really want to have a taste of how to build kernels for Fatdog, my best advice is to download one of the many Fatdog kernel source SFS-es (aptly named as kernel-source-xxx.sfs). Get it, load the SFS, go to /usr/src/linux-XXX and then try to compile it. You don't even have to worry about patching aufs, as it is already patched in. Try to build it and see if you can finish the process.
(If you do finish it, don't follow the guide to "install" it, as Fatdog operates differently and you can't install it the way other guides tell you to do).
Re: How to compile latest, stable Linux Kernel for Remastered FatDog?
Posted: Thu Oct 27, 2022 9:10 pm
by Neo_78
Thanks @jamesbond.
I have a couple of questions if you don't mind.
For instance having a look at the first kernel compilation tutorial search result that you shared:
https://phoenixnap.com/kb/build-linux-kernel
Are the required packages already present in FatDog (sudo apt-get install git fakeroot build-essential ncurses-dev xz-utils libssl-dev bc flex libelf-dev bison
)?
Can you compile a kernel if you run FatDog in RAM-only mode and you don't have it installed on a hard drive?
Regarding your recommendation, just to clarify: do you suggest to compile a pre-built source file, e.g. kernel-source-5.19.14.sfs
, as a test run?
Thanks for your feedback! 
Re: How to compile latest, stable Linux Kernel for Remastered FatDog?
Posted: Fri Oct 28, 2022 12:49 am
by jamesbond
Neo_78 wrote: Thu Oct 27, 2022 9:10 pm
Are the required packages already present in FatDog (sudo apt-get install git fakeroot build-essential ncurses-dev xz-utils libssl-dev bc flex libelf-dev bison
)?
They're all in devx. If you load the devx SFS then you'll have all of them.
Follow step 1, 2, 4, 5.1
Don't run step 5.2 (make modules_install) etc onwards - that's the installation process.
We only want to try to build it at this time; we can cover the installation process later.
Can you compile a kernel if you run FatDog in RAM-only mode and you don't have it installed on a hard drive?
If you have enough RAM.
Regarding your recommendation, just to clarify: do you suggest to compile a pre-built source file, e.g. kernel-source-5.19.14.sfs
, as a test run?
Yes, pick up any version you want to use (even older ones are okay - because you're only practising).
In comparison with the guide you linked, by using those prepackaged SFS, you skip Step 1 and 2 (and the step they don't include there - aufs patching), so you can go straight to Step 4 and 5.1.
Once you are confident enough, you can do Step 1 and 2 on your own, downloading from kernel.org as you wish.
Re: How to compile latest, stable Linux Kernel for Remastered FatDog?
Posted: Fri Oct 28, 2022 9:41 pm
by Neo_78
Thanks a lot for your detailed guidance @jamesbond. Let me try that and I'll get back... 
Re: How to compile latest, stable Linux Kernel for Remastered FatDog?
Posted: Sat Oct 29, 2022 8:51 pm
by Neo_78
Another question if you don't mind @jamesbond:
From your experience, how much space is required to compile the Linux kernel for FatFog?
Some users report temporary file sizes of 22GB (depending on the distribution):
https://superuser.com/questions/130381/ ... -is-needed
That would clearly exceed my available RAM size to compile it in memory only.
As I do not have a hard drive and I boot FatDog from DVD into RAM, would it be possible to simply connect a sufficiently large USB pendrive and compile it on that pendrive? Could I simply let the USB drive auto-mount or would it have to be mounted and formatted in a specific way?
Thanks for your advice! 
Re: How to compile latest, stable Linux Kernel for Remastered FatDog?
Posted: Sun Oct 30, 2022 2:27 pm
by Duprate
Re: How to compile latest, stable Linux Kernel for Remastered FatDog?
Posted: Mon Oct 31, 2022 11:22 am
by jamesbond
@Neo_78
Code: Select all
# du -sh linux-5.19.17
3.7G linux-5.19.17
@Duprate
It's not a secret. Here is the instructions for 6.0.x kernel, straight from the author of aufs.