I don't know how similar or otherwise this is to the vmlinuz process, because I don't know how they do it (I have built a Linux kernel, but all I did was
Code: Select all
make menuconfig; make; make modules; make install; make modules_install [failed]; yaird [Yet Another mkInitRD] [failed];
I haven't come up with an official name yet (I'll do that later); but I like the name Prolix (pun on Minix, Prolix is an actual word meaning "verbose;" I've been told multiple times that I over-comment my code) so I'll use that for now (and maybe forever).
Code: Select all
/* Kernel build process:
* **** List: ****
* * Kernel is built into prolixkernel.bin (binary)
* * Clzss (C implementation of the LZSS compression algorithm) is called
* to create prolixkernel.zbin (zipped binary)
* * Cmd5 (C implementation of the MD5 hashing algorithm) is called to
* create an md5 hash of the kernel.
* * The resulting hash is built into the file prolixboot.bin, via a #define
* passed by gcc on the command-line
* * On boot, the prolixboot.bin program re-md5's the prolixkernel.zbin file
* and checks that it's the same as the #defined md5 (I'll build Clzss and
* Cmd5 into the prolixboot.bin program) and then either prints a warning
* message that the kernel was tainted or extracts it, depending on whether
* the md5s were different or the same, respectively.
* * The prolixkernel boots
*
* **** Flow Chart: ****
*
* Key:
* ( ... ): start or end of block
* [ ... ]: processing
* / ... /: input/output
* < ... >: conditional
* ->, <-, V or ^: control flow (right, left, down and up respectively).
*
* **** Building: ****
*
* ( start build process ) <---------------
* V ^
* < kernel built? > NO -> [ build kernel ]
* YES
* V
* / file prolixkernel.bin is created /
* V
* [ lzss-compress the kernel with Clzss ]
* V
* / file prolixkernel.zbin is created /
* V
* [ md5sum the kernel with Cmd5 ]
* V
* [ build prolixboot.bin from boot.o Cmd5.o and Clzss.o,
* pass the md5 hash on the command line as KERNEL_MD5 ]
* V
* / file prolixboot.bin is created /
* V
* [ create floppy disk image ]
* V
* / file prolix.img is created /
* ( end build process )
*
* **** Booting: ****
*
* ( start boot process )
* V
* [ re-MD5 the prolixkernel.zbin file with Cmd5 ]
* V
* < new MD5 matches KERNEL_MD5? > NO -> ( print error message and shut down )
* YES
* V
* [ de-compress the kernel with Clzss ]
* V
* [ boot the kernel ]
* V
* ( end boot process )
*/