diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2003-03-28 22:42:27 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2003-03-28 22:42:27 +0000 |
commit | 233efcba6a5d51d6435957d5b9de4b0f2ae1d6b3 (patch) | |
tree | 05fe81fbc59f7c8879fe1d58dbe3d3593b1f8879 /sys/arch/hppa/stand | |
parent | c20f96b578d6b516a8cae9ee716ea2d2cd5fde87 (diff) |
a small boot for a cd
Diffstat (limited to 'sys/arch/hppa/stand')
-rw-r--r-- | sys/arch/hppa/stand/Makefile | 5 | ||||
-rw-r--r-- | sys/arch/hppa/stand/cdboot/Makefile | 56 | ||||
-rw-r--r-- | sys/arch/hppa/stand/cdboot/cdboot.c | 54 | ||||
-rw-r--r-- | sys/arch/hppa/stand/cdboot/conf.c | 57 | ||||
-rw-r--r-- | sys/arch/hppa/stand/cdboot/ld.script | 49 |
5 files changed, 220 insertions, 1 deletions
diff --git a/sys/arch/hppa/stand/Makefile b/sys/arch/hppa/stand/Makefile index 98640b0d433..08e01dd95d9 100644 --- a/sys/arch/hppa/stand/Makefile +++ b/sys/arch/hppa/stand/Makefile @@ -1,8 +1,11 @@ -# $OpenBSD: Makefile,v 1.2 2000/05/31 19:59:31 mickey Exp $ +# $OpenBSD: Makefile,v 1.3 2003/03/28 22:42:26 mickey Exp $ .if ${MACHINE} == "hppa" SUBDIR= libsa libkern libz .endif SUBDIR+= mkboot boot +.if ${MACHINE} == "hppa" +SUBDIR+= cdboot +.endif .include <bsd.subdir.mk> diff --git a/sys/arch/hppa/stand/cdboot/Makefile b/sys/arch/hppa/stand/cdboot/Makefile new file mode 100644 index 00000000000..6c096ebad3d --- /dev/null +++ b/sys/arch/hppa/stand/cdboot/Makefile @@ -0,0 +1,56 @@ +# $OpenBSD: Makefile,v 1.1 2003/03/28 22:42:26 mickey Exp $ + +NOMAN= no man +S =${.CURDIR}/../../../.. +CLEANFILES+= cdboot.gdb cdboot.map + +.if ${MACHINE} == "hppa" + +PROG= cdboot +SRCS= srt0.S exec.c cdboot.c conf.c \ + machdep.c pdc.c itecons.c dev_hppa.c dk.c +LD?= ld +LDFLAGS+=-Bstatic -nostartfiles -nostdlib -N -Ttext $(LINKADDR) +LDFLAGS+=-T ${.CURDIR}/ld.script -Map cdboot.map +SIZE?= size +STRIP?= strip +STANDIR=${.CURDIR}/.. +CRTBEGIN= +CRTEND= + +SAREL= +USE_LOADFILE=yes +.include "${S}/lib/libsa/Makefile.inc" +DPADD+= $(SALIB) $(LIBKERN) +LDADD+= $(SALIB) $(LIBKERN) + +.PATH: ${S}/stand/boot +.PATH: ${.CURDIR}/../boot +.PATH: ${.CURDIR}/../libsa + +all: ${PROG} + +clean:: + rm -f a.out [Ee]rrs mklog core *.core \ + ${PROG} ${OBJS} ${LOBJS} ${CLEANFILES} + +realinstall: + ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ + ${PROG} ${DESTDIR}${BINDIR} + +# TODO check for <=32k +${PROG}: $(OBJS) $(DPADD) + $(LD) $(LDFLAGS) -o $(PROG) $(OBJS) $(LDADD) + @cp ${PROG} ${PROG}.gdb + ${STRIP} ${PROG} + @${SIZE} $(PROG) + @${MKBOOT} -v ${PROG} ${PROG}.lif + @mv ${PROG}.lif ${PROG} +.else +NOPROG= +.endif + +.include <bsd.prog.mk> + +CPPFLAGS+=-DRELOC=${LOADADDR} -DHEAP_LIMIT=${HEAP_LIMIT} +CFLAGS+=$(SACFLAGS) -I../.. -I${.CURDIR}/../libsa -I${S}/stand/boot diff --git a/sys/arch/hppa/stand/cdboot/cdboot.c b/sys/arch/hppa/stand/cdboot/cdboot.c new file mode 100644 index 00000000000..4855343fcd7 --- /dev/null +++ b/sys/arch/hppa/stand/cdboot/cdboot.c @@ -0,0 +1,54 @@ +/* $OpenBSD: cdboot.c,v 1.1 2003/03/28 22:42:26 mickey Exp $ */ + +/* + * Copyright (c) 2003 Michael Shalayeff + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Michael Shalayeff. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include <sys/param.h> +#include <sys/reboot.h> +#include <sys/stat.h> +#include <libsa.h> + +char kernel[] = "/bsd"; + +extern const char version[]; + +void +boot(bootdev) + dev_t bootdev; +{ + machdep(); + + printf(">> OpenBSD/" MACHINE " BOOT %s\n" + "booting %s: ", version, kernel); + + exec(kernel, (void *)DEFAULT_KERNEL_ADDRESS, 0); +} diff --git a/sys/arch/hppa/stand/cdboot/conf.c b/sys/arch/hppa/stand/cdboot/conf.c new file mode 100644 index 00000000000..cf96b131013 --- /dev/null +++ b/sys/arch/hppa/stand/cdboot/conf.c @@ -0,0 +1,57 @@ +/* $OpenBSD: conf.c,v 1.1 2003/03/28 22:42:26 mickey Exp $ */ + +/* + * Copyright (c) 2003 Michael Shalayeff + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Michael Shalayeff. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF MIND, + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include <sys/types.h> +#include <libsa.h> +#include <lib/libsa/cd9660.h> +#include <dev/cons.h> + +const char version[] = "0.1"; +int debug = 0; + +struct fs_ops file_system[] = { + { cd9660_open, cd9660_close, cd9660_read, cd9660_write, cd9660_seek, + cd9660_stat, cd9660_readdir }, +}; +int nfsys = NENTS(file_system); + +struct devsw devsw[] = { + { "dk", iodcstrategy, dkopen, dkclose, noioctl }, +}; +int ndevs = NENTS(devsw); + +struct consdev constab[] = { + { ite_probe, ite_init, ite_getc, ite_putc }, + { NULL } +}; +struct consdev *cn_tab; + diff --git a/sys/arch/hppa/stand/cdboot/ld.script b/sys/arch/hppa/stand/cdboot/ld.script new file mode 100644 index 00000000000..398046276ba --- /dev/null +++ b/sys/arch/hppa/stand/cdboot/ld.script @@ -0,0 +1,49 @@ +/* $OpenBSD: ld.script,v 1.1 2003/03/28 22:42:26 mickey Exp $ */ + +OUTPUT_FORMAT("elf32-hppa") +OUTPUT_ARCH(hppa) +ENTRY(begin) + +SECTIONS { + + /* Read-only sections, merged into text segment: */ + . = + SIZEOF_HEADERS; + .text : { + *(.text) + *(.text.*) + *(.rodata) + *(.rodata1) + *($CODE$) + etext = .; + } = 0x08000240 + + /* Read-write sections, merged into data segment: */ + .data : { + $global$ = .; + *(.data) + *(.data1) + *(.sdata) + *(.sdata2) + *(.dynamic) + CONSTRUCTORS + edata = ABSOLUTE(.); + } = 0 + + .bss : { + __bss_start = .; + *(.dynbss) + *(.bss) + *(.sbss) + *(.scommon) + *(COMMON) + end = ABSOLUTE(.); + __bss_end = .; + } + + /* don't need an unwind in the boot, unless we'll have a boot-ddb (; */ + /DISCARD/ : + { + *(.PARISC.unwind) + } +} + |