Bug#809476: Linux 4.4-rc6 fails to boot on QNAP TS-109

2016-01-10 Thread Martin Michlmayr
* Roger Shimizu  [2016-01-11 00:55]:
> On Sat, Jan 9, 2016 at 1:43 AM, Roger Shimizu  wrote:
> > I tried the patch again and find it's working on my Linkstation
> > LS-WTGL (orion5x with 64M memory)
> 
> Enclosed is the dmesg log and u-boot environment.
> Hope someone can help to find any clue from them.

Can you please open a new bug on flash-kernel with the logs.  The QNAP
and Buffalo devices are quite different, so there should be different
bug reports.

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



Bug#809476: Linux 4.4-rc6 fails to boot on QNAP TS-109

2016-01-10 Thread Roger Shimizu
On Sat, Jan 9, 2016 at 1:43 AM, Roger Shimizu  wrote:
> I tried the patch again and find it's working on my Linkstation
> LS-WTGL (orion5x with 64M memory)

Enclosed is the dmesg log and u-boot environment.
Hope someone can help to find any clue from them.

Cheers,
Roger


dmesg_LS-WTGL_4.4.0-rc8-orion5x.gz
Description: GNU Zip compressed data


LS-WTGL_env.txt.gz
Description: GNU Zip compressed data


Bug#809476: Linux 4.4-rc6 fails to boot on QNAP TS-109

2016-01-08 Thread Roger Shimizu
On Wed, Jan 6, 2016 at 9:41 PM, Roger Shimizu  wrote:
> On Thu, Dec 31, 2015 at 9:09 AM, Martin Michlmayr  wrote:
>> -U-Boot-Kernel-Address: 0x8000
>> +U-Boot-Kernel-Address: 0x00c08000
>
> I tried this on local db (/etc/flash-kernel/db) of my Linkstation, but
> it failed to boot.
> Except above change, did you also changed the address in uboot
> command? (like a few lines below)

I tried the patch again and find it's working on my Linkstation
LS-WTGL (orion5x with 64M memory)
I already send the news to another post [0]

So the patch enclosed at the end already confirmed to be working for 3
different kernels:
- jessie-backports: linux-image-4.3.0-0.bpo.1-orion5x (4.3.3-2~bpo8+1)
- sid: linux-image-4.3.0-1-orion5x (4.3.3-5)
- experimental: linux-image-4.4.0-rc8-orion5x (4.4~rc8-1~exp1)

>>> cp.b 0xff20 0x80 0x3f
>>> setenv bootargs console=ttyS0,115200n8 root=/dev/ram rw 
>>> initrd=0x80,0x3f
>>> bootm 0xff00
>
>> u-boot loads it like this:
>>
>> ## Booting image at 0040 ...
>>Load Address: 8000
>>Entry Point:  8000
>
> I also don't understand where the address "0040" comes from. It's
> neither in flash-kernel's db nor in uboot setting.
> From my understanding, the kernel image stores in flash, which address
> is 0xff00, and it will be copied to "8000" by uboot on boot
> time, then kernel will uncompress the image and then boot. Am I missed
> something?

I still don't understand these. So it'd be helpful if anyone can explain.
Thank you!

[0]: https://lists.debian.org/debian-arm/2016/01/msg00056.html

Last but not least, the patch for flash-kernel:

diff --git a/db/all.db b/db/all.db
index 8262e14..6343f03 100644
--- a/db/all.db
+++ b/db/all.db
@@ -72,7 +72,7 @@ Machine: Buffalo Linkstation LS-WTGL
 Kernel-Flavors: orion5x
 DTB-Id: orion5x-linkstation-lswtgl.dtb
 DTB-Append: yes
-U-Boot-Kernel-Address: 0x8000
+U-Boot-Kernel-Address: 0x00c08000
 U-Boot-Initrd-Address: 0x0
 Boot-Kernel-Path: /boot/uImage.buffalo
 Boot-Initrd-Path: /boot/initrd.buffalo



Bug#809476: Linux 4.4-rc6 fails to boot on QNAP TS-109

