Debian Bug report logs - #421359
Needs to be written to flash on upgrades

version graph

Package: apex-nslu2; Maintainer for apex-nslu2 is Marc Singer <elf@debian.org>; Source for apex-nslu2 is src:apex.

Reported by: Martin Michlmayr <tbm@cyrius.com>

Date: Sat, 28 Apr 2007 09:18:01 UTC

Severity: normal

Found in version apex/1.4.15

Fixed in version apex/1.4.15.1

Done: Marc Singer <elf@buici.com>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, joey@debian.org, Marc Singer <elf@debian.org>:
Bug#421359; Package apex-nslu2. Full text and rfc822 format available.

Acknowledgement sent to Martin Michlmayr <tbm@cyrius.com>:
New Bug report received and forwarded. Copy sent to joey@debian.org, Marc Singer <elf@debian.org>. Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Martin Michlmayr <tbm@cyrius.com>
To: submit@bugs.debian.org
Subject: Needs to be written to flash on upgrades
Date: Sat, 28 Apr 2007 11:14:27 +0200
Package: apex-nslu2
Version: 1.4.15

At the moment, the versions of apex-nslu2 are not written to flash.
We need to figure out some way to do this eventually.  I suppose we
could copy some code from flash-kernel to apex-nslu2's postinst, or
maybe have apex-nslu2 depend on flash-kernel and then have
apex-nslu2's postinst call flash-kernel in some special way.

The other problem is that Debian's flash is padded with zeros rather
than FFs as APEX expects.  So we might have to store the environment,
clear it (with FFs) and then restore it.  Some initial thoughts on
this can be found in
http://lists.debian.org/debian-arm/2007/02/msg00014.html
but I'm not sure I'm the right person to work on this.

Joey, do you think look into this?
-- 
Martin Michlmayr
http://www.cyrius.com/



Information forwarded to debian-bugs-dist@lists.debian.org, Marc Singer <elf@debian.org>:
Bug#421359; Package apex-nslu2. Full text and rfc822 format available.

Acknowledgement sent to Marc Singer <elf@buici.com>:
Extra info received and forwarded to list. Copy sent to Marc Singer <elf@debian.org>. Full text and rfc822 format available.

Message #10 received at submit@bugs.debian.org (full text, mbox):

From: Marc Singer <elf@buici.com>
To: Martin Michlmayr <tbm@cyrius.com>, 421359@bugs.debian.org
Cc: submit@bugs.debian.org
Subject: Re: Bug#421359: Needs to be written to flash on upgrades
Date: Mon, 7 May 2007 21:12:55 -0700
On Sat, Apr 28, 2007 at 11:14:27AM +0200, Martin Michlmayr wrote:
> Package: apex-nslu2
> Version: 1.4.15
> 
> At the moment, the versions of apex-nslu2 are not written to flash.
> We need to figure out some way to do this eventually.  I suppose we
> could copy some code from flash-kernel to apex-nslu2's postinst, or
> maybe have apex-nslu2 depend on flash-kernel and then have
> apex-nslu2's postinst call flash-kernel in some special way.

Let me see if I understand what you are saying.  When users upgrade
apex, they don't get a new boot loader as they would expect with LILO
or GRUB.

Sounds like a reasonable thing to do for them as long as it is already
installed.  We can use the environment scanning application to
determine if APEX is present.

> The other problem is that Debian's flash is padded with zeros rather
> than FFs as APEX expects.  So we might have to store the environment,
> clear it (with FFs) and then restore it.  Some initial thoughts on
> this can be found in
> http://lists.debian.org/debian-arm/2007/02/msg00014.html
> but I'm not sure I'm the right person to work on this.

If we are going to automate the procedure of reflashing the boot
loader, we can add support for clearing the environment when we do
this.

> Joey, do you think look into this?

Is there an important reason why Debian pads with zeroes?

Cheers.
 



Information forwarded to debian-bugs-dist@lists.debian.org, Marc Singer <elf@debian.org>:
Bug#421359; Package apex-nslu2. Full text and rfc822 format available.

Acknowledgement sent to Marc Singer <elf@buici.com>:
Extra info received and forwarded to list. Copy sent to Marc Singer <elf@debian.org>. Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Marc Singer <elf@debian.org>:
Bug#421359; Package apex-nslu2. Full text and rfc822 format available.

Acknowledgement sent to Martin Michlmayr <tbm@cyrius.com>:
Extra info received and forwarded to list. Copy sent to Marc Singer <elf@debian.org>. Full text and rfc822 format available.

Message #20 received at 421359@bugs.debian.org (full text, mbox):

From: Martin Michlmayr <tbm@cyrius.com>
To: Marc Singer <elf@buici.com>
Cc: 421359@bugs.debian.org
Subject: Re: Bug#421359: Needs to be written to flash on upgrades
Date: Wed, 9 May 2007 07:32:44 +0200
* Marc Singer <elf@buici.com> [2007-05-07 21:12]:
> Let me see if I understand what you are saying.  When users upgrade
> apex, they don't get a new boot loader as they would expect with LILO
> or GRUB.

Yep, exactly.  Obviously, we could just document this and tell people
how they can upgrade it themselves, but I don't think this is optimal.
Ideally, we should automatically do it for them.

> Is there an important reason why Debian pads with zeroes?

Not really.  I think it would be possible to change it, but then again
this wouldn't really help because we still need to support old
installations and those use zeroes.
-- 
Martin Michlmayr
http://www.cyrius.com/



Information forwarded to debian-bugs-dist@lists.debian.org, Marc Singer <elf@debian.org>:
Bug#421359; Package apex-nslu2. Full text and rfc822 format available.

Acknowledgement sent to "Gordon Farquharson" <gordonfarquharson@gmail.com>:
Extra info received and forwarded to list. Copy sent to Marc Singer <elf@debian.org>. Full text and rfc822 format available.

Message #25 received at 421359@bugs.debian.org (full text, mbox):

From: "Gordon Farquharson" <gordonfarquharson@gmail.com>
To: 421359@bugs.debian.org
Subject: flash-kernel: patch to support APEX (nslu2 only)
Date: Sun, 3 Jun 2007 23:58:23 -0600
[Message part 1 (text/plain, inline)]
Hi All

Attached is a patch that enables flash-kernel to  write APEX to the
NSLU2 flash. It pads the mtdblock with 0xffs (so apex-env works), and
it also preserves any existing APEX configuration environment. I have
tested the patch with apex-1.4.15 and apex-1.5.6 (not yet in Debian).

Assuming that the APEX configuration environment starts at a fixed
offset from the end of the mtdblock, the script could be simplified by
not writing out as many 0xffs to mtdblock2. This method would preserve
the configuration environment. However, apex-env ensures that the
format of the configuration environment is current, which may or may
not be important in the future.

It may be useful to add command line parameters to flash-kernel, to
support only writing APEX or the kernel/initramfs to flash.
Alternatively, it may be useful to create a flash-apex script which
could then be called in the apex-nslu2 postinst script.

I am a relative novice when it comes to scripting, so please make
suggestions for improvements to the code. Once everybody is happy,
I'll commit this version of flash-kernel to SVN.

Gordon

