NetBSD-Users archive

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

Re: Looking for suggestions for small, low power machine



On Mon, May 30, 2011 at 10:24:42PM +0100, David Laight wrote:
> On Mon, May 30, 2011 at 11:00:33PM +0300, Jukka Marin wrote:
> > On Mon, May 30, 2011 at 05:43:15PM +0100, David Laight wrote:
> > > On Mon, May 30, 2011 at 12:35:08PM +0300, Jukka Marin wrote:
> > > > 
> > > > I got a 5501 box now - with zero documentation.  How do I make it boot 
> > > > from
> > > > a CF card?  I installed NetBSD 5.1 on a CF, and did installboot but 
> > > > 5501 does
> > > > not boot from the card ("No Boot device available, enter monitor.").
> > > 
> > > How far does the boot get ?
> > 
> > Not very far, I'm now getting "Error Disk read" which comes from bootxx.
> > I do have /boot on the CF.
> 
> Provided you've got out of pbr.S all the reads start as being by sector
> number, but will be converted to CHS based on the geometry the bios
> returns - so shouldn't be wrong.

On my Soekri, I have usually had to set up CF boot media using the same
"native" track size (ordinarily it is either 32 or 63) as produced (I
think) by the attached script. *shrug*

I always forget how/why this is a problem and I have to ask David Laight
to remind me what is going on. :-)

Dave

-- 
David Young             OJC Technologies
dyoung%ojctech.com@localhost      Urbana, IL * (217) 344-0444 x24
#!/bin/sh
#
# $Id: regcfcard 586 2004-05-18 04:25:49Z dyoung $
#

set_FLASHDEV () {
        FLASHDEV0=$1

        if [ ! -e $FLASHDEV0 -a ${FLASHDEV0##[/.]} != ${FLASHDEV0} ]; then
                echo "$0: no such file $FLASHDEV0" 1>&2
                return 1
        fi

        if [ -c $FLASHDEV0 -a ${FLASHDEV0##/} != ${FLASHDEV0} ]
        then
                FLASHDEV=$FLASHDEV0
                return 0
        fi
        FLASHDEV1=$(basename $FLASHDEV0)
        FLASHDEV=/dev/r${FLASHDEV1%%[a-z]}d
        if [ ! -c $FLASHDEV ]; then
                echo "$0: $FLASHDEV is not a raw device" 1>&2
                return 1
        fi
}

is_writable () {
        if [ ! -w $1 ]; then
                echo "$0: $1 is unwritable" 1>&2
                return 1
        fi
        return 0
}

usage() {
cat 1>&2 <<EOF
Usage: $0 [ device-path | device ]

Print out the device's "native" disklabel in disktab(5) format.
EOF
        exit 1
}

opts=$(getopt t: "$@")

eval set -- $opts

while [ "$#" -gt 0 ] ; do
        case "$1" in
        --)     shift
                break
                ;;
        -t)     # run a test
                shift
                if [ $1 = all ]; then
                        set -- $(list_tests)
                fi
                . $(dirname $0)/$(basename $0)TEST
                failures=0
                for t; do
                        do_test $t
                        if [ $? -ne 0 ]; then
                                failures=$(($failures + 1))
                        fi
                done
                if [ $failures -ne 0 ]; then
                        echo "$0: $failures tests FAILED" 1>&2
                fi
                exit $failures
                ;;
        *)      echo "$0: unknown option $1" 1>&2
                exit 1
                ;;
        esac
        shift
done

if [ "$#" -lt 1 ]; then
        usage
fi

set_FLASHDEV $1 || exit $?

is_writable $FLASHDEV || exit $?

BACKUP_DIR=$(mktemp -d /var/tmp/$(basename $0)-backup.XXXXXX)
if [ $? -ne 0 -o ${BACKUP_DIR:-none} = none -o ! -d $BACKUP_DIR ]; then
        echo "$0: could not create a backup directory" 1>&2
        exit 1
fi

chmod 0700 $BACKUP_DIR

if [ $? -ne 0 ]; then
        echo "$0: could not change backup directory permissions" 1>&2
        exit 1
fi

dd if=$FLASHDEV of=$BACKUP_DIR/blks bs=1k count=32 2> /dev/null

if [ $? -ne 0 ]; then
        echo "$0: could not backup $FLASHDEV blocks" 1>&2
        exit 1
fi

disklabel -W $FLASHDEV || exit $?

dd if=/dev/zero of=$FLASHDEV bs=1k count=32 2> /dev/null

disklabel -t $FLASHDEV 2> /dev/null

dd if=$BACKUP_DIR/blks of=$FLASHDEV bs=1k count=32 2> /dev/null

if [ $? -ne 0 ]; then
        echo "$0: ERROR could not restore first 32kB of $FLASHDEV" 1>&2
        exit 1
else
        rm -f $BACKUP_DIR/blks
        rmdir $BACKUP_DIR
fi
exit 0



Home | Main Index | Thread Index | Old Index