3.7 KiB
How to build this project
To build and run in qemu:
simply run make That's it. It'll ask for your password to run sudo mount image.bin, to create a few directories (and eventually move in files that will be needed for installation/running). If you don't feel comfortable doing this through make, cause you don't trust the build script or something, you can run
make tools && make bootloader && make kernel
You'll then need to copy bin/bootloader to image.bin and resize the image. I suggest 64mb but its up to your discretion, as long as it's big enough. I usually do this by running qemu-img resize -f raw image.bin 64M.
Next, you'll need an initrd, named initrd.rd. Unless you don't want to be able to read and write to the disk, make sure to include idm.elf and ifsm.elf (or/and your own custom .elf formatted relocatable executable modules), as well as the config initrc.conf to be able to load these files. initrd will be mounted at the directory /boot, so any filenames must have /boot appended to them, if they are located on the initrd. The initrd MUST be a ustar-formatted image. My makefile assembles it using tar --format=ustar -cf initrd.rd idm.elf ifsm.elf initrc.conf.
Because linux mangles the names, and the BIOS bootloader does not support LFNs, or account for these mangled names, you'll need to run the custom tool I built to write the the disk image. This can be done by running ./diskwrite initrd.rd kernel.elf. This will write the files to the filesystem in a way that does not mangle the names, granted the names are under 11 characters. If they are above 11 characters, the filenames will be truncated.
As a warning, there is no output to the screen currently, so if you would like to see what the kernel is doing, make sure to check the serial log, or include the option -serial mon:stdio if you are using qemu, to see it in the terminal. Please note that doing this way disables ctrl+c exiting, and you'll have to use ctrl+a x to exit.
running make will open qemu. If you'd like to build without opening qemu then use make mount instead. It'll ask for your password to mount the image to ./mount to allow you to include any files that you won't need at boot time, like a shell, or application files.