-- 
Gordon Farquharson
[flash-kernel-apex.patch (text/x-patch, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org, Marc Singer <elf@debian.org>:
Bug#421359; Package apex-nslu2. Full text and rfc822 format available.

Acknowledgement sent to Marc Singer <elf@buici.com>:
Extra info received and forwarded to list. Copy sent to Marc Singer <elf@debian.org>. Full text and rfc822 format available.

Message #30 received at 421359@bugs.debian.org (full text, mbox):

From: Marc Singer <elf@buici.com>
To: Gordon Farquharson <gordonfarquharson@gmail.com>
Cc: Rod Whitby <rod@whitby.id.au>, Martin Michlmayr <tbm@cyrius.com>, Joey Hess <joeyh@debian.org>, Marcus Better <marcus@better.se>, debian-arm@lists.debian.org, Rob Lockhart <rlockhar@gmail.com>, 421359@bugs.debian.org
Subject: Re: nslu2 startup with automatic fat-slug detection
Date: Tue, 26 Jun 2007 21:07:49 -0700
On Tue, Jun 26, 2007 at 09:07:16PM -0600, Gordon Farquharson wrote:
> Hi Marc
> 
> On 6/26/07, Marc Singer <elf@buici.com> wrote:
> 
> >I recall that there was a thread of discussion about automatically
> >upgrading APEX when a new package is installed.  Was this resolved?
> >In order for me to install a new APEX, I had to take the
> >/boot/apex.flash image, byte swap it, and then put the sercomm header
> >on it.  I can also put a copy of apex with all of those steps already
> >taken into /boot so that it is really easy to upgrade (or downgrade
> >for that matter).
> 
> A while ago, I submitted a patch to flash-kernel [1] which will write
> apex to mtdblock2 as part of the flash-kernel script. As I mentioned
> in my response to #421359, it is easy to make this a separate script.

Sounds good.  I was thinking that it would be handy to have a script
that can do this in one go, but it looks like all of the necessary plumbing is available in flash-kernel.

In reading your script, I noticed a couple of things.  You really
don't need to restore the environment if you don't erase it.  It's at
the end of the block and should be out of the way.  APEX is good about
maintaining compatibility with previous versions of the environment,
so nothing to worry about there.

It also seems to me that you are best off setting the sercomm_header
length to the length of APEX and not the length of the whole block.
In this way, you only need to write the extent of APEX plus the size
of the sercomm header.  I know that the kernel will perform a complete
write in any case, but it more precise to pass the sercomm header with
the APEX length.

Cheers.

P.S.  It is interesting (to me) to see how you use the *= notation to
eliminate default variable contents.  :-)



Information forwarded to debian-bugs-dist@lists.debian.org, Marc Singer <elf@debian.org>:
Bug#421359; Package apex-nslu2. Full text and rfc822 format available.

Acknowledgement sent to Marc Singer <elf@buici.com>:
Extra info received and forwarded to list. Copy sent to Marc Singer <elf@debian.org>. Full text and rfc822 format available.

Message #35 received at 421359@bugs.debian.org (full text, mbox):

From: Marc Singer <elf@buici.com>
To: Gordon Farquharson <gordonfarquharson@gmail.com>
Cc: Rod Whitby <rod@whitby.id.au>, Martin Michlmayr <tbm@cyrius.com>, Joey Hess <joeyh@debian.org>, Marcus Better <marcus@better.se>, debian-arm@lists.debian.org, Rob Lockhart <rlockhar@gmail.com>, 421359@bugs.debian.org
Subject: Re: Bug#421359: nslu2 startup with automatic fat-slug detection
Date: Wed, 27 Jun 2007 08:03:53 -0700
On Tue, Jun 26, 2007 at 09:07:49PM -0700, Marc Singer wrote:
> On Tue, Jun 26, 2007 at 09:07:16PM -0600, Gordon Farquharson wrote:
> > Hi Marc
> > 
> > On 6/26/07, Marc Singer <elf@buici.com> wrote:
> > 
> > >I recall that there was a thread of discussion about automatically
> > >upgrading APEX when a new package is installed.  Was this resolved?
> > >In order for me to install a new APEX, I had to take the
> > >/boot/apex.flash image, byte swap it, and then put the sercomm header
> > >on it.  I can also put a copy of apex with all of those steps already
> > >taken into /boot so that it is really easy to upgrade (or downgrade
> > >for that matter).
> > 
> > A while ago, I submitted a patch to flash-kernel [1] which will write
> > apex to mtdblock2 as part of the flash-kernel script. As I mentioned
> > in my response to #421359, it is easy to make this a separate script.

I had another thought about this.  It may be worthwhile to make sure
to install APEX only if it is already present in the Loader partition
and if there is a Loader partition.  Some people may choose to install
APEX as the primary boot loader.

There is a mkboot script for x86, should we do the same?



Information forwarded to debian-bugs-dist@lists.debian.org, Marc Singer <elf@debian.org>:
Bug#421359; Package apex-nslu2. Full text and rfc822 format available.

Acknowledgement sent to "Gordon Farquharson" <gordonfarquharson@gmail.com>:
Extra info received and forwarded to list. Copy sent to Marc Singer <elf@debian.org>. Full text and rfc822 format available.

Message #40 received at 421359@bugs.debian.org (full text, mbox):

From: "Gordon Farquharson" <gordonfarquharson@gmail.com>
To: "Marc Singer" <elf@buici.com>
Cc: "Rod Whitby" <rod@whitby.id.au>, "Martin Michlmayr" <tbm@cyrius.com>, "Joey Hess" <joeyh@debian.org>, "Marcus Better" <marcus@better.se>, debian-arm@lists.debian.org, "Rob Lockhart" <rlockhar@gmail.com>, 421359@bugs.debian.org
Subject: Re: Bug#421359: nslu2 startup with automatic fat-slug detection
Date: Thu, 28 Jun 2007 00:39:29 -0600
Hi Marc

Thanks very much for your comments on the patch. I'll incorporate them
into a revised version.

On 6/27/07, Marc Singer <elf@buici.com> wrote:

> I had another thought about this.  It may be worthwhile to make sure
> to install APEX only if it is already present in the Loader partition
> and if there is a Loader partition.  Some people may choose to install
> APEX as the primary boot loader.

Currently, the patch does check for a partition called "Loader", but
it does not check whether APEX is present. However, I am not sure that
this step is necessary (see below).

+		mtdloader=$(mtdblock Loader)
+		if [ -z "$mtdloader" ]; then
+			error "Cannot find mtd partition 'Loader'"
+		fi

> There is a mkboot script for x86, should we do the same?

I like the idea of creating a separate script to flash APEX. We add
the script to the apex-nslu2 package, and run it as part of postinst
when APEX is upgraded. In this case, we shouldn't need to check if
APEX is present in the Loader partition, because we can assume that
APEX is being installed as the second stage bootloader.

With reference to your comment on using APEX as the primary
bootloader: I think that it would be dangerous at the moment to
provide an easy way for people to flash APEX as the primary
bootloader, because people may actually do it without a full
appreciation of what they are doing.

BTW, I'll be away for from Friday this week to Sunday next week, so I
won't have time to work on the changes until after the 8th of July.

Gordon

-- 
Gordon Farquharson
GnuPG Key ID: 32D6D676



Information forwarded to debian-bugs-dist@lists.debian.org, Marc Singer <elf@debian.org>:
Bug#421359; Package apex-nslu2. Full text and rfc822 format available.

Acknowledgement sent to "Gordon Farquharson" <gordonfarquharson@gmail.com>:
Extra info received and forwarded to list. Copy sent to Marc Singer <elf@debian.org>. Full text and rfc822 format available.

Message #45 received at 421359@bugs.debian.org (full text, mbox):

From: "Gordon Farquharson" <gordonfarquharson@gmail.com>
To: "Marc Singer" <elf@buici.com>, 421359@bugs.debian.org
Cc: "Rod Whitby" <rod@whitby.id.au>, "Martin Michlmayr" <tbm@cyrius.com>, "Joey Hess" <joeyh@debian.org>, "Marcus Better" <marcus@better.se>, debian-arm@lists.debian.org, "Rob Lockhart" <rlockhar@gmail.com>
Subject: Re: Bug#421359: nslu2 startup with automatic fat-slug detection
Date: Thu, 28 Jun 2007 00:46:23 -0600
On 6/26/07, Marc Singer <elf@buici.com> wrote:

> P.S.  It is interesting (to me) to see how you use the *= notation to
> eliminate default variable contents.  :-)

