Browse Source

Add .usb target

tags/v0.9.3
Michael Brown 17 years ago
parent
commit
6e082c9b81
2 changed files with 34 additions and 0 deletions
  1. 11
    0
      src/arch/i386/Makefile
  2. 23
    0
      src/arch/i386/prefix/usbdisk.S

+ 11
- 0
src/arch/i386/Makefile View File

98
 
98
 
99
 MEDIA			+= exe
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
 # Some suffixes (e.g. %.zfd0) are generated directly from other
105
 # Some suffixes (e.g. %.zfd0) are generated directly from other
102
 # finished files (e.g. %.zdsk), rather than having their own prefix.
106
 # finished files (e.g. %.zdsk), rather than having their own prefix.
103
 
107
 
117
 %liso:	%lilo util/genliso
121
 %liso:	%lilo util/genliso
118
 	bash util/genliso $@ $<
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
 # Add NON_AUTO_MEDIA to the media list, so that they show up in the
131
 # Add NON_AUTO_MEDIA to the media list, so that they show up in the
121
 # output of "make"
132
 # output of "make"
122
 #
133
 #

+ 23
- 0
src/arch/i386/prefix/usbdisk.S View File

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…
Cancel
Save