Date: Tue, 30 Dec 2008 09:40:51 +0000 (UTC) From: Luigi Rizzo <luigi@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r186598 - head/sys/boot/i386/boot0 Message-ID: <200812300940.mBU9epuS086194@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: luigi Date: Tue Dec 30 09:40:50 2008 New Revision: 186598 URL: http://svn.freebsd.org/changeset/base/186598 Log: 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 Modified: head/sys/boot/i386/boot0/Makefile head/sys/boot/i386/boot0/boot0.S Modified: head/sys/boot/i386/boot0/Makefile ============================================================================== --- head/sys/boot/i386/boot0/Makefile Tue Dec 30 08:06:03 2008 (r186597) +++ head/sys/boot/i386/boot0/Makefile Tue Dec 30 09:40:50 2008 (r186598) @@ -30,7 +30,7 @@ CFLAGS += ${OPTS} # with the one in the boot sector. # Default boot flags: -BOOT_BOOT0_FLAGS?= 0xcf +BOOT_BOOT0_FLAGS?= 0x8f # The number of timer ticks to wait for a keypress before assuming the default # selection. Since there are 18.2 ticks per second, the default value of Modified: head/sys/boot/i386/boot0/boot0.S ============================================================================== --- head/sys/boot/i386/boot0/boot0.S Tue Dec 30 08:06:03 2008 (r186597) +++ head/sys/boot/i386/boot0/boot0.S Tue Dec 30 09:40:50 2008 (r186598) @@ -22,6 +22,7 @@ #endif #ifdef PXE /* enable PXE/INT18 booting with F6 */ +#define SAVE_MORE_MEMORY #endif #ifdef CHECK_DRIVE /* make sure we boot from a HD. */ @@ -274,10 +275,11 @@ read_entry: movb %ch,-0x4(%bx) # Zero a * Scan the table of bootable ids, which starts at %di and has * length TLEN. On a match, %di points to the element following the * match; the corresponding offset to the description is $(TLEN-1) - * bytes ahead. If we don't find a match, we hit the 'unknown' entry. + * bytes ahead. We use a count of TLEN+1 so if we don't find a match + * within the first TLEN entries, we hit the 'unknown' entry. */ movw $bootable_ids,%di # Lookup tables - movb $(TLEN),%cl # Number of entries + movb $(TLEN+1),%cl # Number of entries repne # Locate scasb # type /* @@ -324,7 +326,7 @@ print_drive: addb $'0'|0x80,%al # Save callw putx # item /* * Menu is complete, display a prompt followed by current selection. - * 'decw %si' makes the register point to the space after 'Default: ' + * 'decw %si' makes the register point to the space after 'Boot: ' * so we do not see an extra CRLF on the screen. */ print_prompt: movw $prompt,%si # Display @@ -371,6 +373,7 @@ read_key: * Timed out or default selection */ use_default: movb _OPT(%bp),%al # Load default + orb $NOUPDATE,_FLAGS(%bp) # Disable updates jmp check_selection # Join common code /* @@ -585,13 +588,12 @@ intx13: # Prepare CHS parameters * Various menu strings. 'item' goes after 'prompt' to save space. * Also use shorter versions to make room for the PXE/INT18 code. */ +prompt: #ifdef PXE -prompt: .ascii "\nBoot:" -item: .ascii " "; .byte ' '|0x80 -#else -prompt: .ascii "\nDefault:" -item: .ascii " "; .byte ' '|0x80 + .ascii "\nF6 PXE\r" #endif + .ascii "\nBoot:" +item: .ascii " "; .byte ' '|0x80 crlf: .ascii "\r"; .byte '\n'|0x80 /* Partition type tables */ @@ -602,13 +604,13 @@ bootable_ids: * Corresponding descriptions are at desc_ofs: * Entries don't need to be sorted. */ - .byte 0x1, 0x6, 0x7, 0xb, 0xc -#ifndef SAVE_MEMORY - .byte 0xe -#endif - .byte 0x83, 0xa5, 0xa6, 0xa9, 0x4 + .byte 0x83, 0xa5, 0xa6, 0xa9, 0x06, 0x07, 0x0b #ifndef SAVE_MORE_MEMORY - .byte 0x5, 0xf + .byte 0x05 # extended partition +#endif +#ifndef SAVE_MEMORY /* other DOS partitions */ + .byte 0x01 # FAT12 + .byte 0x04 # FAT16 < 32M #endif desc_ofs: @@ -617,24 +619,21 @@ desc_ofs: * actual partition name. The last entry must point to os_misc, * which is used for non-matching names. */ - .byte os_dos-. # 1, FAT12 DOS - .byte os_dos-. # 6, FAT16 <32M, DOS/WIN - .byte os_win-. # 7, FAT16 >=32M Windows - .byte os_win-. # 11, FAT32 - .byte os_win-. # 12, FAT32-LBA -#ifndef SAVE_MEMORY - .byte os_win-. # 14, FAT16-LBA -#endif .byte os_linux-. # 131, Linux .byte os_freebsd-. # 165, FreeBSD .byte os_bsd-. # 166, OpenBSD .byte os_bsd-. # 169, NetBSD - .byte os_dos-. # 4, FAT16 < 32M + .byte os_dos-. # 6, FAT16 >= 32M + .byte os_win-. # 7, NTFS + .byte os_win-. # 11, FAT32 + #ifndef SAVE_MORE_MEMORY .byte os_ext-. # 5, DOS Ext - .byte os_ext-. # 15, DOS Ext-LBA #endif - +#ifndef SAVE_MEMORY + .byte os_dos-. # 1, FAT12 DOS + .byte os_dos-. # 4, FAT16 <32M +#endif .byte os_misc-. # Unknown /* @@ -643,10 +642,10 @@ desc_ofs: */ os_misc: .byte '?'|0x80 os_dos: -#ifndef SAVE_MEMORY /* DOS string only if room */ +#ifndef SAVE_MORE_MEMORY /* 'DOS' remapped to 'WIN' if no room */ .ascii "DO"; .byte 'S'|0x80 #endif -os_win: .ascii "WI"; .byte 'N'|0x80 +os_win: .ascii "Wi"; .byte 'n'|0x80 os_linux: .ascii "Linu"; .byte 'x'|0x80 os_freebsd: .ascii "Free" os_bsd: .ascii "BS"; .byte 'D'|0x80
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200812300940.mBU9epuS086194>