I did that only to make it easier for me to parse the output of
apex-env. I couldn't figure out how to write a neat awk and cut
expression for lines that could contain one or the other of '=' and
'*=' between the key and value. In the end, I think that it turned out
to better solution than setting all of the parameters, but I arrived
at that solution by accident :-)

Gordon

-- 
Gordon Farquharson
GnuPG Key ID: 32D6D676



Information forwarded to debian-bugs-dist@lists.debian.org, Marc Singer <elf@debian.org>:
Bug#421359; Package apex-nslu2. Full text and rfc822 format available.

Acknowledgement sent to Marc Singer <elf@buici.com>:
Extra info received and forwarded to list. Copy sent to Marc Singer <elf@debian.org>. Full text and rfc822 format available.

Message #50 received at 421359@bugs.debian.org (full text, mbox):

From: Marc Singer <elf@buici.com>
To: Gordon Farquharson <gordonfarquharson@gmail.com>, 421359@bugs.debian.org
Cc: Rod Whitby <rod@whitby.id.au>, Martin Michlmayr <tbm@cyrius.com>, Joey Hess <joeyh@debian.org>, Marcus Better <marcus@better.se>, debian-arm@lists.debian.org, Rob Lockhart <rlockhar@gmail.com>
Subject: Re: Bug#421359: nslu2 startup with automatic fat-slug detection
Date: Thu, 28 Jun 2007 06:15:19 -0700
On Thu, Jun 28, 2007 at 12:39:29AM -0600, Gordon Farquharson wrote:
> I like the idea of creating a separate script to flash APEX. We add
> the script to the apex-nslu2 package, and run it as part of postinst
> when APEX is upgraded. In this case, we shouldn't need to check if
> APEX is present in the Loader partition, because we can assume that
> APEX is being installed as the second stage bootloader.

Good point.

> With reference to your comment on using APEX as the primary
> bootloader: I think that it would be dangerous at the moment to
> provide an easy way for people to flash APEX as the primary
> bootloader, because people may actually do it without a full
> appreciation of what they are doing.

Ah, but the key here is that a user *may* have installed APEX as the
primary loader and we don't want to perturb their system if we don't
(in scipts) properly understand their configuration.  As long as the
install script is smart about when it installs and avoids corrupting
the flash, we should be ok.

> 
> BTW, I'll be away for from Friday this week to Sunday next week, so I
> won't have time to work on the changes until after the 8th of July.

No worries.

> 
> Gordon
> 
> -- 
> Gordon Farquharson
> GnuPG Key ID: 32D6D676



Information forwarded to debian-bugs-dist@lists.debian.org, Marc Singer <elf@debian.org>:
Bug#421359; Package apex-nslu2. Full text and rfc822 format available.

Acknowledgement sent to Martin Michlmayr <tbm@cyrius.com>:
Extra info received and forwarded to list. Copy sent to Marc Singer <elf@debian.org>. Full text and rfc822 format available.

Message #55 received at 421359@bugs.debian.org (full text, mbox):

From: Martin Michlmayr <tbm@cyrius.com>
To: Gordon Farquharson <gordonfarquharson@gmail.com>
Cc: Joey Hess <joeyh@debian.org>, Marc Singer <elf@buici.com>, 421359@bugs.debian.org
Subject: Re: #421359 patch submitted
Date: Fri, 28 Sep 2007 13:19:45 +0200
* Gordon Farquharson <gordonfarquharson@gmail.com> [2007-06-04 00:08]:
> I submitted a patch for flash-kernel to address #421359.
>
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=421359

What's the status of this patch?
-- 
Martin Michlmayr
http://www.cyrius.com/




Information forwarded to debian-bugs-dist@lists.debian.org, Marc Singer <elf@debian.org>:
Bug#421359; Package apex-nslu2. Full text and rfc822 format available.

Acknowledgement sent to "Gordon Farquharson" <gordonfarquharson@gmail.com>:
Extra info received and forwarded to list. Copy sent to Marc Singer <elf@debian.org>. Full text and rfc822 format available.

Message #60 received at 421359@bugs.debian.org (full text, mbox):

From: "Gordon Farquharson" <gordonfarquharson@gmail.com>
To: "Martin Michlmayr" <tbm@cyrius.com>
Cc: "Joey Hess" <joeyh@debian.org>, "Marc Singer" <elf@buici.com>, "Rod Whitby" <rod@whitby.id.au>, 421359@bugs.debian.org
Subject: Re: #421359 patch submitted
Date: Sun, 30 Sep 2007 23:15:27 -0600
[Message part 1 (text/plain, inline)]
Hi Martin

On 9/28/07, Martin Michlmayr <tbm@cyrius.com> wrote:

> What's the status of this patch?

I think that we should ditch the patch, and include the attached
script (flash-apex) in the apex-nslu2 package. The script flashes the
file /boot/apex.flash to the FIS partition named "Loader". The script
would therefore be called when installing apex-nslu2, or when apex is
upgraded manually.

