1
00:00:00,850 --> 00:00:04,870
I'm going to show you how to build and test the projects on Ubuntu system.

2
00:00:05,960 --> 00:00:06,770
In boot folder,

3
00:00:09,850 --> 00:00:16,300
boot files and build script are prepared to use.  The boot image file is the blank 10 mb image we created 

4
00:00:16,300 --> 00:00:19,330
in lecture working with linux. 

5
00:00:19,780 --> 00:00:23,590
Be sure to place the image in the boot folder before building the project. 

6
00:00:25,790 --> 00:00:30,380
In the build script, we use the same commands as those in windows.

7
00:00:33,010 --> 00:00:35,380
So let's open the terminal.

8
00:00:38,750 --> 00:00:41,480
And navigate to the boot directory,

9
00:00:46,500 --> 00:00:47,130
and type

10
00:00:48,810 --> 00:00:51,510
./build.sh and press enter.

11
00:00:53,040 --> 00:01:01,490
If you run the script for the first time, we may encounter this error, we need to change mode 

12
00:01:01,510 --> 00:01:03,600
and add executable attribute to this file. 

13
00:01:07,980 --> 00:01:08,820
Let's run it again. 

14
00:01:12,890 --> 00:01:13,210
OK.

15
00:01:13,970 --> 00:01:20,520
we copied 512 bytes in the image file. Before we open the virtual machine, 

16
00:01:20,540 --> 00:01:22,820
we need box configuration file. 

17
00:01:25,290 --> 00:01:29,610
Remember, we created the configuration file in lecture working with linux

18
00:01:30,450 --> 00:01:35,730
I have copied it here. So let's take a look.

19
00:01:36,270 --> 00:01:42,690
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 

20
00:01:42,690 --> 00:01:44,580
,

21
00:01:45,120 --> 00:01:47,640
we simply put boot.img here. 

22
00:01:50,020 --> 00:01:53,110
Now, in the terminal we type bochs 

23
00:01:55,240 --> 00:01:56,050
and press enter. 

24
00:01:57,450 --> 00:02:06,210
As you see, bochs stops and there is a prompt waiting for the action. We type c which means continue 

25
00:02:06,270 --> 00:02:07,170
and press enter. 

26
00:02:10,139 --> 00:02:10,500
OK.

27
00:02:13,470 --> 00:02:15,470
Hello is printed on the virtual machine

28
00:02:18,490 --> 00:02:23,920
The next thing we are going to do is we are going to write image file into a USB flash drive.

29
00:02:26,800 --> 00:02:32,580
I highly recommend to do this task using rufus in windows, because we will use command dd in the terminal. 

30
00:02:32,590 --> 00:02:38,290
If we specify the wrong device, it could overwrite data in other disks.

31
00:02:39,250 --> 00:02:42,880
So we should be careful when we do it in Linux or Macos. 

32
00:02:43,810 --> 00:02:49,420
First, we insert the USB flash drive to the computer and  type sudo, 

33
00:02:51,760 --> 00:02:55,570
fdisk dash L to list the partitions

34
00:03:00,840 --> 00:03:09,510
these are the disks in my computer and disk sdb which is Data traveler, is the USB flash drive we will write into.

35
00:03:09,510 --> 00:03:10,420
.

36
00:03:11,010 --> 00:03:14,420
So we type sudo, 

37
00:03:16,170 --> 00:03:20,550
dd,  the input file boot.img, the output file, 

38
00:03:23,500 --> 00:03:25,000
dev,  sdb, 

39
00:03:26,940 --> 00:03:30,660
and the block size, 512 bytes. 

40
00:03:32,560 --> 00:03:34,180
We copy 1 sector of data. 

41
00:03:36,460 --> 00:03:42,970
Once again, make sure that the output file is the correct device we want to write into, and press enter. 

42
00:03:46,350 --> 00:03:49,440
Ok the bootable usb flash drive is ready to use.

43
00:03:53,260 --> 00:03:55,600
With USB flash drive ready to use, 

44
00:03:55,760 --> 00:04:01,690
we insert it into the test computer and boot the computer. 

45
00:04:01,840 --> 00:04:09,160
Because we are running in legacy bios mode, we have to make sure the csm support is enable if the motherboard has uefi system,  

46
00:04:09,160 --> 00:04:10,870
which should be enabled by default. 

47
00:04:11,590 --> 00:04:14,710
As you can see, this is the BIOS interface in my computer. 

48
00:04:15,530 --> 00:04:17,950
We navigated to BIOS option. 

49
00:04:18,980 --> 00:04:25,160
And CSM is enabled. Also BIOS interface could be different in your machine, 

50
00:04:25,160 --> 00:04:28,760
so you need to check whether the CSM option is at in your computer. 

51
00:04:29,600 --> 00:04:32,270
OK, we exit and reboot the computer. 

52
00:04:39,530 --> 00:04:45,360
Since we didn't set up boot device priority, we open boot menu. In this menu, 

53
00:04:45,380 --> 00:04:50,760
we choose which device we want to boot. Since this is a test computer which has no hard disk, 

54
00:04:51,320 --> 00:04:53,750
the only option is the USB flash drive

55
00:04:53,780 --> 00:04:54,890
I just inserted. 

56
00:04:55,610 --> 00:04:56,660
So we press enter.

57
00:05:00,820 --> 00:05:02,600
If everything goes well, we can see

58
00:05:02,620 --> 00:05:03,610
hello is printed. 

59
00:05:04,690 --> 00:05:06,040
That's it for this lecture.

60
00:05:06,130 --> 00:05:07,600
See you in the next video.

