Home | History | Annotate | Line # | Download | only in conf
evbarm.conf revision 1.43
      1  1.43  christos # $NetBSD: evbarm.conf,v 1.43 2024/12/27 19:02:19 christos Exp $
      2   1.1  christos # evbarm shared config
      3   1.1  christos #
      4   1.1  christos image=$HOME/${board}.img
      5   1.1  christos 
      6  1.14  christos MACHINE=evbarm
      7   1.1  christos 
      8  1.20     skrll extra=48		# spare space
      9  1.28  jmcneill init=32
     10  1.26  jmcneill boot=$((192 - ${init}))
     11  1.34  jmcneill ffsoffset=$(( (${init} + ${boot}) / 2 ))m
     12   1.1  christos 
     13   1.1  christos size=0		# autocompute
     14   1.1  christos msdosid=12
     15   1.1  christos 
     16  1.35  jmcneill if $gpt; then
     17  1.35  jmcneill 	partition_type="gpt"
     18  1.35  jmcneill else
     19  1.35  jmcneill 	partition_type="disklabel"
     20  1.35  jmcneill fi
     21  1.35  jmcneill 
     22  1.15  christos mkdir -p ${mnt}/boot
     23  1.15  christos 
     24   1.5  christos make_label_evbarm() {
     25  1.10     htodd 	# compute all sizes in terms of sectors
     26  1.38       rin 	local totalsize=$(( ${size} / 512 ))
     27  1.10     htodd 
     28   1.1  christos 	local bootsize=$(( ${boot} * 1024 ))
     29   1.1  christos 
     30   1.3     skrll 	local bootoffset=$(( ${init} * 1024 ))
     31   1.3     skrll 
     32  1.34  jmcneill 	local asize=$(( ${totalsize} - ${bootsize} - ${bootoffset} ))
     33  1.34  jmcneill 	local aoffset=$(( ${bootoffset} + ${bootsize} ))
     34   1.1  christos 
     35   1.1  christos 	local bps=512
     36   1.1  christos 	local spt=32
     37   1.1  christos 	local tpc=64
     38   1.1  christos 	local spc=2048
     39   1.1  christos 	local cylinders=$(( ${totalsize} / ${spc} ))
     40   1.1  christos 
     41   1.5  christos 	cat << EOF
     42   1.1  christos type: SCSI
     43   1.1  christos disk: STORAGE DEVICE
     44   1.1  christos label: fictitious
     45   1.1  christos flags: removable
     46   1.1  christos bytes/sector: ${bps}
     47   1.1  christos sectors/track: ${spt}
     48   1.1  christos tracks/cylinder: ${tpc}
     49   1.1  christos sectors/cylinder: ${spc}
     50   1.1  christos cylinders: ${cylinders}
     51   1.1  christos total sectors: ${totalsize}
     52   1.1  christos rpm: 3600
     53   1.1  christos interleave: 1
     54   1.1  christos trackskew: 0
     55   1.1  christos cylinderskew: 0
     56   1.1  christos headswitch: 0           # microseconds
     57   1.1  christos track-to-track seek: 0  # microseconds
     58   1.1  christos drivedata: 0 
     59   1.1  christos 
     60   1.1  christos 8 partitions:
     61   1.1  christos #     size         offset        fstype [fsize bsize cpg/sgs]
     62   1.1  christos  a:   ${asize}     ${aoffset}    4.2BSD  ${fsize} ${bsize} 0  # 
     63  1.12      matt  c:   ${totalsize} 0             unused      0     0          #
     64   1.1  christos  e:   ${bootsize}  ${bootoffset} MSDOS                        #
     65   1.1  christos EOF
     66   1.1  christos }
     67   1.1  christos 
     68  1.11  christos make_fstab_evbarm() {
     69  1.43  christos 	make_fstab_default EFI
     70  1.11  christos }
     71  1.11  christos 
     72   1.1  christos customize_evbarm() {
     73  1.11  christos 	if $minwrites; then
     74  1.11  christos 		mkdir ${mnt}/etc/postfix
     75  1.11  christos 		(umask 022
     76  1.11  christos 		sed -e 's/fifo/unix/' < ${release}/etc/postfix/master.cf > \
     77  1.11  christos 		    ${mnt}/etc/postfix/master.cf)
     78  1.11  christos 	fi
     79  1.27   hubertf 	
     80  1.27   hubertf 	cp ${release}/etc/rc.conf ${mnt}/etc/rc.conf
     81   1.5  christos 	cat >> ${mnt}/etc/rc.conf << EOF
     82  1.31  jmcneill dev_exists() {
     83  1.32  jmcneill 	if /sbin/drvctl -l \$1 >/dev/null 2>&1 ; then
     84  1.31  jmcneill 		printf YES
     85  1.31  jmcneill 	else
     86  1.31  jmcneill 		printf NO
     87  1.31  jmcneill 	fi
     88  1.31  jmcneill }
     89  1.31  jmcneill 
     90  1.40  jmcneill is_cloud() {
     91  1.40  jmcneill 	ret=NO
     92  1.40  jmcneill 
     93  1.40  jmcneill 	# AWS EC2
     94  1.40  jmcneill 	if [ "\$(dev_exists ena0)" = "YES" ]; then
     95  1.40  jmcneill 		ret=YES
     96  1.40  jmcneill 	fi
     97  1.40  jmcneill 
     98  1.40  jmcneill 	# Oracle OCI
     99  1.41  jmcneill 	case "\$(/sbin/sysctl -n machdep.dmi.chassis-asset-tag 2>/dev/null)" in
    100  1.40  jmcneill 	OracleCloud*)
    101  1.40  jmcneill 		ret=YES
    102  1.40  jmcneill 		;;
    103  1.40  jmcneill 	esac
    104  1.40  jmcneill 
    105  1.40  jmcneill 	printf \$ret
    106  1.40  jmcneill }
    107  1.40  jmcneill 
    108   1.7  jmcneill rc_configured=YES
    109  1.36  jmcneill hostname=${hostname:-${board}}
    110  1.34  jmcneill no_swap=YES
    111  1.34  jmcneill savecore=NO
    112   1.1  christos sshd=YES
    113   1.1  christos dhcpcd=YES
    114  1.16  jmcneill ntpd=YES
    115  1.16  jmcneill ntpd_flags="-g"
    116  1.33       mrg creds_msdos=YES
    117  1.33       mrg creds_msdos_partition=/boot
    118  1.42  riastrad certctl_init=YES
    119   1.1  christos EOF
    120  1.21  jmcneill 
    121  1.21  jmcneill 	if $resize; then
    122  1.21  jmcneill 		cat >> ${mnt}/etc/rc.conf << EOF
    123  1.35  jmcneill resize_${partition_type}=YES
    124  1.21  jmcneill resize_root=YES
    125  1.22  jmcneill resize_root_flags="-p"
    126  1.21  jmcneill resize_root_postcmd="/sbin/reboot -n"
    127  1.21  jmcneill EOF
    128  1.21  jmcneill 	fi
    129  1.21  jmcneill 
    130  1.20     skrll 	echo "./etc/rc.conf type=file uname=root gname=wheel mode=0644" \
    131  1.20     skrll 	    >> "$tmp/selected_sets"
    132  1.20     skrll 
    133  1.21  jmcneill 	mkdir ${mnt}/etc/rc.d
    134  1.35  jmcneill 	for _f in resize_${partition_type} creds_msdos; do
    135  1.33       mrg 		cp ${DIR}/files/${_f} ${mnt}/etc/rc.d/${_f}
    136  1.33       mrg 		echo "./etc/rc.d/${_f} type=file uname=root gname=wheel mode=0555" \
    137  1.33       mrg 		    >> "$tmp/selected_sets"
    138  1.33       mrg 	done
    139  1.21  jmcneill 
    140   1.5  christos 	if [ ! -f ${release}/dev/MAKEDEV ]; then
    141   1.5  christos 		echo ${PROG}: Missing ${release}/dev/MAKEDEV 1>&2
    142   1.1  christos 		exit 1
    143   1.1  christos 	fi
    144   1.1  christos 	echo "${bar} running MAKEDEV ${bar}"
    145  1.13     skrll 	${HOST_SH} ${release}/dev/MAKEDEV -s all | sed -e 's:^\./:\./dev/:' \
    146  1.13     skrll 	    >> "$tmp/selected_sets"
    147   1.8  jmcneill 
    148  1.18     skrll 	echo "${bar} fixing up permissions"
    149  1.18     skrll 	echo "./boot type=dir uname=root gname=wheel mode=0755" \
    150  1.18     skrll 	    >> "$tmp/selected_sets"
    151   1.1  christos }
    152