The script (like the patch) still pads the MTD block with 0xffs. Marc
had suggested that it didn't need to overwrite the APEX configuration
area. However, the etch installer padded the MTD block with zeros
instead of 0xffs which meant that one could not use apex-env to change
the configuration area. This script will therefore correct this
problem on previous installations and maintain any custom APEX
environment settings (e.g. if the user had changed the envrioment
settings with Phil Endecott's apexctl).

The script has been tested on the NSLU2. It should probably also
include support for the NAS100D (assuming the NAS100D uses APEX with
Debian - I have CC'd Rod on this email to solicit comments from him).
Are we planning to have a apex-nas100d package?

The script uses functions that have been taken from the flash-kernel
script. We could put these functions in a separate file and include
that file in both flash-kernel and flash-apex. I'm not sure in which
package the file containing the common functions would exist.

Gordon

-- 
Gordon Farquharson
GnuPG Key ID: 32D6D676
[flash-apex (application/octet-stream, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org, Marc Singer <elf@debian.org>:
Bug#421359; Package apex-nslu2. Full text and rfc822 format available.

Acknowledgement sent to Rod Whitby <rod@whitby.id.au>:
Extra info received and forwarded to list. Copy sent to Marc Singer <elf@debian.org>. Full text and rfc822 format available.

Message #65 received at 421359@bugs.debian.org (full text, mbox):

From: Rod Whitby <rod@whitby.id.au>
To: Gordon Farquharson <gordonfarquharson@gmail.com>
Cc: Martin Michlmayr <tbm@cyrius.com>, Joey Hess <joeyh@debian.org>, Marc Singer <elf@buici.com>, 421359@bugs.debian.org
Subject: Re: #421359 patch submitted
Date: Mon, 01 Oct 2007 16:36:45 +0930
Gordon Farquharson wrote:
> The script has been tested on the NSLU2. It should probably also
> include support for the NAS100D (assuming the NAS100D uses APEX with
> Debian - I have CC'd Rod on this email to solicit comments from him).
> Are we planning to have a apex-nas100d package?

It's not possible to easily flash the nas100d from userspace at the
moment - the fis directory on the nas100d has checksums enabled, so you
can't simply flash the mtd partition - you need to correctly update the
fis directory with the correct length and checksum too.

So I wouldn't bother considering nas100d in this round, until I get
around to adding checksum support to the fis userspace tool.

-- Rod




Information forwarded to debian-bugs-dist@lists.debian.org, Marc Singer <elf@debian.org>:
Bug#421359; Package apex-nslu2. Full text and rfc822 format available.

Acknowledgement sent to "Gordon Farquharson" <gordonfarquharson@gmail.com>:
Extra info received and forwarded to list. Copy sent to Marc Singer <elf@debian.org>. Full text and rfc822 format available.

Message #70 received at 421359@bugs.debian.org (full text, mbox):

From: "Gordon Farquharson" <gordonfarquharson@gmail.com>
To: "Martin Michlmayr" <tbm@cyrius.com>
Cc: "Joey Hess" <joeyh@debian.org>, "Marc Singer" <elf@buici.com>, 421359@bugs.debian.org
Subject: Re: Bug#421359: #421359 patch submitted
Date: Mon, 29 Oct 2007 21:33:14 -0600
Hi Martin and Joey

On 9/30/07, Gordon Farquharson <gordonfarquharson@gmail.com> wrote:

> I think that we should ditch the patch, and include the attached
> script (flash-apex) in the apex-nslu2 package. The script flashes the
> file /boot/apex.flash to the FIS partition named "Loader". The script
> would therefore be called when installing apex-nslu2, or when apex is
> upgraded manually.

I'd like to add the flash-apex script (submitted previously) to the
apex package, and have it run after apex is installed. Is this a good
idea? If so, is the postinst script the best way to achieve this goal,
and are there any references other than the one below for writing
postinst scripts?

http://www.debian.org/doc/debian-policy/ch-maintainerscripts.html

Thanks.

Gordon

-- 
Gordon Farquharson
GnuPG Key ID: 32D6D676




Information forwarded to debian-bugs-dist@lists.debian.org, Marc Singer <elf@debian.org>:
Bug#421359; Package apex-nslu2. Full text and rfc822 format available.

Acknowledgement sent to "Gordon Farquharson" <gordonfarquharson@gmail.com>:
Extra info received and forwarded to list. Copy sent to Marc Singer <elf@debian.org>. Full text and rfc822 format available.

Message #75 received at 421359@bugs.debian.org (full text, mbox):

From: "Gordon Farquharson" <gordonfarquharson@gmail.com>
To: "Marc Singer" <elf@buici.com>
Cc: "Martin Michlmayr" <tbm@cyrius.com>, "Joey Hess" <joeyh@debian.org>, 421359@bugs.debian.org
Subject: Re: Bug#421359: #421359 patch submitted
Date: Sun, 2 Mar 2008 21:58:28 -0700
Hi Marc

On Mon, Oct 29, 2007 at 8:33 PM, Gordon Farquharson
<gordonfarquharson@gmail.com> wrote:

>  I'd like to add the flash-apex script (submitted previously) to the
>  apex package, and have it run after apex is installed. Is this a good
>  idea? If so, is the postinst script the best way to achieve this goal,
>  and are there any references other than the one below for writing
>  postinst scripts?

The patch below is my attempt at adding the flash-apex script and a
postinst script to the apex package. The diff is created between apex
version 1.5.13 and an imaginary version 1.5.14.

Would it be possible for you to incorporate these changes, along with
the changes in #451882, into your latest apex version, and upload the
new package?

Thanks.

Gordon

diff -Naur apex-1.5.13/debian/changelog apex-1.5.14/debian/changelog
--- apex-1.5.13/debian/changelog	2007-06-25 18:25:59.000000000 -0600
+++ apex-1.5.14/debian/changelog	2008-03-02 21:16:41.000000000 -0700
@@ -1,3 +1,10 @@
+apex (1.5.14) UNRELEASED; urgency=low
+
+  * Add flash-apex script.
+  * Add postinst script to run flash-apex on installation.
+
+ -- Marc Singer <elf@buici.com>  Sun,  2 Mar 2008 21:14:09 -0700
+
 apex (1.5.8) unstable; urgency=low

   * Added 'release' comand to the apex-env.
diff -Naur apex-1.5.13/debian/postinst apex-1.5.14/debian/postinst
--- apex-1.5.13/debian/postinst	1969-12-31 17:00:00.000000000 -0700
+++ apex-1.5.14/debian/postinst	2008-03-02 17:57:00.000000000 -0700
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+# Abort if any command returns an error value
+set -e
+
+if [ "$1" = "configure" ] && [ -x /usr/sbin/flash-apex ]; then
+	/usr/sbin/flash-apex
+fi
diff -Naur apex-1.5.13/debian/rules apex-1.5.14/debian/rules
--- apex-1.5.13/debian/rules	2007-06-25 18:14:03.000000000 -0600
+++ apex-1.5.14/debian/rules	2008-03-02 21:37:39.000000000 -0700
@@ -58,6 +58,7 @@
 	install -m 0644 src/arch-arm/rom/apex.bin\
 		  debian/$(package)/boot/apex.flash
 	install -m 0755 usr/apex-env debian/$(package)/usr/sbin
+	install -m 0755 usr/flash-apex debian/$(package)/usr/sbin
 	dh_strip
 	dh_installchangelogs ChangeLog
 	dh_installdocs -a
diff -Naur apex-1.5.13/usr/flash-apex apex-1.5.14/usr/flash-apex
--- apex-1.5.13/usr/flash-apex	1969-12-31 17:00:00.000000000 -0700
+++ apex-1.5.14/usr/flash-apex	2008-03-02 17:33:26.000000000 -0700
@@ -0,0 +1,92 @@
+#!/bin/sh
+
+# Copyright (C) 2006  Joey Hess  <joeyh@debian.org>
+# Copyright (C) 2006  Martin Michlmayr <tbm@cyrius.com>
+# Copyright (C) 2007  Gordon Farquharson <gordonfarquharson@gmail.com>
+
+# This code is covered by the GNU General Public License.
+
+set -e
+
+error() {
+	echo "$@" >&2
+	exit 1
+}
+
+check_mtd() {
+	if [ ! -e /proc/mtd ]; then
+		error "/proc/mtd doesn't exist"
+	fi
+}
+
+mtdblock() {
+	grep "$1" /proc/mtd | cut -d: -f 1 | sed 's/mtd/\/dev\/mtdblock/'
+}
+
+# See http://www.nslu2-linux.org/wiki/Info/BootFlash -- the NSLU2 uses a
+# 16 byte MTD header, the first four bytes (big endian) give the length of
+# the remainder of the image, and the remaining bytes are zero.  Generate
+# this header.
+sercomm_header() {
+	perl -e 'print pack("N4", shift)' "$1"
+}
+
+nslu2_swap() {
+	if [ "$little_endian" ]; then
+		devio "<<"$1 "xp $,4"
+	else
+		cat $1
+	fi
+}
+
+apex_file=/boot/apex.flash
+
+if [ ! -e $apex_file ]; then
+	error "Can't find $apex_file"
+fi
+
+machine=$(grep "^Hardware" /proc/cpuinfo | sed 's/Hardware\s*:\s*//')
+case "$machine" in
+	"Linksys NSLU2")
+		check_mtd
+		case "$(dpkg --print-architecture)" in
+			arm|armel)
+				little_endian=1
+			;;
+			armeb)
+				little_endian=0
+			;;
+		esac
+		mtdloader=$(mtdblock Loader)
+		if [ -z "$mtdloader" ]; then
+			error "Cannot find mtd partition 'Loader'"
+		fi
+		lsize=$(wc -c $apex_file | awk '{print $1}')
+		mtdblocksize=131072
+		pad=$(expr $mtdblocksize - $lsize - 16)
+		# Store non-default APEX configuration
+		tmp=$(tempfile)
+		(apex-env printenv | egrep -v '\*=') > $tmp
+		printf "Flashing loader: " >&2
+		(
+			sercomm_header $(expr $lsize + 16)
+			nslu2_swap $apex_file
+			perl -e "print pack(\"C\", 0xff) x $pad"
+		) > "$mtdloader" || error "failed."
+		# Write the stored APEX configuration. For each line,
+		# remove whitespace from the start and the end of the
+		# line, and use all the characters, including
+		# whitespace, after '=' as the value.
+		while read line
+		do
+			key=$(echo $line | cut -d '=' -f1 | awk '{print $1}')
+			val=$(echo $line | awk '{$1=""; $2=""; print substr($0,3)}')
+			apex-env setenv "$key" "$val"
+		done < $tmp
+		rm $tmp
+		echo "done." >&2
+	;;
+	*)
+		error "Unsupported platform."
+	;;
+esac

-- 
Gordon Farquharson
GnuPG Key ID: 32D6D676




Information forwarded to debian-bugs-dist@lists.debian.org, Marc Singer <elf@debian.org>:
Bug#421359; Package apex-nslu2. Full text and rfc822 format available.

Acknowledgement sent to "Gordon Farquharson" <gordonfarquharson@gmail.com>:
Extra info received and forwarded to list. Copy sent to Marc Singer <elf@debian.org>. Full text and rfc822 format available.

Message #80 received at 421359@bugs.debian.org (full text, mbox):

From: "Gordon Farquharson" <gordonfarquharson@gmail.com>
To: "Joey Hess" <joeyh@debian.org>
Cc: "Marc Singer" <elf@buici.com>, "Martin Michlmayr" <tbm@cyrius.com>, 421359@bugs.debian.org
Subject: Re: Bug#421359: #421359 patch submitted
Date: Wed, 5 Mar 2008 21:49:02 -0700
Hi Joey

On Sun, Mar 2, 2008 at 9:58 PM, Gordon Farquharson
<gordonfarquharson@gmail.com> wrote:

>  diff -Naur apex-1.5.13/debian/postinst apex-1.5.14/debian/postinst
>  --- apex-1.5.13/debian/postinst 1969-12-31 17:00:00.000000000 -0700
>  +++ apex-1.5.14/debian/postinst 2008-03-02 17:57:00.000000000 -0700
>  @@ -0,0 +1,8 @@
>  +#!/bin/sh
>  +
>  +# Abort if any command returns an error value
>  +set -e
>  +
>  +if [ "$1" = "configure" ] && [ -x /usr/sbin/flash-apex ]; then
>  +       /usr/sbin/flash-apex
>  +fi

Does this postinst script look ok to you?

Gordon

-- 
Gordon Farquharson
GnuPG Key ID: 32D6D676




Information forwarded to debian-bugs-dist@lists.debian.org, Marc Singer <elf@debian.org>:
Bug#421359; Package apex-nslu2. Full text and rfc822 format available.

Acknowledgement sent to Marc Singer <elf@buici.com>:
Extra info received and forwarded to list. Copy sent to Marc Singer <elf@debian.org>. Full text and rfc822 format available.

Message #85 received at 421359@bugs.debian.org (full text, mbox):

From: Marc Singer <elf@buici.com>
To: Gordon Farquharson <gordonfarquharson@gmail.com>
Cc: Martin Michlmayr <tbm@cyrius.com>, Joey Hess <joeyh@debian.org>, 421359@bugs.debian.org
Subject: Re: Bug#421359: #421359 patch submitted
Date: Thu, 20 Mar 2008 20:11:11 -0700
On Sun, Mar 02, 2008 at 09:58:28PM -0700, Gordon Farquharson wrote:
> 
> The patch below is my attempt at adding the flash-apex script and a
> postinst script to the apex package. The diff is created between apex
> version 1.5.13 and an imaginary version 1.5.14.
> 
> Would it be possible for you to incorporate these changes, along with
> the changes in #451882, into your latest apex version, and upload the
> new package?

I just got this, so I'll take a look.




Information forwarded to debian-bugs-dist@lists.debian.org, Marc Singer <elf@debian.org>:
Bug#421359; Package apex-nslu2. Full text and rfc822 format available.

Acknowledgement sent to Joey Hess <joeyh@debian.org>:
Extra info received and forwarded to list. Copy sent to Marc Singer <elf@debian.org>. Full text and rfc822 format available.

Message #90 received at 421359@bugs.debian.org (full text, mbox):

From: Joey Hess <joeyh@debian.org>
To: 421359@bugs.debian.org
Subject: Re: Bug#421359: #421359 patch submitted
Date: Mon, 12 May 2008 12:57:47 -0400
[Message part 1 (text/plain, inline)]
A few changes to the postinst script. No need to hardocde /usr/sbin,
this is always in the path when running a postinst script. #DEBHELPER# 
should be put in for debhelper's use. No need to test if flash-apex is
executable, it always will be when dpkg runs postinst configure.

#!/bin/sh
set -e

#DEBHELPER#

if [ "$1" = configure ]; then
	flash-apex
fi

-- 
see shy jo
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Marc Singer <elf@debian.org>:
Bug#421359; Package apex-nslu2. Full text and rfc822 format available.

Acknowledgement sent to Martin Michlmayr <tbm@cyrius.com>:
Extra info received and forwarded to list. Copy sent to Marc Singer <elf@debian.org>. Full text and rfc822 format available.

Message #95 received at 421359@bugs.debian.org (full text, mbox):

From: Martin Michlmayr <tbm@cyrius.com>
To: Joey Hess <joeyh@debian.org>, 421359@bugs.debian.org
Cc: Gordon Farquharson <gordonfarquharson@gmail.com>
Subject: Re: Bug#421359: #421359 patch submitted
Date: Mon, 12 May 2008 20:45:31 +0200
* Joey Hess <joeyh@debian.org> [2008-05-12 12:57]:
> A few changes to the postinst script. No need to hardocde /usr/sbin,
> this is always in the path when running a postinst script. #DEBHELPER# 
> should be put in for debhelper's use. No need to test if flash-apex is
> executable, it always will be when dpkg runs postinst configure.

Thanks for your comments, Joey.

Marc, can you please upload a new apex-nslu2 with fixes for #421359
and #451882.  The ramdisk for 2.6.25 (in unstable) is larger than 4 MB
(on armel, not on arm), and some people reported already that their
nslu2 no longer boots... if there's no upload within 2 weeks, I intend
to NMU.

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




Information forwarded to debian-bugs-dist@lists.debian.org, Marc Singer <elf@debian.org>:
Bug#421359; Package apex-nslu2. Full text and rfc822 format available.

Acknowledgement sent to Marc Singer <elf@buici.com>:
Extra info received and forwarded to list. Copy sent to Marc Singer <elf@debian.org>. Full text and rfc822 format available.

Message #100 received at 421359@bugs.debian.org (full text, mbox):

From: Marc Singer <elf@buici.com>
To: Martin Michlmayr <tbm@cyrius.com>, 421359@bugs.debian.org
Cc: Joey Hess <joeyh@debian.org>, Gordon Farquharson <gordonfarquharson@gmail.com>
Subject: Re: Bug#421359: #421359 patch submitted
Date: Sat, 17 May 2008 18:27:58 -0700
On Mon, May 12, 2008 at 08:45:31PM +0200, Martin Michlmayr wrote:
> * Joey Hess <joeyh@debian.org> [2008-05-12 12:57]:
> > A few changes to the postinst script. No need to hardocde /usr/sbin,
> > this is always in the path when running a postinst script. #DEBHELPER# 
> > should be put in for debhelper's use. No need to test if flash-apex is
> > executable, it always will be when dpkg runs postinst configure.
> 
> Thanks for your comments, Joey.
> 
> Marc, can you please upload a new apex-nslu2 with fixes for #421359
> and #451882.  The ramdisk for 2.6.25 (in unstable) is larger than 4 MB
> (on armel, not on arm), and some people reported already that their
> nslu2 no longer boots... if there's no upload within 2 weeks, I intend
> to NMU.
> 
> -- 
> Martin Michlmayr
> http://www.cyrius.com/
> 
> 
> 

Sorry for the delay.  Spam abatement underway.

I'll upload a new version this weekend.




Information forwarded to debian-bugs-dist@lists.debian.org, Marc Singer <elf@debian.org>:
Bug#421359; Package apex-nslu2. Full text and rfc822 format available.

Acknowledgement sent to Martin Michlmayr <tbm@cyrius.com>:
Extra info received and forwarded to list. Copy sent to Marc Singer <elf@debian.org>. Full text and rfc822 format available.

Message #105 received at 421359@bugs.debian.org (full text, mbox):

From: Martin Michlmayr <tbm@cyrius.com>
To: Marc Singer <elf@buici.com>
Cc: 421359@bugs.debian.org, Joey Hess <joeyh@debian.org>, Gordon Farquharson <gordonfarquharson@gmail.com>, Kevin Price <kp@kevin-price.de>
Subject: Re: Bug#421359: #421359 patch submitted
Date: Sun, 18 May 2008 11:15:26 +0200
* Marc Singer <elf@buici.com> [2008-05-17 18:27]:
> I'll upload a new version this weekend.

Thanks, that'd be great.  The base system is frozen alredy but I hope
we can get an exception for this APEX upload.  However, this means you
should make as few changes as possible.  Can you please make an upload
with only the patches for #451882 (ramdisk size) and #421359
(flash-apex script).  The other patch I've seen floating around sets
EABI for the Debian armeb and armel config.  This one might be a good
diea too (but please note that src/mach-ixp42x/debian-nslu2-armel_config
is a symlink to debian-nslu2-arm_config; so you'd have to remove the
symlink first, copy the file and then make the EABI change).

Thanks a lot for your work.  Once this upload is done and (hopefully)
moved to lenny, Kevin Price has a couple of other changes.  I asked
him to file bug reports for these.
-- 
Martin Michlmayr
http://www.cyrius.com/




Information forwarded to debian-bugs-dist@lists.debian.org, Marc Singer <elf@debian.org>:
Bug#421359; Package apex-nslu2. Full text and rfc822 format available.

Acknowledgement sent to Martin Michlmayr <tbm@cyrius.com>:
Extra info received and forwarded to list. Copy sent to Marc Singer <elf@debian.org>. Full text and rfc822 format available.

Message #110 received at 421359@bugs.debian.org (full text, mbox):

From: Martin Michlmayr <tbm@cyrius.com>
To: Marc Singer <elf@buici.com>
Cc: 421359@bugs.debian.org, Joey Hess <joeyh@debian.org>, Gordon Farquharson <gordonfarquharson@gmail.com>, Kevin Price <kp@kevin-price.de>
Subject: Re: Bug#421359: #421359 patch submitted
Date: Sun, 18 May 2008 12:01:55 +0200
* Martin Michlmayr <tbm@cyrius.com> [2008-05-18 11:15]:
> * Marc Singer <elf@buici.com> [2008-05-17 18:27]:
> > I'll upload a new version this weekend.
> 
> Thanks, that'd be great.  The base system is frozen alredy but I hope
> we can get an exception for this APEX upload.  However, this means you
> should make as few changes as possible.

Just to clarify, this also means that the upload should be 1.4.15 plus
those patches, not apex-1.5.13.  However, after the updated 1.4.15 is
in lenny, we should test 1.5.13 for the nslu2.
-- 
Martin Michlmayr
http://www.cyrius.com/




Information forwarded to debian-bugs-dist@lists.debian.org, Marc Singer <elf@debian.org>:
Bug#421359; Package apex-nslu2. Full text and rfc822 format available.

Acknowledgement sent to Marc Singer <elf@buici.com>:
Extra info received and forwarded to list. Copy sent to Marc Singer <elf@debian.org>. Full text and rfc822 format available.

Message #115 received at 421359@bugs.debian.org (full text, mbox):

From: Marc Singer <elf@buici.com>
To: Martin Michlmayr <tbm@cyrius.com>, 421359@bugs.debian.org
Cc: Joey Hess <joeyh@debian.org>, Gordon Farquharson <gordonfarquharson@gmail.com>, Kevin Price <kp@kevin-price.de>
Subject: Re: Bug#421359: #421359 patch submitted
Date: Sun, 18 May 2008 14:01:01 -0700
On Sun, May 18, 2008 at 12:01:55PM +0200, Martin Michlmayr wrote:
> * Martin Michlmayr <tbm@cyrius.com> [2008-05-18 11:15]:
> > * Marc Singer <elf@buici.com> [2008-05-17 18:27]:
> > > I'll upload a new version this weekend.
> > 
> > Thanks, that'd be great.  The base system is frozen alredy but I hope
> > we can get an exception for this APEX upload.  However, this means you
> > should make as few changes as possible.
> 
> Just to clarify, this also means that the upload should be 1.4.15 plus
> those patches, not apex-1.5.13.  However, after the updated 1.4.15 is
> in lenny, we should test 1.5.13 for the nslu2.
> -- 
> Martin Michlmayr
> http://www.cyrius.com/
> 
> 
> 

Let me see if I understand.  You want 1.4.15 with Kevin's patch and
nothing else?




Information forwarded to debian-bugs-dist@lists.debian.org, Marc Singer <elf@debian.org>:
Bug#421359; Package apex-nslu2. Full text and rfc822 format available.

Acknowledgement sent to Marc Singer <elf@buici.com>:
Extra info received and forwarded to list. Copy sent to Marc Singer <elf@debian.org>. Full text and rfc822 format available.

Message #120 received at 421359@bugs.debian.org (full text, mbox):

From: Marc Singer <elf@buici.com>
To: Martin Michlmayr <tbm@cyrius.com>, 421359@bugs.debian.org
Cc: Joey Hess <joeyh@debian.org>, Gordon Farquharson <gordonfarquharson@gmail.com>, Kevin Price <kp@kevin-price.de>
Subject: Re: Bug#421359: #421359 patch submitted
Date: Sun, 18 May 2008 14:09:23 -0700
On Sun, May 18, 2008 at 11:15:26AM +0200, Martin Michlmayr wrote:
> * Marc Singer <elf@buici.com> [2008-05-17 18:27]:
> > I'll upload a new version this weekend.
> 
> Thanks, that'd be great.  The base system is frozen alredy but I hope
> we can get an exception for this APEX upload.  However, this means you
> should make as few changes as possible.  Can you please make an upload
> with only the patches for #451882 (ramdisk size) and #421359
> (flash-apex script).  The other patch I've seen floating around sets
> EABI for the Debian armeb and armel config.  This one might be a good
> diea too (but please note that src/mach-ixp42x/debian-nslu2-armel_config
> is a symlink to debian-nslu2-arm_config; so you'd have to remove the
> symlink first, copy the file and then make the EABI change).
> 
> Thanks a lot for your work.  Once this upload is done and (hopefully)
> moved to lenny, Kevin Price has a couple of other changes.  I asked
> him to file bug reports for these.
> -- 
> Martin Michlmayr
> http://www.cyrius.com/
> 
> 
> 

What I'm going to probably do is roll back to the 1.4.15 release and
apply Kevin's patch.  I'll also fixup the configurations so that the
EABI change is only in the armel config.





Information forwarded to debian-bugs-dist@lists.debian.org, Marc Singer <elf@debian.org>:
Bug#421359; Package apex-nslu2. Full text and rfc822 format available.

Acknowledgement sent to Martin Michlmayr <tbm@cyrius.com>:
Extra info received and forwarded to list. Copy sent to Marc Singer <elf@debian.org>. Full text and rfc822 format available.

Message #125 received at 421359@bugs.debian.org (full text, mbox):

From: Martin Michlmayr <tbm@cyrius.com>
To: Marc Singer <elf@buici.com>
Cc: 421359@bugs.debian.org, Joey Hess <joeyh@debian.org>, Gordon Farquharson <gordonfarquharson@gmail.com>, Kevin Price <kp@kevin-price.de>
Subject: Re: Bug#421359: #421359 patch submitted
Date: Sun, 18 May 2008 23:28:08 +0200
* Marc Singer <elf@buici.com> [2008-05-18 14:01]:
> Let me see if I understand.  You want 1.4.15 with Kevin's patch and
> nothing else?

I believe Kevin's patch contains some changes we don't need.

I think this one is what we want:

--- apex-1.4.xx.orig/debian/rules
+++ apex-1.4.xx/debian/rules
@@ -58,6 +58,7 @@
 	install -m 0644 src/arch-arm/rom/apex.bin\
 		  debian/$(package)/boot/apex.flash
 	install -m 0755 usr/apex-env debian/$(package)/usr/sbin
+	install -m 0755 usr/flash-apex debian/$(package)/usr/sbin
 	dh_strip
 	dh_installchangelogs ChangeLog
 	dh_installdocs -a
--- apex-1.4.xx.orig/debian/postinst
+++ apex-1.4.xx/debian/postinst
@@ -0,0 +1,8 @@
+#!/bin/sh
+set -e
+
+#DEBHELPER#
+
+if [ "$1" = configure ]; then
+	flash-apex
+fi
--- apex-1.4.xx.orig/src/mach-ixp42x/debian-nslu2-arm_config
+++ apex-1.4.xx/src/mach-ixp42x/debian-nslu2-arm_config
@@ -48,7 +48,7 @@
 CONFIG_NOR_BANK0_START=0x50000000
 CONFIG_NOR_BANK0_LENGTH=0x00800000
 CONFIG_MACH="ixp42x"
-CONFIG_RAMDISK_SIZE=0x00400000
+CONFIG_RAMDISK_SIZE=0x005FFFF0
 CONFIG_MACH_NSLU2=y
 # CONFIG_MACH_NAS100D is not set
 # CONFIG_MACH_DSMG600 is not set
--- apex-1.4.xx.orig/src/mach-ixp42x/debian-nslu2-armeb_config
+++ apex-1.4.xx/src/mach-ixp42x/debian-nslu2-armeb_config
@@ -48,7 +48,7 @@
 CONFIG_NOR_BANK0_START=0x50000000
 CONFIG_NOR_BANK0_LENGTH=0x00800000
 CONFIG_MACH="ixp42x"
-CONFIG_RAMDISK_SIZE=0x00400000
+CONFIG_RAMDISK_SIZE=0x005FFFF0
 CONFIG_MACH_NSLU2=y
 # CONFIG_MACH_NAS100D is not set
 # CONFIG_MACH_DSMG600 is not set
--- apex-1.4.xx.orig/usr/flash-apex
+++ apex-1.4.xx/usr/flash-apex
@@ -0,0 +1,92 @@
+#!/bin/sh
+
+# Copyright (C) 2006  Joey Hess  <joeyh@debian.org>
+# Copyright (C) 2006  Martin Michlmayr <tbm@cyrius.com>
+# Copyright (C) 2007  Gordon Farquharson <gordonfarquharson@gmail.com>
+
+# This code is covered by the GNU General Public License.
+
+set -e
+
+error() {
+	echo "$@" >&2
+	exit 1
+}
+
+check_mtd() {
+	if [ ! -e /proc/mtd ]; then
+		error "/proc/mtd doesn't exist"
+	fi
+}
+
+mtdblock() {
+	grep "$1" /proc/mtd | cut -d: -f 1 | sed 's/mtd/\/dev\/mtdblock/'
+}
+
+# See http://www.nslu2-linux.org/wiki/Info/BootFlash -- the NSLU2 uses a
+# 16 byte MTD header, the first four bytes (big endian) give the length of
+# the remainder of the image, and the remaining bytes are zero.  Generate
+# this header.
+sercomm_header() {
+	perl -e 'print pack("N4", shift)' "$1"
+}
+
+nslu2_swap() {
+	if [ "$little_endian" ]; then
+		devio "<<"$1 "xp $,4"
+	else
+		cat $1
+	fi
+}
+
+apex_file=/boot/apex.flash
+
+if [ ! -e $apex_file ]; then
+	error "Can't find $apex_file"
+fi
+
+machine=$(grep "^Hardware" /proc/cpuinfo | sed 's/Hardware\s*:\s*//')
+case "$machine" in
+	"Linksys NSLU2")
+		check_mtd
+		case "$(dpkg --print-architecture)" in
+			arm|armel)
+				little_endian=1
+			;;
+			armeb)
+				little_endian=0
+			;;
+		esac
+		mtdloader=$(mtdblock Loader)
+		if [ -z "$mtdloader" ]; then
+			error "Cannot find mtd partition 'Loader'"
+		fi
+		lsize=$(wc -c $apex_file | awk '{print $1}')
+		mtdblocksize=131072
+		pad=$(expr $mtdblocksize - $lsize - 16)
+		# Store non-default APEX configuration
+		tmp=$(tempfile)
+		(apex-env printenv | egrep -v '\*=') > $tmp
+		printf "Flashing loader: " >&2
+		(
+			sercomm_header $(expr $lsize + 16)
+			nslu2_swap $apex_file
+			perl -e "print pack(\"C\", 0xff) x $pad"
+		) > "$mtdloader" || error "failed."
+		# Write the stored APEX configuration. For each line,
+		# remove whitespace from the start and the end of the
+		# line, and use all the characters, including
+		# whitespace, after '=' as the value.
+		while read line
+		do
+			key=$(echo $line | cut -d '=' -f1 | awk '{print $1}')
+			val=$(echo $line | awk '{$1=""; $2=""; print substr($0,3)}')
+			apex-env setenv "$key" "$val"
+		done < $tmp
+		rm $tmp
+		echo "done." >&2
+	;;
+	*)
+		error "Unsupported platform."
+	;;
+esac

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




