1# 2# $FreeBSD$ 3# 4NANO_SRC=$(pwd) 5NANO_SRC=${NANO_SRC%/tools/tools/nanobsd/rescue} 6NANO_OBJ=${NANO_SRC}/../nanobsd-builds/${NANO_NAME}/obj 7NANO_TOOLS=`pwd` 8NANO_PACKAGE_DIR=`pwd`/Pkg 9NANO_RAM_TMPVARSIZE=40960 10NANO_PMAKE="make -j 8" 11NANO_LABEL="rescue" 12NANO_RAM_TMPVARSIZE=40960 13#NANO_MEDIASIZE="3932160" 14NANO_MEDIASIZE="16384000" 15NANO_SECTS="63" 16NANO_HEADS="16" 17NANO_IMAGES="2" 18NANO_INIT_IMG2="0" 19NANO_BOOT0CFG="-o packet,update,nosetdrv -s 1 -m 3" 20NANO_DRIVE=da0 21#NANO_MODULES= 22NANO_BOOTLOADER="boot/boot0" 23NANO_BOOT2CFG="" 24NANO_MD_BACKING=file 25 26# Options to put in make.conf during buildworld only 27CONF_BUILD=' 28' 29# Options to put in make.conf during installworld only 30CONF_INSTALL=' 31' 32# Options to put in make.conf during both build- & installworld. 33CONF_WORLD=' 34#TARGET_ARCH=i386 35CFLAGS=-O -pipe 36WITHOUT_TESTS=YES 37ALL_MODULES=YES 38' 39 40# Functions 41toLower() { 42 echo $1 | tr "[:upper:]" "[:lower:]" 43} 44 45toUpper() { 46 echo $1 | tr "[:lower:]" "[:upper:]" 47} 48 49#customize_cmd cust_comconsole 50customize_cmd cust_allow_ssh_root 51customize_cmd cust_install_files 52 53cust_ld32_cfg () ( 54 cd ${NANO_WORLDDIR}/libexec 55 if [ \! -f ld-elf32.so.1 ]; then 56 ln -s ld-elf.so.1 ld-elf32.so.1 57 fi 58) 59customize_cmd cust_ld32_cfg 60 61#cust_boot_cfg () ( 62# cd ${NANO_WORLDDIR} 63# echo "-S115200 -h" > boot.config 64# echo "console=\"comconsole\"" > boot/loader.conf 65# echo "comconsole_speed=\"115200\"" >> boot/loader.conf 66# echo "hint.acpi.0.disabled=\"1\"" >> boot/loader.conf 67#) 68#customize_cmd cust_boot_cfg 69 70customize_cmd cust_pkgng 71 72cust_etc_cfg () ( 73 cd ${NANO_WORLDDIR} 74# mkdir -pv scratch 75 echo "hostname=\"rescue\"" > etc/rc.conf 76 echo "font8x14=\"iso15-8x14\"" >> etc/rc.conf 77 echo "font8x16=\"iso15-8x16\"" >> etc/rc.conf 78 echo "font8x8=\"iso15-8x8\"" >> etc/rc.conf 79 echo "keymap=\"german.iso\"" >> etc/rc.conf 80 echo "#ifconfig_fxp0=\"AUTO\"" >> etc/rc.conf 81 echo "#sshd_enable=\"YES\"" >> etc/rc.conf 82 echo "/dev/ufs/${NANO_LABEL}s1a / ufs ro,noatime 0 0" > etc/fstab 83 echo "/dev/${NANO_DRIVE}s3 /cfg ufs rw,noauto 2 2" >> etc/fstab 84 echo "tmpfs /boot/zfs tmpfs rw,size=1048576,mode=777 0 0" >> etc/fstab 85 echo "ports:/usr/ports /usr/ports nfs rw,noauto,noatime,bg,soft,intr,nfsv3 0 0" >> etc/fstab 86# echo "/dev/ad1s1a /scratch ufs rw,noauto,noatime 0 0" >> etc/fstab 87 /usr/sbin/pwd_mkdb -d etc etc/master.passwd 88) 89customize_cmd cust_etc_cfg 90 91setup_nanobsd_etc ( ) ( 92 pprint 2 "configure nanobsd /etc" 93 ( 94 cd ${NANO_WORLDDIR} 95 # create diskless marker file 96 touch etc/diskless 97 # Make root filesystem R/O by default 98 echo "root_rw_mount=NO" >> etc/defaults/rc.conf 99 # save config file for scripts 100 echo "NANO_DRIVE=${NANO_DRIVE}" > etc/nanobsd.conf 101 mkdir -p cfg 102 ) 103) 104last_orders () ( 105 pprint 2 "last orders" 106 ( 107 cd ${NANO_WORLDDIR} 108 #makefs converts labels to uppercase anyways 109 BIGLABEL=`toUpper "${NANO_LABEL}"` 110 echo "/dev/iso9660/${BIGLABEL} / cd9660 ro,noatime 0 0" > etc/fstab 111 echo "tmpfs /boot/zfs tmpfs rw,size=1048576,mode=777 0 0" >> etc/fstab 112 echo "ports:/usr/ports /usr/ports nfs rw,noauto,noatime,bg,soft,intr,nfsv3 0 0" >> etc/fstab 113# echo "/dev/ad1s1a /scratch ufs rw,noauto,noatime 0 0" >> etc/fstab 114 rm -f conf/default/etc/remount 115 touch conf/default/etc/.keepme 116 touch conf/default/var/.keepme 117 mkdir bootpool 118 mkdir mnt/a 119 mkdir mnt/b 120 mkdir mnt/c 121 cd .. 122 makefs -t cd9660 -o rockridge \ 123 -o label="${BIGLABEL}" -o publisher="RMX" \ 124 -o bootimage="i386;_.w/boot/cdboot" -o no-emul-boot _.disk.iso _.w/ 125 ) 126) 127