Source-Changes-HG archive

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

[src/trunk]: src/distrib/utils/embedded first step at autosizing, still does ...



details:   https://anonhg.NetBSD.org/src/rev/ddefcc2cc1f9
branches:  trunk
changeset: 784022:ddefcc2cc1f9
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Jan 15 03:26:27 2013 +0000

description:
first step at autosizing, still does not work.

diffstat:

 distrib/utils/embedded/conf/rpi.conf |  19 +++++++++++--------
 distrib/utils/embedded/mkimage       |  19 +++++++++++--------
 2 files changed, 22 insertions(+), 16 deletions(-)

diffs (111 lines):

diff -r 232975620a36 -r ddefcc2cc1f9 distrib/utils/embedded/conf/rpi.conf
--- a/distrib/utils/embedded/conf/rpi.conf      Tue Jan 15 03:24:00 2013 +0000
+++ b/distrib/utils/embedded/conf/rpi.conf      Tue Jan 15 03:26:27 2013 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: rpi.conf,v 1.5 2013/01/13 22:08:43 christos Exp $
+# $NetBSD: rpi.conf,v 1.6 2013/01/15 03:26:28 christos Exp $
 # Raspberry PI customization script used by mkimage
 #
 image=$HOME/rpi.img
@@ -7,22 +7,24 @@
 firmwarefiles="LICENCE.broadcom bootcode.bin fixup.dat fixup_cd.dat start.elf start_cd.elf"
 
 sets="base etc comp games man misc modules tests text"
-setsdir=$obj/evbarm/media
+setsdir=$obj/evbarm//media/evbarm/binary/sets/
 kerneldir=$src/sys/arch/evbarm/compile/RPI
 specialdirs="/kern /proc"
 
-swap=512
-size=2048
-overhead=8
+swap=256
+extra=8
 boot=112
 init=8
+
+size=0
 msdosid=12
+overhead=$(( ${swap} + ${extra} + ${init} + ${boot} ))
 
 tmp=/tmp/rpi.disklabel.$$
 
 make_filesystems() {
 
-       local asize=$(( ${size} * 1024 ))
+       local asize=$(( ${newsize} * 1024 ))
        local swapsize=$(( ${swap} * 1024 ))
        local bootsize=$(( ${boot} * 1024 ))
 
@@ -100,13 +102,14 @@
 #fb=disable            # to disable fb completely
 EOF
 
-       echo "${bar} installing firmware files ${bar}"
+       echo -n "${bar} installing firmware files:"
        (cd ${mnt}/boot &&
                for f in ${firmwarefiles}; do
-                       echo $f
+                       echo -n " $f"
                        ${sudo} cp ${firmwaredir}/${f} .
                done
        )
+       echo " ${bar}"
 
        if [ ! -f ${kerneldir}/kernel.img ]; then
                echo ${PROG}: Missing ${kerneldir}/kernel.img 1>&2
diff -r 232975620a36 -r ddefcc2cc1f9 distrib/utils/embedded/mkimage
--- a/distrib/utils/embedded/mkimage    Tue Jan 15 03:24:00 2013 +0000
+++ b/distrib/utils/embedded/mkimage    Tue Jan 15 03:26:27 2013 +0000
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# $NetBSD: mkimage,v 1.9 2013/01/15 02:50:08 jmcneill Exp $
+# $NetBSD: mkimage,v 1.10 2013/01/15 03:26:27 christos Exp $
 
 # Copyright (c) 2012 Alistair Crooks <agc%NetBSD.org@localhost>
 # All rights reserved.
@@ -168,17 +168,18 @@
 total=$(( ( ( ${total} + ${custsize} ) / 1000000 ) + ${overhead} ))
 if [ $size -eq 0 ]; then
         # auto-size the pkgs fs
-        size=${total}
+        newsize=${total}
 else
         # check that we've been given enough space
         if [ ${total} -gt ${size} ]; then
                 echo "$PROG: Given size is ${size} MB, but we need ${total} MB" >&2
                 exit 1
         fi
+       newsize=${size}
 fi
 
-echo "${bar} making a new ${size} MB image in ${image} ${bar}"
-dd if=/dev/zero of=${image} bs=1m count=${size} conv=sparse
+echo "${bar} making a new ${newsize} MB image in ${image} ${bar}"
+dd if=/dev/zero of=${image} bs=1m count=${newsize} conv=sparse
 
 vnddev=$(next_avail vnd)
 echo "${bar} mounting image via vnd ${vnddev} ${bar}"
@@ -188,15 +189,17 @@
 
 ${sudo} mkdir -p ${mnt}/etc ${mnt}/dev
 
-echo "${bar} installing sets ${bar}"
+echo -n "${bar} installing sets:"
 (cd ${mnt} &&
        for s in ${sets}; do
-               if [ -f "${setsdir}/${s}.tgz" ]; then
-                       echo ${s}
-                       ${sudo} tar xpzf ${setsdir}/${s}.tgz
+               ss="${setsdir}/${s}.tgz"
+               if [ -f "${ss}" ]; then
+                       echo -n " ${s}"
+                       ${sudo} tar xpzf "${ss}"
                fi
        done
 )
+echo " ${bar}"
 
 echo "${bar} performing customisations ${bar}"
 



Home | Main Index | Thread Index | Old Index