Information forwarded to debian-bugs-dist@lists.debian.org, Marc Singer <elf@debian.org>:
Bug#421359; Package apex-nslu2. Full text and rfc822 format available.

Acknowledgement sent to Martin Michlmayr <tbm@cyrius.com>:
Extra info received and forwarded to list. Copy sent to Marc Singer <elf@debian.org>. Full text and rfc822 format available.

Message #130 received at 421359@bugs.debian.org (full text, mbox):

From: Martin Michlmayr <tbm@cyrius.com>
To: Marc Singer <elf@buici.com>
Cc: 421359@bugs.debian.org, Joey Hess <joeyh@debian.org>, Gordon Farquharson <gordonfarquharson@gmail.com>, Kevin Price <kp@kevin-price.de>
Subject: Re: Bug#421359: #421359 patch submitted
Date: Sun, 18 May 2008 23:28:42 +0200
* Marc Singer <elf@buici.com> [2008-05-18 14:09]:
> What I'm going to probably do is roll back to the 1.4.15 release and
> apply Kevin's patch.  I'll also fixup the configurations so that the
> EABI change is only in the armel config.

AFAIK the EABI change/support was introdued in 1.15.xx, so this is not
needed for 1.4.15.

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




Information forwarded to debian-bugs-dist@lists.debian.org, Marc Singer <elf@debian.org>:
Bug#421359; Package apex-nslu2. Full text and rfc822 format available.

