From d2847b39ba5d0c9dedabbbe49582bb324da7ee75 Mon Sep 17 00:00:00 2001 From: Per Fogelstrom Date: Sun, 18 May 1997 13:40:55 +0000 Subject: ARC ramdisk install --- distrib/arc/Makefile | 5 ++ distrib/arc/Makefile.inc | 10 +++ distrib/arc/common/rdsetroot.c | 4 +- distrib/arc/ramdisk/Makefile | 45 +++++++++----- distrib/arc/ramdisk/install.md | 137 +++++++++++++++++++++++++++++++++-------- distrib/arc/ramdisk/list | 21 ++++--- distrib/arc/runlist.sh | 2 +- 7 files changed, 172 insertions(+), 52 deletions(-) create mode 100644 distrib/arc/Makefile create mode 100644 distrib/arc/Makefile.inc (limited to 'distrib/arc') diff --git a/distrib/arc/Makefile b/distrib/arc/Makefile new file mode 100644 index 00000000000..1708bb8b3b5 --- /dev/null +++ b/distrib/arc/Makefile @@ -0,0 +1,5 @@ +# $OpenBSD: Makefile,v 1.1 1997/05/18 13:40:43 pefo Exp $ + +SUBDIR= ramdisk + +.include diff --git a/distrib/arc/Makefile.inc b/distrib/arc/Makefile.inc new file mode 100644 index 00000000000..d6c53686d9a --- /dev/null +++ b/distrib/arc/Makefile.inc @@ -0,0 +1,10 @@ +# $OpenBSD: Makefile.inc,v 1.1 1997/05/18 13:40:44 pefo Exp $ + +# Revision is 2.1 +REV= 21 + +LDSTATIC= -static + +# Hack needed to find kernel images... +BSDSRCDIR?= /usr/src +SRCSYSDIR?= ${BSDSRCDIR}/sys diff --git a/distrib/arc/common/rdsetroot.c b/distrib/arc/common/rdsetroot.c index 35ba7aa3401..4161293c4ef 100644 --- a/distrib/arc/common/rdsetroot.c +++ b/distrib/arc/common/rdsetroot.c @@ -1,11 +1,11 @@ -/* $OpenBSD: rdsetroot.c,v 1.1 1997/05/14 21:13:32 pefo Exp $ */ +/* $OpenBSD: rdsetroot.c,v 1.2 1997/05/18 13:40:47 pefo Exp $ */ /* $NetBSD: rdsetroot.c,v 1.2 1995/10/13 16:38:39 gwr Exp $ */ /* * Copyright (c) 1994 Gordon W. Ross * All rights reserved. * - * ELF modifications Copyright (c) Per Fogelstrom. + * ELF modifications Copyright (c) 1997 Per Fogelstrom. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/distrib/arc/ramdisk/Makefile b/distrib/arc/ramdisk/Makefile index 2c0bd816013..91d5d58a12a 100644 --- a/distrib/arc/ramdisk/Makefile +++ b/distrib/arc/ramdisk/Makefile @@ -1,10 +1,11 @@ -# $OpenBSD: Makefile,v 1.2 1997/05/14 21:25:14 niklas Exp $ +# $OpenBSD: Makefile,v 1.3 1997/05/18 13:40:50 pefo Exp $ # NOTE! We don't do crunched yet! TOP= ${.CURDIR}/.. .include "${TOP}/Makefile.inc" +BSD_RD= bsd.rd IMAGE= mr.fs CBIN?= instbin CRUNCHCONF?= ${.CURDIR}/${CBIN}.conf @@ -13,33 +14,43 @@ LISTS= ${.CURDIR}/list MOUNT_POINT= /mnt MTREE= ${.CURDIR}/mtree.conf -VND?= svnd0 +VND?= vnd0 VND_DEV= /dev/${VND}a VND_RDEV= /dev/r${VND}a VND_CRDEV= /dev/r${VND}c PID!= echo $$$$ REALIMAGE!= echo /tmp/image.${PID} -all: bsd.rd - DISKTYPE= rdroot NBLKS= 20000 # minfree, opt, b/i trks, sects, cpg NEWFSARGS= -m 0 -o space -c 16 -i 4096 -bsd.rd: ${IMAGE} bsd rdsetroot - cp bsd bsd.rd - ${.OBJDIR}/rdsetroot bsd.rd < ${IMAGE} +.ifndef DESTDIR +all ${IMAGE}: + @echo setenv DESTDIR before makeing a ramdisk! + @false +.else -bsd: - cd ${.CURDIR}/../../../../sys/arch/arc/conf && config RAMDISK - cd ${.CURDIR}/../../../../sys/arch/arc/compile/RAMDISK && \ - make clean && make depend && make - cp ${.CURDIR}/../../../../sys/arch/arc/compile/RAMDISK/bsd bsd +all: ${BSD_RD} + +${BSD_RD}: ${IMAGE} bsd rdsetroot + cp bsd ${BSD_RD}.elf + ${.OBJDIR}/rdsetroot ${BSD_RD}.elf < ${IMAGE} + elf2ecoff ${BSD_RD}.elf ${BSD_RD} + rm ${IMAGE} ${IMAGE}: rd_setup do_files rd_teardown +.endif + +bsd: + cd ${.TOP}/../../sys/arch/arc/conf && config RAMDISK + cd ${.TOP}/../../sys/arch/arc/compile/RAMDISK && \ + make clean && make depend && make + cp ${.TOP}/../../sys/arch/arc/compile/RAMDISK/bsd bsd + rd_setup: dd if=/dev/zero of=${REALIMAGE} bs=512 count=${NBLKS} vnconfig -v -c ${VND} ${REALIMAGE} @@ -49,6 +60,9 @@ rd_setup: mount ${VND_DEV} ${MOUNT_POINT} rd_teardown: + sync + cat /*bin/* > /dev/null + sync @df -i ${MOUNT_POINT} -umount ${MOUNT_POINT} -vnconfig -u ${VND} @@ -66,7 +80,7 @@ unconfig: .PRECIOUS: ${IMAGE} install: - cp ${FS} ${DESTDIR}/snapshot/${FS} + cp ${BSD_RD} ${DESTDIR}/snapshot/${BSD_RD} ${CBIN}.mk ${CBIN}.cache ${CBIN}.c: ${CRUNCHCONF} crunchgen -D ${BSDSRCDIR} -L ${DESTDIR}/usr/lib ${CRUNCHCONF} @@ -81,6 +95,9 @@ do_files: clean cleandir: /bin/rm -f core ${IMAGE} ${CBIN} ${CBIN}.mk ${CBIN}.cache *.o *.lo *.c \ - bsd bsd.rd bsd.gz floppy*.fs rdsetroot + bsd ${BSD_RD} ${BSD_RD}.elf rdsetroot + +beforeinstall: + cp ${BSD.RD} ${DESTDIR}/snapshot .include diff --git a/distrib/arc/ramdisk/install.md b/distrib/arc/ramdisk/install.md index 459765b7664..4d5d4b18e17 100644 --- a/distrib/arc/ramdisk/install.md +++ b/distrib/arc/ramdisk/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.2 1997/05/14 21:43:09 millert Exp $ +# $OpenBSD: install.md,v 1.3 1997/05/18 13:40:52 pefo Exp $ # # # Copyright rc) 1996 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ # # Machine-dependent install sets -MDSETS="kernel" +MDSETS="kern" md_set_term() { if [ ! -z "$TERM" ]; then @@ -81,8 +81,14 @@ md_get_partition_range() { } md_installboot() { - echo "Installing boot block..." - disklabel -B $1 + echo "Installing bootable kernel in the msdos partition /dev/${1}i" + if mount -t msdos /dev/${1}i /mnt2 ; then + elf2ecoff /mnt/bsd /mnt2/bsd + umount /mnt2 + else + echo "Failed, you will not be able to boot from /dev/${1}." + fi + ldconfig } md_native_fstype() { @@ -93,10 +99,76 @@ md_native_fsopts() { echo "ro" } +md_init_mbr() { + # $1 is the disk to init + echo + echo "You will now be asked if you want to initialize the disk with a 5Mb" + echo "MSDOS partition. This is the recomended setup and will allow you to" + echo "store about three to four different bootable kernels on the disk." + echo "If you want to have a different setup, exit 'install' now and do" + echo "the MBR initialization by hand using the 'fdisk' program. You may" + echo "also use any vendor specific program to set up the disk. Consult" + echo "your ARC system manuals for doing setup this way." + echo + echo -n "Do you want to init the MBR and the MSDOS partition? [y]" + getresp "y" + case "$resp" in + n*|N*) + exit 0;; + *) + echo + echo "A MBR record with an OpenBSD usable partition table will now be copied" + echo "to your disk. Unless you have special requirements you will not need" + echo "to edit this MBR. After the MBR is copied an empty 5Mb MSDOS partition" + echo "will be created on the disk. You *MUST* setup the OpenBSD disklabel" + echo "to have a partition covering this MSDOS partition." + echo "You will probably see a few '...: no disk label' messages" + echo "It's completly normal. The disk has no label yet." + echo "This will take a minute or two..." + sleep 2 + dd if=/usr/mdec/mbr of=/dev/$1c 2>&1 >/dev/null + gunzip < /usr/mdec/msdos5mb.gz | dd of=/dev/$1c bs=512 seek=32 2>&1 >/dev/null + ;; + esac +} + md_checkfordisklabel() { # $1 is the disk to check local rval + echo + echo "ARC systems need a MBR and MSDOS partition on the bootable disk." + echo "This is necessary because the BIOS doesn't know nothing about" + echo "OpenBSD and have to boot the system from a file stored in the" + echo "MSDOS partition. Install will put a bootable kernel with the" + echo "name 'bsd' in there that you later should use to boot OpenBSD. " + echo + echo -n "Have this disk previously been used with DOS or Windows? [n]" + getresp "n" + case "$resp" in + n*|N*) + md_init_mbr $1;; + *) + echo + echo "You may keep your current setup if you want to be able to use any" + echo "already loaded OS. However you will be asked to prepare an empty" + echo "partition for OpenBSD later. There must also be ~1.5Mb free space" + echo "in the boot partition to hold the bootable OpenBSD kernel." + echo "Also note that the boot partition must be included as partition" + echo "'i' in the OpenBSD disklabel." + echo + echo -n "Do You want to keep the current MSDOS partition setup? [y]" + getresp "y" + case "$resp" in + n*|N*) + md_init_mbr $1;; + *) + ;; + esac + ;; + esac + + disklabel -r $1 > /dev/null 2> /tmp/checkfordisklabel if grep "no disk label" /tmp/checkfordisklabel; then rval=1 @@ -116,18 +188,20 @@ md_prep_fdisk() local _done _disk=$1 - echo "This disk has not previously been used with OpenBSD. Do you wish" - echo "to share this disk with other operating systems (such as Windows" - echo -n "95, MS-DOS, Linux etc.)? [y]" - getresp "y" - case "$resp" in - n*|N*) return ;; - *) ;; - esac - + echo + echo "This disk has not previously been used with OpenBSD. You may share" + echo "this disk with other operating systems (probably Windows/NT or" + echo "maybe Linux/Mips etc.) Anyhow, to be able to boot the system you" + echo "will need a small DOS partition in the begining of the disk to" + echo "hold the bootable kernel. This has been take care of if you choosed" + echo "to do that initialization just before." + echo echo "WARNING: Wrong information in the BIOS partition table might" echo "render the disk unusable." + echo -n "Press [Enter] to continue " + getresp "" + echo echo "Current partition information is:" fdisk ${_disk} @@ -166,8 +240,12 @@ __md_prep_fdisk_1 esac done + echo echo "Please take note of the offset and size of the OpenBSD partition" - echo "of the disk, as you will need that for the BSD disk label." + echo "*AND* the MSDOS partitions you may want to access from OpenBSD." + echo "At least the MSDOS partition used for booting must be accessible" + echo "by OpenBSD as partition 'i'. You will need this information to " + echo "fill in the OpenBSD disk label later." echo -n "Press [Enter] to continue " getresp "" } @@ -191,6 +269,7 @@ md_prep_disklabel() echo "WARNING: Label on disk $_disk is corrupted" echo -n "Do you want to try and repair the damage using the disklabel editor? [y]" ;; + esac getresp "y" @@ -204,23 +283,31 @@ md_prep_disklabel() Here is an example of what the partition information will look like once you have entered the disklabel editor. Disk partition sizes and offsets -are in sector (most likely 512 bytes) units. Make sure these size/offset -pairs are on cylinder boundaries (the number of sector per cylinder is -given in the `sectors/cylinder' entry, which is not shown here). +are in sector (most likely 512 bytes) units. You may set these size/offset +pairs on cylinder boundaries (the number of sector per cylinder is given +in the `sectors/cylinder' entry, which is not shown here). Although this +is not requiered. + +Also, you *must* make sure that the 'd' partition points at the MSDOS +partition that will be used for booting. The 'c' partition shall start +at offset 0 and include the entire disk. This is most likely correct when +you see the default label in the editor. -Also, if this disk is shared with other operating systems and have a BIOS -partition table, make sure all file systems reserved for OpenBSD are within -the offset and size specified in the BIOS partition table. Do not change any parameters except the partition layout and the label name. [Example] -16 partitions: +10 partitions: # size offset fstype [fsize bsize cpg] - a: 50176 0 4.2BSD 1024 8192 16 # (Cyl. 0 - 111) - b: 64512 50176 swap # (Cyl. 112 - 255) - c: 640192 0 unknown # (Cyl. 0 - 1428) - d: 525504 114688 4.2BSD 1024 8192 16 # (Cyl. 256 - 1428) + a: 120832 10240 4.2BSD 1024 8192 16 # (Cyl. 11*- 142*) + b: 131072 131072 swap # (Cyl. 142*- 284*) + c: 6265200 0 unused 1024 8192 # (Cyl. 0 - 6809) + d: 10208 32 MSDOS # (Cyl. 0*- 11*) + e: 781250 262144 4.2BSD 1024 8192 16 # (Cyl. 284*- 1134*) + f: 1205000 1043394 4.2BSD 1024 8192 16 # (Cyl. 1134*- 2443*) + g: 2008403 2248394 4.2BSD 1024 8192 16 # (Cyl. 2443*- 4626*) + h: 2008403 4256797 4.2BSD 1024 8192 16 # (Cyl. 4626*- 6809*) + i: 10208 32 MSDOS # (Cyl. 0*- 11*) [End of example] __md_prep_disklabel_1 diff --git a/distrib/arc/ramdisk/list b/distrib/arc/ramdisk/list index a0cca8c46e4..bd77ba1b087 100644 --- a/distrib/arc/ramdisk/list +++ b/distrib/arc/ramdisk/list @@ -1,4 +1,4 @@ -# $OpenBSD: list,v 1.1 1997/05/14 20:52:45 pefo Exp $ +# $OpenBSD: list,v 1.2 1997/05/18 13:40:54 pefo Exp $ # copy the crunched binary, link to it, and kill it COPY ${OBJDIR}/bin/cat bin/cat @@ -45,13 +45,14 @@ COPY ${OBJDIR}/sbin/mount_kernfs sbin/mount_kernfs COPY ${OBJDIR}/sbin/newfs sbin/newfs LINK sbin/newfs sbin/mount_mfs COPY ${OBJDIR}/sbin/ping sbin/ping -COPY ${OBJDIR}/sbin/restore sbin/restore +#COPY ${OBJDIR}/sbin/restore sbin/restore COPY ${OBJDIR}/sbin/route sbin/route #COPY ${OBJDIR}/sbin/slattach sbin/slattach #COPY ${OBJDIR}/sbin/scsi sbin/scsi COPY ${OBJDIR}/sbin/umount sbin/umount COPY ${OBJDIR}/usr/bin/cut usr/bin/cut COPY ${OBJDIR}/usr/bin/egrep usr/bin/egrep +COPY ${OBJDIR}/usr/bin/elf2ecoff usr/bin/elf2ecoff LINK usr/bin/egrep usr/bin/fgrep LINK usr/bin/egrep usr/bin/grep COPY ${OBJDIR}/usr/bin/ftp usr/bin/ftp @@ -64,14 +65,16 @@ COPY ${OBJDIR}/usr/bin/rsh usr/bin/rsh COPY ${OBJDIR}/usr/bin/sed usr/bin/sed COPY ${OBJDIR}/usr/bin/sort usr/bin/sort #COPY ${OBJDIR}/usr/bin/tip usr/bin/tip -#COPY ${OBJDIR}/usr/bin/vi usr/bin/vi +COPY ${OBJDIR}/usr/bin/vi usr/bin/vi #COPY ${OBJDIR}/usr/sbin/bad144 usr/sbin/bad144 #COPY ${OBJDIR}/usr/sbin/chat usr/sbin/chat COPY ${OBJDIR}/usr/sbin/chown usr/sbin/chown usr/sbin/chgrp LINK usr/sbin/chown usr/sbin/chgrp #COPY ${OBJDIR}/usr/sbin/pppd usr/sbin/pppd COPY ${OBJDIR}/usr/lib/libc.so.16.1 usr/lib/libc.so.16.1 +COPY ${OBJDIR}/usr/lib/libedit.so.0.0 usr/lib/libedit.so.0.0 COPY ${OBJDIR}/usr/lib/libtermcap.so.0.0 usr/lib/libtermcap.so.0.0 +COPY ${OBJDIR}/usr/lib/libtermlib.so.2.0 usr/lib/libtermlib.so.2.0 COPY ${OBJDIR}/usr/libexec/ld.so usr/libexec/ld.so # `internal' crunchgen links @@ -83,10 +86,8 @@ SPECIAL cd dev; sh MAKEDEV ramdisk SPECIAL /bin/rm dev/MAKEDEV # we need the contents of /usr/mdec -#COPY ${DESTDIR}/usr/mdec/bootsd usr/mdec/bootsd -#COPY ${DESTDIR}/usr/mdec/sdboot usr/mdec/sdboot -#LINK usr/mdec/bootsd usr/mdec/bootwd -#LINK usr/mdec/sdboot usr/mdec/wdboot +COPY ${DESTDIR}/usr/mdec/mbr usr/mdec/mbr +COPY ${DESTDIR}/usr/mdec/msdos5mb.gz usr/mdec/msdos5mb.gz # various files that we need in /etc for the install COPY ${DESTDIR}/etc/group etc/group @@ -104,7 +105,7 @@ COPY ${DESTDIR}/usr/share/misc/scsi_modes usr/share/misc/scsi_modes COPY dot.profile .profile COPY dot.instutils .instutils COPY install.md install.md -COPY ${CURDIR}/../../../miniroot/install.sh install -COPY ${CURDIR}/../../../miniroot/upgrade.sh upgrade -SPECIAL sed "/^VERSION=/s/=.*/=${REV}/" < ${CURDIR}/../../../miniroot/install.sub > install.sub +COPY ${TOPDIR}/../miniroot/install.sh install +COPY ${TOPDIR}/../miniroot/upgrade.sh upgrade +SPECIAL sed "/^VERSION=/s/=.*/=${REV}/" < ${TOPDIR}/../miniroot/install.sub > install.sub SPECIAL chmod 755 install diff --git a/distrib/arc/runlist.sh b/distrib/arc/runlist.sh index 3e49510c909..a7d17019b75 100644 --- a/distrib/arc/runlist.sh +++ b/distrib/arc/runlist.sh @@ -1,4 +1,4 @@ -# $Id: runlist.sh,v 1.1 1997/05/14 21:15:45 pefo Exp $ +# $OpenBSD: runlist.sh,v 1.2 1997/05/18 13:40:45 pefo Exp $ if [ "X$1" = "X-d" ]; then SHELLCMD=cat -- cgit v1.2.3