Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/distrib/utils/embedded/conf Autosize label



details:   https://anonhg.NetBSD.org/src/rev/18363d503103
branches:  trunk
changeset: 783966:18363d503103
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Jan 13 21:38:45 2013 +0000

description:
Autosize label

diffstat:

 distrib/utils/embedded/conf/rpi.conf |  43 +++++++++++++++++++++++++----------
 1 files changed, 31 insertions(+), 12 deletions(-)

diffs (75 lines):

diff -r c20613bfe8f4 -r 18363d503103 distrib/utils/embedded/conf/rpi.conf
--- a/distrib/utils/embedded/conf/rpi.conf      Sun Jan 13 21:01:05 2013 +0000
+++ b/distrib/utils/embedded/conf/rpi.conf      Sun Jan 13 21:38:45 2013 +0000
@@ -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 @@
 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 @@
 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}



Home | Main Index | Thread Index | Old Index