Module Name:    src
Committed By:   christos
Date:           Sun Jan 13 21:38:45 UTC 2013

Modified Files:
        src/distrib/utils/embedded/conf: rpi.conf

Log Message:
Autosize label


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/distrib/utils/embedded/conf/rpi.conf

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/utils/embedded/conf/rpi.conf
diff -u src/distrib/utils/embedded/conf/rpi.conf:1.1 src/distrib/utils/embedded/conf/rpi.conf:1.2
--- src/distrib/utils/embedded/conf/rpi.conf:1.1	Sun Jan 13 15:57:18 2013
+++ src/distrib/utils/embedded/conf/rpi.conf	Sun Jan 13 16:38:45 2013
@@ -1,4 +1,4 @@
-# $NetBSD: rpi.conf,v 1.1 2013/01/13 20:57:18 christos Exp $
+# $NetBSD: rpi.conf,v 1.2 2013/01/13 21:38:45 christos Exp $
 # Raspberry PI customization script used by mkimage
 #
 image=$HOME/rpi.img
@@ -11,23 +11,42 @@ setsdir=$obj/evbarm/media
 kerneldir=$src/sys/arch/evbarm/compile/RPI
 specialdirs="/kern /proc"
 
+swap=512
 size=2048
 overhead=8
+boot=112
+init=8
 
 tmp=/tmp/rpi.disklabel.$$
 
 make_filesystems() {
+
+	local asize=$(( ${size} * 1024 ))
+	local swapsize=$(( ${swap} * 1024 ))
+	local bootsize=$(( ${boot} * 1024 ))
+
+	local bootoffset=$((${init} * 1024 ))
+	local swapoffset=$(( ${bootoffset} + ${bootsize} ))
+	local aoffset=$(( ${swapoffset} + ${swapsize} ))
+
+	local totalsize=$(( ${asize} + ${swapsize} + ${bootsize} + ${bootoffset} ))
+	local bps=512
+	local spt=32
+	local tpc=64
+	local spc=2048
+	local cylinders=$(( ${totalsize} / ${spc} ))
+
 	cat > ${tmp} << EOF
 type: SCSI
 disk: STORAGE DEVICE
 label: fictitious
 flags: removable
-bytes/sector: 512
-sectors/track: 32
-tracks/cylinder: 64
-sectors/cylinder: 2048
-cylinders: 7460
-total sectors: 2097152
+bytes/sector: ${bps}
+sectors/track: ${spt}
+tracks/cylinder: ${tpc}
+sectors/cylinder: ${spc}
+cylinders: ${cylinders}
+total sectors: ${totalsize}
 rpm: 3600
 interleave: 1
 trackskew: 0
@@ -37,11 +56,11 @@ track-to-track seek: 0  # microseconds
 drivedata: 0 
 
 8 partitions:
-#        size    offset     fstype [fsize bsize cpg/sgs]
- a:   1449984    647168     4.2BSD   2048 16384     0  # 
- b:    524288    122880       swap                     #
- d:   2097152         0     unused      0     0        #
- e:    114688      8192      MSDOS                     #
+#     size         offset        fstype [fsize bsize cpg/sgs]
+ a:   ${asize}     ${aoffset}    4.2BSD   2048 16384     0  # 
+ b:   ${swapsize}  ${swapoffset} swap                       #
+ d:   ${totalsize} 0             unused      0     0        #
+ e:   ${bootsize}  ${bootoffset} MSDOS                      #
 EOF
 	${sudo} disklabel -R ${vnddev} ${tmp}
 	${sudo} fdisk -f -u -0 -s 12/8192/114688 -F ${image}

Reply via email to