c38b4f3b91
This is the long-threatened ISO 9660 CD-ROM bootstrap code. This work has been sponsored by Plutotech International, Inc (who paid the initial work), and interface business GmbH (where i did most of the work). A big thanks also goes to Bruce Evans, for his continuing help and answering my stupid questions. The code is basically functioning, with the following caveats: . Rock Ridge attributes are not yet supported. . Only SCSI CD-ROMs are supported, since i fail to see any possibility to determine the drive type using BIOS functions. (Even for hard disks, this determination is done by a big hack only.) . El Torito specifies a lot of crap and useless misfeatures, but crucial things like the ability to figure out the CD TOC have been ``forgotten''. Thus, if you wanna boot a multisession CD, you need to know at which CD block your session starts, and need to speciffy it using the @ clause. . None of the CD-ROM controllers i've seen so far implements the full El Torito specification at all. Adaptec is probably the closest, but they miss on non-emulation booting (which would be the most logical choice for us). Thus, the current code bloats the 7.5 KB boot code up to 1.44 MB, in order to fake a `floppy' image. If you wanna use it, specify this file as the boot image on the command-line of the mksiosfs command (option -b). Caveat emptor: some versions of the Adaptec BIOS might even fail to access the CD-ROM at all, using the BIOS functions. I think i've notice this for ver 1.26, the code has been tested with ver 1.23. The boot string is as follows: [@sess-start] [filename] [-flags] sess-start Extend # where the last session starts, measured in CD-ROM blocks. filename As usual, but the input is case-insensitive by now (since we don't grok RR anyway). flags As usual, but -C (use CDROM root f/s) is default, so specifying -C will decactivate this option (which is probably not what you want :). A lot of cleanup work is probably required, and some of the files could/should be merged back to biosboot, perhaps made conditional on some #ifdef. The malloc implementation that comes with cdboot might also be useful for kzipboot. (I needed a malloc() since the root dir ain't fixed in size on a CD.) I've been testing all this with a 2.2-STABLE as the base for biosboot. I don't expect too many surprises, although i know the biosboot stuff has been changed a lot in -current lately. I'm sure Bruce will comment on all this here anyway. :-)
115 lines
3.3 KiB
Makefile
115 lines
3.3 KiB
Makefile
# $Id$
|
|
#
|
|
|
|
PROG= boot
|
|
# Order is very important on the SRCS line for this prog
|
|
SRCS= start.S table.c boot2.S boot.c asm.S bios.S serial.S
|
|
SRCS+= probe_keyboard.c io.c cdrom.c malloc.c
|
|
|
|
.PATH: ${.CURDIR}/../biosboot
|
|
|
|
BINDIR= /usr/mdec
|
|
BINMODE= 444
|
|
CFLAGS= -O2 -malign-functions=0 -malign-jumps=0 -malign-loops=0 \
|
|
-mno-486 \
|
|
-DDO_BAD144 -DBOOTWAIT=${BOOTWAIT} -DTIMEOUT=${TIMEOUT}
|
|
CFLAGS+= -DBOOTSEG=${BOOTSEG} -DBOOTSTACK=${BOOTSTACK}
|
|
CFLAGS+= -I${.CURDIR}/../../.. -I${.CURDIR}/../biosboot
|
|
CFLAGS+= ${CWARNFLAGS}
|
|
#CFLAGS+= -DDEBUG
|
|
|
|
# Probe the keyboard and use the serial console if the keyboard isn't found.
|
|
.if defined(BOOT_PROBE_KEYBOARD)
|
|
CFLAGS+= -DPROBE_KEYBOARD
|
|
.endif
|
|
|
|
# Probe the keyboard lock and use the serial console if the keyboard is locked.
|
|
.if defined(BOOT_PROBE_KEYBOARD_LOCK)
|
|
CFLAGS+= -DPROBE_KEYBOARD_LOCK
|
|
.endif
|
|
|
|
# Force use of the serial console.
|
|
.if defined(BOOT_FORCE_COMCONSOLE)
|
|
CFLAGS+= -DFORCE_COMCONSOLE
|
|
.endif
|
|
|
|
# By default, if a serial port is going to be used as console, use COM1
|
|
# (aka /dev/ttyd0).
|
|
BOOT_COMCONSOLE_PORT?=0x3F8
|
|
CFLAGS+= -DCOMCONSOLE=${BOOT_COMCONSOLE_PORT}
|
|
|
|
BOOT_COMCONSOLE_SPEED?=9600
|
|
CFLAGS+= -DCONSPEED=${BOOT_COMCONSOLE_SPEED}
|
|
|
|
# Enable code to take the default boot string from a fixed location on the
|
|
# disk. See nextboot(8) and README.386BSD for more info.
|
|
#CFLAGS+= -DNAMEBLOCK
|
|
#CFLAGS+= -DNAMEBLOCK_WRITEBACK
|
|
|
|
# Bias the conversion from the BIOS drive number to the FreeBSD unit number
|
|
# for hard disks. This may be useful for people booting in a mixed IDE/SCSI
|
|
# environment (set BOOT_HD_BIAS to the number of IDE drives).
|
|
#CFLAGS+= -DBOOT_HD_BIAS=1
|
|
#
|
|
# Details: this only applies if BOOT_HD_BIAS > 0. If the BIOS drive number
|
|
# for the boot drive is >= BOOT_HD_BIAS, then the boot drive is assumed to
|
|
# be SCSI and have unit number (BIOS_drive_number - BOOT_HD_BIAS). E.g.,
|
|
# BOOT_HD_BIAS=1 makes BIOS drive 1 correspond to 1:sd(0,a) instead of
|
|
# 1:wd(1,a). If `sd' is given explicitly, then the drive is assumed to be
|
|
# SCSI and have BIOS drive number (sd_unit_number + BOOT_HD_BIAS). E.g.,
|
|
# BOOT_HD_BIAS=1 makes sd(0,a) correspond to 1:sd(0,a) instead of 0:sd(0,a).
|
|
|
|
CLEANFILES+= boot.nohdr boot.strip boot1 boot2 sizetest
|
|
LDFLAGS+= -N -T 0 -nostdlib
|
|
#LINKS= ${BINDIR}/sdboot ${BINDIR}/wdboot\
|
|
# ${BINDIR}/sdboot ${BINDIR}/fdboot\
|
|
# ${BINDIR}/bootsd ${BINDIR}/bootwd\
|
|
# ${BINDIR}/bootsd ${BINDIR}/bootfd
|
|
NOSHARED= YES
|
|
NOMAN=
|
|
STRIP=
|
|
|
|
# tunable timeout parameter, waiting for keypress, calibrated in ms
|
|
BOOTWAIT?= 5000
|
|
# tunable timeout during string input, calibrated in ms
|
|
#TIMEOUT?= 30000
|
|
|
|
# Location that boot2 is loaded at
|
|
BOOTSEG= 0x1000
|
|
|
|
# Offset in BOOTSEG for the top of the stack, keep this 16 byte aligned
|
|
BOOTSTACK= 0xFFF0
|
|
|
|
boot.strip: boot
|
|
cp -p boot boot.strip
|
|
strip boot.strip
|
|
size boot.strip
|
|
|
|
boot.nohdr: boot.strip
|
|
dd if=boot.strip of=boot.nohdr ibs=32 skip=1 obs=1024b
|
|
ls -l boot.nohdr
|
|
|
|
boot1: boot.nohdr
|
|
dd if=boot.nohdr of=boot1 bs=512 count=1
|
|
|
|
boot2: boot.nohdr
|
|
dd if=boot.nohdr of=boot2 bs=512 skip=1
|
|
@dd if=boot2 skip=14 of=sizetest 2> /dev/null
|
|
@if [ -s sizetest ] ; then \
|
|
echo "boot2 is too big" >&2 ; \
|
|
rm boot2 ; \
|
|
exit 2 ; \
|
|
fi
|
|
|
|
boot.img: boot.nohdr
|
|
dd if=boot.nohdr of=boot.img bs=1440k count=1 conv=sync
|
|
|
|
all: boot.img
|
|
|
|
install:
|
|
${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE}\
|
|
boot.img ${DESTDIR}${BINDIR}/cdboot
|
|
|
|
.include <bsd.kern.mk>
|
|
.include <bsd.prog.mk>
|