Bug#580714: debian-installer: build installer image for Buffalo Linkstation Pro/Live

2010-05-24 Thread Martin Michlmayr
* Ryan Tandy tarp...@gmail.com [2010-05-21 14:45]:
 I've attached an updated patch, including a check for a minimum BOOTVER
 of 1.10.  I don't know precisely which versions exist in the wild but
 that is the lowest version I've encountered that is known to work.

Looks good to me.  Applied!
-- 
Martin Michlmayr
http://www.cyrius.com/



-- 
To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20100524125138.gt3...@jirafa.cyrius.com



Bug#580714: debian-installer: build installer image for Buffalo Linkstation Pro/Live

2010-05-24 Thread Ryan Tandy
On Mon, 2010-05-24 at 13:51 +0100, Martin Michlmayr wrote:
 Looks good to me.  Applied!

Great.  Thanks both Martin and Tim for your time and reviews. :)




-- 
To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/1274720792.2472.1.ca...@localhost.localdomain



Bug#580714: debian-installer: build installer image for Buffalo Linkstation Pro/Live

2010-05-21 Thread Ryan Tandy
On Thu, 2010-05-20 at 14:34 -0700, Ryan Tandy wrote:
 There definitely needs to be some kind of check in the script then to
 prevent people from accidentally bricking their boxes.  It looks like
 the Buffalo u-boot exposes a version in the BOOTVER environment
 variable: 1.01 for the original firmware, 1.10 for the updated (1.15
 or LSProV2) firmware.  We can easily check that in the script.  I'm
 going to flash a few different bootloaders into my Linkstation to
 verify that the BOOTVER does change.

The BOOTVER (which gets tacked on to the kernel command line,
incidentally) does seem to indicate the bootloader revision.  I verified
the 1.01 and 1.10 versions on my Linkstation for the original and
updated firmwares respectively.  Some other values are found at [1] and
are of interest for other boxes.

I've attached an updated patch, including a check for a minimum BOOTVER
of 1.10.  I don't know precisely which versions exist in the wild but
that is the lowest version I've encountered that is known to work.

Thanks,
Ryan

