Browse Source

[int13con] Create log partition only when CONSOLE_INT13 is enabled

Reduce the size of the USB disk image in the common case that
CONSOLE_INT13 is not enabled.

Originally-implemented-by: Romain Guyard <romain.guyard@mujin.co.jp>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
master
Michael Brown 4 years ago
parent
commit
efc1ae5aba
1 changed files with 17 additions and 0 deletions
  1. 17
    0
      src/arch/x86/prefix/usbdisk.S

+ 17
- 0
src/arch/x86/prefix/usbdisk.S View File

1
 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
1
 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
2
 
2
 
3
+#include <config/console.h>
4
+
3
 	.text
5
 	.text
4
 	.arch i386
6
 	.arch i386
5
 	.section ".prefix", "awx", @progbits
7
 	.section ".prefix", "awx", @progbits
13
 #define SECTORS 32
15
 #define SECTORS 32
14
 #define CYLADDR(cyl) ((((cyl) * HEADS + (((cyl) == 0) & 1)) * SECTORS) * 512)
16
 #define CYLADDR(cyl) ((((cyl) * HEADS + (((cyl) == 0) & 1)) * SECTORS) * 512)
15
 
17
 
18
+#ifdef CONSOLE_INT13
19
+#define LOGPART 1
16
 #define LOGSTART 0
20
 #define LOGSTART 0
17
 #define LOGCOUNT 1
21
 #define LOGCOUNT 1
18
 #define BOOTSTART 1
22
 #define BOOTSTART 1
19
 #define BOOTCOUNT 2
23
 #define BOOTCOUNT 2
24
+#else /* CONSOLE_INT13 */
25
+#define LOGPART 0
26
+#define BOOTSTART 0
27
+#define BOOTCOUNT 2
28
+#endif /* CONSOLE_INT13 */
20
 
29
 
21
 	/* Construct a C/H/S address */
30
 	/* Construct a C/H/S address */
22
 	.macro	chs cylinder, head, sector
31
 	.macro	chs cylinder, head, sector
44
 	.org 446
53
 	.org 446
45
 	.space 16
54
 	.space 16
46
 	.space 16
55
 	.space 16
56
+
47
 	/* Partition 3: log partition (for CONSOLE_INT13) */
57
 	/* Partition 3: log partition (for CONSOLE_INT13) */
58
+	.if LOGPART
48
 	partition 0x00, 0xe0, LOGSTART, LOGCOUNT
59
 	partition 0x00, 0xe0, LOGSTART, LOGCOUNT
60
+	.else
61
+	.space 16
62
+	.endif
63
+
49
 	/* Partition 4: boot partition */
64
 	/* Partition 4: boot partition */
50
 	partition 0x80, 0xeb, BOOTSTART, BOOTCOUNT
65
 	partition 0x80, 0xeb, BOOTSTART, BOOTCOUNT
51
 
66
 
54
 	.byte 0x55, 0xaa
69
 	.byte 0x55, 0xaa
55
 
70
 
56
 /* Skip to start of log partition */
71
 /* Skip to start of log partition */
72
+	.if LOGPART
57
 	.org CYLADDR(LOGSTART)
73
 	.org CYLADDR(LOGSTART)
58
 	.ascii "iPXE LOG\n\n"
74
 	.ascii "iPXE LOG\n\n"
75
+	.endif
59
 
76
 
60
 /* Skip to start of boot partition */
77
 /* Skip to start of boot partition */
61
 	.org CYLADDR(BOOTSTART)
78
 	.org CYLADDR(BOOTSTART)

Loading…
Cancel
Save