Commit aaf00621 authored by Alessandro Rubini's avatar Alessandro Rubini

Merge branch 'barebox-update'

parents 89be2973 28116ef9
No preview for this file type
#!/bin/sh
bootargs="quiet console=ttyS0,115200 panic=10 mem=64m"
bootargs="$bootargs root=nfs ip=dhcp"
......
#!/bin/sh
bootargs="quiet console=ttyS0,115200 panic=10 mem=64m"
bootargs="$bootargs root=nfs ip=192.168.16.9:192.168.16.1:255.255.255.0"
......
......@@ -11,8 +11,8 @@ at91bootstrap-3-3.0.tar.gz 059a3e99cd93727c642ab7843c714887 \
http://repository.timesys.com/buildsources/a/at91bootstrap-3/at91bootstrap-3-3.0/at91bootstrap-3-3.0.tar.gz
# boot loader
barebox-2012.05.0.tar.bz2 208495f31b832eb6ae0c887787431def \
http://www.barebox.org/download/barebox-2012.05.0.tar.bz2
barebox-2014.04.0.tar.bz2 e1f089fc24cc7f24478e663c0e3b91d9 \
http://www.barebox.org/download/barebox-2014.04.0.tar.bz2
# kernel
linux-2.6.39.tar.bz2 1aab7a741abe08d42e8eccf20de61e05 \
......
......@@ -225,15 +225,16 @@ if [ "x$MAC2" = "x$MAC2_DEF" ]; then
fi
## Selecting the running memmode
df=false; nf=false, ddr=false
if [ "x$memmode" = "xdf" ]; then
df=1
df=true
elif [ "x$memmode" = "xnf" ]; then
nf=1
nf=true
elif [ "x$memmode" = "xddr" ]; then
test=1
ddr=true
else
df=1
nf=1
df=true
nf=true
fi
# Check if atmel sam-ba is found by lsusb
......@@ -265,13 +266,13 @@ Tbarebox=$TMPDIR/bb.new
modifyMAC ${barebox} ${Tbarebox}
## Flashing DataFlash
if [ $df ]; then
## Flashing DataFlash: at91bootstrap at 0, then barebox at 0x8400 (33792)
if $df; then
${FLASHER} -m df $FLAGS $DEV ${at91bs} 0 ${Tbarebox} 33792
fi
## Prepare for the NAND flashing procedure
if [ $nf ]; then
if $nf; then
TMPFS=$TMPDIR/wrsfs-tgz; mkdir $TMPFS
rootfsjffs2=$TMPDIR/wrs-image.jffs2
......@@ -324,7 +325,7 @@ EOF
fi
## Loading in DDR
if [ $test ]; then
if $ddr; then
TMPFS=$(mktemp -d /tmp/wrsfs-tgz.XXXXXX)
rootfsjffs2=/tmp/wrs-image.jffs2.img
......
......@@ -11,7 +11,7 @@ fi
wrs_check_vars WRS_OUTPUT_DIR WRS_DOWNLOAD_DIR CROSS_COMPILE
wrs_echo "--- Barebox"
tarname="barebox-2012.05.0.tar.bz2"
tarname="barebox-2014.04.0.tar.bz2"
wrs_download $tarname
mkdir -p $WRS_OUTPUT_DIR/build || wrs_die "mkdir build"
......@@ -19,11 +19,12 @@ mkdir -p $WRS_OUTPUT_DIR/images || wrs_die "mkdir images"
# go to the build dir and compile it
cd $WRS_OUTPUT_DIR/build
dirname="barebox-2012.05.0"
version="v2014.04"
dirname="barebox-2014.04.0"
rm -rf $dirname
tar xjf ${WRS_DOWNLOAD_DIR}/$tarname || wrs_die "untar $tarname"
cd $dirname
patchdir="$WRS_BASE_DIR/../patches/barebox/"
patchdir="$WRS_BASE_DIR/../patches/barebox/$version"
wrs_echo "Patching Barebox"
for n in $patchdir/*patch; do
# the shell passes the "*" over if no matches are there, so check
......
......@@ -631,13 +631,20 @@ and 02:34:56:78:9A:00 for MAC2 (the base address for the 18 SFP ports).
flash-wrs: Working in /tmp/flash-wrs-1vV9z6
Warning: you did not set the MAC1 value; using "02:34:56:78:9A:BC"
Warning: you did not set the MAC2 value; using "02:34:56:78:9A:00"
flash-wrs: Waiting for at91sam SAMBA bootloader on usb.
Please check the Managment USB cable is connected
and keep pressed the Flash button while
resetting/powering the switch.
............. Ok
flash-wrs: I'm talking with the switch;
please remove the jumper and press Enter to start flashing:
please release the flash button and press Enter to start flashing:
@end smallexample
If the script cannot find the Atmel programming interface on your USB
bus, it prints a message and waits for the switch to be turned on
in the proper way (with the jumper plugged or the button pressed).
in the proper way (with the button pressed or, for older hardware
versions, the jumper plugged).
The process calls the flasher program twice (so you'll see the
initialization strings two times) and takes slightly less than 3
......@@ -918,6 +925,10 @@ this is the default place where the NFS-Root filesystem is mounted
from, as shown in the log excerpt above. So you'll have your
@file{wrboot} in the same place
@b{Note:} recent @i{barebox} versions require scripts to include a
leading @t{#!/bin/sh}. Examples in @i{wr-switch-sw} did not include the
line until April 2014 included.
The @file{binaries} subdirectory of this package includes two known-working
wrboot scripts as examples; one if for use with static IP addresses and
the other relies on DHCP. If you want to override the default NFS-Root
......@@ -1054,7 +1065,7 @@ The switch uses @i{barebox} as a boot loader. We are running version
file. Note that we are piggy-backing on the Ronetix PM9G45 board, out
of laziness.
The patches are part of this package in @i{patches/barebox} and
The patches are part of this package in @i{patches/barebox/v2012.05/} and
the set is made up of the following ones:
@smallexample
......@@ -1076,14 +1087,14 @@ environment, and its own configuration and scripts live in a small
filesystem. To ease modification of such configuration and boot steps
the build script copies over the configuration instead of patching it
in the sources. You can thus edit the files you find in
@file{patches/barebox/env} and rebuild your customized bootloader.
@file{patches/barebox/v2012.05/env} and rebuild your customized bootloader.
The script that is executed at boot time is @file{env/bin/init} and as
you see it calls the other ones. The menus included in the shipped
configuration are described in @ref{Booting with Barebox}.
Building @i{barebox} relies on a @i{Kconfig} setup, and the
configuration file we use is
@file{patches/barebox/@-wrs3_defconfig}. Again, this is copied over and
@file{patches/barebox/v2012.05/@-wrs3_defconfig}. Again, this is copied over and
not patched in (see the simple @file{build/scripts/@-wrs_build_barebox}
for details).
......@@ -1597,35 +1608,38 @@ After tou managed to load and run @i{barebox.bin},
you will see the following messages on the serial port, at 115200,8N1.
The first 4 lines are printed by @i{at91bootstrap}, the rest by @i{barebox}.
@c FIXME: the messages and prompts
@smallexample
Start AT91Bootstrap...
DDR2 Config: 0x39 (NC=0xa, NR=0xd, CAS=0x3, ba_offset = 0x18)
DDR2 Config: 0x39 (NC=0xa, NR=0xd, CAS=0x3, ba_offset = 0x18)
Compiled by federico (Jul 31 2012 @ 16:14:34)
git rev:
Compiled by Alessandro Rubini (May 2 2014 @ 18:32:34)
git rev:wr-switch-sw-v3.3.1-113-g0b2af1f+
Begin to load image...
++++++++
++++++++++++++++
Loading image done.
barebox 2014.04.0 #1 Fri May 2 18:32:51 CEST 2014
barebox 2012.05.0 (Aug 7 2012 - 13:44:23)
Board: CERN White Rabbit Switch V3
Board: White Rabbit Switch
AT91: Detected soc type: at91sam9g45
AT91: Detected soc subtype: Unknown
Clocks: CPU 400 MHz, master 133 MHz, main 12.000 MHz
registered netconsole as cs1
NAND device: Manufacturer ID: 0x2c, Chip ID: 0xbc (Micron NAND 512MiB 1,8V 16-bi
t)
Scanning device for bad blocks
GPIOs: PA4=1 (36), PC7=1 (103)
Malloc space: 0x73b00000 -> 0x73efffff (size 4 MB)
Stack space : 0x73af8000 -> 0x73b00000 (size 32 kB)
envfs: wrong magic on /dev/env0
no valid environment found on /dev/env0. Using default environment
netconsole: registered as cs1
atmel_nand: Use On Flash BBT
nand: Trying ONFI probe in 16 bits mode, aborting !
nand: NAND device: Manufacturer ID: 0x2c, Chip ID: 0xbc (Micron NAND 512MiB 1,8V 16-bit), 512MiB, page size: 2048, OOB size: 64
Bad block table found at page 262080, version 0x01
Bad block table found at page 262016, version 0x01
mtd_dataflash mtd_dataflash0: AT45DB642x (8448 KBytes) pagesize 1056 bytes (OTP)
mdio_bus: miibus0: probed
macb macb0: Cadence MACB at 0xfffbc000
GPIOs: PA4=1 (4), PC7=1 (71)
malloc space: 0x73b00000 -> 0x73efffff (size 4 MiB)
running /env/bin/init...
Starting up barebox [wrs3] (MAC=02:0B:AD:C0:FF:EE)
starting menu in 5 seconds
files differ at offset 0
Starting up barebox [wrs3] (MAC=22:23:24:25:26:27)
starting menu in 3 seconds
@end smallexample
When the boot loader is running, you can boot a kernel and use its
......
......@@ -108,7 +108,7 @@ CONFIG_LOAD_UBOOT=y
CONFIG_IMG_ADDRESS="0x00008400"
CONFIG_SETTING_ADDRESS="0x00408400"
CONFIG_SETTING_SIZE="0x00001000"
CONFIG_IMG_SIZE="0x00040000"
CONFIG_IMG_SIZE="0x00084000"
CONFIG_JUMP_ADDR="0x73F00000"
CONFIG_GLBDRV_ADDR="0x7006b000"
# CONFIG_LONG_TEST is not set
......
......@@ -6,7 +6,7 @@ memcmp -s /dev/mem -d /env/magicstr 0x71FFFFF8 0x0 8
if [ $? -eq 0 ]; then
echo "Booting kernel for NAND flashing procedure"
bootargs="console=ttyS0,115200 panic=10 mem=64M"
bootargs="$bootargs initrd=0x72000000,20M"
bootargs="$bootargs initrd=0x72000000,25M"
bootargs="$bootargs root=/dev/ram0"
addpart /dev/ram0 0x1000000@0x1000000(kernel)
addpart /dev/ram0 0x1000000@0x2000000(initrd)
......
From 6a749ab56344d6868aedc0b5dc8fbbc9ac8d17bb Mon Sep 17 00:00:00 2001
From: Alessandro Rubini <rubini@gnudd.com>
Date: Fri, 16 Sep 2011 01:12:15 +0200
Subject: [PATCH 1/8] sam945: include mtd/nand.h in device file
---
arch/arm/mach-at91/at91sam9g45_devices.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index 5af8761..bb422fd 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -22,6 +22,7 @@
#include <mach/iomux.h>
#include <mach/io.h>
#include <i2c/i2c-gpio.h>
+#include <linux/mtd/nand.h>
#include "generic.h"
--
1.7.7.2
From 3824d57e37a5576a094adfe889cc55c9ea323e4d Mon Sep 17 00:00:00 2001
From: Alessandro Rubini <rubini@gnudd.com>
Date: Thu, 15 Sep 2011 23:53:57 +0200
Subject: [PATCH 2/8] arm: change prompt for pm9263 (wrs piggy-backs on that
code)
Signed-off-by: Alessandro Rubini <rubini@gnudd.com>
---
arch/arm/boards/pm9g45/init.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/boards/pm9g45/init.c b/arch/arm/boards/pm9g45/init.c
index 1e43be5..629a1ab 100644
--- a/arch/arm/boards/pm9g45/init.c
+++ b/arch/arm/boards/pm9g45/init.c
@@ -169,8 +169,8 @@ device_initcall(pm9g45_devices_init);
static int pm9g45_console_init(void)
{
- barebox_set_model("Ronetix PM9G45");
- barebox_set_hostname("pm9g45");
+ barebox_set_model("White Rabbit Switch");
+ barebox_set_hostname("wrs");
at91_register_uart(0, 0);
return 0;
--
1.7.7.2
From 2f5ef2e2ea8caf5b69c4acc93c434fd53b5da70d Mon Sep 17 00:00:00 2001
From: Alessandro Rubini <rubini@gnudd.com>
Date: Tue, 6 Mar 2012 01:26:28 +0100
Subject: [PATCH 3/8] nand wrs: our nand is 16-bit connected: fix accordingly
Signed-off-by: Alessandro Rubini <rubini@gnudd.com>
---
arch/arm/boards/pm9g45/init.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/arm/boards/pm9g45/init.c b/arch/arm/boards/pm9g45/init.c
index 629a1ab..e2286ed 100644
--- a/arch/arm/boards/pm9g45/init.c
+++ b/arch/arm/boards/pm9g45/init.c
@@ -47,9 +47,9 @@ static struct atmel_nand_data nand_pdata = {
.ale = 21,
.cle = 22,
.det_pin = -EINVAL,
- .rdy_pin = AT91_PIN_PD3,
+ .rdy_pin = AT91_PIN_PC8,
.enable_pin = AT91_PIN_PC14,
- .bus_width_16 = 0,
+ .bus_width_16 = 1,
.on_flash_bbt = 1,
};
@@ -73,7 +73,7 @@ static struct sam9_smc_config pm_nand_smc_config = {
static void pm_add_device_nand(void)
{
- pm_nand_smc_config.mode |= AT91_SMC_DBW_8;
+ pm_nand_smc_config.mode |= AT91_SMC_DBW_16;
/* configure chip-select 3 (NAND) */
sam9_smc_configure(0, 3, &pm_nand_smc_config);
--
1.7.7.2
From 81987499eefe5a714bbc0653ea5daf573e11eeba Mon Sep 17 00:00:00 2001
From: Benoit Rat <benoit@sevensols.com>
Date: Mon, 28 May 2012 12:23:13 +0200
Subject: [PATCH 4/8] gpio: add function to check them
---
arch/arm/boards/pm9g45/init.c | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/arch/arm/boards/pm9g45/init.c b/arch/arm/boards/pm9g45/init.c
index e2286ed..e5b1e12 100644
--- a/arch/arm/boards/pm9g45/init.c
+++ b/arch/arm/boards/pm9g45/init.c
@@ -43,6 +43,25 @@ struct w1_gpio_platform_data w1_pdata = {
.is_open_drain = 0,
};
+/*
+ * board revision encoding
+ * V3.1 => by default: PA4 is 1 & PC7 is 0.
+ * V3.2 => by default: PA4 is 0 & PC7 is 1
+ */
+static void wrs3_check_gpios(void)
+{
+ if (!gpio_request(AT91_PIN_PA4, "") &&
+ !gpio_request(AT91_PIN_PC7, ""))
+ {
+ printf("GPIOs: PA4=%d (%d), PC7=%d (%d)\n",
+ gpio_get_value(AT91_PIN_PA4),AT91_PIN_PA4,gpio_get_value(AT91_PIN_PC7),AT91_PIN_PC7);
+ }
+ else
+ {
+ printf("Error: unable to acquire board GPIOs\n");
+ }
+}
+
static struct atmel_nand_data nand_pdata = {
.ale = 21,
.cle = 22,
@@ -163,6 +182,8 @@ static int pm9g45_devices_init(void)
armlinux_set_architecture(MACH_TYPE_PM9G45);
+ wrs3_check_gpios();
+
return 0;
}
device_initcall(pm9g45_devices_init);
--
1.7.7.2
From 8ec5e0b30090928df96318f043f30610653b0b3d Mon Sep 17 00:00:00 2001
From: Benoit Rat <benoit@sevensols.com>
Date: Mon, 9 Jul 2012 13:40:30 +0200
Subject: [PATCH 5/8] wrs (on pm9g45): change nand setup
Signed-off-by: Alessandro Rubini <rubini@gnudd.com>
---
arch/arm/boards/pm9g45/init.c | 8 ++------
1 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/arch/arm/boards/pm9g45/init.c b/arch/arm/boards/pm9g45/init.c
index e5b1e12..93efaff 100644
--- a/arch/arm/boards/pm9g45/init.c
+++ b/arch/arm/boards/pm9g45/init.c
@@ -15,7 +15,6 @@
*
*
*/
-
#include <common.h>
#include <net.h>
#include <init.h>
@@ -173,11 +172,8 @@ static int pm9g45_devices_init(void)
pm9g45_add_device_eth();
pm9g45_add_device_usbh();
- devfs_add_partition("nand0", 0x00000, SZ_128K, DEVFS_PARTITION_FIXED, "at91bootstrap_raw");
- dev_add_bb_dev("at91bootstrap_raw", "at91bootstrap");
- devfs_add_partition("nand0", SZ_128K, SZ_256K, DEVFS_PARTITION_FIXED, "self_raw");
- dev_add_bb_dev("self_raw", "self0");
- devfs_add_partition("nand0", SZ_256K + SZ_128K, SZ_128K, DEVFS_PARTITION_FIXED, "env_raw");
+ //device, offset, size, flag, name
+ devfs_add_partition("nand0", 0x40000, 0x40000, DEVFS_PARTITION_FIXED, "env_raw");
dev_add_bb_dev("env_raw", "env0");
armlinux_set_architecture(MACH_TYPE_PM9G45);
--
1.7.7.2
From b0c7f0b480138a99d95ea967334a10579288f6a5 Mon Sep 17 00:00:00 2001
From: Alessandro Rubini <rubini@gnudd.com>
Date: Fri, 2 May 2014 12:43:47 +0200
Subject: [PATCH 6/8] wrs (on pm9g45): add dataflash initialization
Signed-off-by: Alessandro Rubini <rubini@gnudd.com>
---
arch/arm/boards/pm9g45/init.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/arch/arm/boards/pm9g45/init.c b/arch/arm/boards/pm9g45/init.c
index 93efaff..9665c18 100644
--- a/arch/arm/boards/pm9g45/init.c
+++ b/arch/arm/boards/pm9g45/init.c
@@ -114,6 +114,22 @@ static void pm9g45_add_device_mci(void)
static void pm9g45_add_device_mci(void) {}
#endif
+static const struct spi_board_info ek_spi_devices[] = {
+ {
+ .name = "mtd_dataflash",
+ .chip_select = 0,
+ .max_speed_hz = 15 * 1000 * 1000,
+ .bus_num = 0,
+ }
+};
+
+static void ek_add_device_spi(void)
+{
+ spi_register_board_info(ek_spi_devices,
+ ARRAY_SIZE(ek_spi_devices));
+ at91_add_device_spi(0, NULL);
+}
+
/*
* USB OHCI Host port
*/
@@ -168,6 +184,7 @@ static int pm9g45_devices_init(void)
add_generic_device_res("w1-gpio", DEVICE_ID_SINGLE, NULL, 0, &w1_pdata);
pm_add_device_nand();
+ ek_add_device_spi();
pm9g45_add_device_mci();
pm9g45_add_device_eth();
pm9g45_add_device_usbh();
--
1.7.7.2
#!/bin/sh
# boot kernel from bad block aware partition
cp /dev/nand0.kernel.bb /dev/mem.kernel
bootargs="quiet console=ttyS0,115200 panic=10 mem=64M"
bootargs="$bootargs root=/dev/mtdblock1 rootfstype=jffs2 ro"
bootargs="$bootargs wr_nic.macaddr=$macaddr"
bootz /dev/mem.kernel
# If it don't boot, show the menu
echo "Can't boot from NAND"
# Sleep 2 seconds so you can see the message and return to menu
sleep 2
menu -s boot
#!/bin/sh
# This script loads a wrboot script from the TFTP server and runs it.
if [ "x$eth0.ipaddr" = "x" ] || [ "$eth0.ipaddr" = "0.0.0.0" ]; then
dhcp 5;
fi
# fetch wrboot-<MAC> script, or <IP>/wrboot or wrboot
tftp wrboot-$eth0.ethaddr wrboot
if [ "$?" -ne "0" ]; then
sleep 1
tftp $eth0.ipaddr/wrboot wrboot
fi
if [ "$?" -ne "0" ]; then
sleep 1
tftp wrboot wrboot
fi
if [ "$?" -eq "0" ]; then
./wrboot
fi
# If the script doesn't boot return to menu after some time to read output
sleep 2
menu -s boot
#!/bin/sh
edit /env/config
. /env/config
saveenv
sleep 2
menu -s boot
#!/bin/sh
# If we are in the flashing procedure, start with the kernel and file system
# loaded into the DDR memory
memcmp -s /dev/mem -d /env/magicstr 0x71FFFFF8 0x0 8
if [ $? -eq 0 ]; then
echo "Booting kernel for NAND flashing procedure"
bootargs="console=ttyS0,115200 panic=10 mem=64M"
bootargs="$bootargs initrd=0x72000000,25M"
bootargs="$bootargs root=/dev/ram0"
addpart /dev/ram0 0x1000000@0x1000000(kernel)
addpart /dev/ram0 0x1000000@0x2000000(initrd)
bootm /dev/ram0.kernel
fi
#default value (can be overridden in /env/config)
preboot_timeout="3"
autoboot_timeout="5"
autoboot_select="1"
### Override default value using /env/config
. /env/config
echo "Starting up barebox [wrs3] (MAC=$eth0.ethaddr)"
### Generic setup
PATH=/env/bin
export PATH
if [ x$autoboot_timeout != x ]; then
menu_timeout="-A $autoboot_timeout"
fi
#Set 2nd LED ON (PA2)
gpio_set_value 33 0
PS1="wrs-$eth0.ethaddr# "
### Creating the partitions:
if [ -e /dev/mem.kernel ]; then
else
addpart /dev/mem 8M@0x71000000(kernel)
fi
if [ -e /dev/nand0.kernel ]; then
else
addpart /dev/nand0 256k@0x4000(bareboxenv),8M@0x100000(kernel),-@0x4000000(rootfs)
fi
if [ -e /dev/nand0.kernel.bb ]; then
else
nand -a /dev/nand0.*
fi
# Create the menu
#menu -r -m boot
menu -a -m boot -d "Welcome on WRSv3 Boot Sequence"
menu -e -a -m boot -c 'boot-nand' -d "boot from nand (default)"
menu -e -a -m boot -c 'boot-script' -d "boot from TFTP script"
menu -e -a -m boot -c 'edit-config' -d "edit config"
menu -e -a -m boot -c 'exit 0' -d "exit to shell"
menu -e -a -m boot -c reset -d "reboot"
# allow the user to see previous messages
echo "starting menu in ${preboot_timeout} seconds"
sleep ${preboot_timeout}
# Select by default a specific menu
menu -m boot -S -n $autoboot_select
#Use a timeout to let the user change the entry in menu
menu -s boot $menu_timeout
#!/bin/sh
## Please type Ctrl+D to Save-and-exit or Ctrl+C to Exit
## eth0.ethaddr corresponds to the MAC address of the switch, it can also be
## changes using flasher
# eth0.ethaddr=
## macaddr is the base MAC address to assign to the first switch port. All
## the other ports are sequentially assigned
# macaddr=
## You can set your networking parameters here
## If unset, then boot-script will use dhcp
## This is shipped as unset ("if false" below)
if false; then
eth0.serverip=192.168.1.1
eth0.ipaddr=192.168.1.2
eth0.netmask=255.255.255.0
eth0.gateway=192.168.1.254
fi
## Timeout to autoboot in the pre-selected menu
autoboot_timeout="5";
paperino
\ No newline at end of file
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment