Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/distrib/utils/embedded switch to makefs
details: https://anonhg.NetBSD.org/src/rev/b93af8a80a4b
branches: trunk
changeset: 784605:b93af8a80a4b
user: christos <christos%NetBSD.org@localhost>
date: Sun Feb 03 09:16:24 2013 +0000
description:
switch to makefs
diffstat:
distrib/utils/embedded/conf/beagleboard.conf | 12 +-
distrib/utils/embedded/conf/evbarm.conf | 33 +-
distrib/utils/embedded/conf/rpi.conf | 22 +-
distrib/utils/embedded/conf/usermode.conf | 28 +-
distrib/utils/embedded/mkimage | 351 ++++++---------------------
5 files changed, 118 insertions(+), 328 deletions(-)
diffs (truncated from 659 to 300 lines):
diff -r be7959a88981 -r b93af8a80a4b distrib/utils/embedded/conf/beagleboard.conf
--- a/distrib/utils/embedded/conf/beagleboard.conf Sun Feb 03 08:22:21 2013 +0000
+++ b/distrib/utils/embedded/conf/beagleboard.conf Sun Feb 03 09:16:24 2013 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: beagleboard.conf,v 1.4 2013/01/28 09:06:19 skrll Exp $
+# $NetBSD: beagleboard.conf,v 1.5 2013/02/03 09:16:25 christos Exp $
# BeagleBoard customization script used by mkimage
#
board=beagleboard
@@ -10,10 +10,8 @@
kernelimg=netbsd.ub
loadaddr=81000000
-
-
-make_filesystems() {
- make_filesystems_evbarm
+make_label() {
+ make_label_evbarm
}
make_fstab() {
@@ -22,10 +20,10 @@
customize() {
customize_evbarm
- ${sudo} cat >> ${mnt}/etc/rc.conf << EOF
+ cat >> ${mnt}/etc/rc.conf << EOF
mdnsd=YES
EOF
- ${sudo} cat > ${mnt}/boot/uEnv.txt << EOF
+ cat > ${mnt}/boot/uEnv.txt << EOF
loaduimage=fatload mmc 0 ${loadaddr} ${kernelimg}; bootm ${loadaddr} root=ld0a
EOF
}
diff -r be7959a88981 -r b93af8a80a4b distrib/utils/embedded/conf/evbarm.conf
--- a/distrib/utils/embedded/conf/evbarm.conf Sun Feb 03 08:22:21 2013 +0000
+++ b/distrib/utils/embedded/conf/evbarm.conf Sun Feb 03 09:16:24 2013 +0000
@@ -1,9 +1,8 @@
-# $NetBSD: evbarm.conf,v 1.4 2013/01/28 09:06:19 skrll Exp $
+# $NetBSD: evbarm.conf,v 1.5 2013/02/03 09:16:25 christos Exp $
# evbarm shared config
#
image=$HOME/${board}.img
-setsdir=$obj/evbarm/media/evbarm/binary/sets/
specialdirs="/kern /proc"
swap=256
@@ -13,12 +12,8 @@
size=0 # autocompute
msdosid=12
-overhead=$(( ${swap} + ${extra} + ${init} + ${boot} ))
-tmp=/tmp/${board}.disklabel.$$
-
-make_filesystems_evbarm() {
-
+make_label_evbarm() {
local totalsize=$(( ${newsize} * 1024 * 2 ))
local swapsize=$(( ${swap} * 1024 ))
local bootsize=$(( ${boot} * 1024 ))
@@ -35,7 +30,7 @@
local spc=2048
local cylinders=$(( ${totalsize} / ${spc} ))
- cat > ${tmp} << EOF
+ cat << EOF
type: SCSI
disk: STORAGE DEVICE
label: fictitious
@@ -61,17 +56,10 @@
d: ${totalsize} 0 unused 0 0 #
e: ${bootsize} ${bootoffset} MSDOS #
EOF
- ${sudo} disklabel -R ${vnddev} ${tmp}
- ${sudo} fdisk -f -u -0 -s ${msdosid}/${bootoffset}/${bootsize} -F ${image}
- ${sudo} newfs /dev/r${vnddev}a
- ${sudo} newfs_msdos /dev/r${vnddev}e
- ${sudo} mount -o async /dev/${vnddev}a ${mnt}
- ${sudo} mkdir ${mnt}/boot
- ${sudo} mount_msdos /dev/${vnddev}e ${mnt}/boot
}
make_fstab_evbarm() {
- ${sudo} cat > ${mnt}/etc/fstab << EOF
+ cat > ${mnt}/etc/fstab << EOF
# NetBSD /etc/fstab
# See /usr/share/examples/fstab/ for more examples.
/dev/ld0a / ffs rw,log 1 1
@@ -84,19 +72,14 @@
}
customize_evbarm() {
- ${sudo} cat >> ${mnt}/etc/rc.conf << EOF
+ cat >> ${mnt}/etc/rc.conf << EOF
sshd=YES
dhcpcd=YES
EOF
- if [ ! -f ${mnt}/dev/MAKEDEV ]; then
- echo ${PROG}: Missing ${mnt}/dev/MAKEDEV 1>&2
+ if [ ! -f ${release}/dev/MAKEDEV ]; then
+ echo ${PROG}: Missing ${release}/dev/MAKEDEV 1>&2
exit 1
fi
echo "${bar} running MAKEDEV ${bar}"
- (cd ${mnt}/dev && ${sudo} sh MAKEDEV all)
+ (cd ${mnt}/dev && sh ${release}/dev/MAKEDEV all)
}
-
-cleanup_evbarm() {
- rm -f ${tmp}
- ${sudo} umount ${mnt}/boot
-}
diff -r be7959a88981 -r b93af8a80a4b distrib/utils/embedded/conf/rpi.conf
--- a/distrib/utils/embedded/conf/rpi.conf Sun Feb 03 08:22:21 2013 +0000
+++ b/distrib/utils/embedded/conf/rpi.conf Sun Feb 03 09:16:24 2013 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: rpi.conf,v 1.12 2013/01/23 22:20:06 skrll Exp $
+# $NetBSD: rpi.conf,v 1.13 2013/02/03 09:16:25 christos Exp $
# Raspberry Pi customization script used by mkimage
#
@@ -19,37 +19,39 @@
make_fstab_evbarm
}
+make_label() {
+ make_label_evbarm
+}
+
customize() {
customize_evbarm
- ${sudo} cat >> ${mnt}/etc/rc.conf << EOF
+ cat >> ${mnt}/etc/rc.conf << EOF
wscons=YES
EOF
- ${sudo} cat > ${mnt}/boot/cmdline.txt << EOF
+}
+
+populate() {
+ cat > ${mnt}/boot/cmdline.txt << EOF
root=ld0a console=fb
#fb=1280x1024 # to select a mode, otherwise try EDID
#fb=disable # to disable fb completely
EOF
-
if [ ! -f ${kerneldir}/kernel.img ]; then
echo ${PROG}: Missing ${kerneldir}/kernel.img 1>&2
exit 1
fi
echo "${bar} installing kernel ${bar}"
- ${sudo} cp ${kerneldir}/kernel.img ${mnt}/boot
+ cp ${kerneldir}/kernel.img ${mnt}/boot
echo -n "${bar} installing firmware files:"
(cd ${mnt}/boot &&
for f in ${firmwarefiles}; do
echo -n " $f"
- ${sudo} cp ${firmwaredir}/${f} .
+ cp ${firmwaredir}/${f} .
done
)
echo " ${bar}"
}
-
-cleanup() {
- cleanup_evbarm
-}
diff -r be7959a88981 -r b93af8a80a4b distrib/utils/embedded/conf/usermode.conf
--- a/distrib/utils/embedded/conf/usermode.conf Sun Feb 03 08:22:21 2013 +0000
+++ b/distrib/utils/embedded/conf/usermode.conf Sun Feb 03 09:16:24 2013 +0000
@@ -1,5 +1,7 @@
-# $NetBSD: usermode.conf,v 1.2 2013/01/13 22:08:43 christos Exp $
+# $NetBSD: usermode.conf,v 1.3 2013/02/03 09:16:25 christos Exp $
# NetBSD/usermode customization script used by mkimage
+
+# XXX: BROKEN, needs to be converted to makefs
custom=custom
image=usermode.img
overhead=8 # in MB
@@ -10,12 +12,12 @@
usermodedirs="/var.cow /etc.cow /root.cow /pkgs"
make_filesystems() {
- ${sudo} newfs /dev/r${vnddev}a
- ${sudo} mount /dev/${vnddev}a ${mnt}
+ newfs /dev/r${vnddev}a
+ mount /dev/${vnddev}a ${mnt}
}
make_fstab() {
-${sudo} cat > ${mnt}/etc/fstab << EOF
+cat > ${mnt}/etc/fstab << EOF
# NetBSD/usermode /etc/fstab
/dev/ld0a / ffs ro 1 1
/dev/ld1a /pkgs ffs ro 1 2
@@ -37,7 +39,7 @@
}
customize() {
-${sudo} cat >> ${mnt}/etc/rc.conf << EOF
+cat >> ${mnt}/etc/rc.conf << EOF
# make sure we have the right rw filesystem at boot
critical_filesystems_local="/var.cow /var /etc.cow /etc /root.cow /root"
@@ -49,26 +51,26 @@
echo "${bar} making extra directories ${bar}"
for d in ${usermodedirs}; do
- ${sudo} mkdir -p ${mnt}/${d}
+ mkdir -p ${mnt}/${d}
done
echo "${bar} customising /var/tmp ${bar}"
-${sudo} rm -rf ${mnt}/var/tmp
-(cd ${mnt}/var && ${sudo} ln -s /tmp tmp)
+rm -rf ${mnt}/var/tmp
+(cd ${mnt}/var && ln -s /tmp tmp)
# package-related stuff
(cat ${mnt}/etc/csh.cshrc;echo "setenv PKG_DBDIR /usr/pkg/.dbdir") > ${tmp}
-${sudo} mv ${tmp} ${mnt}/etc/csh.cshrc
+mv ${tmp} ${mnt}/etc/csh.cshrc
(cat ${mnt}/etc/profile;echo "export PKG_DBDIR=/usr/pkg/.dbdir") > ${tmp}
-${sudo} mv ${tmp} ${mnt}/etc/profile
+mv ${tmp} ${mnt}/etc/profile
(echo "PKG_DBDIR=/usr/pkg/.dbdir") > ${tmp}
-${sudo} mv ${tmp} ${mnt}/etc/mk.conf
-(cd ${mnt}/usr && ${sudo} ln -s /pkgs/usr/pkg pkg)
+mv ${tmp} ${mnt}/etc/mk.conf
+(cd ${mnt}/usr && ln -s /pkgs/usr/pkg pkg)
# last, customisation stage
if [ -d ${custom} ]; then
echo "${bar} user customisations from files in ${custom} ${bar}"
- (cd ${custom} && ${sudo} pax -rwpe . ${mnt})
+ (cd ${custom} && pax -rwpe . ${mnt})
fi
df ${mnt}
diff -r be7959a88981 -r b93af8a80a4b distrib/utils/embedded/mkimage
--- a/distrib/utils/embedded/mkimage Sun Feb 03 08:22:21 2013 +0000
+++ b/distrib/utils/embedded/mkimage Sun Feb 03 09:16:24 2013 +0000
@@ -1,10 +1,12 @@
-#! /bin/sh
-
-# $NetBSD: mkimage,v 1.16 2013/01/30 07:40:34 skrll Exp $
+#!/bin/sh
+# $NetBSD: mkimage,v 1.17 2013/02/03 09:16:24 christos Exp $
#
-# Copyright (c) 2012 Alistair Crooks <agc%NetBSD.org@localhost>
+# Copyright (c) 2013 The NetBSD Foundation, Inc.
# All rights reserved.
#
+# This code is derived from software contributed to The NetBSD Foundation
+# by Christos Zoulas.
+#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
@@ -13,192 +15,58 @@
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
+# 3. Neither the name of The NetBSD Foundation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
#
-# find next available vnd, from kre
-next_avail ()
-{
- local dev="$1"
Home |
Main Index |
Thread Index |
Old Index