瀏覽代碼

Add .usb target

tags/v0.9.3
Michael Brown 17 年之前
父節點
當前提交
6e082c9b81
共有 2 個檔案被更改,包括 34 行新增0 行删除
  1. 11
    0
      src/arch/i386/Makefile
  2. 23
    0
      src/arch/i386/prefix/usbdisk.S

+ 11
- 0
src/arch/i386/Makefile 查看文件

@@ -98,6 +98,10 @@ MEDIA			+= com
98 98
 
99 99
 MEDIA			+= exe
100 100
 
101
+# Special target for building Master Boot Record binary
102
+$(BIN)/mbr.bin : $(BIN)/mbr.o
103
+	$(OBJCOPY) -O binary $< $@
104
+
101 105
 # Some suffixes (e.g. %.zfd0) are generated directly from other
102 106
 # finished files (e.g. %.zdsk), rather than having their own prefix.
103 107
 
@@ -117,6 +121,13 @@ NON_AUTO_MEDIA		+= liso
117 121
 %liso:	%lilo util/genliso
118 122
 	bash util/genliso $@ $<
119 123
 
124
+# rule to make a USB disk image
125
+$(BIN)/usbdisk.bin : $(BIN)/usbdisk.o
126
+	$(OBJCOPY) -O binary $< $@
127
+
128
+%usb: $(BIN)/usbdisk.bin %hd
129
+	cat $^ > $@
130
+
120 131
 # Add NON_AUTO_MEDIA to the media list, so that they show up in the
121 132
 # output of "make"
122 133
 #

+ 23
- 0
src/arch/i386/prefix/usbdisk.S 查看文件

@@ -0,0 +1,23 @@
1
+	.text
2
+	.arch i386
3
+	.section ".prefix", "awx", @progbits
4
+	.code16
5
+	.org 0
6
+
7
+#include "mbr.S"
8
+
9
+/* Partition table: ZIP-compatible partition 4, 64 heads, 32 sectors/track */
10
+	.org 446
11
+	.space 16
12
+	.space 16
13
+	.space 16
14
+	.byte 0x80, 0x01, 0x01, 0x00
15
+	.byte 0x01, 0x3f, 0x20, 0x01
16
+	.long 0x00000020
17
+	.long 0x00000fe0
18
+
19
+	.org 510
20
+	.byte 0x55, 0xaa
21
+
22
+/* Skip to start of partition */
23
+	.org 32 * 512

Loading…
取消
儲存