Acknowledgement sent to Marc Singer <elf@buici.com>:
Extra info received and forwarded to list. Copy sent to Marc Singer <elf@debian.org>. Full text and rfc822 format available.

Message #135 received at 421359@bugs.debian.org (full text, mbox):

From: Marc Singer <elf@buici.com>
To: Martin Michlmayr <tbm@cyrius.com>, 421359@bugs.debian.org
Cc: Joey Hess <joeyh@debian.org>, Gordon Farquharson <gordonfarquharson@gmail.com>, Kevin Price <kp@kevin-price.de>
Subject: Re: Bug#421359: #421359 patch submitted
Date: Sun, 18 May 2008 15:05:16 -0700
On Sun, May 18, 2008 at 11:28:08PM +0200, Martin Michlmayr wrote:
> * Marc Singer <elf@buici.com> [2008-05-18 14:01]:
> > Let me see if I understand.  You want 1.4.15 with Kevin's patch and
> > nothing else?
> 
> I believe Kevin's patch contains some changes we don't need.
> 
> I think this one is what we want:

[deletia]

That's what I've included.  I added the man page for flash-apex as
well.

I'd have been done, but my slug appears to need debhelper updating....




Information forwarded to debian-bugs-dist@lists.debian.org, Marc Singer <elf@debian.org>:
Bug#421359; Package apex-nslu2. Full text and rfc822 format available.

