Content-Length: 502102 | pFad | https://github.com/freebsd/freebsd-src/commit/9b90a7e39

55 A number of small changes to make the 'save choice to disk' safer, · freebsd/freebsd-src@9b90a7e · GitHub
Skip to content

Commit 9b90a7e

Browse files
luigiluigi
luigi
authored and
luigi
committed
A number of small changes to make the 'save choice to disk' safer,
and re-enable it as default. In particular: + re-enable the 'update' flag in the Makefile (of course!); + commit Warner's patch "orb $NOUPDATE,_FLAGS(%bp)" to avoid writing to disk in case of a timeout/default choice; + fix an off-by-one count in the partition scan code that would print the wrong name for unknown partitions; + unconditionally change the boot prompt to 'Boot:' instead of 'Default:' to make room for the extra code/checks/messages. Some of the changes listed below are also made to save space; + rearrange and fix comments for known partition types. Right now we explicitly recognise *BSD, Linux, FAT16 (type 6, used on many USB keys), NTFS (type 7), FAT32 (type 11). Depending on other options we also recognise Extended (type 5), FAT12 (type 1) and FAT16 < 32MB (type 4). + Add an entry "F6 PXE" when the code is built with -DPXE (which is a default now). Technically, F6 boots through INT18, so the prompt 'PXE' is a bit misleading. Unfortunately the name INT18 is too long and does not fit in - we could use ROM perhaps. The reason I picked 'PXE' is that on many (I believe) new systems INT18 calls PXE. Apart from the choice of the name for PXE/ROM/INT18, this should close pending issues on the 1-sector boot0 code and we should be able to move the code to RELENG_7 when it reopens. No boot0cfg changes are necessary. MFC after: 3 weeks
1 parent 4dc7d8d commit 9b90a7e

File tree

2 files changed

+27
-28
lines changed

2 files changed

+27
-28
lines changed

sys/boot/i386/boot0/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ CFLAGS += ${OPTS}
3030
# with the one in the boot sector.
3131

3232
# Default boot flags:
33-
BOOT_BOOT0_FLAGS?= 0xcf
33+
BOOT_BOOT0_FLAGS?= 0x8f
3434

3535
# The number of timer ticks to wait for a keypress before assuming the default
3636
# selection. Since there are 18.2 ticks per second, the default value of

sys/boot/i386/boot0/boot0.S

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#endif
2323

2424
#ifdef PXE /* enable PXE/INT18 booting with F6 */
25+
#define SAVE_MORE_MEMORY
2526
#endif
2627

2728
#ifdef CHECK_DRIVE /* make sure we boot from a HD. */
@@ -274,10 +275,11 @@ read_entry: movb %ch,-0x4(%bx) # Zero active flag (ch == 0)
274275
* Scan the table of bootable ids, which starts at %di and has
275276
* length TLEN. On a match, %di points to the element following the
276277
* match; the corresponding offset to the description is $(TLEN-1)
277-
* bytes ahead. If we don't find a match, we hit the 'unknown' entry.
278+
* bytes ahead. We use a count of TLEN+1 so if we don't find a match
279+
* within the first TLEN entries, we hit the 'unknown' entry.
278280
*/
279281
movw $bootable_ids,%di # Lookup tables
280-
movb $(TLEN),%cl # Number of entries
282+
movb $(TLEN+1),%cl # Number of entries
281283
repne # Locate
282284
scasb # type
283285
/*
@@ -324,7 +326,7 @@ print_drive: addb $'0'|0x80,%al # Save next
324326
callw putx # item
325327
/*
326328
* Menu is complete, display a prompt followed by current selection.
327-
* 'decw %si' makes the register point to the space after 'Default: '
329+
* 'decw %si' makes the register point to the space after 'Boot: '
328330
* so we do not see an extra CRLF on the screen.
329331
*/
330332
print_prompt: movw $prompt,%si # Display
@@ -371,6 +373,7 @@ read_key:
371373
* Timed out or default selection
372374
*/
373375
use_default: movb _OPT(%bp),%al # Load default
376+
orb $NOUPDATE,_FLAGS(%bp) # Disable updates
374377
jmp check_selection # Join common code
375378

