Updated build.md

This commit is contained in:
notsomeidiot123 2026-01-22 12:52:47 -05:00
parent c00f8d84f8
commit 03e72ce030
1 changed files with 12 additions and 1 deletions

View File

@ -6,7 +6,17 @@ simply run `make` That's it. It'll ask for your password to run `sudo mount imag
`make tools && make bootloader && make kernel` `make tools && make bootloader && make kernel`
followed by `cp bin/bootloader.bin image.bin`, `qemu-img resize -f raw image.bin 64M`, and `diskwrite idm.elf ifsm.elf kernel.elf -o image.bin`, which will then allow you to mount image.bin. Then, run `mk {mount}/mod {mount}/bin {mount}/sys` and copy and files that need to be copied into their respective folders (currently there are none other than `idm.elf`, `ifsm.elf`, and `kernel.elf`) 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.
<!-- followed by `cp bin/bootloader.bin image.bin`, `qemu-img resize -f raw image.bin 64M`, and `diskwrite initrd.rd kernel.elf -o image.bin`, which will then allow you to mount image.bin. Then, run `mk {mount}/mod {mount}/bin {mount}/sys` and copy and files that need to be copied into their respective folders (currently there are none other than `idm.elf`, `ifsm.elf`, and `kernel.elf`)
You MUST run the `diskwrite` tool BEFORE mounting, as it sets up the filesystem for the bootloader, and copies `idm.elf`, `ifsm.elf` and `kernel.elf` in a way that can be read by the bootloader. You MUST run the `diskwrite` tool BEFORE mounting, as it sets up the filesystem for the bootloader, and copies `idm.elf`, `ifsm.elf` and `kernel.elf` in a way that can be read by the bootloader.
@ -15,3 +25,4 @@ To run, just use the command `qemu-system-i386 -hda image.bin {settings}`, with
## To build, but NOT run in qemu ## To build, but NOT run in qemu
You could always just run `make` and close qemu immediately, or you could run `make mount`. It'll ask for your password again for the above reason, but you can just follow the above steps, minus running qemu if you don't feel comfortable letting the build script handle it. Again, it is imperitive that you run `diskwrite` as specified, or else the bootloader won't be able to find the files (as linux defaults to long file names, and my bootloader does not support them, and the short filenames are in a different style than expected (eg `kernel.elf` becomes `KERNEL ELF`)) You could always just run `make` and close qemu immediately, or you could run `make mount`. It'll ask for your password again for the above reason, but you can just follow the above steps, minus running qemu if you don't feel comfortable letting the build script handle it. Again, it is imperitive that you run `diskwrite` as specified, or else the bootloader won't be able to find the files (as linux defaults to long file names, and my bootloader does not support them, and the short filenames are in a different style than expected (eg `kernel.elf` becomes `KERNEL ELF`))
-->