How to develop a simple OS using Assembly language
This story will help you to develop a simple Operating System and show hardware information of the computer using assembly language on ubuntu.
Pre-Requisites for the implementation
This task is performed on ubuntu operating system and the tools are mentioned below should be installed to coding.
- NASM installation — This tool can be installed using terminal of ubuntu by entering following code.
sudo bash apt-get install nasm
2. mkisofs installation — This is used to make an ISO image of AMOS
sudo apt-get install cdda2wav cdrecord mkisofs
3. QEMU — This is an emulator and this is used to run .flp/.iso file that we needed.
sudo bash apt-get install qemu-system-x86
File Constraints
- Programs/ — Source code for programs added to the disk image.
- Source/ — Contains the entire OS source code.
- Source/bootload/ — source to generate BOOTLOAD.BIN, which is added to the image when building.
- Source/features/ — Components of Jil OS(keyboard and screen).
- Source/kernel.asm — The core kernel source file, which pulls in other source files.
Implementation
There is the all code of the jil OS in the github.
Building “jil OS”
Open the terminal and change directory to the jil OS folder and then enter the code below.
sudo bash ./build-linux.sh
This will use NASM to assemble the bootloader, kernal and supplied programs, then write the bootloader to the jilOs.flp floppydisk image in the disk_images/directory.(It writes the 512-byte bootloader to the first sector of the floppy disk image to create a boot sector and set up a DOS-like file system.)
Next, the build script loopback-mounts the jilOs.flp image onto the file system — in other words, mounting the image as if it was a real floppy.
The script copies over the kernel(kernel.bin) and binaries from the programs/directory, brfore unmounting the floppy image.
With that done, the script runs the mkisofs utility to generate a CD-ROM ISO image of jilOs, injecting the floppy image as a boot section.
So we end up with two files in the disk_images/directory: one for floppy disks and one for CD-Rs.
Running the jil Os
Now we can use jilOs.iso/jilOs.flp in an emulator or on a real pc. In here we used qemu for this and code for that is (when we are using qemu),
sudo bash qemu-system-x86 -soundhw pcspk -drive
format=raw,file=disk_images/jilOs.flp,index=0,if=floppy
is we want to run this jilOs on windows, we can use virtual box and jilOs.iso.
Screenshot of jilOs
project files : https://github.com/JeewanthaLahiru/Jil-OS