mirror of
git://projects.qi-hardware.com/openwrt-packages.git
synced 2025-04-21 12:27:27 +03:00
nanonote-files: cleanup the file structure. update version to 201204
This commit is contained in:
546
nanonote-files/base-files/root/.tclshrc
Normal file
546
nanonote-files/base-files/root/.tclshrc
Normal file
@@ -0,0 +1,546 @@
|
||||
global tcl_interactive
|
||||
if {[info exists tcl_interactive] && $tcl_interactive > 0} {
|
||||
|
||||
# ripped from http://wiki.tcl.tk/16139
|
||||
|
||||
foreach {var val} {
|
||||
PROMPT {tclsh$::tcl_patchLevel> }
|
||||
HISTORY ""
|
||||
HISTORY_BUFFER 500
|
||||
COMPLETION_MATCH ""
|
||||
} {
|
||||
if {![info exists env($var)]} {
|
||||
set env($var) $val
|
||||
}
|
||||
}
|
||||
foreach {var val} {
|
||||
CMDLINE ""
|
||||
CMDLINE_CURSOR 0
|
||||
CMDLINE_LINES 0
|
||||
HISTORY_LEVEL -1
|
||||
} {
|
||||
set env($var) $val
|
||||
}
|
||||
unset var val
|
||||
|
||||
set forever 0
|
||||
|
||||
# Resource & history files:
|
||||
set HISTFILE $env(HOME)/.tclsh_history
|
||||
|
||||
proc ESC {} {
|
||||
return "\033"
|
||||
}
|
||||
|
||||
proc readbuf {txt} {
|
||||
upvar 1 $txt STRING
|
||||
|
||||
set ret [string index $STRING 0]
|
||||
set STRING [string range $STRING 1 end]
|
||||
return $ret
|
||||
}
|
||||
|
||||
proc goto {row {col 1}} {
|
||||
switch -- $row {
|
||||
"home" {set row 1}
|
||||
}
|
||||
print "[ESC]\[${row};${col}H" nowait
|
||||
}
|
||||
|
||||
proc gotocol {col} {
|
||||
print "\r" nowait
|
||||
if {$col > 0} {
|
||||
print "[ESC]\[${col}C" nowait
|
||||
}
|
||||
}
|
||||
|
||||
proc clear {} {
|
||||
print "[ESC]\[2J" nowait
|
||||
goto home
|
||||
}
|
||||
|
||||
proc clearline {} {
|
||||
print "[ESC]\[2K\r" nowait
|
||||
}
|
||||
|
||||
proc getColumns {} {
|
||||
set cols 0
|
||||
if {![catch {exec stty -a} err]} {
|
||||
regexp {rows \d+; columns (\d+)} $err -> cols
|
||||
}
|
||||
return $cols
|
||||
}
|
||||
|
||||
proc prompt {{txt ""}} {
|
||||
global env
|
||||
|
||||
set prompt [subst $env(PROMPT)]
|
||||
set txt "$prompt$txt"
|
||||
foreach {end mid} $env(CMDLINE_LINES) break
|
||||
|
||||
# Calculate how many extra lines we need to display.
|
||||
# Also calculate cursor position:
|
||||
set n -1
|
||||
set totalLen 0
|
||||
set cursorLen [expr {$env(CMDLINE_CURSOR)+[string length $prompt]}]
|
||||
set row 0
|
||||
set col 0
|
||||
|
||||
# Render output line-by-line to $out then copy back to $txt:
|
||||
set found 0
|
||||
set out [list]
|
||||
foreach line [split $txt "\n"] {
|
||||
set len [expr {[string length $line]+1}]
|
||||
incr totalLen $len
|
||||
if {$found == 0 && $totalLen >= $cursorLen} {
|
||||
set cursorLen [expr {$cursorLen - ($totalLen - $len)}]
|
||||
set col [expr {$cursorLen % $env(COLUMNS)}]
|
||||
set row [expr {$n + ($cursorLen / $env(COLUMNS)) + 1}]
|
||||
|
||||
if {$cursorLen >= $len} {
|
||||
set col 0
|
||||
incr row
|
||||
}
|
||||
set found 1
|
||||
}
|
||||
incr n [expr {int(ceil(double($len)/$env(COLUMNS)))}]
|
||||
while {$len > 0} {
|
||||
lappend out [string range $line 0 [expr {$env(COLUMNS)-1}]]
|
||||
set line [string range $line $env(COLUMNS) end]
|
||||
set len [expr {$len-$env(COLUMNS)}]
|
||||
}
|
||||
}
|
||||
set txt [join $out "\n"]
|
||||
set row [expr {$n-$row}]
|
||||
|
||||
# Reserve spaces for display:
|
||||
if {$end} {
|
||||
if {$mid} {
|
||||
print "[ESC]\[${mid}B" nowait
|
||||
}
|
||||
for {set x 0} {$x < $end} {incr x} {
|
||||
clearline
|
||||
print "[ESC]\[1A" nowait
|
||||
}
|
||||
}
|
||||
clearline
|
||||
set env(CMDLINE_LINES) $n
|
||||
|
||||
# Output line(s):
|
||||
print "\r$txt"
|
||||
|
||||
if {$row} {
|
||||
print "[ESC]\[${row}A" nowait
|
||||
}
|
||||
gotocol $col
|
||||
lappend env(CMDLINE_LINES) $row
|
||||
}
|
||||
|
||||
proc print {txt {wait wait}} {
|
||||
# Sends output to stdout chunks at a time.
|
||||
# This is to prevent the terminal from
|
||||
# hanging if we output too much:
|
||||
while {[string length $txt]} {
|
||||
puts -nonewline [string range $txt 0 2047]
|
||||
set txt [string range $txt 2048 end]
|
||||
if {$wait == "wait"} {
|
||||
after 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
################################
|
||||
# Key bindings
|
||||
################################
|
||||
proc handleEscapes {} {
|
||||
global env
|
||||
upvar 1 keybuffer keybuffer
|
||||
set seq ""
|
||||
set found 0
|
||||
while {[set ch [readbuf keybuffer]] != ""} {
|
||||
append seq $ch
|
||||
|
||||
switch -exact -- $seq {
|
||||
"\[A" { ;# Cursor Up (cuu1,up)
|
||||
handleHistory 1
|
||||
set found 1; break
|
||||
}
|
||||
"\[B" { ;# Cursor Down
|
||||
handleHistory -1
|
||||
set found 1; break
|
||||
}
|
||||
"\[C" { ;# Cursor Right (cuf1,nd)
|
||||
if {$env(CMDLINE_CURSOR) < [string length $env(CMDLINE)]} {
|
||||
incr env(CMDLINE_CURSOR)
|
||||
}
|
||||
set found 1; break
|
||||
}
|
||||
"\[D" { ;# Cursor Left
|
||||
if {$env(CMDLINE_CURSOR) > 0} {
|
||||
incr env(CMDLINE_CURSOR) -1
|
||||
}
|
||||
set found 1; break
|
||||
}
|
||||
"\[H" -
|
||||
"\[7~" -
|
||||
"\[1~" { ;# home
|
||||
set env(CMDLINE_CURSOR) 0
|
||||
set found 1; break
|
||||
}
|
||||
"\[3~" { ;# delete
|
||||
if {$env(CMDLINE_CURSOR) < [string length $env(CMDLINE)]} {
|
||||
set env(CMDLINE) [string replace $env(CMDLINE) \
|
||||
$env(CMDLINE_CURSOR) $env(CMDLINE_CURSOR)]
|
||||
}
|
||||
set found 1; break
|
||||
}
|
||||
"\[F" -
|
||||
"\[K" -
|
||||
"\[8~" -
|
||||
"\[4~" { ;# end
|
||||
set env(CMDLINE_CURSOR) [string length $env(CMDLINE)]
|
||||
set found 1; break
|
||||
}
|
||||
"\[5~" { ;# Page Up }
|
||||
"\[6~" { ;# Page Down }
|
||||
}
|
||||
}
|
||||
return $found
|
||||
}
|
||||
|
||||
proc handleControls {} {
|
||||
global env
|
||||
upvar 1 char char
|
||||
upvar 1 keybuffer keybuffer
|
||||
|
||||
# Control chars start at a == \u0001 and count up.
|
||||
switch -exact -- $char {
|
||||
\u0004 { ;# ^d
|
||||
if { $env(CMDLINE_CURSOR) <= 0 } {
|
||||
print "exit\n" nowait
|
||||
doExit
|
||||
}
|
||||
}
|
||||
\u0003 { ;# ^c
|
||||
print "^C\n" nowait
|
||||
doExit
|
||||
}
|
||||
\u0008 -
|
||||
\u007f { ;# ^h && backspace ?
|
||||
if {$env(CMDLINE_CURSOR) > 0} {
|
||||
incr env(CMDLINE_CURSOR) -1
|
||||
set env(CMDLINE) [string replace $env(CMDLINE) \
|
||||
$env(CMDLINE_CURSOR) $env(CMDLINE_CURSOR)]
|
||||
}
|
||||
}
|
||||
\u001b { ;# ESC - handle escape sequences
|
||||
handleEscapes
|
||||
}
|
||||
}
|
||||
# Rate limiter:
|
||||
set keybuffer ""
|
||||
}
|
||||
|
||||
proc shortMatch {maybe} {
|
||||
# Find the shortest matching substring:
|
||||
set maybe [lsort $maybe]
|
||||
set shortest [lindex $maybe 0]
|
||||
foreach x $maybe {
|
||||
while {![string match $shortest* $x]} {
|
||||
set shortest [string range $shortest 0 end-1]
|
||||
}
|
||||
}
|
||||
return $shortest
|
||||
}
|
||||
|
||||
proc handleCompletion {} {
|
||||
global env
|
||||
set vars ""
|
||||
set cmds ""
|
||||
|
||||
# First find out what kind of word we need to complete:
|
||||
set wordstart [string last " " $env(CMDLINE) \
|
||||
[expr {$env(CMDLINE_CURSOR)-1}]]
|
||||
incr wordstart
|
||||
set wordend [string first " " $env(CMDLINE) $wordstart]
|
||||
if {$wordend == -1} {
|
||||
set wordend end
|
||||
} else {
|
||||
incr wordend -1
|
||||
}
|
||||
set word [string range $env(CMDLINE) $wordstart $wordend]
|
||||
|
||||
if {[string trim $word] == ""} return
|
||||
|
||||
set firstchar [string index $word 0]
|
||||
|
||||
# Check if word is a variable:
|
||||
if {$firstchar == "\$"} {
|
||||
set word [string range $word 1 end]
|
||||
incr wordstart
|
||||
|
||||
# Check if it is an array key:
|
||||
set x [string first "(" $word]
|
||||
if {$x != -1} {
|
||||
set v [string range $word 0 [expr {$x-1}]]
|
||||
incr x
|
||||
set word [string range $word $x end]
|
||||
incr wordstart $x
|
||||
if {[uplevel #0 "array exists $v"]} {
|
||||
set vars [uplevel #0 "array names $v $word*"]
|
||||
}
|
||||
} else {
|
||||
foreach x [uplevel #0 {info vars}] {
|
||||
if {[string match $word* $x]} {
|
||||
lappend vars $x
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if {$firstchar == "\[" || $wordstart == 0} {
|
||||
if {$firstchar == "\["} {
|
||||
set word [string range $word 1 end]
|
||||
incr wordstart
|
||||
}
|
||||
# Check commands:
|
||||
foreach x [info commands] {
|
||||
if {[string match $word* $x]} {
|
||||
lappend cmds $x
|
||||
}
|
||||
}
|
||||
} else {
|
||||
# Check commands anyway:
|
||||
foreach x [info commands] {
|
||||
if {[string match $word* $x]} {
|
||||
lappend cmds $x
|
||||
}
|
||||
}
|
||||
}
|
||||
if {$wordstart != 0} {
|
||||
# Check variables anyway:
|
||||
set x [string first "(" $word]
|
||||
if {$x != -1} {
|
||||
set v [string range $word 0 [expr {$x-1}]]
|
||||
incr x
|
||||
set word [string range $word $x end]
|
||||
incr wordstart $x
|
||||
if {[uplevel #0 "array exists $v"]} {
|
||||
set vars [uplevel #0 "array names $v $word*"]
|
||||
}
|
||||
} else {
|
||||
foreach x [uplevel #0 {info vars}] {
|
||||
if {[string match $word* $x]} {
|
||||
lappend vars $x
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
set maybe [concat $vars $cmds]
|
||||
set shortest [shortMatch $maybe]
|
||||
if {"$word" == "$shortest"} {
|
||||
if {[llength $maybe] > 1 && $env(COMPLETION_MATCH) != $maybe} {
|
||||
set env(COMPLETION_MATCH) $maybe
|
||||
clearline
|
||||
set temp ""
|
||||
foreach {match format} {
|
||||
vars "35"
|
||||
cmds "1;32"
|
||||
} {
|
||||
if {[llength $match]} {
|
||||
append temp "[ESC]\[${format}m"
|
||||
foreach x [set $match] {
|
||||
append temp "[file tail $x] "
|
||||
}
|
||||
append temp "[ESC]\[0m"
|
||||
}
|
||||
}
|
||||
print "\n$temp\n"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc handleHistory {x} {
|
||||
global env
|
||||
|
||||
set hlen [llength $env(HISTORY)]
|
||||
incr env(HISTORY_LEVEL) $x
|
||||
if {$env(HISTORY_LEVEL) > -1} {
|
||||
set env(CMDLINE) [lindex $env(HISTORY) end-$env(HISTORY_LEVEL)]
|
||||
set env(CMDLINE_CURSOR) [string length $env(CMDLINE)]
|
||||
}
|
||||
if {$env(HISTORY_LEVEL) <= -1} {
|
||||
set env(HISTORY_LEVEL) -1
|
||||
set env(CMDLINE) ""
|
||||
set env(CMDLINE_CURSOR) 0
|
||||
} elseif {$env(HISTORY_LEVEL) > $hlen} {
|
||||
set env(HISTORY_LEVEL) $hlen
|
||||
}
|
||||
}
|
||||
|
||||
################################
|
||||
# History handling functions
|
||||
################################
|
||||
|
||||
proc getHistory {} {
|
||||
global env
|
||||
return $env(HISTORY)
|
||||
}
|
||||
|
||||
proc setHistory {hlist} {
|
||||
global env
|
||||
set env(HISTORY) $hlist
|
||||
}
|
||||
|
||||
proc appendHistory {cmdline} {
|
||||
global env
|
||||
set old [lsearch -exact $env(HISTORY) $cmdline]
|
||||
if {$old != -1} {
|
||||
set env(HISTORY) [lreplace $env(HISTORY) $old $old]
|
||||
}
|
||||
lappend env(HISTORY) $cmdline
|
||||
set env(HISTORY) \
|
||||
[lrange $env(HISTORY) end-$env(HISTORY_BUFFER) end]
|
||||
}
|
||||
|
||||
################################
|
||||
# main()
|
||||
################################
|
||||
|
||||
proc rawInput {} {
|
||||
fconfigure stdin -buffering none -blocking 0
|
||||
fconfigure stdout -buffering none -translation crlf
|
||||
exec stty raw -echo
|
||||
}
|
||||
|
||||
proc lineInput {} {
|
||||
fconfigure stdin -buffering line -blocking 1
|
||||
fconfigure stdout -buffering line
|
||||
exec stty -raw echo
|
||||
}
|
||||
|
||||
proc doExit {{code 0}} {
|
||||
global env HISTFILE
|
||||
|
||||
# Reset terminal:
|
||||
# print "[ESC]c[ESC]\[2J" nowait
|
||||
lineInput
|
||||
|
||||
set hlist [getHistory]
|
||||
if {[llength $hlist] > 0} {
|
||||
set f [open $HISTFILE w]
|
||||
foreach x $hlist {
|
||||
# Escape newlines:
|
||||
puts $f [string map {
|
||||
\n "\\n"
|
||||
"\\" "\\b"
|
||||
} $x]
|
||||
}
|
||||
close $f
|
||||
}
|
||||
|
||||
___exit $code
|
||||
}
|
||||
|
||||
# Load history if available:
|
||||
if {[llength $env(HISTORY)] == 0} {
|
||||
if {[file exists $HISTFILE]} {
|
||||
set f [open $HISTFILE r]
|
||||
set hlist [list]
|
||||
foreach x [split [read $f] "\n"] {
|
||||
if {$x != ""} {
|
||||
# Undo newline escapes:
|
||||
lappend hlist [string map {
|
||||
"\\n" \n
|
||||
"\\\\" "\\"
|
||||
"\\b" "\\"
|
||||
} $x]
|
||||
}
|
||||
}
|
||||
setHistory $hlist
|
||||
unset hlist
|
||||
close $f
|
||||
}
|
||||
}
|
||||
|
||||
rawInput
|
||||
|
||||
rename exit ___exit
|
||||
proc exit args doExit
|
||||
|
||||
proc tclline {} {
|
||||
global env
|
||||
set char ""
|
||||
set keybuffer [read stdin]
|
||||
set env(COLUMNS) [getColumns]
|
||||
|
||||
while {$keybuffer != ""} {
|
||||
if {[eof stdin]} return
|
||||
set char [readbuf keybuffer]
|
||||
if {$char == ""} {
|
||||
# Sleep for a bit to reduce CPU time:
|
||||
after 40
|
||||
continue
|
||||
}
|
||||
|
||||
if {[string is print $char]} {
|
||||
set x $env(CMDLINE_CURSOR)
|
||||
|
||||
if {$x < 1 && [string trim $char] == ""} continue
|
||||
|
||||
set trailing [string range $env(CMDLINE) $x end]
|
||||
set env(CMDLINE) [string replace $env(CMDLINE) $x end]
|
||||
append env(CMDLINE) $char
|
||||
append env(CMDLINE) $trailing
|
||||
incr env(CMDLINE_CURSOR)
|
||||
} elseif {$char == "\t"} {
|
||||
handleCompletion
|
||||
} elseif {$char == "\n" || $char == "\r"} {
|
||||
if {[info complete $env(CMDLINE)] &&
|
||||
[string index $env(CMDLINE) end] != "\\"} {
|
||||
lineInput
|
||||
print "\n" nowait
|
||||
uplevel #0 {
|
||||
global env
|
||||
|
||||
# Run the command:
|
||||
if { [catch $env(CMDLINE) res] } {
|
||||
print "[ESC]\[1;31m\[[ESC]\[0;31mError[ESC]\[1;31m\][ESC]\[0m "
|
||||
}
|
||||
if {$res != ""} {
|
||||
print "$res\n"
|
||||
}
|
||||
|
||||
# Append HISTORY:
|
||||
set env(HISTORY_LEVEL) -1
|
||||
appendHistory $env(CMDLINE)
|
||||
|
||||
set env(CMDLINE) ""
|
||||
set env(CMDLINE_CURSOR) 0
|
||||
set env(CMDLINE_LINES) {0 0}
|
||||
}
|
||||
rawInput
|
||||
} else {
|
||||
set x $env(CMDLINE_CURSOR)
|
||||
|
||||
if {$x < 1 && [string trim $char] == ""} continue
|
||||
|
||||
set trailing [string range $env(CMDLINE) $x end]
|
||||
set env(CMDLINE) [string replace $env(CMDLINE) $x end]
|
||||
append env(CMDLINE) $char
|
||||
append env(CMDLINE) $trailing
|
||||
incr env(CMDLINE_CURSOR)
|
||||
}
|
||||
} else {
|
||||
handleControls
|
||||
}
|
||||
}
|
||||
prompt $env(CMDLINE)
|
||||
}
|
||||
tclline
|
||||
|
||||
fileevent stdin readable tclline
|
||||
vwait forever
|
||||
doExit
|
||||
}
|
||||
2
nanonote-files/base-files/root/.vimrc
Normal file
2
nanonote-files/base-files/root/.vimrc
Normal file
@@ -0,0 +1,2 @@
|
||||
set encoding=utf-8
|
||||
set term=xterm
|
||||
116
nanonote-files/base-files/usr/bin/mtd.nn
Executable file
116
nanonote-files/base-files/usr/bin/mtd.nn
Executable file
@@ -0,0 +1,116 @@
|
||||
#!/bin/sh
|
||||
|
||||
__VERSION__=2011-03-07
|
||||
|
||||
if [ "$1" == "flash" ] && [ "$#" == "3" ]; then
|
||||
case "$2" in
|
||||
"bootloader")
|
||||
echo "not implenment"
|
||||
#flash_eraseall /dev/mtd0
|
||||
exit 0
|
||||
;;
|
||||
"kernel")
|
||||
echo "flashing kernel ..."
|
||||
flash_eraseall /dev/mtd1
|
||||
nandwrite -p /dev/mtd1 "$3"
|
||||
exit 0
|
||||
;;
|
||||
"rootfs")
|
||||
echo "flashing rootfs ..."
|
||||
ubiformat /dev/mtd2 -f "$3"
|
||||
exit 0
|
||||
;;
|
||||
"data")
|
||||
echo "flashing data partition ..."
|
||||
ubiformat /dev/mtd3 -f "$3"
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if [ "$1" == "mount" ] && [ "$#" == "3" ]; then
|
||||
if [ "$2" == "rootfs" ] || [ "$2" == "data" ]; then
|
||||
MOUNT_POINT="$3"
|
||||
if [ "$2" == "rootfs" ]; then
|
||||
PARTITION="2"
|
||||
elif [ "$2" == "data" ]; then
|
||||
PARTITION="3"
|
||||
fi
|
||||
|
||||
mkdir -p $MOUNT_POINT
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "mkdir -p $MOUNT_POINT Fail"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ubiattach /dev/ubi_ctrl -m ${PARTITION}
|
||||
DEV_UBI=`dmesg | grep "UBI: attached mtd${PARTITION} to" | cut -d ":" -f 2 | cut -d " " -f 5`
|
||||
mount -t ubifs ${DEV_UBI}_0 $MOUNT_POINT
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$1" == "format_data_default" ]; then
|
||||
ubiformat /dev/mtd3 -y
|
||||
ubiattach /dev/ubi_ctrl -m 3
|
||||
ubimkvol /dev/ubi1 -s 1480MiB -N data
|
||||
# test in xiangfu's nanonote. 1486 is the MAX size we can make
|
||||
# so we using 1480 for now
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" == "fw_setenv_default" ]; then
|
||||
fw_setenv bootargs mem=32M console=tty0 console=ttyS0,57600n8 ubi.mtd=2 rootfstype=ubifs root=ubi0:rootfs rw rootwait consoleblank=30 quiet
|
||||
fw_setenv bootcmd nand read 0x80600000 0x400000 0x280000\;bootm
|
||||
fw_setenv bootargsfromsd mem=32M console=tty0 console=ttyS0,57600n8 rootfstype=ext2 root=/dev/mmcblk0p1 rw rootwait
|
||||
fw_setenv bootcmdfromsd mmc init\; ext2load mmc 0 0x80600000 /boot/uImage\; bootm
|
||||
fw_setenv bootdelay 0
|
||||
fw_setenv baudrate 57600
|
||||
fw_setenv loads_echo 1
|
||||
fw_setenv stdin serial
|
||||
fw_setenv stderr serial
|
||||
fw_setenv stdout serial
|
||||
fw_setenv bootcmdf1 mmc init\; ext2load mmc 0:1 0x80600000 /boot/uImage\; bootm
|
||||
fw_setenv bootargsf1 mem=32M console=tty0 console=ttyS0,57600n8 rootfstype=ext2 root=/dev/mmcblk0p1 rw rootwait
|
||||
fw_setenv bootcmdf2 mmc init\; ext2load mmc 0:2 0x80600000 /boot/uImage\; bootm
|
||||
fw_setenv bootargsf2 mem=32M console=tty0 console=ttyS0,57600n8 rootfstype=ext2 root=/dev/mmcblk0p2 rw rootwait
|
||||
fw_setenv bootcmdf3 mmc init\; ext2load mmc 0:3 0x80600000 /boot/uImage\; bootm
|
||||
fw_setenv bootargsf3 mem=32M console=tty0 console=ttyS0,57600n8 rootfstype=ext2 root=/dev/mmcblk0p3 rw rootwait
|
||||
fw_setenv bootcmdf4 mtdparts default\;ubi part rootfs\;ubifsmount rootfs\;ubifsload 0x80600000 /boot/uImage\; bootm
|
||||
fw_setenv bootargsf4 mem=32M console=tty0 console=ttyS0,57600n8 ubi.mtd=2 rootfstype=ubifs root=ubi0:rootfs rw rootwait
|
||||
fw_setenv silent 1
|
||||
echo "fw_setenv finished, check u-boot env by fw_printenv"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "\
|
||||
Usage: $0 [ command ] [ <para1> <para2> <para3> ]
|
||||
flash bootloader|kernel|rootfs|data image_file
|
||||
flash nand partition using <image_file>
|
||||
|
||||
mount rootfs|data mount_point
|
||||
mount nand partition
|
||||
|
||||
format_data_default
|
||||
lookinside for more detari
|
||||
NOTICE:
|
||||
this command will format data
|
||||
partition, create a default
|
||||
1400MB volume, named 'data',
|
||||
ALL data will lost after run.
|
||||
|
||||
fw_setenv_default
|
||||
reset bootloader default variable
|
||||
lookinside for more detail
|
||||
NOTICE:
|
||||
this command write hardcode
|
||||
variables to nand, so it must
|
||||
run once before you want change
|
||||
change it.
|
||||
|
||||
script file for Qi Hardware Ben NanoNote
|
||||
written by: Xiangfu Liu (xiangfu@sharism.cc)
|
||||
written with Emacs in Ben NanoNote
|
||||
version: ${__VERSION__}
|
||||
Report bugs to developer@lists.qi-hardware.com"
|
||||
exit 0
|
||||
36
nanonote-files/base-files/usr/bin/pick-pdf
Executable file
36
nanonote-files/base-files/usr/bin/pick-pdf
Executable file
@@ -0,0 +1,36 @@
|
||||
#! /bin/bash
|
||||
|
||||
export CMD=nupdf
|
||||
export EXT=pdf
|
||||
|
||||
export i=0
|
||||
|
||||
export PDF_PATH=~/
|
||||
|
||||
echo -e `basename $0` "\t\tVersion: 2012-02-02"
|
||||
echo "Searching for *.$EXT files. It may take a while..."
|
||||
echo " "
|
||||
|
||||
rm -f /tmp/fsel.tmp 2>/dev/null
|
||||
touch /tmp/fsel.tmp
|
||||
for aa in `find ${PDF_PATH} -name "*.$EXT" -type f -print` ; do
|
||||
i=`expr $i + 1` ;
|
||||
echo $i $aa >>/tmp/fsel.tmp ;
|
||||
done
|
||||
|
||||
export B=`cat /tmp/fsel.tmp`
|
||||
if [ "$B" == "" ]; then
|
||||
echo "No pdf file found"
|
||||
exit
|
||||
fi
|
||||
|
||||
export A=`dialog --menu "Select a File" 0 50 20 $B --stdout`
|
||||
|
||||
if test $A > 0
|
||||
then
|
||||
export C=`grep "^$A" /tmp/fsel.tmp`
|
||||
export D=`echo $C | cut -d' ' -f2 -`
|
||||
$CMD $D
|
||||
else
|
||||
echo "No file selected!"
|
||||
fi
|
||||
14
nanonote-files/base-files/usr/bin/wav2png
Executable file
14
nanonote-files/base-files/usr/bin/wav2png
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
#usage: wav2png.sh file.wav
|
||||
|
||||
BASE=${1%.wav}
|
||||
PNG=$BASE.png
|
||||
WAV=$BASE.wav
|
||||
DAT=$BASE.dat
|
||||
|
||||
#echo $BASE,$PNG,$WAV,$DAT
|
||||
sox $WAV $DAT
|
||||
grep -v '^;' $DAT >$DAT.clean
|
||||
FREQ=`head -1 $DAT|tr -d ';'`
|
||||
|
||||
echo -e "set terminal png; set title '$FREQ';set output '$PNG'; plot '$DAT.clean' w l lt 2" | gnuplot
|
||||
31
nanonote-files/base-files/usr/bin/wpan.nn
Executable file
31
nanonote-files/base-files/usr/bin/wpan.nn
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
cd /lib/modules/`uname -r`
|
||||
|
||||
echo jz4740-mmc.0 > /sys/bus/platform/drivers/jz4740-mmc/unbind
|
||||
insmod at86rf230.ko
|
||||
insmod spi_atben.ko
|
||||
|
||||
cd ${HOME}
|
||||
|
||||
iz add wpan-phy0
|
||||
if [ "$1" == "2" ]; then
|
||||
ip link set wpan0 address de:ad:be:af:ca:fe:ba:b2
|
||||
else
|
||||
ip link set wpan0 address de:ad:be:af:ca:fe:ba:b1
|
||||
fi
|
||||
ifconfig wpan0 up
|
||||
|
||||
if [ "$1" == "2" ]; then
|
||||
iz assoc wpan0 777 1 11 short
|
||||
|
||||
izchat 777 8001 1
|
||||
#dirtpan 777 8001 1 'ifconfig tun0 10.8.0.2 dstaddr 10.8.0.1 up' &
|
||||
else
|
||||
rm -f /tmp/lease
|
||||
izcoordinator -d 1 -l /tmp/lease -i wpan0 -p 0x777 -s 1 -c 11 &
|
||||
|
||||
izchat 777 1 8001
|
||||
#dirtpan 777 1 8001 'ifconfig tun0 10.8.0.1 dstaddr 10.8.0.2 up' &
|
||||
fi
|
||||
1
nanonote-files/base-files/usr/lib/tcl8.5/init.tcl
Normal file
1
nanonote-files/base-files/usr/lib/tcl8.5/init.tcl
Normal file
@@ -0,0 +1 @@
|
||||
source /root/.tclshrc
|
||||
@@ -0,0 +1,3 @@
|
||||
title=abook
|
||||
icon=skin:icons/abook.png
|
||||
exec=/usr/bin/abook
|
||||
@@ -0,0 +1,3 @@
|
||||
title=aewan
|
||||
icon=skin:icons/aewan.png
|
||||
exec=/usr/bin/aewan
|
||||
@@ -0,0 +1,3 @@
|
||||
title=ASEPRITE
|
||||
icon=skin:icons/ase.png
|
||||
exec=/usr/bin/aseprite
|
||||
@@ -0,0 +1,2 @@
|
||||
title=bard
|
||||
exec=/usr/bin/bard
|
||||
@@ -0,0 +1,4 @@
|
||||
title=bard
|
||||
icon=skin:icons/Bard32.png
|
||||
exec=/usr/local/bin/bard
|
||||
params=
|
||||
@@ -0,0 +1,4 @@
|
||||
title=bc
|
||||
icon=skin:icons/calc.png
|
||||
params=-l
|
||||
exec=/usr/bin/bc
|
||||
@@ -0,0 +1,3 @@
|
||||
title=calcurse
|
||||
icon=skin:icons/calcurse.png
|
||||
exec=/usr/bin/calcurse
|
||||
@@ -0,0 +1,3 @@
|
||||
title=centerim
|
||||
icon=skin:icons/irc.png
|
||||
exec=/usr/bin/centerim
|
||||
@@ -0,0 +1,3 @@
|
||||
title=ctronome
|
||||
icon=skin:icons/ctronome.png
|
||||
exec=/usr/bin/ctronome
|
||||
@@ -0,0 +1,4 @@
|
||||
title=DGClock
|
||||
icon=skin:icons/dgclock.png
|
||||
exec=/usr/bin/dgclock
|
||||
wrapper=true
|
||||
@@ -0,0 +1,3 @@
|
||||
title=elinks
|
||||
icon=skin:icons/browser.png
|
||||
exec=/usr/bin/elinks
|
||||
@@ -0,0 +1,3 @@
|
||||
title=emacs
|
||||
icon=skin:icons/emacs.png
|
||||
exec=/usr/bin/emacs
|
||||
@@ -0,0 +1,3 @@
|
||||
title=gjay
|
||||
icon=skin:icons/gjay.png
|
||||
exec=/usr/bin/gjay
|
||||
@@ -0,0 +1,3 @@
|
||||
title=GMU
|
||||
icon=skin:icons/gmu.png
|
||||
exec=/usr/bin/gmu
|
||||
@@ -0,0 +1,4 @@
|
||||
title=Gnuplot
|
||||
icon=skin:icons/gnuplot.png
|
||||
exec=/usr/bin/gnuplot
|
||||
params=
|
||||
@@ -0,0 +1,3 @@
|
||||
title=gtkguitune
|
||||
icon=skin:icons/gtkguitune.png
|
||||
exec=/usr/bin/gtkguitune
|
||||
@@ -0,0 +1,2 @@
|
||||
title=hnb
|
||||
exec=/usr/bin/hnb
|
||||
@@ -0,0 +1,3 @@
|
||||
title=ikog.py
|
||||
icon=skin:icons/utilities-terminal.png
|
||||
exec=/usr/bin/ikog.py
|
||||
@@ -0,0 +1,3 @@
|
||||
title=joe
|
||||
icon=skin:icons/editor.png
|
||||
exec=/usr/bin/joe
|
||||
@@ -0,0 +1,3 @@
|
||||
title=lingot
|
||||
icon=skin:icons/lingot.png
|
||||
exec=/usr/bin/lingot
|
||||
@@ -0,0 +1,4 @@
|
||||
title=links
|
||||
icon=skin:icons/links.png
|
||||
exec=/usr/bin/links
|
||||
params=-driver svgalib -mode 320x240x16M32 -download-dir /root/ http://en.qi-hardware.com/wiki/Main_Page
|
||||
@@ -0,0 +1,4 @@
|
||||
title=lynx
|
||||
icon=skin:icons/lynx.png
|
||||
exec=/bin/sh
|
||||
params=--login -c /usr/bin/lynx
|
||||
@@ -0,0 +1,3 @@
|
||||
title=mathomatic
|
||||
icon=skin:icons/mathomatic.png
|
||||
exec=/usr/bin/mathomatic
|
||||
@@ -0,0 +1,3 @@
|
||||
title=mcabber
|
||||
icon=skin:icons/mcabber.png
|
||||
exec=/usr/bin/mcabber
|
||||
@@ -0,0 +1,3 @@
|
||||
title=minicom
|
||||
icon=skin:icons/utilities-terminal.png
|
||||
exec=/usr/bin/minicom
|
||||
@@ -0,0 +1,4 @@
|
||||
title=MPlayer
|
||||
icon=skin:icons/mplayer.png
|
||||
exec=/usr/bin/alfilesel
|
||||
params=-t "MPlayer: Select Video" -p /root/ -f "ogg;ogv;mkv;webm;avi;mpg;mpeg" -- mplayer
|
||||
@@ -0,0 +1,3 @@
|
||||
title=mutt
|
||||
icon=skin:icons/mutt.png
|
||||
exec=/usr/bin/mutt
|
||||
@@ -0,0 +1,4 @@
|
||||
title=NanoMap
|
||||
icon=skin:icons/nanomap.png
|
||||
exec=/usr/bin/NanoMap
|
||||
params=-qws
|
||||
@@ -0,0 +1,3 @@
|
||||
title=netsurf
|
||||
icon=skin:icons/utilities-terminal.png
|
||||
exec=/usr/bin/netsurf@BROKEN #don't know how to exit
|
||||
@@ -0,0 +1,3 @@
|
||||
title=nightsky
|
||||
icon=skin:icons/nightsky.png
|
||||
exec=/usr/bin/nightsky
|
||||
@@ -0,0 +1,4 @@
|
||||
title=NuPDF
|
||||
icon=skin:icons/editor.png
|
||||
exec=/usr/bin/alfilesel
|
||||
params=-t "NuPDF: Select File" -p /root/ -f "pdf;PDF" -- nupdf
|
||||
@@ -0,0 +1,4 @@
|
||||
title=PDF
|
||||
icon=skin:icons/generic.png
|
||||
exec=/usr/bin/pick-pdf
|
||||
params=/root/
|
||||
@@ -0,0 +1,2 @@
|
||||
title=pyclock
|
||||
exec=/usr/bin/pyclock
|
||||
@@ -0,0 +1,3 @@
|
||||
title=qc
|
||||
icon=skin:icons/calc.png
|
||||
exec=/usr/bin/qc
|
||||
@@ -0,0 +1,4 @@
|
||||
title=qStarDict
|
||||
icon=skin:icons/qstardict.png
|
||||
exec=/usr/bin/qstardict
|
||||
params=-qws
|
||||
@@ -0,0 +1,3 @@
|
||||
title=sc
|
||||
icon=skin:icons/sc.png
|
||||
exec=/usr/bin/sc
|
||||
@@ -0,0 +1,4 @@
|
||||
title=sdcv
|
||||
icon=skin:icons/stardict.png
|
||||
exec=/usr/bin/sdcv
|
||||
params=--utf8-output
|
||||
@@ -0,0 +1,3 @@
|
||||
title=snownews
|
||||
icon=skin:icons/leaf_red.png
|
||||
exec=/usr/bin/snownews
|
||||
@@ -0,0 +1,3 @@
|
||||
title=StarDict
|
||||
icon=skin:icons/stardict.png
|
||||
exec=/usr/bin/stardict
|
||||
@@ -0,0 +1,3 @@
|
||||
title=tunec
|
||||
icon=skin:icons/utilities-terminal.png
|
||||
exec=/usr/bin/tunec
|
||||
@@ -0,0 +1,3 @@
|
||||
title=vim
|
||||
icon=skin:icons/vim.png
|
||||
exec=/usr/bin/vim
|
||||
@@ -0,0 +1,4 @@
|
||||
title=w3m
|
||||
icon=skin:icons/w3m.png
|
||||
exec=/usr/bin/w3m
|
||||
params=http://en.qi-hardware.com/wiki/Main_Page
|
||||
@@ -0,0 +1,4 @@
|
||||
title=zgv
|
||||
icon=skin:icons/zgv.png
|
||||
exec=/usr/bin/zgv
|
||||
params=/root/
|
||||
@@ -0,0 +1,4 @@
|
||||
title=Alex4
|
||||
icon=skin:icons/allegro.png
|
||||
exec=/usr/bin/alex4
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
title=Allegro Demo
|
||||
icon=skin:icons/allegro.png
|
||||
exec=/usr/bin/shooter
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
title=backgammon
|
||||
icon=skin:icons/backgammon.png
|
||||
exec=/usr/bin/backgammon.sh
|
||||
@@ -0,0 +1,4 @@
|
||||
title=Brainless
|
||||
icon=skin:icons/brainless.png
|
||||
exec=/usr/bin/brainless-jfbterm
|
||||
params=
|
||||
@@ -0,0 +1,4 @@
|
||||
title=dunnet
|
||||
icon=skin:icons/emacs.png
|
||||
exec=/usr/bin/emacs
|
||||
params=-batch -l dunnet
|
||||
@@ -0,0 +1,4 @@
|
||||
title=freedroid
|
||||
exec=/usr/bin/freedroid
|
||||
icon=skin:icons/freedroid.png
|
||||
params=-q
|
||||
@@ -0,0 +1,3 @@
|
||||
title=gnuchess
|
||||
icon=skin:icons/chess.png
|
||||
exec=/usr/bin/gnuchess
|
||||
@@ -0,0 +1,4 @@
|
||||
title=gottet
|
||||
icon=skin:icons/gottet.png
|
||||
exec=/usr/bin/gottet
|
||||
params=-qws
|
||||
@@ -0,0 +1,4 @@
|
||||
title=qball
|
||||
icon=skin:icons/qball.png
|
||||
exec=/usr/bin/qball
|
||||
params=-qws
|
||||
@@ -0,0 +1,4 @@
|
||||
title=sokoban
|
||||
icon=skin:icons/gforth.png
|
||||
exec=/usr/bin/gforth
|
||||
params=sokoban.fs -e sokoban -e bye
|
||||
@@ -0,0 +1,3 @@
|
||||
title=Supertux
|
||||
icon=skin:icons/supertux.png
|
||||
exec=/usr/bin/supertux
|
||||
@@ -0,0 +1,4 @@
|
||||
title=tetris
|
||||
icon=skin:icons/tetris.png
|
||||
exec=/usr/sbin/setfont2
|
||||
params=/usr/share/setfont2/un-fuzzy-6x10-font.pnm; /usr/bin/tetris
|
||||
@@ -0,0 +1,4 @@
|
||||
title=Tile
|
||||
icon=skin:icons/tile.png
|
||||
exec=/usr/bin/Tile
|
||||
params=-qws
|
||||
@@ -0,0 +1,3 @@
|
||||
title=vitetris
|
||||
icon=skin:icons/vitetris.png
|
||||
exec=/usr/bin/vitetris
|
||||
@@ -0,0 +1,3 @@
|
||||
title=worm
|
||||
icon=skin:icons/worm.png
|
||||
exec=/usr/bin/worm
|
||||
@@ -0,0 +1,3 @@
|
||||
title=4th
|
||||
icon=skin:icons/4th.png
|
||||
exec=/usr/bin/4th
|
||||
@@ -0,0 +1,3 @@
|
||||
title=gforth
|
||||
icon=skin:icons/gforth.png
|
||||
exec=/usr/bin/gforth
|
||||
@@ -0,0 +1,3 @@
|
||||
title=guile
|
||||
icon=skin:icons/guile.png
|
||||
exec=/usr/bin/guile
|
||||
@@ -0,0 +1,3 @@
|
||||
title=lua
|
||||
icon=skin:icons/lua.png
|
||||
exec=/usr/bin/lua
|
||||
@@ -0,0 +1,3 @@
|
||||
title=GNU Octave
|
||||
icon=skin:icons/octave.png
|
||||
exec=/usr/bin/octave
|
||||
@@ -0,0 +1,3 @@
|
||||
title=python
|
||||
icon=skin:icons/python.png
|
||||
exec=/usr/bin/python
|
||||
@@ -0,0 +1,3 @@
|
||||
title=tcl
|
||||
icon=skin:icons/tclsh.png
|
||||
exec=/usr/bin/tclsh8.5
|
||||
@@ -0,0 +1,4 @@
|
||||
title=ash(Color)
|
||||
icon=skin:icons/utilities-terminal.png
|
||||
exec=/usr/bin/setfont
|
||||
params=/usr/share/kbd/consolefonts/kernel-6x11-font; /bin/ash --login
|
||||
@@ -0,0 +1,4 @@
|
||||
title=ash(Default)
|
||||
icon=skin:icons/utilities-terminal.png
|
||||
exec=/usr/sbin/setfont2
|
||||
params=/usr/share/setfont2/un-fuzzy-6x10-font.pnm; /usr/bin/loadunimap /usr/share/setfont2/ben_uni.trans; /bin/ash --login
|
||||
@@ -0,0 +1,4 @@
|
||||
title=bash
|
||||
icon=skin:icons/utilities-terminal.png
|
||||
exec=/bin/bash
|
||||
params=--login
|
||||
@@ -0,0 +1,4 @@
|
||||
title=byobu
|
||||
icon=skin:icons/utilities-terminal.png
|
||||
exec=/bin/touch
|
||||
params=/var/run/utmp; /usr/bin/byobu
|
||||
@@ -0,0 +1,4 @@
|
||||
title=fbterm
|
||||
icon=skin:icons/utilities-terminal.png
|
||||
exec=/usr/bin/fbterm
|
||||
params=-- /bin/ash --login
|
||||
@@ -0,0 +1,3 @@
|
||||
title=jfbterm
|
||||
icon=skin:icons/utilities-terminal.png
|
||||
exec=/usr/bin/jfbterm
|
||||
@@ -0,0 +1,3 @@
|
||||
title=nanoterm
|
||||
icon=skin:icons/utilities-terminal.png
|
||||
exec=/usr/bin/nanoterm
|
||||
@@ -0,0 +1,3 @@
|
||||
title=screen
|
||||
icon=skin:icons/utilities-terminal.png
|
||||
exec=/usr/sbin/screen
|
||||
@@ -0,0 +1,4 @@
|
||||
title=alsamixer
|
||||
icon=skin:icons/alsamixer.png
|
||||
exec=/usr/bin/alsamixer
|
||||
params=-Vall
|
||||
@@ -0,0 +1,3 @@
|
||||
title=htop
|
||||
icon=skin:icons/htop.png
|
||||
exec=/usr/bin/htop
|
||||
@@ -0,0 +1,4 @@
|
||||
title=mc
|
||||
icon=skin:icons/mc.png
|
||||
exec=/usr/bin/mc
|
||||
params=~/ ~/
|
||||
@@ -0,0 +1,3 @@
|
||||
title=mediatomb
|
||||
icon=skin:icons/mediatomb.png
|
||||
exec=/usr/bin/mediatomb
|
||||
@@ -0,0 +1,3 @@
|
||||
title= poweroff
|
||||
icon=skin:icons/poweroff.png
|
||||
exec=/sbin/poweroff
|
||||
@@ -0,0 +1,3 @@
|
||||
title=powertop
|
||||
icon=skin:icons/powertop.png
|
||||
exec=/usr/bin/powertop
|
||||
@@ -0,0 +1,3 @@
|
||||
title=reboot
|
||||
icon=skin:icons/reboot.png
|
||||
exec=/sbin/reboot
|
||||
@@ -0,0 +1,4 @@
|
||||
title=start-listener
|
||||
icon=skin:icons/listener.png
|
||||
exec=/usr/bin/listener
|
||||
params= ; sleep 1
|
||||
@@ -0,0 +1,4 @@
|
||||
title=stop-listener
|
||||
icon=skin:icons/listener.png
|
||||
exec=/usr/bin/killall
|
||||
params= -s 9 listener; cd /usr/share/listener && ash
|
||||
BIN
nanonote-files/base-files/usr/share/qmaps/ben.qmap
Normal file
BIN
nanonote-files/base-files/usr/share/qmaps/ben.qmap
Normal file
Binary file not shown.
Reference in New Issue
Block a user