376379
/*
@@ -585,13 +588,12 @@ intx13: # Prepare CHS parameters
585588
* Various menu strings. 'item' goes after 'prompt' to save space.
586589
* Also use shorter versions to make room for the PXE/INT18 code.
587590
*/
591+
prompt:
588592
#ifdef PXE
589-
prompt: .ascii "\nBoot:"
590-
item: .ascii " "; .byte ' '|0x80
591-
#else
592-
prompt: .ascii "\nDefault:"
593-
item: .ascii " "; .byte ' '|0x80
593+
.ascii "\nF6 PXE\r"
594594
#endif
595+
.ascii "\nBoot:"
596+
item: .ascii " "; .byte ' '|0x80
595597
crlf: .ascii "\r"; .byte '\n'|0x80
596598

597599
/* Partition type tables */
@@ -602,13 +604,13 @@ bootable_ids:
602604
* Corresponding descriptions are at desc_ofs:
603605
* Entries don't need to be sorted.
604606
*/
605-
.byte 0x1, 0x6, 0x7, 0xb, 0xc
606-
#ifndef SAVE_MEMORY
607-
.byte 0xe
608-
#endif
609-
.byte 0x83, 0xa5, 0xa6, 0xa9, 0x4
607+
.byte 0x83, 0xa5, 0xa6, 0xa9, 0x06, 0x07, 0x0b
610608
#ifndef SAVE_MORE_MEMORY
611-
.byte 0x5, 0xf
609+
.byte 0x05 # extended partition
610+
#endif
611+
#ifndef SAVE_MEMORY /* other DOS partitions */
612+
.byte 0x01 # FAT12
613+
.byte 0x04 # FAT16 < 32M
612614
#endif
613615

614616
desc_ofs:
@@ -617,24 +619,21 @@ desc_ofs:
617619
* actual partition name. The last entry must point to os_misc,
618620
* which is used for non-matching names.
619621
*/
620-
.byte os_dos-. # 1, FAT12 DOS
621-
.byte os_dos-. # 6, FAT16 <32M, DOS/WIN
622-
.byte os_win-. # 7, FAT16 >=32M Windows
623-
.byte os_win-. # 11, FAT32
624-
.byte os_win-. # 12, FAT32-LBA
625-
#ifndef SAVE_MEMORY
626-
.byte os_win-. # 14, FAT16-LBA
627-
#endif
628622
.byte os_linux-. # 131, Linux
629623
.byte os_freebsd-. # 165, FreeBSD
630624
.byte os_bsd-. # 166, OpenBSD
631625
.byte os_bsd-. # 169, NetBSD
632-
.byte os_dos-. # 4, FAT16 < 32M
626+
.byte os_dos-. # 6, FAT16 >= 32M
627+
.byte os_win-. # 7, NTFS
628+
.byte os_win-. # 11, FAT32
629+
633630
#ifndef SAVE_MORE_MEMORY
634631
.byte os_ext-. # 5, DOS Ext
635-
.byte os_ext-. # 15, DOS Ext-LBA
636632
#endif
637-
633+
#ifndef SAVE_MEMORY
634+
.byte os_dos-. # 1, FAT12 DOS
635+
.byte os_dos-. # 4, FAT16 <32M
636+
#endif
638637
.byte os_misc-. # Unknown
639638

640639
/*
@@ -643,10 +642,10 @@ desc_ofs:
643642
*/
644643
os_misc: .byte '?'|0x80
645644
os_dos:
646-
#ifndef SAVE_MEMORY /* DOS string only if room */
645+
#ifndef SAVE_MORE_MEMORY /* 'DOS' remapped to 'WIN' if no room */
647646
.ascii "DO"; .byte 'S'|0x80
648647
#endif
649-
os_win: .ascii "WI"; .byte 'N'|0x80
648+
os_win: .ascii "Wi"; .byte 'n'|0x80
650649
os_linux: .ascii "Linu"; .byte 'x'|0x80
651650
os_freebsd: .ascii "Free"
652651
os_bsd: .ascii "BS"; .byte 'D'|0x80

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/freebsd/freebsd-src/commit/9b90a7e39

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy