#!/bin/csh # build_80m_532_from_486 by Julian Stacey echo Building an 80M bootable disc from a FreeBSD-i486 base for use echo "on a PC532 to run NetBSD-pc532, using Phil Nelson's binaries." # takes maybe 15 or 20 minutes to run. # it doesnt get all the fiddly stuff right yet, # it does get a bootable multi user self booting system up though ! set user=`whoami` set drive_i486=sd3# Drive name on i486 set disktab_name=netbsd_pc532_80m# Name in i486:/etc/disktab for PC532 set drive_nsc532=sd0# Drive name on pc532 set home=/usr/public/pc532/netbsd/940415# Dir. with NetBSD-PC532 binaries echo "You should be running as root. You are currently `whoami`." echo Will use layout $disktab_name to /dev/${drive_i486}. echo Doing an unmount, in case anything left it mounted. # maybe from a previous aborted run of this script. umount /dev/${drive_i486}h umount /dev/${drive_i486}a echo It is assumed ${drive_i486} is not mounted, looking now. mount | grep ${drive_i486} echo echo Break off now to avoid erasing /dev/${drive_i486} , echo "or type to irrevocably overwrite disc /dev/${drive_i486}." set x=`cat /dev/tty` # write disklabel disklabel -r -w /dev/r${drive_i486}d ${disktab_name} disklabel -r -w /dev/r${drive_i486}c ${disktab_name} echo Showing label ${disktab_name} as just written to /dev/r${drive_i486}d disklabel -r /dev/r${drive_i486}d newfs /dev/r${drive_i486}a newfs /dev/r${drive_i486}h mount /dev/${drive_i486}a /mnt mkdir /mnt/usr mount /dev/${drive_i486}h /mnt/usr cd /mnt foreach i ( `cd ${home} ; ls *.tar.gz` ) echo Extracting $i tar xzpf ${home}/$i end echo Next line making devices has not yet been tested # My dev inodes came from Stuart, who built some other way (Mach or Serial). (cd dev ; ./MAKEDEV all ) # maybe one should also run maketrees # etorwi@hisoy.etn.ericsson._ERASE_.se (Raymond A. Wiker ) # # vi makeetc # (The makeetc script is slightly broken - the variable settings # for BINOWN, BINGRP and BIN1 are not valid sh syntax. Remove the # space(s) after the "=" sign, and put quotes about the value that # should be assigned to BIN1. Also, the variables MTREE and NAMEDB are # not given values - I don't know what they should be. The "install" # command for BIN1 may need to be evall'ed, since BIN1 now is a single # string of names - just put "eval " in front of "install".) # # sh makeetc # (This command should also work, now - I got warnings because I # hadn't set the variables MTREE and NAMEDB.) echo Copying kernels. cp ${home}/netbsd.rd.gz ${home}/netbsd.sd[01].gz . gzip -d netbsd.rd.gz netbsd.sd[01].gz ln netbsd.${drive_nsc532} netbsd echo Installing kernel images for eprom to boot from dd if=netbsd.rd of=/dev/r${drive_i486}f # 654+1 records dd if=netbsd.sd0 of=/dev/r${drive_i486}f seek=900 # 654+1 dd if=netbsd.sd1 of=/dev/r${drive_i486}f seek=1900 # 654+1 echo now overwrite etc/fstab # Phil old root.tar (or whatever) has # /dev/sd1a / ufs rw 1 1 # #kernfs /kern kernfs rw 1 1 # /dev/sd1e /mnt ufs rw 1 1 # /dev/sd0h /usr ufs rw 1 1 echo "/dev/${drive_nsc532}a / ufs rw 1 1" > etc/fstab echo "/dev/${drive_nsc532}h /usr ufs rw 1 2" >> etc/fstab echo Copy my disktab so I can run pc532 native disklabel. cp /etc/disktab etc/disktab.$user # copy this script so you have sytax for reference cp $0 pc532_build.$user echo fix more missing stuff # my /etc/netstart doesnt exist, because ive short circuited some of # phils stuff somewhere cat /dev/null >> /etc/netstart mkdir -p tmp var/run var/tmp root home/phil chmod 777 tmp var/run var/tmp echo Displaying occupancy. df | head -1 df | grep ${drive_i486} cd /tmp umount /dev/${drive_i486}h umount /dev/${drive_i486}a echo Installing ram root cp ${home}/ram.root.gz . gzip -d ram.root dd if=ram.root of=/dev/r${drive_i486}g rm ram.root echo "Copying FreeBSD (intel) disc label to netbsd-pc532 label" # from sector 1 offset 0 to sector 0 offset 64 dd if=/dev/r${drive_i486}e count=1 skip=1 of=label-netbsd-pc532.1 # cant do single byte writes to raw device so buffer it dd if=label-netbsd-pc532.1 of=label-netbsd-pc532.0 bs=1 seek=64 \ count=`echo "512 64 - p" | dc` dd if=label-netbsd-pc532.0 of=/dev/r${drive_i486}e dd if=/dev/r${drive_i486}e count=1 of=label-netbsd-pc532.0 od -c label-netbsd-pc532.0 rm label-netbsd-pc532.0 label-netbsd-pc532.1 exit while (1) echo "Please kill this script $0, " echo "then read $0 and continue manually." sleep 6000 end ------------------ Now move disc from intel to PC532, and set to scsi id 0, Reset, (If this is a power up, keep resetting after power up, till disc spins up, because otherwise I guess this scenario happens autoboot monitor tries to access disc, disc hasnt spun up, latches an error, monitor never tells disc to cancel error. monitor can never access disc # C-Kermit> set speed 9600 c baud d'19200 # C-Kermit> set speed 19200 c # for netbsd.sd0 kernel read d'1000 2000 d'1000 # Fallback Alternate 1 - for netbsd.rd kernel + ram.root read d'100 2000 d'900 read d'3000 200000 d'4000 # Fallback Alternate 2 - for netbsd.sd1 kernel read d'2000 2000 d'1000 2 run 2020 == == == == == == == == == == IF USING RAM ROOT # use "mount -u /" to make / writable /sbin/mount -u / mkdir mnt /sbin/mount /dev/sd0a /mnt /sbin/mount /dev/sd0h /usr TERM=vt100 export TERM ls -l /usr/local/bin/kermit mkdir /mnt /sbin/mount /dev/sd0a /mnt cd / tar cf - dev | ( cd /mnt ; tar xpf - ) == == == == == == == == == == CUSTOMISE ^D login root setenv TERM vt100 vi /etc/ttys console "/usr/libexec/getty std.19200" vt100 on secure tty00 "/usr/libexec/getty std.19200" vt100 off secure tty01 "/usr/libexec/getty std.9600" vt100 off secure tty02 "/usr/libexec/getty std.9600" vt100 on secure tty03 "/usr/libexec/getty std.9600" vt100 off secure tty04 "/usr/libexec/getty std.9600" vt100 on secure vi /root/.cshrc set path=(/sbin /usr/sbin /bin /usr/bin /usr/local/bin ) if ($?prompt) then set prompt="`hostname -s`# " endif setenv BLOCKSIZE K kill -HUP 1 == == == == == == == == == == ARRANGE FOR EPROM TO AUTOBOOT # dont use hdsetup on raw dev, as it doesnt write 512 byte blocks # do use hdsetup on a partition that starts at sector 0, ie C,D,E /sbin/hdsetup /dev/sd0c Do you want the images initialized? (y or n) y y help change change 5 13 100 2900 partitions 0 4.2BSD 7000 20000 1 swap 27000 16384 5 boot 100 2900 7 4.2BSD 43384 120602 add /netbsd.sd0 netbsd.sd0 # allways complains /netbsd.sd0 has a load address greater than 0xFFFFFF add /netbsd.sd1 netbsd.sd1 add /netbsd.rd netbsd.rd default 0 images Image address size load addr run addr name 0 0 220 2000 2020 netbsd.sd0 1 220 220 2000 2020 netbsd.sd1 2 440 220 2000 2020 netbsd.rd partitions exit halt Reset Wait for autoboot! Or type boot netbsd.sd0 == End Of File == == == == == == ==