I'm going to show you how to build and test the projects on Ubuntu system.
In boot folder,
boot files and build script are prepared to use. The boot image file is the blank 10 mb image we created
in lecture working with linux.
Be sure to place the image in the boot folder before building the project.
In the build script, we use the same commands as those in windows.
So let's open the terminal.
And navigate to the boot directory,
and type
./build.sh and press enter.
If you run the script for the first time, we may encounter this error, we need to change mode
and add executable attribute to this file.
Let's run it again.
OK.
we copied 512 bytes in the image file. Before we open the virtual machine,
we need box configuration file.
Remember, we created the configuration file in lecture working with linux
I have copied it here. So let's take a look.
In the configuration file, the image path should point to the correct image. Because we copied the configuration file in the same directory as boot image file
,
we simply put boot.img here.
Now, in the terminal we type bochs
and press enter.
As you see, bochs stops and there is a prompt waiting for the action. We type c which means continue
and press enter.
OK.
Hello is printed on the virtual machine
The next thing we are going to do is we are going to write image file into a USB flash drive.
I highly recommend to do this task using rufus in windows, because we will use command dd in the terminal.
If we specify the wrong device, it could overwrite data in other disks.
So we should be careful when we do it in Linux or Macos.
First, we insert the USB flash drive to the computer and type sudo,
fdisk dash L to list the partitions
these are the disks in my computer and disk sdb which is Data traveler, is the USB flash drive we will write into.
.
So we type sudo,
dd, the input file boot.img, the output file,
dev, sdb,
and the block size, 512 bytes.
We copy 1 sector of data.
Once again, make sure that the output file is the correct device we want to write into, and press enter.
Ok the bootable usb flash drive is ready to use.
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 CSM 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.
So we press enter.
If everything goes well, we can see
hello is printed.
That's it for this lecture.
See you in the next video.