diff -urN -X dontdiff linux/CREDITS linux-bcp/CREDITS
--- linux/CREDITS       Sat Feb 19 08:24:17 2000
+++ linux-bcp/CREDITS   Sat Feb 19 18:17:51 2000
@@ -42,6 +42,7 @@
W: http://www.ocston.org/~tigran
D: BFS filesystem
D: Intel P6 CPU microcode update support
+D: BCP
S: United Kingdom

N: Werner Almesberger
diff -urN -X dontdiff linux/Documentation/Configure.help linux-bcp/Documentation/Configure.help
--- linux/Documentation/Configure.help  Sat Feb 19 08:24:17 2000
+++ linux-bcp/Documentation/Configure.help      Sat Feb 19 18:16:41 2000
@@ -1797,6 +1797,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 <ENTER> which will activate BCP. You can press <SPACE>
+  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 linux-bcp/Documentation/i386/zero-page.txt
--- linux/Documentation/i386/zero-page.txt      Mon Aug 30 18:47:02 1999
+++ linux-bcp/Documentation/i386/zero-page.txt  Sat Feb 19 18:16:41 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 linux-bcp/arch/i386/boot/Makefile
--- linux/arch/i386/boot/Makefile       Mon Dec 20 22:43:39 1999
+++ linux-bcp/arch/i386/boot/Makefile   Sat Feb 19 18:16:41 2000
@@ -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 linux-bcp/arch/i386/boot/bcp.S
--- linux/arch/i386/boot/bcp.S  Thu Jan  1 01:00:00 1970
+++ linux-bcp/arch/i386/boot/bcp.S      Sat Feb 19 18:37:06 2000
@@ -0,0 +1,154 @@
+/*
+ *     bcp.S
+ *     =====
+ *     Boot Command Processor
+ *     Copyright (C) 2000, Tigran Aivazian <[email protected]>
+ *     Used some ideas from LILO's second.S.
+ */
+
+#define CL_MAGIC_ADDR  0x20
+#define CL_MAGIC       0xa33f
+#define CL_OFFSET      0x22
+
+#define BCP_BUFLEN     0x803   /* 2K for command line + 3 bytes for BCP */
+
+/* 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
+
+       movb    $4, %bl
+       call    getkt                   # get a key or timeout after 4 seconds
+
+       cmpb    $0x0d, %al              # ENTER ?
+       jne     bcpx                    # no - get out
+
+       leaw    bcpwlcm, %si
+       call    prtstr
+       call    bcp1
+
+bcpx:  popw    %ds                     # restore %ds for video.S
+bcpx2: ret
+
+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+BCP_BUFLEN-1, %di      # out of buffer space yet?
+       jz      bcp2                            # yes -> next key (hope it's backspace)
+       stosb
+       call    prtchr
+       jmp     bcp2
+
+bcpent:        cmpw    $bcp_buf, %di           # <RETURN> on its own?
+       jz      bcp1                    # yes -> go back to [bcp] prompt
+       leaw    bcpnl, %si              # new line
+       call    prtstr
+       movb    $0x00, (%di)            # NULL-terminate the whole thing
+       leaw    bcp_buf, %si            # %si points to bcp_buf now
+       cmpw    $0x6f67, (%si)          # "go" ?
+       je      bcpx2                   # yes -> out of here
+       cmpw    $0x6d63, (%si)          # "cm" ?
+       je      bcpcm                   # yes -> handle it
+       cmpw    $0x736c, (%si)          # "ls" ?
+       je      bcpls                   # yes -> handle it
+       leaw    bcpunk, %si
+       call    prtstr
+       jmp     bcp1
+
+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: cmpw    $bcp_buf+3, %di
+       jg      bcpcm1
+       leaw    bcperr2, %si
+       call    prtstr
+       jmp     bcp1
+bcpcm1:        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                      # 2K command line
+       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 <TAB> for help\r\n"
+
+bcprmpt:       .string "\r\n[bcp] "
+
+bcphlp:                .byte   0x0d, 0x0a
+               .ascii  "Available BCP commands: "
+               .byte   0x0d, 0x0a
+               .ascii  "cm <cmdline> - set boot command line to <cmdline>"
+               .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 "No CL_MAGIC signature found"
+
+bcperr2:       .string "'cm' command requires an argument"
+
+bcpok:         .string "OK"
+
+bcpunk:                .ascii  "\r\nBCP: unknown command: " # no '\0' here to fall through to bcp_buf
+
+bcp_buf:       .space  BCP_BUFLEN
+
diff -urN -X dontdiff linux/arch/i386/boot/setup.S linux-bcp/arch/i386/boot/setup.S
--- linux/arch/i386/boot/setup.S        Thu Jan 13 21:20:59 2000
+++ linux-bcp/arch/i386/boot/setup.S    Sat Feb 19 18:16:41 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
@@ -819,6 +824,44 @@
       popw    %cx
       ret

+# Read a key with a timeout of %bl seconds.
+# The hardware clock is used to get the time.
+getkt: call    gettime
+       addb    %bl, %al                        # Wait 30 seconds
+       cmpb    $60, %al
+       jl      lminute
+
+       subb    $60, %al
+lminute:
+       movb    %al, %cl
+again: movb    $0x01, %ah
+       int     $0x16
+       jnz     getkey                          # key pressed, so get it
+
+       call    gettime
+       cmpb    %cl, %al
+       jne     again
+
+       movb    $0x20, %al                      # timeout, return `space'
+       ret
+
+# Flush the keyboard buffer
+flush: movb    $0x01, %ah
+       int     $0x16
+       jz      empty
+
+       xorb    %ah, %ah
+       int     $0x16
+       jmp     flush
+
+empty: ret
+
+
+# Read a key and return the ASCII code in al, scan code in ah
+getkey:        xorb    %ah, %ah
+       int     $0x16
+       ret
+
# Delay is needed after doing I/O
delay:
       jmp     .+2                             # jmp $+2
@@ -852,6 +895,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 linux-bcp/arch/i386/boot/video.S
--- linux/arch/i386/boot/video.S        Sun Nov 21 08:09:51 1999
+++ linux-bcp/arch/i386/boot/video.S    Sat Feb 19 18:16:41 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 ?
@@ -1808,43 +1809,6 @@
       .ascii  "Local"
       .byte   0
#endif /* CONFIG_VIDEO_LOCAL */
-
-# Read a key and return the ASCII code in al, scan code in ah
-getkey:        xorb    %ah, %ah
-       int     $0x16
-       ret
-
-# Read a key with a timeout of 30 seconds.
-# The hardware clock is used to get the time.
-getkt: call    gettime
-       addb    $30, %al                        # Wait 30 seconds
-       cmpb    $60, %al
-       jl      lminute
-
-       subb    $60, %al
-lminute:
-       movb    %al, %cl
-again: movb    $0x01, %ah
-       int     $0x16
-       jnz     getkey                          # key pressed, so get it
-
-       call    gettime
-       cmpb    %cl, %al
-       jne     again
-
-       movb    $0x20, %al                      # timeout, return `space'
-       ret
-
-# Flush the keyboard buffer
-flush: movb    $0x01, %ah
-       int     $0x16
-       jz      empty
-
-       xorb    %ah, %ah
-       int     $0x16
-       jmp     flush
-
-empty: ret

