Reprinted Note: k_linux_man
We have always been using the bochs simulator to start our merxos operating system. The simulation is really not fun. Today we will let our "merxos: Hello, world" run on the real machine. Today's modernization,
The USB flash disk has already replaced the floppy disk, so we use the USB flash disk as an example to describe how to load the merxos operating system from the USB flash disk.
First Sector of the USB flash drive
The first sector of a USB flash drive consists of three parts:
Part 1 (0x0000 ~ 0x01bd) The 446 bytes are MBR, MBR (Master Boot Record) Primary Boot Sector, and our merxos: Hello, world program should be placed within 0-bytes.
Part 1 (0x01be ~ 0x01fd) 64 bytes are the disk partition table (DPT) of the u disk. Each 16 bytes describes a primary partition. Therefore, a hard disk can have up to four primary partitions.
The 1st bytes of each partition in a partitioned table are the activity indicator. When the value is 80 h, it indicates that the partition is currently active and can be guided. When the value is H, indicates that the partition is not bootable.
Part 1 (0x01fe ~ 0x01ff) two bytes "55 AA" indicate the effective end of the partition.
Powerful binary Editor: winhex
I used winhex15.8. After searching for it from the Internet for a long time, I found one that could be used for cracking. I will upload this winhex program.
Select My Lenovo USB flash drive
However, we can see that 0x00-0x1bd is the first part, and the part starting with 0x80 is the second part. The 64-byte partition table. If we break this part, our USB flash drive won't be recognized in the XP system.
End with 55aa.
Use winhex to open the boot. imgfile of Hello, world in the previous section, and copy 0x00 ~ Replace the content of the first 446 bytes of 0x1bd with the content of the first 446 bytes of the USB flash drive, and change the last two bytes to 0x55, 0xaa
After boot. IMG is enabled, select 0x00-0x1bd and copy it.
Right-click Edit
In the same way, select the 0x00-0x1bd content of the USB flash drive. the content copied by IMG is written to the USB flash drive. Note that when you perform the write operation, select the first byte, then edit, and then wirte. At this time, the message starts from 0. We also want to perform the write operation from 0x00 to 0x1bd.
After writing, remember to modify 55, AA
Save the USB flash drive file. This software prompts an error when shutting down the USB flash drive. It doesn't matter. We have modified the content of the USB flash drive. Click OK directly (this is the software to crack, please be satisfied ).
Another Simpler Method
In Linux, the USB flash drive device is regarded as a file, so we can operate on this file. I am using Ubuntu, and the same method can be implemented using commands.
Sudo dd If = boot. IMG of =/dev/sdb bs = 446 COUNT = 1
I don't need to explain why it is 446, as mentioned in this Article. If it is written as 512, it will be miserable. Your USB flash drive cannot be identified in the XP system. The partition table format is damaged.
Because our environment is in XP, I will not explain Ubuntu command operations here.
Exciting moment-real machine testing Choose to start from the USB flash drive, and then it will be merxos.
Select Start from USB Lenovo