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