Home | History | Annotate | Line # | Download | only in conf
rpi_inst.conf revision 1.10
      1  1.10       kre # $NetBSD: rpi_inst.conf,v 1.10 2017/11/28 02:56:44 kre Exp $
      2   1.1   garbled # Raspberry Pi customization script used by mkimage
      3   1.1   garbled #
      4   1.1   garbled 
      5   1.1   garbled board=rpi_inst
      6   1.1   garbled kernel=$src/sys/arch/evbarm/compile/RPI/netbsd-RPI_INSTALL.bin
      7   1.1   garbled 
      8   1.5     ozaki . ${DIR}/conf/evbarm.conf
      9   1.5     ozaki 
     10   1.1   garbled image=$HOME/${board}.img
     11   1.1   garbled 
     12   1.1   garbled swap=8
     13   1.1   garbled extra=8		# spare space
     14   1.1   garbled boot=112
     15   1.1   garbled init=8
     16   1.1   garbled 
     17   1.1   garbled size=$(( 10485760 + ${swap} * 1024 * 512 + ${boot} * 1024 * 512 + ${init} * 1024 * 512 ))
     18   1.1   garbled msdosid=12
     19   1.1   garbled 
     20   1.8   hubertf make_label() {
     21   1.1   garbled 	# compute all sizes in terms of sectors
     22   1.1   garbled 	local totalsize=$(( ${newsize} * 1024 * 2 / 512 ))
     23   1.1   garbled 
     24   1.1   garbled 	local swapsize=$(( ${swap} * 1024 ))
     25   1.1   garbled 	local bootsize=$(( ${boot} * 1024 ))
     26   1.1   garbled 
     27   1.1   garbled 	local bootoffset=$(( ${init} * 1024 ))
     28   1.1   garbled 	local swapoffset=$(( ${bootoffset} + ${bootsize} ))
     29   1.1   garbled 
     30   1.1   garbled 	local asize=$(( ${totalsize} - ${swapsize} - ${bootsize} - ${bootoffset} ))
     31   1.1   garbled 	local aoffset=$(( ${swapoffset} + ${swapsize} ))
     32   1.1   garbled 
     33   1.1   garbled 	local bps=512
     34   1.1   garbled 	local spt=32
     35   1.1   garbled 	local tpc=64
     36   1.1   garbled 	local spc=2048
     37   1.1   garbled 	local cylinders=$(( ${totalsize} / ${spc} ))
     38   1.1   garbled 
     39   1.1   garbled 	cat << EOF
     40   1.1   garbled type: SCSI
     41   1.1   garbled disk: STORAGE DEVICE
     42   1.1   garbled label: fictitious
     43   1.1   garbled flags: removable
     44   1.1   garbled bytes/sector: ${bps}
     45   1.1   garbled sectors/track: ${spt}
     46   1.1   garbled tracks/cylinder: ${tpc}
     47   1.1   garbled sectors/cylinder: ${spc}
     48   1.1   garbled cylinders: ${cylinders}
     49   1.1   garbled total sectors: ${totalsize}
     50   1.1   garbled rpm: 3600
     51   1.1   garbled interleave: 1
     52   1.1   garbled trackskew: 0
     53   1.1   garbled cylinderskew: 0
     54   1.1   garbled headswitch: 0           # microseconds
     55   1.1   garbled track-to-track seek: 0  # microseconds
     56   1.1   garbled drivedata: 0 
     57   1.1   garbled 
     58   1.1   garbled 8 partitions:
     59   1.1   garbled #     size         offset        fstype [fsize bsize cpg/sgs]
     60   1.1   garbled  a:   ${asize}     ${aoffset}    4.2BSD  ${fsize} ${bsize} 0  # 
     61   1.1   garbled  b:   ${swapsize}  ${swapoffset} swap                         #
     62   1.1   garbled  d:   ${totalsize} 0             unused      0     0          #
     63   1.1   garbled  e:   ${bootsize}  ${bootoffset} MSDOS                        #
     64   1.1   garbled EOF
     65   1.1   garbled }
     66   1.1   garbled 
     67   1.8   hubertf customize() {
     68   1.1   garbled 	echo "${bar} creating directories ${bar}"
     69   1.1   garbled 	mkdir ${mnt}/proc ${mnt}/kern
     70   1.1   garbled }
     71   1.1   garbled 
     72   1.1   garbled make_fstab() {
     73   1.8   hubertf 	:
     74   1.1   garbled }
     75   1.1   garbled 
     76   1.8   hubertf firmwaredir=$src/external/broadcom/rpi-firmware/dist
     77   1.8   hubertf firmwarefiles="LICENCE.broadcom bootcode.bin fixup.dat fixup_cd.dat start.elf start_cd.elf"
     78   1.1   garbled 
     79   1.1   garbled populate() {
     80   1.1   garbled 	cat > ${mnt}/boot/cmdline.txt << EOF
     81   1.1   garbled root=ld0a console=fb
     82   1.1   garbled #fb=1280x1024		# to select a mode, otherwise try EDID 
     83   1.1   garbled #fb=disable		# to disable fb completely
     84   1.1   garbled EOF
     85   1.9  jmcneill 
     86   1.9  jmcneill 	cat > ${mnt}/boot/config.txt << EOF
     87   1.9  jmcneill # UART settings, see https://www.raspberrypi.org/documentation/configuration/uart.md
     88   1.9  jmcneill enable_uart=1            
     89   1.9  jmcneill force_turbo=0
     90   1.9  jmcneill EOF
     91   1.9  jmcneill 
     92   1.1   garbled 	if [ ! -f ${kernel} ]; then
     93   1.1   garbled 		echo ${PROG}: Missing ${kernel} 1>&2
     94   1.1   garbled 		exit 1
     95   1.1   garbled 	fi
     96   1.1   garbled 
     97   1.1   garbled 	echo "${bar} installing kernel ${bar}"
     98   1.1   garbled 	case ${kernel} in
     99   1.1   garbled 	*.gz)
    100   1.3       ast 		${GZIP_CMD} -dc ${kernel} > ${mnt}/boot/kernel.img
    101   1.1   garbled 		;;
    102   1.1   garbled 	*)
    103   1.1   garbled 		cp ${kernel} ${mnt}/boot/kernel.img
    104   1.1   garbled 		;;
    105  1.10       kre 	esac || fail "copy of ${kernel} to  ${mnt}/boot/kernel.img failed"
    106   1.1   garbled 
    107   1.1   garbled 	echo "${bar} installing firmware files ${bar}"
    108   1.1   garbled 	(cd ${mnt}/boot &&
    109   1.1   garbled 		for f in ${firmwarefiles}; do
    110   1.1   garbled 			echo " $f"
    111  1.10       kre 			cp ${firmwaredir}/${f} . || exit 1
    112   1.1   garbled 		done
    113  1.10       kre 	) || fail "Copy of firmware to ${mnt}/boot failed"
    114   1.1   garbled 
    115   1.1   garbled }
    116