1Intro
2-----
3The Buffalo Linkstation Pro/Live, codename LS-XHL and LS-CHLv2, is a single
4disk NAS server. The PCBs of the LS-XHL and LS-CHLv2 are almost the same.
5The LS-XHL has a faster CPU and more RAM with a wider data bus, therefore
6the LS-XHL PCB has two SDRAM chips. Both have a Kirkwood CPU (Marvell
788F6281). The only on-board storage is a 4 Mbit SPI flash which stores the
8bootloader and its environment. The linux kernel and the initial ramdisk
9are loaded from the hard disk.
10
11Important! Changes since v2019.07
12---------------------------------
13In u-boot v2019.07 the driver for the SATA port was changed to a new
14one. This means that the old "ide" command and block interface is not
15supported anymore. More important, the boot commands have changed. You have
16to overwrite the boot commands in your envionment with the new ones:
17
18  env default -f bootcmd_legacy
19  env default -f bootcmd_hdd
20  saveenv
21
22Rescue Mode
23-----------
24These linkstations don't have a populated serial port. There is no way to
25access an (unmodified) board other than using the netconsole. If you want
26to recover from a bad environment setting or an empty environment, you can
27do this only with a working network connection.
28
29Therefore, on entering the resuce mode, a random ethernet address is
30generated if no valid address could be loaded from the environment variable
31'ethaddr' and a DHCP request is sent. After a successful DHCP response is
32received, the network settings are configured and the ncip is unset. Thus
33all netconsole packets are broadcasted and you can use the netconsole to
34access board from any host within the network segment. To determine the IP
35address assigned to the board, you either have to sniff the traffic or
36check the logs/leases of your DHCP server.
37
38The resuce mode is selected by holding the push button for at least one
39second, while powering-on the device. The status LED turns solid amber if
40the resuce mode is enabled, thus providing a visual feedback.
41
42Pressing the same button for at least 10 seconds on power-up will erase the
43environment and reset the board. In this case the visual indication will
44be:
45- blinking blue, for about one second
46- solid amber, for about nine seconds
47- blinking amber, until you release the button
48
49This ensures, that you still can recover a device with a broken
50environment by first erasing the environment and then entering the rescue
51mode.
52
53Once the rescue mode is started, use the ncb binary from the tools/
54directory to access your board. There is a helper script named
55'restore_env' to save your changes. It unsets all the network variables
56which were set by the rescue mode, saves your changes and then resets the
57board.
58
59The common use case for this is setting a MAC address. Let us assume you
60have an empty environment, the board comes up with the amber LED blinking.
61Then you enter the rescue mode, connect to the board with the ncb tool and
62use the following commands to set your MAC address:
63
64  setenv ethaddr 00:00:00:00:00:00
65  run restore_env
66
67Of course you need to replace the 00:00:00:00:00:00 with your valid MAC
68address, which can be found on a sticker on the bottom of your box.
69
70
71Status LED
72----------
73blinking blue
74  Bootloader is running normally.
75
76blinking amber
77  No ethaddr set. Use the `Rescue Mode` to set one.
78
79blinking red
80  Something bad happend during loading the operating system.
81
82The default behavior of the linux kernel is to turn on the blue LED. So if
83the blinking blue LED changes to solid blue the kernel was loaded
84successfully.
85
86
87Power-on Switch
88---------------
89The power-on switch is a software switch. If it is not in ON position when
90the bootloader starts, the bootloader will disable the HDD and USB power
91and stop the fan. Then it loops until the switch is in ON position again,
92enables the power and fan again and continue booting.
93
94
95Boot sources
96------------
97The environment defines several different boot sources:
98
99legacy
100  This is the default boot source. It loads the kernel and ramdisk from the
101  attached HDD using the original filenames. The load addresses were
102  modified to support loading larger kernels. But it should behave the same
103  as the original bootloader.
104
105hdd
106  Use this for new-style booting. Loads three files /vmlinuz, /initrd.img
107  and /dtb from the boot partition. This should work out of the box if you
108  have debian and the flash-kernel package installed.
109
110usb
111  Same as hdd expect, that the files are loaded from an attached USB mass
112  storage device and the filename for the device tree is kirkwood-lsxhl.dtb
113  (or kirkwood-lschlv2.dtb).
114
115net
116  Same as usb expect, that the file are loaded from the network.
117
118rescue
119  Automatically activated if the push button is pressed for at least one
120  second on power-up. Does a DHCP request and enables the network console.
121  See `Rescue Mode` for more information.
122
123You can change the boot source by setting the 'bootsource' variable to the
124corresponding value. Please note, that the restore_env script will the the
125bootsource back to 'legacy'.
126
127
128Flash map
129---------
13000000 - 5ffff   u-boot
13160000 - 6ffff   reserved, may be used to store dtb
13270000 - 7ffff   u-boot environment
133
134
135Compiling
136---------
137make lsxhl_config (or lschlv2_config)
138make u-boot.kwb
139
140
141Update your board
142-----------------
143Just flash the resulting u-boot.kwb to the beginning of the SPI flash. If
144you already have a bootloader CLI, you can use the following commands:
145
146 sf probe 0
147 bootp ${loadaddr} u-boot.kwb
148 sf erase 0 +${filelen}
149 sf write 0 ${fileaddr} ${filesize}
150