diff -urN -X dontdiff linux/CREDITS bcp/CREDITS --- linux/CREDITS Sat Jan 1 13:11:41 2000 +++ bcp/CREDITS Sun Jan 2 11:44:07 2000 @@ -34,7 +34,7 @@ N: Tigran A. Aivazian E: tigran@ocston.org W: http://www.ocston.org/~tigran -D: BFS filesystem +D: BFS filesystem, BCP S: United Kingdom N: Werner Almesberger diff -urN -X dontdiff linux/Documentation/Configure.help bcp/Documentation/Configure.help --- linux/Documentation/Configure.help Sat Jan 1 13:12:56 2000 +++ bcp/Documentation/Configure.help Sat Jan 1 22:40:25 2000 @@ -1738,6 +1738,20 @@ Documentation/mca.txt (and especially the web page given there) before attempting to build an MCA bus kernel. +BCP support +CONFIG_BCP + BCP is a simple Boot Command Processor that allows to pass + command line parameters to the kernel at very early stages of boot + process. It can be used to override the command line prepared by other + boot loader (e.g. LILO) or to pass command line in situations where + otherwise there is no way to do it, e.g. when booting a kernel image + directly from floppy. After the kernel is loaded, you will be given 4 + seconds to press which will activate BCP. You can press + to skip BCP if 4 seconds seem like eternity to you. + + If you are concerned about the fact that any user with access to the + console can pass command line to the kernel, then say N. Otherwise, say Y. + SGI Visual Workstation support CONFIG_VISWS The SGI Visual Workstation series is an IA32-based workstation diff -urN -X dontdiff linux/Documentation/i386/zero-page.txt bcp/Documentation/i386/zero-page.txt --- linux/Documentation/i386/zero-page.txt Mon Aug 30 18:47:02 1999 +++ bcp/Documentation/i386/zero-page.txt Sat Jan 1 20:58:23 2000 @@ -7,6 +7,7 @@ arch/i386/boot/setup.S arch/i386/boot/video.S + arch/i386/boot/bcp.S arch/i386/kernel/head.S arch/i386/kernel/setup.c diff -urN -X dontdiff linux/arch/i386/boot/Makefile bcp/arch/i386/boot/Makefile --- linux/arch/i386/boot/Makefile Mon Dec 20 22:43:39 1999 +++ bcp/arch/i386/boot/Makefile Fri Dec 31 16:54:06 1999 @@ -66,7 +66,7 @@ setup.o: setup.s $(AS) -o $@ $< -setup.s: setup.S video.S Makefile $(BOOT_INCL) $(TOPDIR)/include/linux/version.h $(TOPDIR)/include/linux/compile.h +setup.s: setup.S video.S bcp.S Makefile $(BOOT_INCL) $(TOPDIR)/include/linux/version.h $(TOPDIR)/include/linux/compile.h $(CPP) $(CPPFLAGS) -traditional $(SVGA_MODE) $(RAMDISK) $< -o $@ bsetup: bsetup.o @@ -75,7 +75,7 @@ bsetup.o: bsetup.s $(AS) -o $@ $< -bsetup.s: setup.S video.S Makefile $(BOOT_INCL) $(TOPDIR)/include/linux/version.h $(TOPDIR)/include/linux/compile.h +bsetup.s: setup.S video.S bcp.S Makefile $(BOOT_INCL) $(TOPDIR)/include/linux/version.h $(TOPDIR)/include/linux/compile.h $(CPP) $(CPPFLAGS) -D__BIG_KERNEL__ -traditional $(SVGA_MODE) $(RAMDISK) $< -o $@ dep: diff -urN -X dontdiff linux/arch/i386/boot/bcp.S bcp/arch/i386/boot/bcp.S --- linux/arch/i386/boot/bcp.S Thu Jan 1 01:00:00 1970 +++ bcp/arch/i386/boot/bcp.S Sun Jan 2 11:39:11 2000 @@ -0,0 +1,151 @@ +/* + * bcp.S + * ===== + * Boot Command Processor, version 0.01 (Jan-2000) + * Copyright (C) 2000, Tigran Aivazian + * Used some ideas from LILO's second.S. + */ + +#define CL_MAGIC_ADDR 0x20 +#define CL_MAGIC 0xa33f +#define CL_OFFSET 0x22 + +/* bcp - main entry point, called from setup.S before video */ + +bcp: pushw %ds # %ds must be left intact for video.S + pushw %ds + popw %fs + pushw %cs + popw %ds + pushw %cs + popw %es + cld + call flush # flush the keyboard buffer + +gkey: movb $4, %bl + call getkt # get a key or timeout after 4 seconds + + cmpb $0x0d, %al # ENTER ? + je bcp0 # yes - enter BCP + +bcpx: popw %ds # restore %ds for video.S + ret + +bcp0: leaw bcpwlcm, %si + call prtstr + call bcp1 + jmp bcpx + +bcp1: leaw bcprmpt, %si # print [bcp] prompt + call prtstr + leaw bcp_buf, %di # point %di to our line buffer + +bcp2: call getkey # ASCII code returned in %al + cmpb $0x09, %al # TAB? + je bcph # yes -> display help + cmpb $0x0d, %al # ENTER? + jz bcpent + cmpb $0x08, %al # backspace? + jz bcpbs + cmpb $0x20, %al # printable? + jb bcp2 # no -> get next key + ja nospc # yes, and it is not a space + cmpb -1(%di), %al # second space in a row? + je bcp2 # yes -> ignore it + +nospc: cmpw $bcp_buf+2050, %di # out of space yet? + jz bcp2 # yes -> next key (hope it's backspace) + stosb + call prtchr + jmp bcp2 + +bcpent: cmpw $bcp_buf, %di # on its own? + jz bcp1 # yes -> go back to [bcp] prompt + leaw bcpnl, %si # new line + call prtstr + leaw bcp_buf, %si # %si points to bcp_buf now + cmpw $0x6f67, (%si) # "go" ? + je bcpgo # yes -> out of here + movb $0x00, (%di) # NULL-terminate the whole thing + cmpw $0x6d63, (%si) # "cm" ? + je bcpcm # yes -> handle it + cmpw $0x736c, (%si) # "ls" ? + je bcpls # yes -> handle it + leaw bcpunk, %si + call prtstr + leaw bcp_buf, %si + call prtstr + jmp bcp1 + +bcpgo: ret + +bcpls: pushw %ds + movw $INITSEG, %ax + movw %ax, %ds + cmpw $(CL_MAGIC), CL_MAGIC_ADDR + je bcpls1 + popw %ds + leaw bcperr1, %si + call prtstr + jmp bcp1 +bcpls1: movl CL_OFFSET, %esi + call prtstr + popw %ds + jmp bcp1 + +bcpcm: pushw %ds + movw $INITSEG, %ax + movw %ax, %ds + movw %ax, %es + movw $(CL_MAGIC), CL_MAGIC_ADDR + movw $0x8000, %di + movw %di, CL_OFFSET + popw %ds + leaw bcp_buf+3, %si + movw $1024, %cx + rep + movsw + pushw %cs + popw %es + leaw bcpok, %esi + call prtstr + jmp bcp1 + +bcph: leaw bcphlp, %si + call prtstr + jmp bcp1 + +bcpbs: cmpw $bcp_buf, %di + jz bcp2 + + decw %di + movb $0x08, %al + call prtchr + call prtspc + movb $0x08, %al + call prtchr + jmp bcp2 + +# Various data used by BCP +bcpwlcm: .string "\r\nBCP: Press for help\r\n" + +bcprmpt: .string "\r\n[bcp] " + +bcphlp: .byte 0x0d, 0x0a + .ascii "Available BCP commands: " + .byte 0x0d, 0x0a + .ascii "cm - set boot command line to " + .byte 0x0d, 0x0a + .ascii "ls - list currently set boot command line" + .byte 0x0d, 0x0a + .string "go - boot the kernel" + +bcpnl: .string "\r\n" + +bcperr1: .string "BCP: ERROR: no CL_MAGIC signature found" + +bcpok: .string "OK" + +bcpunk: .string "\r\nBCP: unknown command: " + +bcp_buf: .space 2052 # 2 (bcp comm) + 2048 (boot comm) + \r + NULL diff -urN -X dontdiff linux/arch/i386/boot/setup.S bcp/arch/i386/boot/setup.S --- linux/arch/i386/boot/setup.S Sat Dec 4 04:37:07 1999 +++ bcp/arch/i386/boot/setup.S Sun Jan 2 11:39:11 2000 @@ -346,6 +346,11 @@ xorw %bx, %bx int $0x16 +#ifdef CONFIG_BCP +# Allow the user to interact with BCP + call bcp +#endif + # Check for video adapter and its parameters and allow the # user to browse video modes. call video # NOTE: we need %ds pointing @@ -852,6 +857,11 @@ # Include video setup & detection code #include "video.S" + +#ifdef CONFIG_BCP +# Include boot commandline passer (BCP) code +#include "bcp.S" +#endif # Setup signature -- must be last setup_sig1: .word SIG1 diff -urN -X dontdiff linux/arch/i386/boot/video.S bcp/arch/i386/boot/video.S --- linux/arch/i386/boot/video.S Sun Nov 21 08:09:51 1999 +++ bcp/arch/i386/boot/video.S Sun Jan 2 11:39:11 2000 @@ -246,6 +246,7 @@ leaw keymsg, %si # "Return/Space/Timeout" message call prtstr call flush + movb $30, %bl # 30 seconds timeout nokey: call getkt cmpb $0x0d, %al # ENTER ? @@ -1814,10 +1815,10 @@ int $0x16 ret -# Read a key with a timeout of 30 seconds. +# Read a key with a timeout of %bl seconds. # The hardware clock is used to get the time. getkt: call gettime - addb $30, %al # Wait 30 seconds + addb %bl, %al # Wait 30 seconds cmpb $60, %al jl lminute diff -urN -X dontdiff linux/arch/i386/config.in bcp/arch/i386/config.in --- linux/arch/i386/config.in Sat Jan 1 13:12:57 2000 +++ bcp/arch/i386/config.in Sat Jan 1 22:03:25 2000 @@ -103,6 +103,8 @@ bool 'MCA support' CONFIG_MCA fi +bool 'BCP support' CONFIG_BCP + source drivers/pcmcia/Config.in bool 'System V IPC' CONFIG_SYSVIPC diff -urN -X dontdiff linux/arch/i386/defconfig bcp/arch/i386/defconfig --- linux/arch/i386/defconfig Sat Jan 1 13:12:57 2000 +++ bcp/arch/i386/defconfig Sat Jan 1 22:03:31 2000 @@ -53,6 +53,7 @@ CONFIG_PCI_DIRECT=y CONFIG_PCI_NAMES=y # CONFIG_MCA is not set +CONFIG_BCP=y # # PCMCIA/CardBus support diff -urN -X dontdiff linux/arch/i386/kernel/head.S bcp/arch/i386/kernel/head.S --- linux/arch/i386/kernel/head.S Mon Dec 20 23:35:25 1999 +++ bcp/arch/i386/kernel/head.S Sat Jan 1 23:19:01 2000 @@ -133,9 +133,9 @@ movl $ SYMBOL_NAME(empty_zero_page)+2048,%edi movzwl CL_OFFSET,%esi addl $(CL_BASE_ADDR),%esi - movl $2048,%ecx + movl $1024,%ecx rep - movsb + movsw 1: #ifdef __SMP__ checkCPUtype: .