[1]
http://buffalo.nas-central.org/wiki/U-boot_Default_Environmental_Variables_and_Values
Index: installer/build/boot/arm/lspro-config-debian
===
--- installer/build/boot/arm/lspro-config-debian	(revision 0)
+++ installer/build/boot/arm/lspro-config-debian	(revision 0)
@@ -0,0 +1,66 @@
+#!/bin/sh
+
+# This code is covered by the GNU General Public License (GPLv2 or higher)
+
+NVRAM=$(which nvram)
+FW_PRINTENV=$(which fw_printenv)
+
+path=$(mount | grep ext2 | sed -n '/sda1/ {s/\/dev\/sda1 on \(.*\) type.*/\1/; p}')
+if [ -z $path ]; then
+	echo You have to create an ext2 filesystem on /dev/sda1
+	exit 1
+fi
+
+if [ ! -e $path/uImage.buffalo ]; then
+	echo You have to download the uImage.buffalo file from the debian-installer for Linkstation Pro/Live, and put it in $path
+	exit 1
+fi
+
+if [ ! -e $path/initrd.buffalo ]; then
+	echo You have to download the initrd.buffalo file from the debian-installer for Linkstation Pro/Live, and put it in $path
+	exit 1
+fi
+
+if [ -n $NVRAM ]; then
+	PRINTENV=$NVRAM -c printenv
+	SETENV=$NVRAM -c set
+	GETENV=$NVRAM -c get
+elif [ -n $FW_PRINTENV ]; then
+	if [ -z $(which fw_setenv) ]; then
+		echo Program fw_setenv not found, cannot modify U-Boot environment...
+		exit 1
+	elif [ ! -f /etc/fw_env.config ]; then
+		echo Configuration file for fw_printenv not found.
+		exit 1
+	else
+		PRINTENV=$FW_PRINTENV
+		SETENV=$(which fw_setenv)
+		GETENV=$FW_PRINTENV -n
+	fi
+else
+	echo No tool found for modifying U-Boot environment...
+	exit 1
+fi
+
+BOOTVER=$($GETENV buffalo_ver | sed 's/^.*=//')
+if [ -z $BOOTVER ]; then
+	echo Unable to detect Buffalo bootloader version.  Please ensure that your bootloader supports automatic initrd position/size detection.
+else
+	BOOTVER_MAJOR=${BOOTVER%.*}
+	BOOTVER_MINOR=${BOOTVER#*.}
+	if [ $BOOTVER_MAJOR -eq 1 -a $BOOTVER_MINOR -lt 10 ]; then
+		echo Incompatible bootloader version detected.  Please update to the latest firmware version.
+		exit 1
+	fi
+fi
+
+printf Saving U-Boot environment to ubootenv.bak... 
+$PRINTENV  ubootenv.bak
+echo done.
+
+echo Changing U-Boot environment... 
+$SETENV bootargs_root root=/dev/sda2 rw panic=5
+echo done.
+
+echo Please reboot your Linkstation.
Index: installer/build/config/armel/orion5x/netboot.cfg
===
--- installer/build/config/armel/orion5x/netboot.cfg	(revision 63243)
+++ installer/build/config/armel/orion5x/netboot.cfg	(working copy)
@@ -1,6 +1,6 @@
 MEDIA_TYPE = netboot image
 
-TARGET = $(TEMP_INITRD) $(TEMP_KERNEL) dns-323 kuroboxpro mv2120 ts209 ts409
+TARGET = $(TEMP_INITRD) $(TEMP_KERNEL) dns-323 kuroboxpro lspro mv2120 ts209 ts409
 EXTRANAME = $(MEDIUM)
 TYPE = netboot/network-console
 
@@ -35,6 +35,22 @@
 	update-manifest $(SOME_DEST)/$(EXTRANAME)/buffalo/kuroboxpro/uImage.buffalo Linux kernel for Kurobox Pro
 	update-manifest $(SOME_DEST)/$(EXTRANAME)/buffalo/kuroboxpro/initrd.buffalo initrd for Kurobox Pro
 
+# Buffalo Linkstation Pro/Live
+lspro:
+	mkdir -p $(SOME_DEST)/$(EXTRANAME)/buffalo/lspro
+	mkdir -p $(TEMP)/lspro
+	# Set machine id 1585 (0x0631)
+	devio  $(TEMP)/lspro/kernel 'wl 0xe3a01c06,4' 'wl 0xe3811031,4'
+	cat $(TEMP_KERNEL)  $(TEMP)/lspro/kernel
+	mkimage -A arm -O linux -T kernel -C none -a 0x8000 -e 0x8000 -n Debian kernel -d $(TEMP)/lspro/kernel $(TEMP)/lspro/kernel.uboot
+	cp $(TEMP)/lspro/kernel.uboot $(SOME_DEST)/$(EXTRANAME)/buffalo/lspro/uImage.buffalo
+	mkimage -A arm -O linux -T ramdisk -C gzip -a 0x0200 -e 0x0200 -n debian-installer ramdisk -d $(TEMP_INITRD) $(TEMP)/lspro/initrd.uboot
+	cp $(TEMP)/lspro/initrd.uboot $(SOME_DEST)/$(EXTRANAME)/buffalo/lspro/initrd.buffalo
+	install -m 744 boot/arm/lspro-config-debian $(SOME_DEST)/$(EXTRANAME)/buffalo/lspro/config-debian
+	update-manifest $(SOME_DEST)/$(EXTRANAME)/buffalo/lspro/config-debian Script to run debian-installer
+	update-manifest 

Bug#580714: debian-installer: build installer image for Buffalo Linkstation Pro/Live

2010-05-20 Thread Martin Michlmayr
* Ryan Tandy tarp...@gmail.com [2010-05-19 20:07]:
 Reading that message again reminded me that I did not implement a test
 for the bootloader version.  A note in the documentation recommending
 the latest firmware revision might suffice, but I'll also have a look
 at how the u-boot version might be detected from userspace.

Running 'strings' over the u-boot partition might work, but I'm not
sure if 'strings' is included in the LSPro firmware.  I doubt it is.

I'm not sure if there's another reliable way to figure out the
version.

 So indeed that line should read:
 $SETENV bootargs_root root=/dev/sda2 rw panic=5
 precisely as in Tim's email.

Ok, great.

Thanks for working on this, Ryan!
-- 
Martin Michlmayr
http://www.cyrius.com/



-- 
To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20100520111216.gk26...@jirafa.cyrius.com



Bug#580714: debian-installer: build installer image for Buffalo Linkstation Pro/Live

2010-05-20 Thread Tim Small
Hi,

First of all, thanks for the work on this - it's been on my TODO list
for about 2 years now :o(

Ryan Tandy wrote:
 I thought I'd read that entire thread, but as you can see the form I
 used in the patch is from an older message that Tim quotes.  My
 Linkstations work fine (on stock firmware as well) with the initrd=
 parameter removed entirely, so let's go with that.
   

Old linkstation stock-firmware versions won't boot at all with this
parameter removed - they won't boot the standard Buffalo Linux stuff
thereafter either

Perhaps it's good enough to just complain about these, or instruct the
user to use a certain minimum version.  As most people don't have serial
consoles, some semi-official Debian firmware which does netconsole (and
thus proper netboot etc. etc.) would probably be a big win, but that can
come later.

Cheers,

Tim.



-- 
To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/4bf59b8c.2030...@buttersideup.com



Bug#580714: debian-installer: build installer image for Buffalo Linkstation Pro/Live

2010-05-20 Thread Ryan Tandy
On Thu, May 20, 2010 at 1:29 PM, Tim Small t...@buttersideup.com wrote:
 Old linkstation stock-firmware versions won't boot at all with this
 parameter removed - they won't boot the standard Buffalo Linux stuff
 thereafter either

There definitely needs to be some kind of check in the script then to
prevent people from accidentally bricking their boxes.  It looks like
the Buffalo u-boot exposes a version in the BOOTVER environment
variable: 1.01 for the original firmware, 1.10 for the updated (1.15
or LSProV2) firmware.  We can easily check that in the script.  I'm
going to flash a few different bootloaders into my Linkstation to
verify that the BOOTVER does change.

Do you know what the precise effects are of using initrd= without the
size parameter?  As I understand it there is no form that allows us to
use initramfs with the old bootloader but if we can set it to
something that would still allow booting the Buffalo initrd that would
definitely be preferable.

Thanks,
Ryan



-- 
To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/aanlktikilil2yko3dkdctbzu4pao14yh4owgqrobk...@mail.gmail.com



Bug#580714: debian-installer: build installer image for Buffalo Linkstation Pro/Live

2010-05-19 Thread Martin Michlmayr
* Ryan Tandy tarp...@gmail.com [2010-05-07 16:17]:
 The attached patch adds a target to debian-installer to build a kernel
 image and ramdisk for the Linkstation Pro/Live platform, similar to the
 Kurobox Pro which is already supported.

I've copied Tim Small and John with whom I've previously had
conversations about the LS Pro.  Since I don't know a lot about the LS
and don't have such a device, I hope they can help with the code
review.

To me, this patch looks fine with one exception.  I wonder if this is
the right thing to do:

| $SETENV bootargs_root root=/dev/sda2 rw initrd=0x00800040

I know we have to modify the initrd= parameter because the default one
will not work.  However, afaict, Tim originally suggested to remove
the whole initrd= parameter; see
http://lists.debian.org/debian-arm/2008/08/msg00036.html

In any case, I'm fine with leaving it there as long as it will work
both with Debian and the original LS firmware.

Also, from Tim's message above, it seems that you've removed panic=5
from the command line.  Any reason why?

-- 
Martin Michlmayr
http://www.cyrius.com/



-- 
To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20100519200158.gf1...@jirafa.cyrius.com



Bug#580714: debian-installer: build installer image for Buffalo Linkstation Pro/Live

2010-05-19 Thread Ryan Tandy
On Wed, May 19, 2010 at 1:01 PM, Martin Michlmayr t...@cyrius.com wrote:
 To me, this patch looks fine with one exception.  I wonder if this is
 the right thing to do:

 | $SETENV bootargs_root root=/dev/sda2 rw initrd=0x00800040

 I know we have to modify the initrd= parameter because the default one
 will not work.  However, afaict, Tim originally suggested to remove
 the whole initrd= parameter; see
 http://lists.debian.org/debian-arm/2008/08/msg00036.html

I thought I'd read that entire thread, but as you can see the form I
used in the patch is from an older message that Tim quotes.  My
Linkstations work fine (on stock firmware as well) with the initrd=
parameter removed entirely, so let's go with that.

Reading that message again reminded me that I did not implement a test
for the bootloader version.  A note in the documentation recommending
the latest firmware revision might suffice, but I'll also have a look
at how the u-boot version might be detected from userspace.

 Also, from Tim's message above, it seems that you've removed panic=5
 from the command line.  Any reason why?

A typo on my part; thanks for catching it.

So indeed that line should read:
$SETENV bootargs_root root=/dev/sda2 rw panic=5
precisely as in Tim's email.

Thanks,
Ryan



--
To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/aanlktinsdxvx1ih-j6vsg3rffs5teibdmzbk8inwe...@mail.gmail.com



Bug#580714: debian-installer: build installer image for Buffalo Linkstation Pro/Live

2010-05-07 Thread Ryan Tandy
Package: debian-installer
Version: 20100211
Severity: wishlist
Tags: patch

The attached patch adds a target to debian-installer to build a kernel
image and ramdisk for the Linkstation Pro/Live platform, similar to the
Kurobox Pro which is already supported.
Index: installer/build/boot/arm/lspro-config-debian
===
--- installer/build/boot/arm/lspro-config-debian	(revision 0)
+++ installer/build/boot/arm/lspro-config-debian	(revision 0)
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+# This code is covered by the GNU General Public License (GPLv2 or higher)
+
+NVRAM=$(which nvram)
+FW_PRINTENV=$(which fw_printenv)
+
+path=$(mount | grep ext2 | sed -n '/sda1/ {s/\/dev\/sda1 on \(.*\) type.*/\1/; p}')
+if [ -z $path ]; then
+	echo You have to create an ext2 filesystem on /dev/sda1
+	exit 1
+fi
+
+if [ ! -e $path/uImage.buffalo ]; then
+	echo You have to download the uImage.buffalo file from the debian-installer for Linkstation Pro/Live, and put it in $path
+	exit 1
+fi
+
+if [ ! -e $path/initrd.buffalo ]; then
+	echo You have to download the initrd.buffalo file from the debian-installer for Linkstation Pro/Live, and put it in $path
+	exit 1
+fi
+
+if [ -n $NVRAM ]; then
+	PRINTENV=$NVRAM -c printenv
+	SETENV=$NVRAM -c set
+elif [ -n $FW_PRINTENV ]; then
+	if [ -z $(which fw_setenv) ]; then
+		echo Program fw_setenv not found, cannot modify U-Boot environment...
+		exit 1
+	elif [ ! -f /etc/fw_env.config ]; then
+		echo Configuration file for fw_printenv not found.
+		exit 1
+	else
+		PRINTENV=$FW_PRINTENV
+		SETENV=$(which fw_setenv)
+	fi
+else
+	echo No tool found for modifying U-Boot environment...
+	exit 1
+fi
+
+printf Saving U-Boot environment to ubootenv.bak... 
+$PRINTENV  ubootenv.bak
+echo done.
+
+echo Changing U-Boot environment... 
+$SETENV bootargs_root root=/dev/sda2 rw initrd=0x00800040
+echo done.
+
+echo Please reboot your Linkstation Pro.
Index: installer/build/config/armel/orion5x/netboot.cfg
===
--- installer/build/config/armel/orion5x/netboot.cfg	(revision 63088)
+++ installer/build/config/armel/orion5x/netboot.cfg	(working copy)
@@ -1,6 +1,6 @@
 MEDIA_TYPE = netboot image
 
-TARGET = $(TEMP_INITRD) $(TEMP_KERNEL) dns-323 kuroboxpro mv2120 ts209 ts409
+TARGET = $(TEMP_INITRD) $(TEMP_KERNEL) dns-323 kuroboxpro lspro mv2120 ts209 ts409
 EXTRANAME = $(MEDIUM)
 TYPE = netboot/network-console
 
@@ -35,6 +35,22 @@
 	update-manifest $(SOME_DEST)/$(EXTRANAME)/buffalo/kuroboxpro/uImage.buffalo Linux kernel for Kurobox Pro
 	update-manifest $(SOME_DEST)/$(EXTRANAME)/buffalo/kuroboxpro/initrd.buffalo initrd for Kurobox Pro
 
+# Buffalo Linkstation Pro/Live
+lspro:
+	mkdir -p $(SOME_DEST)/$(EXTRANAME)/buffalo/lspro
+	mkdir -p $(TEMP)/lspro
+	# Set machine id 1585 (0x0631)
+	devio  $(TEMP)/lspro/kernel 'wl 0xe3a01c06,4' 'wl 0xe3811031,4'
+	cat $(TEMP_KERNEL)  $(TEMP)/lspro/kernel
+	mkimage -A arm -O linux -T kernel -C none -a 0x8000 -e 0x8000 -n Debian kernel -d $(TEMP)/lspro/kernel $(TEMP)/lspro/kernel.uboot
+	cp $(TEMP)/lspro/kernel.uboot $(SOME_DEST)/$(EXTRANAME)/buffalo/lspro/uImage.buffalo
+	mkimage -A arm -O linux -T ramdisk -C gzip -a 0x0200 -e 0x0200 -n debian-installer ramdisk -d $(TEMP_INITRD) $(TEMP)/lspro/initrd.uboot
+	cp $(TEMP)/lspro/initrd.uboot $(SOME_DEST)/$(EXTRANAME)/buffalo/lspro/initrd.buffalo
+	install -m 744 boot/arm/lspro-config-debian $(SOME_DEST)/$(EXTRANAME)/buffalo/lspro/config-debian
+	update-manifest $(SOME_DEST)/$(EXTRANAME)/buffalo/lspro/config-debian Script to run debian-installer
+	update-manifest $(SOME_DEST)/$(EXTRANAME)/buffalo/lspro/uImage.buffalo Linux kernel for Linkstation Pro/Live
+	update-manifest $(SOME_DEST)/$(EXTRANAME)/buffalo/lspro/initrd.buffalo initrd for Linkstation Pro/Live
+
 # HP Media Vault mv2120
 mv2120:
 	mkdir -p $(SOME_DEST)/$(EXTRANAME)/hp/mv2120