Author: wmb
Date: Sun Oct 16 02:24:57 2011
New Revision: 2616
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2616
Log:
Checked in i8042-forced-reset patch so the code is not lost, in case we need it later.
Added:
cpu/x86/pc/olpc/via/Notes/i8042-forced-reset.patch
Added: cpu/x86/pc/olpc/via/Notes/i8042-forced-reset.patch
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ cpu/x86/pc/olpc/via/Notes/i8042-forced-reset.patch Sun Oct 16 02:24:57 2011 (r2616)
@@ -0,0 +1,57 @@
+*** i8042.fth 2011-06-29 22:17:18.000000000 -1000
+--- i8042-forced-reset.fth 2011-06-29 22:16:40.000000000 -1000
+***************
+*** 239,246 ****
+--- 239,268 ----
+ endcase
+ ." The keyboard '" type ." ' line is stuck " type ." ." cr
+ false
+ ;
++ : consume ( -- )
++ \ Discard any data that is already queued up
++ begin d# 10 ms stat@ out-buf-full and while
++ data@ drop
++ repeat
++ d# 10 ms
++ ;
++ : reset-ps2 ( -- )
++ consume
++
++ \ Reset the mouse if the controller is expecting a mouse command
++ stat@ h# 38 = if h# ff data! consume then
++
++ \ Reset the mouse if the controller is reporting an aux port ready bit
++ stat@ h# 30 = if
++ h# ff h# d4 put-ctlr-cmd2 consume
++ then
++
++ \ Reset the keyboard just for good measure
++ h# ff data! consume
++ ;
++
+ headerless
+ 0 value open-count
+ headers
+ : open ( -- flag? )
+***************
+*** 248,261 ****
+--- 270,288 ----
+ data-port 0= if
+ my-address my-space 5 " map-in" $call-parent is data-port
+ data-port 4 + is cmd-status-reg
+
++ [ifdef] notdef
+ ctlr-selftest if
+ ctlr-selftest if \ Retry in case we're out of sync
+ ." Failed keyboard controller self test" cr
+ false exit
+ then
+ then
++ [else]
++ reset-ps2
++ [then]
++
+ q0 init-q q1 init-q
+ then
+ true
+ ;
Author: wmb
Date: Sun Oct 16 02:21:05 2011
New Revision: 2614
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2614
Log:
XO-1.5 - Checked in some test code.
Added:
cpu/x86/pc/olpc/via/Notes/make-rtcreset.sig
Added: cpu/x86/pc/olpc/via/Notes/make-rtcreset.sig
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ cpu/x86/pc/olpc/via/Notes/make-rtcreset.sig Sun Oct 16 02:21:05 2011 (r2614)
@@ -0,0 +1,47 @@
+Added an "a2" tag with a test key for which I have the corresponding private key:
+
+$ cp testkeys/lease.public /e/lease.pub
+ok load u:\lease.pub
+ok loaded " a2" $add-tag
+
+Rolled back the clock by one day and verified that it was detected:
+
+ok now today swap 1- swap clock-node @ iselect set-time iunselect
+ok rtc-rollback? .
+ffffffff
+ok dev /chosen .properties dend
+
+Got CURRENTRTC value from rtc-timestamp and NONCE value from rtc-count
+
+$ CURRENTRTC=20110510T200549Z
+$ NONCE=0000000132
+
+ok .mfg-data
+
+Got SERIAL-NUMBER from SN
+Got UUID from U#
+
+$ SN=SHC005007B7
+$ UUID=1273E0EC-AEF1-9FF6-45B2-FB706DC24B8D
+
+Made a newrtc value by decrementing the month
+
+$ NEWRTC=20110410T200549Z
+
+$ echo -n ${SN}:${UUID}:${CURRENTRTC}:${NONCE}:${NEWRTC} >signed-data
+$ cat signed-data
+SHC005007B7:1273E0EC-AEF1-9FF6-45B2-FB706DC24B8D:20110512T003512Z:0000000135:20110412T003512Z
+$ cd /space/bios-crypto/build
+$ ./sig01 sha256 testkeys/lease signed-data >sig
+$ cat sig
+sig01: sha256 e842349e413bfd424426bdacd1cb46fd8e6c5e516ed80a8a849f410203010001 7e65d0d158cbe8b891a099900ab0f8a46618a8208203283b13158103e98ff6deebec8bd0f77534c1a30be0484f49f3b31f78eaaa374329240e7735a68e5c55527c927b7e47d97c9b2d6a145f00e7b1fdbe1e1b8a6d6863079f620a3b8f74c166cdec2a68dcc36a0218e0525b1dcbf95d803f81ef60460ba3fadc468c108f1ded5a941b60fd6896fe694d2abf41945242d4cd36ad42979baf911d70b4f73a76d5afe19a9909870ff244833a80b9d470416a37b03fcf85d79feca21dd4ea3b29741a9801ef567769f945badf625068979bc5635a85a012a381bb1344e7645345ed8df5ca4dccda6b0c5050126716e9d9a8dfdb572f0aa286cb1e71e758e58f5b92
+$ echo -n rtc01: ${SN} ${CURRENTRTC} ${NONCE} ${NEWRTC} "" | cat - sig >rtcreset.sig
+$ cat rtcreset.sig
+rtc01: SHC005007B7 20110512T003512Z 0000000135 20110412T003512Z sig01: sha256 e842349e413bfd424426bdacd1cb46fd8e6c5e516ed80a8a849f410203010001 7e65d0d158cbe8b891a099900ab0f8a46618a8208203283b13158103e98ff6deebec8bd0f77534c1a30be0484f49f3b31f78eaaa374329240e7735a68e5c55527c927b7e47d97c9b2d6a145f00e7b1fdbe1e1b8a6d6863079f620a3b8f74c166cdec2a68dcc36a0218e0525b1dcbf95d803f81ef60460ba3fadc468c108f1ded5a941b60fd6896fe694d2abf41945242d4cd36ad42979baf911d70b4f73a76d5afe19a9909870ff244833a80b9d470416a37b03fcf85d79feca21dd4ea3b29741a9801ef567769f945badf625068979bc5635a85a012a381bb1344e7645345ed8df5ca4dccda6b0c5050126716e9d9a8dfdb572f0aa286cb1e71e758e58f5b92
+$ mount /e; mkdir -p /e/security; cp rtcreset.sig /e/security; umount /e
+
+ok get-my-sn . date-bad? . load-crypto .
+0 0 0
+ok " u:" dn-buf place filesystem-present? .
+ffffffff
+ok
Author: wmb
Date: Sun Oct 16 01:21:46 2011
New Revision: 2611
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2611
Log:
Ext2 filesystem - added test script.
Added:
ofw/fs/ext2fs/ext2test.fth
ofw/fs/ext2fs/ext2test.sh
Added: ofw/fs/ext2fs/ext2test.fth
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ ofw/fs/ext2fs/ext2test.fth Sun Oct 16 01:21:46 2011 (r2611)
@@ -0,0 +1,109 @@
+\ OLPC boot script
+
+\ dev.laptop.org #6210 test script
+\ Exercises several OFW features on an ext2 filesystem on a USB stick
+\ see associated test.sh
+
+visible
+no-page
+start-logging
+
+.( test.fth ticket #6210 ofw ext2 filesystem tests ) cr
+
+show-aborts on
+
+.( test 0001 define u: ) cr
+volume: u:
+
+.( test 0002 reference u: ) cr
+u:
+
+\ .( test 0003 directory ) cr
+\ dir
+
+\ .( test 0004 directory by name ) cr
+\ dir *.fth
+
+.( test 0005 chdir down ) cr
+chdir directory
+
+.( test 0006 directory of subdirectory after chdir ) cr
+dir
+
+.( test 0007 chdir up ) cr
+chdir ..
+
+.( test 0008 directory of main directory after chdir ) cr
+dir
+
+.( test 0009 disk free ) cr
+disk-free u:\
+
+.( test 0010 display a file ) cr
+more u:\hello
+
+.( test 0011 display a file with a hyphen in file name ) cr
+more u:\hello-world
+
+.( test 0012 display a link ) cr
+more u:\hello-link
+
+.( test 0013 directory of subdirectory by name ) cr
+dir u:\directory
+
+.( test 0014 display a file in subdirectory ) cr
+more u:\directory\hw
+
+.( test 0015 copy a file ) cr
+copy u:\hello-world u:\copy
+
+.( test 0016 display the copy ) cr
+more u:\copy
+
+.( test 0017 rename the copy ) cr
+rename u:\copy u:\renamed
+
+.( test 0018 delete the renamed copy ) cr
+del u:\renamed
+
+.( test 0019 delete a non-existent file ) cr
+del u:\vapour
+
+: load-file ( "devspec" -- adr len )
+ safe-parse-word
+ open-dev dup 0= abort" Can't open it" ( ih )
+ >r ( r: ih )
+ load-base " load" r@ $call-method ( len r: ih )
+ r> close-dev ( len )
+ load-base swap
+;
+
+: calculate-md5 ( adr len -- adr len )
+ $md5digest1 ;
+
+: print-md5 ( adr len -- )
+ bounds ?do i c@ (.2) type loop space ;
+
+: md5sum ( "devspec" -- ) load-file calculate-md5 print-md5 ;
+
+.( test 0020 calculate md5sum of a test file ) cr
+md5sum u:\hello-world cr
+
+.( test 0021 calculate md5sum of a test file and save to a file ) cr
+del u:\hello-world.md5
+load-file u:\hello-world calculate-md5 to-file u:\hello-world.md5 print-md5
+
+.( test 0022 dump forth dictionary to file ) cr
+del u:\words.txt
+to-file u:\words.txt words
+
+\ reference: forth/lib/tofile.fth
+\ to-file u:\words words
+\ append-to-file u:\words words
+
+.( done ) cr
+save-log u:\ofw.log
+stop-logging
+
+\ .( boot ) cr
+\ boot n:\boot\olpc.fth
Added: ofw/fs/ext2fs/ext2test.sh
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ ofw/fs/ext2fs/ext2test.sh Sun Oct 16 01:21:46 2011 (r2611)
@@ -0,0 +1,160 @@
+#!/bin/bash
+# dev.laptop.org #6210 test script
+#
+# Creates an ext2 filesystem on a USB stick for testing with OFW
+#
+# Instructions for use:
+# - copy this file and ext2test.fth to a Linux machine
+# - turn off X with 'telinit 4',
+# - ensure that no USB stick is mounted
+# - insert USB stick, wait seven seconds settling time,
+# - execute this script "ext2test.sh /dev/sda",
+# - remove USB stick,
+# - insert in test laptop,
+# - power up,
+# - examine output.
+#
+set -e
+
+function help {
+ cat <<EOF
+Usage: test.sh [options] device
+ --help display this help
+ --end N partition end specification for parted, -1s is the
+ default and means full size, or use a number followed
+ by s for a given number of sectors, see the parted(8)
+ unit command.
+ device the device you wish to write to, e.g. /dev/sdZ
+EOF
+}
+
+DEVICE=
+END=-1s
+while [ ! -z "${1}" ]; do
+ case "${1}" in
+ --end)
+ shift
+ END=${1}
+ shift
+ echo "test.sh: partition end to be set to ${END}"
+ ;;
+ --help)
+ shift
+ help
+ exit 0
+ ;;
+ *)
+ DEVICE=${1}
+ shift
+# if [ ! -e ${DEVICE} ]; then
+# echo "test.sh: no such device ${DEVICE}"
+# exit 1
+# fi
+ esac
+
+done
+
+if [ -z "${DEVICE}" ]; then
+ echo "test.sh: no device specified"
+ help
+ exit 1
+fi
+
+if [ ! -b "${DEVICE}" ]; then
+echo REMAKING FILE
+rm -f "${DEVICE}"
+dd if=/dev/zero of=${DEVICE} bs=512 count=1 seek=8388000 2> /dev/null #8388608
+# dd if=/dev/zero of=${DEVICE} bs=512 count=1 seek=4194303 2> /dev/null
+#dd if=/dev/zero of=${DEVICE} bs=512 count=1 seek=2097151 2> /dev/null
+#dd if=/dev/zero of=${DEVICE} bs=512 count=1 seek=1050000 2> /dev/null
+chmod 666 ${DEVICE}
+fi
+# if [ ! -b "${DEVICE}" -a ! -f "${DEVICE}" ]; then
+# Need to parse ${END} to remove the trailing s if it exists, or if not, to change the bs units
+# dd if=/dev/zero of=${DEVICE} bs=512 count=1 seek=${END} status=noxfer 2> /dev/null
+# fi
+
+echo -n "zero overwrite partition table ... "
+dd if=/dev/zero of=${DEVICE} bs=1024 count=256 status=noxfer conv=notrunc 2> /dev/null
+echo "ok"
+
+echo -n "create new partition table ... "
+/sbin/parted --script ${DEVICE} mklabel msdos
+echo "ok"
+
+# if we do not do this, the old partition in /dev does not go away
+echo -n "probe partition table ... "
+/sbin/partprobe ${DEVICE}
+echo "ok"
+
+# This commented-out block of code is unreliable
+# echo -n "wait for old partition to go ... "
+# declare -i c
+# c=0
+# until [ ! -e ${DEVICE}1 ]; do
+# sleep 0.1
+# echo -n .
+# c=c+1
+# if [ ${c} -gt 10 ]; then
+# # sometimes it needs a harder whack
+# /sbin/partprobe -s > /dev/null 2> /dev/null
+# sleep 0.1
+# fi
+# done
+# echo "ok"
+
+echo -n "create new partition ... "
+echo /sbin/parted --script -- ${DEVICE} mkpart primary ext2 0 ${END}
+/sbin/parted --script -- ${DEVICE} mkpart primary ext2 0 ${END} || true
+echo "ok"
+
+if [ -b ${DEVICE} ] ; then
+ PARTITION=${DEVICE}1
+
+ echo -n "wait for new partition to arrive ... "
+ until [ -e ${PARTITION} ]; do sleep 0.1; echo -n .; done
+ echo "ok"
+else
+ OFFSET=512
+ PARTITION=`/sbin/losetup -o ${OFFSET} -f -s ${DEVICE}`
+ echo partition = $PARTITION
+fi
+
+echo -n "make filesystem ... "
+#/sbin/mke2fs -n -b 4096 -q ${PARTITION}
+# /sbin/mke2fs -n -j -O dir_index,^huge_file -E resize=8G -m 1 -b 4096 -q ${PARTITION}
+/sbin/mke2fs -n -j -O dir_index -m 1 -b 1024 -q ${PARTITION}
+echo "made"
+
+# we occasionally get
+# mount: you must specify the filesystem type
+# despite having just created the filesystem
+echo -n "mount filesystem ... "
+until mount ${PARTITION} /mnt; do sleep 0.1; done
+echo "mounted"
+
+echo -n "create test content and unmount ... "
+
+mkdir /mnt/boot
+cp ext2test.fth /mnt/boot/olpc.fth
+
+cd /mnt
+touch touched
+echo hello > hello
+echo hello world > hello-world
+date > date
+ln -s hello hello-link
+mkdir directory
+ln -s directory directory-link
+touch directory/touched
+echo hello world down here > directory/hw
+mkfifo fifo
+mknod node b 1 1
+cd
+umount /mnt
+
+if [ ! -b ${DEVICE} ] ; then
+ /sbin/losetup -d ${PARTITION}
+fi
+
+echo "finished"