Ok. That is all I can get:
- Code: Select all
Barebox-C2K >/ help
. - alias for source
? - alias for help
[ - alias for test
addpart - adds a partition table to a device
bootm - boot an application image
bootu - bootu - start a raw linux image
bootz - bootz - start a zImage
cat - concatenate file(s)
cd - change working directory
clear - clear screen
copy - copy command
cp - copy files
cpuinfo - Show info about CPU
crc32 - crc32 checksum calculation
dd - DDR test
delpart - delete partition(s)
devinfo - Show information about devices and drivers.
dhcp - invoke dhcp client to obtain ip/boot params
echo - echo args to console
edit - Usage: (s)edit <file>
erase - erase FLASH memory
erase_nand - Erase the NAND
erase_old_nand_fmt - Erase old NAND format
ethact - set current ethernet device
exit - exit script
false - do nothing, unsuccessfully
gemac_stats - retrieve GEMAC statistics
get_button_status - get_button_status
getopt - getopt <optstring> <var>
help - print online help
i2c_probe - probe for an i2c device
i2c_read - read from an i2c device
i2c_write - write to an i2c device
led - changes the LED color
loadenv - Load environment from ENVFS into DIRECTORY (default: /dev/env0 -> /env).
ls - list a file or directory
md - memory display
memcmp - memory compare
memcpy - memory copy
memset - memory fill
mkdir - make directories
mount - Mount a filesystem of a given type to a mountpoint or list mounted filesystems.
mw - memory write (fill)
nand - NAND specific handling
pfe - pfe <options>
pfe_stats - retrieve PFE statistics
phy - PHY status, read and write operation
ping - ping <destination>
printenv - Print value of one or all environment variables.
protect - enable flash write protection
pwd - print working directory
read_nand - Read the NAND
readline - prompt for user input
reset - Perform RESET of the CPU
rm - remove files
rmdir - remove directorie(s)
rxicmp - rxicmp
sata - SATA sub system
sataenv - SATA sub system
satapart - SATA sub system
saveenv - save environment to persistent storage
sedit - alias for edit
sh - run shell script
socinfo - print SoC info
source - execute shell script in current shell environment
switch - Atheros AR8328 switch read and write operation
test - minimal test like /bin/sh
tftp - Load file using tftp protocol
timeout - wait for a specified timeout
true - do nothing, successfully
umount - umount a filesystem
unprotect - disable flash write protection
update_i2c - update_i2c <src> <off> <size>
update_nand - Flash the NAND
update_nor - Flash the NOR
update_spi - update_spi <src> <sec> <off> <size>
version - print monitor version
Barebox-C2K >/
As you can see there is no
dmesg but
ls give me that:
- Code: Select all
Barebox-C2K >/ ls -l
drwxrwxrwx 0 .
drwxrwxrwx 0 ..
drwxrwxrwx 0 dev
drwxrwxrwx 0 env
In
dev directory:
- Code: Select all
Barebox-C2K >/dev ls -l
cr-------- 4294967295 zero
crw------- 12717 defaultenv
crw------- 4294967295 mem
crw------- 64 phy0
crw------- 16777216 spi0
crw------- 65536 env0
crw------- 3145728 mem.uImage
Barebox-C2K >/dev
...and in
env directory:
- Code: Select all
Barebox-C2K >/env ls -l
drwxrwxrwx 0 .
drwxrwxrwx 0 ..
-rwxrwxrwx 311 config
drwxrwxrwx 0 bin
Barebox-C2K >/env
...and there:
- Code: Select all
Barebox-C2K >/env ls -lR
/env:
drwxrwxrwx 0 .
drwxrwxrwx 0 ..
-rwxrwxrwx 311 config
drwxrwxrwx 0 bin
/env/bin:
drwxrwxrwx 0 .
drwxrwxrwx 0 ..
-rwxrwxrwx 442 boot_sata
-rwxrwxrwx 880 _update_help
-rwxrwxrwx 1185 init
-rwxrwxrwx 1522 update
-rwxrwxrwx 240 rxicmp_startup_script
-rwxrwxrwx 1141 _update
-rwxrwxrwx 46 update_barebox
-rwxrwxrwx 45 update_kernel
-rwxrwxrwx 3728 boot
-rwxrwxrwx 2600 static_config
-rwxrwxrwx 45 update_rootfs
-rwxrwxrwx 21 hush_hack
-rwxrwxrwx 46 update_uloader
mount give me this:
- Code: Select all
Barebox-C2K >/ mount
none on / type ramfs
none on /dev type devfs
Barebox-C2K >/
There is no
proc directory so I cannot list
/proc/partitionsI don't know how to copy files from
/env/bin directory to my pc but all of them are regular bash scripts AFAIK. I can
cat all of them.
For example:
- Code: Select all
Barebox-C2K >/ cat /env/config
#!/bin/sh
###############################################################################
# This file contains the barebox Environment variables. #
###############################################################################
eth0.ethaddr=00:90:A9:D8:5E:AD
model=sq
serial=
board_test=
or:
- Code: Select all
Barebox-C2K >/ cat /env/bin/rxicmp_startup_script
#!/bin/sh
#
# rxicmp_startup_script - TFTP's and executes startup.sh script required for
# initiating the rxicmp boot sequence.
#
dhcp
tftp startup.sh
/startup.sh
#tftp $rootpath/$bootfile /dev/mem
#bootm /dev/mem
or...
- Code: Select all
Barebox-C2K >/ cat /env/bin/boot_sata
#!/bin/sh
sata
#sata read 3008000 1 5000
satapart 0x3008000 5 0x5000
sata stop
## The following gets set in static_config ##
#bootargs="console=ttyS0,115200n8, init=/sbin/init"
#bootargs="$bootargs root=/dev/sda1 rootfstype=ext4 rw noinitrd"
#bootargs="$bootargs mac_addr=$eth0.ethaddr"
#bootargs="$bootargs model=$model serial=$serial board_test=$board_test btn_status="
#############################################
bootm /dev/mem.uImage
If you wish I can list all of that files. Maybe we can use uboot instead barebox? Is it possible to swap it?
A few more
init file:
- Code: Select all
Barebox-C2K >/ cat /env/bin/init
#!/bin/sh
PATH=/env/bin
#export PATH
## Button initial state
btn_status=0
get_button_status
. /env/bin/static_config
. /env/config
# NOTE: rxicmp requires 'rxicmp_startup_env' barebox env variable to be
# pointing to an executable script (ex: /env/bin/rxicmp_startup_script)
rxicmp
# Western Digital: For now for tftping...
addpart /dev/mem 3M@0x3008000(uImage)
if [ -e /dev/nor0 -a -n "$nor_parts" ]; then
addpart /dev/nor0 $nor_parts
fi
if [ -e /dev/disk0 -a -n "$disk_parts" ]; then
addpart /dev/disk0 $disk_parts
fi
if [ -e /dev/nand0 -a -n "$nand_parts" ]; then
addpart /dev/nand0 $nand_parts
# Uh, oh, hush first expands wildcards and then starts executing
# commands. What a bug!
source /env/bin/hush_hack
fi
if [ -f /env/bin/init_board ]; then
/env/bin/init_board
fi
echo
echo -n "Hit any key to stop autoboot: "
timeout -a $autoboot_timeout
if [ $? != 0 ]; then
. /env/bin/_update_help
exit
fi
#./boot
sata # initialize SATA
sataenv run 7 # try to run script from partition 7
sataenv run 8 # try to run script from partition 8
. /env/bin/boot_sata # if all else fails, use this script to boot
led system_led red
Barebox-C2K >/
Another example:
/env/bin/update_barebox leads to
/env/bin/update- Code: Select all
Barebox-C2K >/ cat /env/bin/update_barebox
#!/bin/sh
. /env/bin/update -t barebox -d $1
- Code: Select all
Barebox-C2K >/ cat /env/bin/update
#!/bin/sh
type=""
device_type=""
check=n
mode=tftp
. /env/config
while getopt "ht:d:f:a:s:m:c" Option
do
if [ ${Option} = t ]; then
type=${OPTARG}
elif [ ${Option} = d ]; then
device_type=${OPTARG}
elif [ ${Option} = f ]; then
imagename=${OPTARG}
elif [ ${Option} = a ]; then
address=${OPTARG}
elif [ ${Option} = s ]; then
size=${OPTARG}
elif [ ${Option} = c ]; then
check=y
elif [ ${Option} = m ]; then
mode=${OPTARG}
else
. /env/bin/_update_help
exit 0
fi
done
if [ x${type} = xkernel ]; then
image=$kernelimage
elif [ x${type} = xrootfs ]; then
image=$rootfsimage
elif [ x${type} = xbarebox ]; then
image=$bareboximage
if [ x${image} = x ]; then
image=barebox.bin
fi
elif [ x${type} = xuloader ]; then
image=$uloaderimage
elif [ x${type} = xbareboxenv ]; then
image=$bareboxenvimage
if [ x${image} = x ]; then
image=bareboxenv.bin
fi
type=env
else
. /env/bin/_update_help
exit 1
fi
if [ x${imagename} != x ]; then
image=${imagename}
fi
if [ x${device_type} = xnand ]; then
part=/dev/nand0.${type}.bb
elif [ x${device_type} = xnor ]; then
part=/dev/nor0.${type}
else
. /env/bin/_update_help
exit 1
fi
if [ x${mode} != xtftp ] && [ x${mode} != xxmodem ] && [ x${mode} != xddr ]; then
echo "unsupported mode ${mode}."
. /env/bin/_update_help
exit 1
fi
. /env/bin/_update || exit 1
if [ x${check} = xy ]; then
if [ x${mode} = xddr ]; then
crc32 -f $part
crc32 $address+$size
elif [ x${mode} = xtftp ]; then
crc32 -f $part
else
crc32 -f $image -F $part
fi
else
true
fi
Barebox-C2K >/
This is interesting:
- Code: Select all
Barebox-C2K >/ cat /env/bin/boot
#!/bin/sh
# This is not used but it was originally called by init script
. /env/bin/static_config
. /env/config
if [ x$1 = xnand ]; then
rootfs_loc=nand
kernel_loc=nand
elif [ x$1 = xnor ]; then
rootfs_loc=nor
kernel_loc=nor
elif [ x$1 = xsata ]; then
rootfs_loc=sata
kernel_loc=sata
elif [ x$1 = xnfs ]; then
rootfs_loc=net
kernel_loc=nfs
elif [ x$1 = xtftp ]; then
rootfs_loc=net
kernel_loc=tftp
fi
if [ x$ip = xdhcp ]; then
bootargs="$bootargs ip=dhcp"
elif [ x$ip = xnone ]; then
bootargs="$bootargs ip=none"
else
bootargs="$bootargs ip=$eth0.ipaddr::$eth0.gateway:$eth0.netmask:::"
fi
if [ x$rootfs_loc = xnet ]; then
bootargs="$bootargs root=/dev/nfs nfsroot=$nfsroot,v3,tcp noinitrd"
elif [ x$rootfs_loc = xinitrd ]; then
bootargs="$bootargs root=/dev/ram0 rdinit=/sbin/init"
elif [ x$rootfs_loc = xsata ]; then
bootargs="$bootargs rootfstype=$rootfs_type rw noinitrd"
else
if [ x$rootfs_loc = xnand ]; then
rootfs_mtdblock=$rootfs_mtdblock_nand
else
rootfs_mtdblock=$rootfs_mtdblock_nor
fi
if [ x$rootfs_type = xubifs ]; then
if [ -z $ubiroot ]; then
ubiroot="rootfs"
fi
if [ x$rootfs_loc = xnand ]; then
bootargs="$bootargs root=ubi0:$ubiroot ubi.mtd=$rootfs_mtdblock,4096"
else
bootargs="$bootargs root=ubi0:$ubiroot ubi.mtd=$rootfs_mtdblock"
fi
else
bootargs="$bootargs root=/dev/mtdblock$rootfs_mtdblock"
fi
bootargs="$bootargs rootfstype=$rootfs_type rw noinitrd"
fi
if [ -n $nor_parts ]; then
mtdparts="${mtdparts}${nor_device}:${nor_parts}"
fi
if [ -n $nand_parts ]; then
if [ -n ${mtdparts} ]; then
mtdparts="${mtdparts};"
fi
mtdparts="${mtdparts}${nand_device}:${nand_parts}"
fi
if [ -n $mtdparts ]; then
bootargs="${bootargs} mtdparts=${mtdparts}"
fi
if [ -e /dev/ram0 ]; then
if [ ! -e /dev/ram0.kernelraw ]; then
# arm raw kernel images are usually located at sdram start + 0x8000
addpart /dev/ram0 8M@0x8000(kernelraw)
fi
if [ ! -e /dev/ram0.kernel ]; then
# Here we can safely put the kernel without risking of overwriting it
# while extracting
addpart /dev/ram0 8M@8M(kernel)
fi
fi
if [ x$kernel_loc = xnfs ] || [ x$kernel_loc = xtftp ]; then
if [ x$ip = xdhcp ]; then
dhcp
fi
if [ $kernelimage_type = uimage ]; then
netload="/dev/ram0.kernel"
elif [ $kernelimage_type = zimage ]; then
netload="/dev/ram0.kernel"
elif [ $kernelimage_type = raw ]; then
netload="/dev/ram0.kernelraw"
elif [ $kernelimage_type = raw_lzo ]; then
netload="/dev/ram0.kernel"
else
echo "error: set kernelimage_type to one of 'uimage', 'zimage', 'raw' or 'raw_lzo'"
exit 1
fi
$kernel_loc $kernelimage $netload || exit 1
kdev="$netload"
elif [ x$kernel_loc = xnor ]; then
kdev="/dev/nor0.kernel"
elif [ x$kernel_loc = xnand ]; then
kdev="/dev/nand0.kernel.bb"
elif [ x$kernel_loc = xsata ]; then
# addpart /dev/mem 3M@0x3008000(uImage)
# sata init
# sata read 3008000 7800 1c00
# kdev="/dev/mem.uImage"
# sata stop
sata
sataenv run 7 # try to run script from partition 7
sataenv run 8 # try to run script from partition 8
. /env/bin/boot_sata # if all else fails, use this script to boot
else
echo "error: set kernel_loc to one of 'nfs', 'tftp', 'nand' or 'nor'"
exit 1
fi
if [ -n $usb3_internal_clk ]; then
bootargs="$bootargs usb3_internal_clk=$usb3_internal_clk"
fi
echo "booting kernel of type $kernelimage_type from $kdev"
if [ x$kernelimage_type = xuimage ]; then
bootm $kdev
elif [ x$kernelimage_type = xzimage ]; then
bootz $kdev
elif [ x$kernelimage_type = xraw ]; then
if [ $kernel_loc != net ]; then
cp $kdev /dev/ram0.kernelraw
fi
bootu /dev/ram0.kernelraw
elif [ x$kernelimage_type = xraw_lzo ]; then
unlzo $kdev /dev/ram0.kernelraw
bootu /dev/ram0.kernelraw
fi
Barebox-C2K >/
Next fine spot:
- Code: Select all
Barebox-C2K >/ cat /env/bin/_update_help
#!/bin/sh
echo "usage: update -t <kernel|rootfs|barebox|bareboxenv> -d <nor|nand> [-m tftp|xmodem|ddr] [-f imagename|-a address] -c"
echo "update tools."
echo ""
echo "options"
echo " -c to check the crc32 for the image and flashed one"
echo ""
echo "default mode is tftp"
echo "type update -t uloader -d <nor|nand> [-m tftp|xmodem|ddr] [-f imagename|-a address] to update uloader into flash"
echo "type update -t barebox -d <nor|nand> [-m tftp|xmodem|ddr] [-f imagename|-a address] to update barebox into flash"
echo "type update -t kernel -d <nor|nand> [-m tftp|xmodem|ddr] [-f imagename|-a address] to update kernel into flash"
echo "type update -t rootfs -d <nor|nand> [-m tftp|xmodem|ddr] [-f imagename|-a address] to update rootfs into flash"
echo "type update -t bareboxenv -d <nor|nand> [-m tftp|xmodem|ddr] [-f imagename|-a address] to update bareboxenv into flash"
Barebox-C2K >/
If we could upload uboot file there I think we can put it on nand:
- Code: Select all
Barebox-C2K >/ cat /env/bin/_update
#!/bin/sh
if [ x$mode = xddr ]; then
if [ -z "$part" -o -z "$address" -o -z "$size" ]; then
echo "define \$part, \$address and \$size"
exit 1
fi
else
if [ -z "$part" -o -z "$image" ]; then
echo "define \$part and \$image"
exit 1
fi
fi
if [ ! -e "$part" ]; then
echo "Partition $part does not exist"
exit 1
fi
if [ x$mode = xtftp ]; then
if [ x$ip = xdhcp ]; then
dhcp
fi
ping $eth0.serverip
if [ $? -ne 0 ] ; then
echo "Server did not reply! Update aborted."
exit 1
fi
elif [ x$mode = xxmodem ]; then
loadb -f $image -c
if [ $? -ne 0 ] ; then
echo "loadb failed or cancelled! Update aborted."
exit 1
fi
fi
unprotect $part
echo
echo "erasing partition $part"
echo
erase $part
if [ x$mode = xddr ]; then
echo
echo "flashing $size@$address to $part"
echo
else
echo
echo "flashing $image to $part"
echo
fi
if [ x$mode = xtftp ]; then
tftp $image $part
if [ $? -ne 0 ] ; then
echo "!!!Probable use of old NAND layout.!!!"
echo "Use 'erase_old_nand_fmt' command to clean NAND."
exit 1
fi
elif [ x$mode = xddr ]; then
memcpy $address -d $part 0 $size
else
cp $image $part
fi
protect $part
Barebox-C2K >/
One more script:
- Code: Select all
Barebox-C2K >/ cat /env/bin/static_config
#!/bin/sh
###############################################################################
# This file contains the barebox Environment variables. #
# This file was the old config file and contains static things, mostly for #
# debugging, NFS or TFTPing. #
# #
# This file will be sourced before /env/config to set default values. #
# #
###############################################################################
## barebox and uloader parameters
uloaderimage=microloader-c2kevm.bin
bareboximage=barebox-c2kevm.bin
autoboot_timeout=1
## use 'dhcp' to do dhcp in barebox and in kernel
## use 'none' if you want to skip kernel ip autoconfiguration
ip=none # TODO: Someone needs to take a look at this configuration
# option as this is perhaps needed for autoconfiguration
# of NAS during bootup
## or set your networking parameters here
#eth0.ipaddr=192.168.1.90
#eth0.netmask=255.255.255.0
#eth0.serverip=192.168.1.99
#eth0.gateway=192.168.2.1
eth0.ethaddr=00:11:22:33:44:55
eth1.ethaddr=00:1A:1B:1C:1D:1E
eth2.ethaddr=00:2A:2B:2C:2D:2E
## set kernel and root file system parameters
kernel_loc=sata # can be 'nfs', 'tftp', 'nor', 'nand' or 'sata'
kernelimage_type=uimage # can be 'uimage', 'zimage', 'raw' or 'raw_lzo'
kernelimage=uImage # kernel image name
rootfs_loc=sata # can be 'net', 'nor', 'initrd', 'nand' or 'sata'
rootfs_type=ext4 # can be 'jffs2' or 'ubifs'
rootfsimage=root.$rootfs_type-128k # rootfs image name
#nfsroot="$eth0.serverip:/opt/work/busybox/rootfs_arm"
## NOR setting
#nor_device="comcertoflash.0"
#nor_parts="128k(uloader)ro,512k(barebox)ro,128k(env),4M(kernel),48M(rootfs)"
#rootfs_mtdblock_nor=4
## NAND setting
#nand_device="comcertonand"
#nand_parts="1024k(barebox)ro,1024k(bareboxenv),4M(kernel),-(rootfs)"
#rootfs_mtdblock_nand=8
## USB setting
usb3_internal_clk="yes"
## kernel boot command-line parameters
bootargs="console=ttyS0,115200n8, init=/sbin/init"
bootargs="$bootargs rootfstype=$rootfs_type rw noinitrd"
#bootargs="$bootargs root=/dev/sda1 rootfstype=ext4 rw noinitrd" # this is set in boot
bootargs="$bootargs mac_addr=$eth0.ethaddr"
bootargs="$bootargs model=$model serial=$serial board_test=$board_test btn_status=$btn_status"
## rxicmp settings
rxicmp_startup_env="/env/bin/rxicmp_startup_script"
Barebox-C2K >/
Why there are 3 different MAC addresses? :scratch