2016-01-06 Thread Roger Shimizu
[Resend previous email to keep ARM experts in CC]

On Thu, Dec 31, 2015 at 9:09 AM, Martin Michlmayr  wrote:
> I tried to boot Debian's 4.4-rc6 kernel on my QNAP TS-109 and it failed
> to boot with:
> [   19.380002] Unpacking initramfs...
> [   19.380044] Initramfs unpacking failed: junk in compressed archive

I see this error message on my Linkstation boxes for long time, but
most of time they just boot fine.
After seeing your report, now I understand the root cause why failing
sometimes. :-)

> -U-Boot-Kernel-Address: 0x8000
> +U-Boot-Kernel-Address: 0x00c08000

I tried this on local db (/etc/flash-kernel/db) of my Linkstation, but
it failed to boot.
Except above change, did you also changed the address in uboot
command? (like a few lines below)

>> cp.b 0xff20 0x80 0x3f
>> setenv bootargs console=ttyS0,115200n8 root=/dev/ram rw 
>> initrd=0x80,0x3f
>> bootm 0xff00

> u-boot loads it like this:
>
> ## Booting image at 0040 ...
>Load Address: 8000
>Entry Point:  8000

I also don't understand where the address "0040" comes from. It's
neither in flash-kernel's db nor in uboot setting.
>From my understanding, the kernel image stores in flash, which address
is 0xff00, and it will be copied to "8000" by uboot on boot
time, then kernel will uncompress the image and then boot. Am I missed
something?

What I intend to do is following your QNAP's way to fix things on Linkstation.
Any clue would be appreciated. Thank you!

Cheers,
Roger



Bug#809476: Linux 4.4-rc6 fails to boot on QNAP TS-109

2016-01-05 Thread Roger Shimizu
On Thu, Dec 31, 2015 at 9:09 AM, Martin Michlmayr  wrote:
> I tried to boot Debian's 4.4-rc6 kernel on my QNAP TS-109 and it failed
> to boot with:
> [   19.380002] Unpacking initramfs...
> [   19.380044] Initramfs unpacking failed: junk in compressed archive

I see this error message on my Linkstation boxes for long time, but
most of time they just boot fine.
After seeing your report, now I understand the root cause why failing
sometimes. :-)

> -U-Boot-Kernel-Address: 0x8000
> +U-Boot-Kernel-Address: 0x00c08000

I tried this on local db (/etc/flash-kernel/db) of my Linkstation, but
it failed to boot.
Except above change, did you also changed the address in uboot
command? (like a few lines below)

>> cp.b 0xff20 0x80 0x3f
>> setenv bootargs console=ttyS0,115200n8 root=/dev/ram rw 
>> initrd=0x80,0x3f
>> bootm 0xff00

> u-boot loads it like this:
>
> ## Booting image at 0040 ...
>Load Address: 8000
>Entry Point:  8000

I also don't understand where the address "0040" comes from. It's
neither in flash-kernel's db nor in uboot setting.
>From my understanding, the kernel image stores in flash, which address
is 0xff00, and it will be copied to "8000" by uboot on boot
time, then kernel will uncompress the image and then boot. Am I missed
something?

What I intend to do is following your QNAP's way to fix things on Linkstation.
Any clue would be appreciated. Thank you!

Cheers,
Roger



Bug#809476: Linux 4.4-rc6 fails to boot on QNAP TS-109

2016-01-01 Thread Ian Campbell
On Thu, 2015-12-31 at 08:20 -0800, Martin Michlmayr wrote:
> * Martin Michlmayr  [2015-12-30 16:09]:
> > I guess the kernel is uncompressed and overwrites part of the
> > ramdisk
> > located at 0x80.  I don't really get this part because
> > arch/arm/boot/Image is only 6.1 MB (but vmlinux is around 9 MB,
> > even
> > on the kernel that works).
> 
> Actually, now that I think about it, this makes perfect sense since
> we're loading a 2 MB image to 0x8000 which is then presumably
> decompressed right after the image leading to another 6 MB.  So around
> 8 MB.  If it's too large, it would overwrite the ramdisk at 0x80.

