OK, I'm going to show you how to build and test the projects on Windows 10.
So first, we open the terminal.
in this video, Ubuntu system is used, we need to change the directory to mount
c drive and users,
The name of the user, work in my computer. You should change the path to your user path and desktop,
boot file
And press enter.
OK, we can check the file using command ls.
you can see the assembly file, the build script and the boot image.
The boot image file is the blank 10 mb image we created
in lecture working with windows 10. So make sure to copy the image to the project before we run the build script
because we need to write the projects into this image.
The bochs configuration file is also the one we created in lecture working with Windows 10.
We need to copy the configuration file in the project as well.
OK, let's build the project. We run the build script by typing ./build.sh
and press enter.
OK.
It says 512 bytes copied.
So if we check the directory, we open the boot folder.
you can see the boot.bin file is generated.
We can also inspect the binary file using hexdump command.
So in the terminal, we type hexdump,
dash C so that we can see the file with character string,
and the name of the file boot.bin,
press enter.
As you see, the last two bytes are 55 and AA.
The first column shows the address in hexadecimal. 200 is equal to 512 in decimal.
So the boot file is 512 bytes.
The right column shows the ascii code.
We can see message Hello is here.
OK.
In order to run the program in the virtual machine, we copy the bochs configure file into the directory
which is already copied here.
We need to do some editing,
so we add the bochs configuration file to visual studio code.
Here we need to change the path to the current directory
the boot image locates.
Here I have set it up.
OK, we are good to go.
Running bochs is simple. We just double-click it.
And bochs is running.
Ok now you can see hello is printed on the screen.
The other messages are printed by bochs,
You can see we are booting from hard disk.
OK, we just closed it out.
If you want to write the boot file into usb flash drive and boot it on a real machine,
we need to insert the usb drive to the computer and write the image to it using rufus in windows
or dd command in linux and mac os. Since this is the first project we build,
let's see how to do it. In Windows environment,
we open rufus
and select the boot image file
by clicking select.
And choose the boot image here, click open.
If you inserted the USB thumb drive, you should see it in the device here.
Also, you need to check that this is the correct device.
Then we can write to the image file by clicking start.
This is a warning message popping up.
We just click OK.
This process is really quick, and now we have bootable USB flash drive.
With USB flash drive ready to use,
we insert it into the test computer and boot the computer.
Because we are running in legacy bios mode,
we have to make sure the csm support is enable if the motherboard has uefi system,
which should be enabled by default.
As you can see, this is the BIOS interface in my computer.
We navigated to BIOS option.
And CSM is enabled. Also BIOS interface could be different in your machine, so you need to check
whether the C,S,M option is at in your computer.
OK, we exit and reboot the computer.
Since we didn't set up boot device priority, we open boot menu. In this menu,
we choose which device we want to boot. Since this is a test computer which has no hard disk,
the only option is the USB flash drive
I just inserted. Press enter.
If everything goes as expected, we can see hello is printed.
That's it for this lecture.
See you in the next video.