From db11691a33689cdb128e0371801ff4ace9217ca4 Mon Sep 17 00:00:00 2001 From: christos Date: Tue, 15 Jan 2013 03:26:27 +0000 Subject: [PATCH] first step at autosizing, still does not work. --- distrib/utils/embedded/conf/rpi.conf | 19 +++++++++++-------- distrib/utils/embedded/mkimage | 19 +++++++++++-------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/distrib/utils/embedded/conf/rpi.conf b/distrib/utils/embedded/conf/rpi.conf index 27d4044af867..23c7087dbd20 100644 --- a/distrib/utils/embedded/conf/rpi.conf +++ b/distrib/utils/embedded/conf/rpi.conf @@ -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 @@ firmwaredir=$src/external/broadcom/rpi-firmware/dist 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 @@ console=fb #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 --git a/distrib/utils/embedded/mkimage b/distrib/utils/embedded/mkimage index e56fbc5ef10e..643734b16db9 100755 --- a/distrib/utils/embedded/mkimage +++ b/distrib/utils/embedded/mkimage @@ -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 # All rights reserved. @@ -168,17 +168,18 @@ fi 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 @@ make_filesystems ${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}"