Acknowledgement sent to Kevin Price <kp@kevin-price.de>:
Extra info received and forwarded to list. Copy sent to Marc Singer <elf@debian.org>. Full text and rfc822 format available.

Message #140 received at 421359@bugs.debian.org (full text, mbox):

From: Kevin Price <kp@kevin-price.de>
To: Marc Singer <elf@buici.com>
Cc: Martin Michlmayr <tbm@cyrius.com>, 421359@bugs.debian.org, Joey Hess <joeyh@debian.org>, Gordon Farquharson <gordonfarquharson@gmail.com>
Subject: Re: Bug#421359: #421359 patch submitted
Date: Mon, 19 May 2008 00:23:23 +0200
[Message part 1 (text/plain, inline)]
Hi Marc!

> That's what I've included.  I added the man page for flash-apex as
> well.

Thaks a lot!

> I'd have been done, but my slug appears to need debhelper updating....

What version of debhelper is needed? If plain 5 is not enough, we should
consider adding the correct build-dependency at least for the future
versions.

-- 
Kevin
http://www.kevin-price.de/

[signature.asc (application/pgp-signature, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org, Marc Singer <elf@debian.org>:
Bug#421359; Package apex-nslu2. Full text and rfc822 format available.

Acknowledgement sent to Kevin Price <kp@kevin-price.de>:
Extra info received and forwarded to list. Copy sent to Marc Singer <elf@debian.org>. Full text and rfc822 format available.

Message #145 received at 421359@bugs.debian.org (full text, mbox):

From: Kevin Price <kp@kevin-price.de>
To: Marc Singer <elf@buici.com>
Cc: Martin Michlmayr <tbm@cyrius.com>, Joey Hess <joeyh@debian.org>, 421359@bugs.debian.org, Gordon Farquharson <gordonfarquharson@gmail.com>
Subject: Re: Bug#421359: #421359 patch submitted
Date: Mon, 19 May 2008 00:58:50 +0200
[Message part 1 (text/plain, inline)]
Hey Marc,

I'm sure you knew this but just as a reminder:

> That's what I've included.  I added the man page for flash-apex as
> well.

Please also remeber adding the dependency of devio to debian/control,
whithout which flash-apex is useless. Thank you.

-- 
Kevin Price
http://www.kevin-price.de/

[signature.asc (application/pgp-signature, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org, Marc Singer <elf@debian.org>:
Bug#421359; Package apex-nslu2. Full text and rfc822 format available.

Acknowledgement sent to Martin Michlmayr <tbm@cyrius.com>:
Extra info received and forwarded to list. Copy sent to Marc Singer <elf@debian.org>. Full text and rfc822 format available.

Message #150 received at 421359@bugs.debian.org (full text, mbox):

From: Martin Michlmayr <tbm@cyrius.com>
To: Kevin Price <kp@kevin-price.de>
Cc: Marc Singer <elf@buici.com>, Joey Hess <joeyh@debian.org>, 421359@bugs.debian.org, Gordon Farquharson <gordonfarquharson@gmail.com>
Subject: Re: Bug#421359: #421359 patch submitted
Date: Mon, 19 May 2008 08:12:49 +0200
* Kevin Price <kp@kevin-price.de> [2008-05-19 00:58]:
> > That's what I've included.  I added the man page for flash-apex as
> > well.
> 
> Please also remeber adding the dependency of devio to debian/control,
> whithout which flash-apex is useless. Thank you.

Good point!
-- 
Martin Michlmayr
http://www.cyrius.com/




Reply sent to Marc Singer <elf@buici.com>:
You have taken responsibility. Full text and rfc822 format available.

Notification sent to Martin Michlmayr <tbm@cyrius.com>:
Bug acknowledged by developer. Full text and rfc822 format available.

Message #155 received at 421359-close@bugs.debian.org (full text, mbox):

From: Marc Singer <elf@buici.com>
To: 421359-close@bugs.debian.org
Subject: Bug#421359: fixed in apex 1.4.15.1
Date: Mon, 19 May 2008 16:02:02 +0000
Source: apex
Source-Version: 1.4.15.1

We believe that the bug you reported is fixed in the latest version of
apex, which is due to be installed in the Debian FTP archive:

apex-nslu2_1.4.15.1_arm.deb
  to pool/main/a/apex/apex-nslu2_1.4.15.1_arm.deb
apex_1.4.15.1.dsc
  to pool/main/a/apex/apex_1.4.15.1.dsc
apex_1.4.15.1.tar.gz
  to pool/main/a/apex/apex_1.4.15.1.tar.gz



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 421359@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Marc Singer <elf@buici.com> (supplier of updated apex package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.8
Date: Sun, 18 May 2008 14:37:51 -0700
Source: apex
Binary: apex-nslu2
Architecture: source arm
Version: 1.4.15.1
Distribution: unstable
Urgency: low
Maintainer: Marc Singer <elf@debian.org>
Changed-By: Marc Singer <elf@buici.com>
Description: 
 apex-nslu2 - APEX Boot Loader for Linksys NSLU2
Closes: 421359 451882
Changes: 
 apex (1.4.15.1) unstable; urgency=low
 .
   * Release of old APEX version during Debian freeze.
   * Adding flash-apex so that apex is written to flash on install of the
     package (closes: #421359).
   * Expanding CONFIG_RAMDISK_SIZE (closes: #451882).
Checksums-Sha1: 
 5c715990aa267fa27ba210feb1200f66cff66e3a 706 apex_1.4.15.1.dsc
 b881564cd70cb65837bba94d832823ceff7f4a75 1095806 apex_1.4.15.1.tar.gz
 b597de293a1d00e67e1775bd9ede6e12b608e710 54706 apex-nslu2_1.4.15.1_arm.deb
Checksums-Sha256: 
 c66495ee2c97221783fe713c6a2f23f25d55eb7c7c04591f851603e29e57bc08 706 apex_1.4.15.1.dsc
 b6ea26c0567aacaf1e313578a8442177ae02513a1d4faebfc36389bf9d2fbecc 1095806 apex_1.4.15.1.tar.gz
 286a7ee381343c284d1b72a05f75efa87cb505e271acce67871467252d789f5a 54706 apex-nslu2_1.4.15.1_arm.deb
Files: 
 bffacd9436d6287ff72c55d100e7d73d 706 admin optional apex_1.4.15.1.dsc
 0676db1584d4a6bb5e7eb35ba46ae9c7 1095806 admin optional apex_1.4.15.1.tar.gz
 eba626cf5414b9d390cfb2279987bd18 54706 admin optional apex-nslu2_1.4.15.1_arm.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFIMZeOV+jOBy6uXS0RAt9PAKCPH/CsVhhdDLjDFbr7jAAeSddRfQCfd6Nx
CVHgvHblube5F6lBf/tMix8=
=SaHT
-----END PGP SIGNATURE-----





Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Tue, 17 Jun 2008 07:39:11 GMT) Full text and rfc822 format available.

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Sun Apr 20 00:22:31 2014; Machine Name: buxtehude.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.