# Print hexadecimal number.
prthw: pushw   %ax
diff -urN -X dontdiff linux/arch/i386/config.in linux-bcp/arch/i386/config.in
--- linux/arch/i386/config.in   Sat Feb 19 08:24:17 2000
+++ linux-bcp/arch/i386/config.in       Sat Feb 19 18:16:41 2000
@@ -130,6 +130,7 @@
bool 'System V IPC' CONFIG_SYSVIPC
bool 'BSD Process Accounting' CONFIG_BSD_PROCESS_ACCT
bool 'Sysctl support' CONFIG_SYSCTL
+bool 'BCP support' CONFIG_BCP
if [ "$CONFIG_PROC_FS" = "y" ]; then
   choice 'Kernel core (/proc/kcore) format' \
       "ELF            CONFIG_KCORE_ELF        \
diff -urN -X dontdiff linux/arch/i386/defconfig linux-bcp/arch/i386/defconfig
--- linux/arch/i386/defconfig   Thu Feb 17 20:07:54 2000
+++ linux-bcp/arch/i386/defconfig       Sat Feb 19 18:16:41 2000
@@ -57,6 +57,7 @@
CONFIG_PCI_DIRECT=y
CONFIG_PCI_NAMES=y
# CONFIG_MCA is not set
+CONFIG_BCP=y
CONFIG_HOTPLUG=y

#
diff -urN -X dontdiff linux/fs/Config.in linux-bcp/fs/Config.in
--- linux/fs/Config.in  Sat Feb 19 08:24:18 2000
+++ linux-bcp/fs/Config.in      Sat Feb 19 12:20:54 2000
@@ -106,7 +106,7 @@
        define_tristate CONFIG_LOCKD n
      fi
   fi
-   if [ "$CONFIG_NFSD_V3" == "y" ]; then
+   if [ "$CONFIG_NFSD_V3" = "y" ]; then
     define_bool CONFIG_LOCKD_V4 y
   fi
   tristate 'SMB file system support (to mount WfW shares etc.)' CONFIG_SMB_FS