FWIW, makes sense to me.

Ian.



Bug#809476: Linux 4.4-rc6 fails to boot on QNAP TS-109

2015-12-31 Thread Martin Michlmayr
* Martin Michlmayr  [2015-12-30 16:09]:
> I guess the kernel is uncompressed and overwrites part of the ramdisk
> located at 0x80.  I don't really get this part because
> arch/arm/boot/Image is only 6.1 MB (but vmlinux is around 9 MB, even
> on the kernel that works).

Actually, now that I think about it, this makes perfect sense since
we're loading a 2 MB image to 0x8000 which is then presumably
decompressed right after the image leading to another 6 MB.  So around
8 MB.  If it's too large, it would overwrite the ramdisk at 0x80.

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



Bug#809476: Linux 4.4-rc6 fails to boot on QNAP TS-109

2015-12-30 Thread Martin Michlmayr
Package: linux
Version: 4.4~rc6-1~exp1
Severity: important

I tried to boot Debian's 4.4-rc6 kernel on my QNAP TS-109 and it failed
to boot with:
[   19.380002] Unpacking initramfs...
[   19.380044] Initramfs unpacking failed: junk in compressed archive

After spending ages bisecting and not getting anywhere, I spoke to Ben
Hutchings who thought it was a kernel size issue and that part of the
initramfs was now getting overwritten.  And he was right (disabling
some options made the kernel boot).

On the QNAP TS-109, the kernel/ramdisk are loaded like this:

> cp.b 0xff20 0x80 0x3f
> setenv bootargs console=ttyS0,115200n8 root=/dev/ram rw 
> initrd=0x80,0x3f
> bootm 0xff00

So the ramdisk is copied to memory while the kernel is loaded from flash
(where we have a 2 MB limit due to the partition size).

u-boot loads it like this:

## Booting image at 0040 ...
   Load Address: 8000
   Entry Point:  8000

This is the load address used by the original QNAP firmware.

I guess the kernel is uncompressed and overwrites part of the ramdisk
located at 0x80.  I don't really get this part because
arch/arm/boot/Image is only 6.1 MB (but vmlinux is around 9 MB, even
on the kernel that works).

Anyway, I guess we have two options:

1) In addition to ensuring the compressed kernel is below 2 MB (to fit
in the flash partition) we should ensure that the uncompressed kernel
is smaller than some limit.

or:

2) We could change the load address to 0x00c08000 which is after the
ramdisk (the ramdisk is loaded at 0x80 and can only be 4 MB due
to the size of the MTD partition).  u-boot says:
> Addresses 20M - 0M are saved for the U-Boot usage.
so I guess this is ok.  I made this change and the kernel and ramdisk
loaded correctly.

However, I don't fully understand the boot process.  I've copied some
ARM experts.  Can you comment whether using 0x00c08000 as the load
address is safe / the correct thing to do, or is there a better
solution?

If this is the right approach, I suggest the following patch to
flash-kernel:

diff --git a/db/all.db b/db/all.db
index 936d498..4344265 100644
--- a/db/all.db
+++ b/db/all.db
@@ -877,7 +877,7 @@ Kernel-Flavors: orion5x
 Machine-Id: 1565
 Mtd-Kernel: Kernel
 Mtd-Initrd: RootFS1
-U-Boot-Kernel-Address: 0x8000
+U-Boot-Kernel-Address: 0x00c08000
 Required-Packages: u-boot-tools
 Bootloader-Sets-Incorrect-Root: yes
 
@@ -898,7 +898,7 @@ Kernel-Flavors: orion5x
 Machine-Id: 1601
 Mtd-Kernel: Kernel
 Mtd-Initrd: RootFS1
-U-Boot-Kernel-Address: 0x8000
+U-Boot-Kernel-Address: 0x00c08000
 Required-Packages: u-boot-tools
 Bootloader-Sets-Incorrect-Root: yes
 

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