Welcome! Log In Create A New Profile

Advanced

Buffalo Terastation III TS-X4.0L/r5 (Sakura) From Stock 1.71(Buffalo Latest FW) ==>Debian Jessie/Stretch

Posted by Kapt Blasto 
I dug into the issue with the 4.19 kernel, I'm fairly sure it's the same as this one:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=908712

It looks like a fix is already pending, I'll try it out in the coming days.

In the meantime I've been working on a Debian Installer image for this device which sets up the kernel/startup scripts/initramfs hooks etc. I'm still working out exactly how I want to package/host all this.

once I get it all to a state where I'm comfortable posting it I'll make it all available. After that I'll see if I can do anything for the PCI support and other hardware components.
Sorry for the late reply, I ended up being overwelmed with my house renovation work.

Great news that you got the 4.19 compiled, do you mind sharing you .config here so we can work on the same basis? (also your Debian Stretch kernel 4.9 .config if you have it).


On my side, I got to review how to write a DT file so I can make this go forward for any future kernel.

As I only have a TS-WXL, and the the null-modem port offers read only data, I am having some issue when trying a vanilla 4.x as the machine type of my machine, doesn't match the automatically generated machine type of a kernel.

Can you provide me you machine type for the TS-WXL to see if the machine types on those models are somewhat equivalent or not?

For this patch to work properly, the first step is to ensure that anyone can compile the kernel with "Multiple machine support". That would be a great step to try to hit while I am trying a DT support.

Cheers,
Sounds good!

I'm testing my latest installer image today, assuming it works as expected I'll try and get everything posted on github to provide a good starting point.

Until then, here is the diff between Debian's config and the one I have working:

$ diff config-4.9.0-9-marvell linux-4.9.168/.config
377c377,380
< # CONFIG_ARCH_MV78XX0 is not set
---
> CONFIG_ARCH_MV78XX0=y
> # CONFIG_MACH_DB78X00_BP is not set
> # CONFIG_MACH_RD78X00_MASA is not set
> CONFIG_MACH_TERASTATION_WXL=y
564,568c567,571
< CONFIG_ARM_APPENDED_DTB=y
< CONFIG_ARM_ATAG_DTB_COMPAT=y
< CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_FROM_BOOTLOADER=y
< # CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_EXTEND is not set
< CONFIG_CMDLINE=""
---
> # CONFIG_ARM_APPENDED_DTB is not set
> CONFIG_CMDLINE="console=ttyS0,115200 initrd=0x02700040,50M panic=5"
> # CONFIG_CMDLINE_FROM_BOOTLOADER is not set
> # CONFIG_CMDLINE_EXTEND is not set
> CONFIG_CMDLINE_FORCE=y
2968c2971
< CONFIG_SERIAL_8250_RUNTIME_UARTS=2
---
> CONFIG_SERIAL_8250_RUNTIME_UARTS=4

here are the commands I'm using to build it, generate the machineID and create a uImage:
                            

prefix="/usr/local/bin/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-"
gcc="$prefix""gcc"

kernel_ver="4.9.168"

cd linux-$kernel_ver
##add V=1 for errors
make -j12 ARCH=arm KBUILD_DEBARCH=armel CROSS_COMPILE="$prefix" bindeb-pkg

cd ..
devio 'wl 0xe3a01c0a,4' 'wl 0xe3811089,4' > machtype
cat machtype linux-$kernel_ver/arch/arm/boot/zImage > katkern
mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n  custom-$kernel_ver -d  katkern uImage.buffalo
rm katkern

here is the code I'm using to pack my installer at the offset I hardcoded in the kernel cmdline (becasue I can't get the one uboot passes to work):
dd if=/dev/null of=frontpad bs=1 seek=24117184
cat frontpad uImage.buffalo > padkern
rm frontpad
dd if=/dev/null of=padkern bs=1M seek=30
cat padkern initrd.gz > installer-initrd.img
rm padkern
mkimage -A arm -O linux -T ramdisk -C gzip -a 0x0 -e 0x0 -n installer-initrd.gz initrd.buffalo

I'll upload all the files/scripts used to generate the installer as well as a working image to a git repo and provide a link once it's ready.

let me know if you have any questions.
My installer image worked and my ts-wxl is running again.

I went ahead and created a repository and will start committing my build scripts as I get things streamlined. The url is:
https://github.com/1000001101000/Terastation-III-research

I uploaded my current installer images as Stretch/installer_files.zip. You can use this to install Debian Stretch on the device along with my kernel, my microcontroller scripts (disable watchdog, shutdown, restart, lcd_init) and the script for padding the initrd/kernel to proper offsets (triggered by update-initramfs similar to flash-kernel).

To install:
1. unpack installer_files.zip
2. replace initrd.buffalo and uImage.buffalo with the files from the zip
3. reboot the device, after a few minutes it will finish booting and start an ssh server. it should also display "debian installer" on the lcd
4. connect using the credentials
username: installer
password: install
5. run through the debian install, select manual formatting
6. setup the old /boot volume as follows:
use as: ext3
format: no, keep existing data
mount point: /boot
7. set the remaining partitions however you prefer.
8. run through the rest of the install normally, when the device reboots it should work normally.

let me know if you run into any problems.
I've got the scripts for building the kernel and installer images posted now along with the installer and kernel packages.
https://github.com/1000001101000/Terastation-III-research

Let me know if you need anything else to get started.
I spent some time working out the requirements to make a working boot partition for this version/build of u-boot which makes setting up a disk without first installing the stock firmware on it much easier on modern distros.

https://buffalonas.miraheze.org/wiki/Terastation_TS-XL#boot_partition_requirements
I spent some time tracing the TS-XL PCI error in the kernel today. It turned out to be a pretty easy fix once I traced the error message back through the kernel source. I now have Debian Stretch running on my TS-XL with working sata.

I've uploaded the patch along with new installer images etc to the github page:
https://github.com/1000001101000/Terastation-III-research


Adding folks from earlier in the thread in case they are still interested.
@Kapt Blasto
@brmiller
@Esteban
@feas
I’ve tried out my patches and configure changes from the Stretch 4.9 kernel with the Buster 4.19 kernel. I’ve gotten it to boot successfully but am still getting errors trying to start the network. The error still matches the one reported in:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=908712

They listed that bug as fixed in the next proposed kernel
https://salsa.debian.org/kernel-team/linux/blob/debian/4.19.67-1/debian/changelog

I tried building this version but find i’m still getting the same error:
[    4.447914] Unable to handle kernel NULL pointer dereference at virtual address 0000000c                  
[    4.456000] pgd = (ptrval)                                                                                
[    4.458709] [0000000c] *pgd=00000000                                                                      
[    4.462287] Internal error: Oops: 5 [#1] ARM                                                              
[    4.466531] Modules linked in: mvmdio(+) libata(+) usb_common nls_base rtc_rs5c372(+) scsi_mod mv643xx_eth
[    4.476163] CPU: 0 PID: 56 Comm: systemd-udevd Not tainted 4.19.67 #1                                     
[    4.482567] Hardware name: Buffalo Nas WXL                                                                
[    4.486650] PC is at of_clk_get+0x14/0x54                                                                 
[    4.490650] LR is at orion_mdio_probe+0x118/0x2d4 [mvmdio]                                                
[    4.496109] pc : [<c0269490>]    lr : [<bf170430>]    psr: a0000013                                       
[    4.502346] sp : df6dfcc0  ip : c0566018  fp : df7ec2a4                                                   
[    4.507547] r10: 00000000  r9 : c0566060  r8 : c0565f40                                                   
[    4.512750] r7 : c0565f30  r6 : df7ec000  r5 : df7ec2a0  r4 : df6dfcc8                                    
[    4.519246] r3 : df713bc0  r2 : bf170f20  r1 : 00000000  r0 : 00000000                                    
[    4.525744] Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none                             
[    4.532846] Control: 0005397f  Table: 1f6e4000  DAC: 00000051                                             
[    4.538565] Process systemd-udevd (pid: 56, stack limit = 0x(ptrval))                                     
[    4.544976] Stack: (0xdf6dfcc0 to 0xdf6e0000)                                                             
[    4.549321] fcc0: 00000024 006080c0 c022deec c0019984 00000000 000f1072 df713be0 00000084                 
[    4.557468] fce0: df713bc0 c02a4a38 a0000013 df713be0 00000084 c0565f40 00000000 c02a4a70                 
[    4.565616] fd00: fd072004 c022df28 00000000 df7ec2a0 df7ec000 00000000 df7ec2a0 bf170430                 
[    4.573763] fd20: c713eae0 c713eb40 00000001 00000000 df50a2a0 df7ec2a4 df6dff4c c0565f40                 
[    4.581911] fd40: bf170cc4 00000000 00000000 c05e3944 df713ba4 00000004 df6dff4c c02a3450                 
[    4.590058] fd60: c0565f40 bf170cc4 00000000 c02a1958 c0565f40 bf170cc4 c0565f40 c0565f74                 
[    4.598206] fd80: bf170cc4 00000000 00000001 df713ba4 c0078738 c02a1e44 c0565f40 bf170cc4                 
[    4.606354] fda0: c02a1d9c c029fa58 df49304c df404e10 bf170cc4 df6ee6c0 c0591d80 c02a0d30                 
[    4.614501] fdc0: bf170c50 bf170c51 0000006f bf170cc4 c055d028 bf173000 00000000 c02a25cc                 
[    4.622649] fde0: bf170d20 c055d028 bf173000 c000ab60 00000001 df675c64 df400fe0 c012dcac                 
[    4.630796] fe00: df508a80 df4b6000 df501d20 df4df400 c059da14 c012de8c dfbefab0 c012ebb4                 
[    4.638943] fe20: df401e60 006000c0 df6dff4c c012ebc0 df401e60 006000c0 bf170d20 ca996996                 
[    4.647091] fe40: bf170d20 00000001 df6636a0 df713b80 00000001 c007c30c bf170d20 dffe35a0 
[    4.655239] fe60: bf170d20 00000001 bf170d68 c007b8ec bf170d2c 00007fff bf170d20 c0078e24                 
[    4.663386] fe80: e09e1f88 c03e95cc e09e1f38 bf173060 0000001a bf170ef4 df62e6e0 b6f2a3a0                 
[    4.671532] fea0: df62e6e0 df6dff3c 00000000 00000000 00000000 00000000 00000000 00000000
[    4.679671] fec0: 6e72656b 00006c65 00000000 00000000 00000000 00000000 00000000 00000000                 
[    4.687810] fee0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 ca996996                 
[    4.695949] ff00: 7fffffff 00000000 b6f2a3a0 00000005 0000017b c00091e4 df6de000 00000000                 
[    4.704097] ff20: 00a8b2f8 c007bbbc 7fffffff 00000000 00000003 c010a920 00000002 e09df000                 
[    4.712245] ff40: 00002fb0 00000000 df6dff58 e09dfba7 e09e0580 e09df000 00002fb0 e09e1998                 
[    4.720392] ff60: e09e1810 e09e101c 00000f20 000010d0 00000000 00000000 00000000 00000c7c                 
[    4.728539] ff80: 00000024 00000025 0000001b 00000018 00000013 00000000 7cc52700 00a7f1c8                 
[    4.736679] ffa0: 00000000 c0009000 7cc52700 00a7f1c8 00000005 b6f2a3a0 00000000 b6f2aeb4                 
[    4.744826] ffc0: 7cc52700 00a7f1c8 00000000 0000017b 00020000 00469110 00000000 00a8b2f8                 
[    4.752973] ffe0: bed5e7c8 bed5e7b8 b6f21610 b6dfb800 60000010 00000005 00000000 00000000                 
[    4.761136] [<c0269490>] (of_clk_get) from [<bf170430>] (orion_mdio_probe+0x118/0x2d4 [mvmdio])           
[    4.769808] [<bf170430>] (orion_mdio_probe [mvmdio]) from [<c02a3450>] (platform_drv_probe+0x40/0x74)     
[    4.778990] [<c02a3450>] (platform_drv_probe) from [<c02a1958>] (really_probe+0x220/0x3b0)                
[    4.787223] [<c02a1958>] (really_probe) from [<c02a1e44>] (__driver_attach+0xa8/0x128)
[    4.795116] [<c02a1e44>] (__driver_attach) from [<c029fa58>] (bus_for_each_dev+0x5c/0x80)                 
[    4.803263] [<c029fa58>] (bus_for_each_dev) from [<c02a0d30>] (bus_add_driver+0x1bc/0x234)                
[    4.811494] [<c02a0d30>] (bus_add_driver) from [<c02a25cc>] (driver_register+0xb4/0xf8)
[    4.819470] [<c02a25cc>] (driver_register) from [<c000ab60>] (do_one_initcall+0x60/0x178)                 
[    4.827618] [<c000ab60>] (do_one_initcall) from [<c007c30c>] (do_init_module+0x60/0x1d4)
[    4.835677] [<c007c30c>] (do_init_module) from [<c007b8ec>] (load_module.constprop.15+0x1f98/0x2034)      
[    4.844774] [<c007b8ec>] (load_module.constprop.15) from [<c007bbbc>] (sys_finit_module+0xb0/0xc4)        
[    4.853699] [<c007bbbc>] (sys_finit_module) from [<c0009000>] (ret_fast_syscall+0x0/0x50)                 
[    4.861839] Exception stack(0xdf6dffa8 to 0xdf6dfff0)
[    4.866873] ffa0:                   7cc52700 00a7f1c8 00000005 b6f2a3a0 00000000 b6f2aeb4                 
[    4.875013] ffc0: 7cc52700 00a7f1c8 00000000 0000017b 00020000 00469110 00000000 00a8b2f8                 
[    4.883149] ffe0: bed5e7c8 bed5e7b8 b6f21610 b6dfb800
[    4.888180] Code: e24dd054 e52de004 e8bd4000 e28d4008 (e590500c)                                          
[    4.894265] ---[ end trace f6a873a1ad0ae84d ]---                                                          
           
I tried building the current Sid kernel (5.2.9) and it worked just fine on the ts-wxl. It seems like my pci patch must not work work with this version since the ts-xl failed to find the rootfs.

I expect with some work I’ll be able get that working again.
looks like there is an addition fix in 5.2.9 that isn’t in 4.19.67 yet. I created a patch that adds it in which now allows 4.19.67 to work properly on the ts-wxl.

i’m getting the same error in 4.19 and 5.2.9 preventing the pci sata from working on the ts-xl
[   17.363300] Internal error: Oops - undefined instruction: 0 [#1] ARM
[   17.369631] Modules linked in: sata_mv(+) mvmdio(+) usbcore(+) libata rtc_rs5c372(+) usb_common nls_base scsi_mod mv643xx_eth
[   17.380912] CPU: 0 PID: 54 Comm: systemd-udevd Not tainted 4.19.67 #1
[   17.387317] Hardware name: Buffalo Nas WXL
[   17.391404] PC is at mv78xx0_init+0x21c/0x274
[   17.395745] LR is at orion5x_pci_disable+0x0/0x1c
[   17.400426] pc : [<c0513018>]    lr : [<c05140d4>]    psr: 00000013
[   17.406663] sp : df6b5d18  ip : 0000003c  fp : df6b5f4c
[   17.411864] r10: 00000004  r9 : df7a43a4  r8 : bf13b234
[   17.417066] r7 : 00000001  r6 : 00000001  r5 : df4dec00  r4 : c051316c
[   17.423564] r3 : df4e9340  r2 : 00000001  r1 : 00000001  r0 : df4c8000
[   17.430061] Flags: nzcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
[   17.437163] Control: 0005397f  Table: 1f6b8000  DAC: 00000051
[   17.442882] Process systemd-udevd (pid: 54, stack limit = 0x(ptrval))
[   17.449292] Stack: (0xdf6b5d18 to 0xdf6b6000)
[   17.453632] 5d00:                                                       df4dec00 00000001
[   17.461776] 5d20: 00000001 df4dec00 df4e9200 df4dec00 00000000 c025e8c8 df4dec00 01000013
[   17.469924] 5d40: a0000013 df4dec68 bf13b234 c0257e18 df4dec68 bf13b234 00000000 00000000
[   17.478071] 5d60: c05e3944 c02a1958 df4dec68 bf13b234 df4dec68 df4dec9c bf13b234 00000000
[   17.486219] 5d80: 00000001 df7a43a4 c0078738 c02a1e44 df4dec68 bf13b234 c02a1d9c c029fa58
[   17.494367] 5da0: df4a54cc df50b750 bf13b234 c7043960 c058ee70 c02a0d30 bf13aca7 bf13aca8
[   17.502514] 5dc0: 00000073 bf13b234 c055d028 bf13e000 00000000 c02a25cc bf13b5e0 c055d028
[   17.510662] 5de0: bf13e000 bf13e01c bf13b5e0 c000ab60 00000001 df674064 c059da14 00000000
[   17.518809] 5e00: df508cc0 df4b6000 df501920 df4df800 df400fe0 c012dcac dfbefab0 c012ebb4
[   17.526957] 5e20: df401e60 006000c0 df6b5f4c c012ebc0 df401e60 006000c0 bf13b5e0 9a07172a
[   17.535104] 5e40: bf13b5e0 00000001 df7fc0a0 df7a4380 00000001 c007c30c bf13b5e0 df400fe4
[   17.543252] 5e60: bf13b5e0 00000001 bf13b628 c007b8ec bf13b5ec 00007fff bf13b5e0 c0078e24
[   17.551400] 5e80: e0a30410 c03e95cc e0a303c0 bf13e0a0 00000087 bf13b7b4 df68d000 b6e633a0
[   17.559546] 5ea0: df68d000 df6b5f3c 00000000 00000000 00000000 00000000 00000000 00000000
[   17.567693] 5ec0: 6e72656b 00006c65 00000000 00000000 00000000 00000000 00000000 00000000
[   17.575832] 5ee0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 9a07172a
[   17.583980] 5f00: 7fffffff 00000000 b6e633a0 0000000d 0000017b c00091e4 df6b4000 00000000
[   17.592127] 5f20: 00510820 c007bbbc 7fffffff 00000000 00000003 c010a920 00000002 e0a25000
[   17.600275] 5f40: 0000b438 00000000 df6b5f58 e0a29cb5 e0a2c0e0 e0a25000 0000b438 e0a2fd58
[   17.608423] 5f60: e0a2fba8 e0a2d9bc 000057f0 00006070 00000000 00000000 00000000 00002644
[   17.616569] 5f80: 00000029 0000002a 00000020 0000001b 00000014 00000000 a1609c00 005041c8
[   17.624709] 5fa0: 00000000 c0009000 a1609c00 005041c8 0000000d b6e633a0 00000000 b6e63eb4
[   17.632857] 5fc0: a1609c00 005041c8 00000000 0000017b 00020000 004e6110 00000000 00510820
[   17.641004] 5fe0: bed457c8 bed457b8 b6e5a610 b6d34800 60000010 0000000d 00000000 00000000
[   17.649152] Code: b6cd63cc b6cd6aa4 b6cd63cc 000000a2 (ffffffff) 
[   17.655220] ---[ end trace 6243ba4c2b221837 ]---
I added some debugging options which made the stack trace a bit more readable:
[   18.445931] Internal error: Oops - undefined instruction: 0 [#1] ARM
[   18.452259] Modules linked in: marvell(+) sata_mv(+) usbcore(+) mvmdio(+) usb_common nls_base rtc_rs5c372(+) libata scsi_mod mv643xx_h
[   18.464499] CPU: 0 PID: 54 Comm: systemd-udevd Not tainted 4.19.67 #1
[   18.470903] Hardware name: Buffalo Nas WXL
[   18.474988] PC is at mv78xx0_pcie_preinit+0x14/0x180
[   18.479929] LR is at pcibios_map_irq+0x30/0x78
[   18.484350] pc : [<c05821ac>]    lr : [<c00152f0>]    psr: a0000013
[   18.490587] sp : c710bd18  ip : 0000003c  fp : c710bf4c
[   18.495789] r10: 00000004  r9 : c73e13a4  r8 : bf12f234
[   18.500991] r7 : 00000001  r6 : 00000001  r5 : df532240  r4 : c058216c
[   18.507487] r3 : df55d580  r2 : 00000001  r1 : 00000001  r0 : df532240
[   18.513987] Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
[   18.521088] Control: 0005397f  Table: 0710c000  DAC: 00000051
[   18.526807] Process systemd-udevd (pid: 54, stack limit = 0x(ptrval))
[   18.533218] Stack: (0xc710bd18 to 0xc710c000)
[   18.537555] bd00:                                                       df532240 00000001
[   18.545700] bd20: 00000001 df532240 df55d440 df532240 00000000 c0261508 df532240 01000013
[   18.553848] bd40: a0000013 df5322a8 bf12f234 c025aa68 df5322a8 bf12f234 00000000 00000000
[   18.561996] bd60: c0653a44 c02a4478 bf12eca7 df5f4020 df5322a8 df5322dc bf12f234 00000000
[   18.570143] bd80: 00000001 c73e13a4 c007879c c02a4954 df5322a8 bf12f234 c02a489c c02a25f0
[   18.578291] bda0: df538f0c df5f7190 bf12f234 c6cc8520 c05fef50 c02a388c bf12eca7 bf12eca8
[   18.586438] bdc0: 00000073 bf12f234 c05cd028 bf132000 00000000 c02a50bc bf12f5e0 c05cd028
[   18.594586] bde0: bf132000 bf13201c bf12f5e0 c000ab60 dfcdbaa0 80100010 c73e1380 00000001
[   18.602733] be00: dfcdbaa0 60000013 00000000 006000c0 c007c2d4 0000000c c73e13a4 c007879c
[   18.610881] be20: c710bf4c c0130090 df401180 c01302ac df401180 006000c0 bf12f5e0 4bc559d2
[   18.619028] be40: bf12f5e0 00000001 c6c12420 c73e1380 00000001 c007c310 bf12f5e0 df400f24
[   18.627175] be60: bf12f5e0 00000001 bf12f628 c007b8f0 bf12f5ec 00007fff bf12f5e0 c0078e88
[   18.635324] be80: e0a3c410 c03ec5cc e0a3c3c0 bf1320a0 0000015b bf12f7b4 c7398620 b6e563a0
[   18.643470] bea0: c7398620 c710bf3c 00000000 00000000 00000000 00000000 00000000 00000000
[   18.651617] bec0: 6e72656b 00006c65 00000000 00000000 00000000 00000000 00000000 00000000
[   18.659755] bee0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 4bc559d2
[   18.667895] bf00: 7fffffff 00000000 b6e563a0 0000000d 0000017b c00091e4 c710a000 00000000
[   18.676044] bf20: 015ca820 c007bbc0 7fffffff 00000000 00000003 c010ab48 00000002 e0a31000
[   18.684191] bf40: 0000b438 00000000 c710bf58 e0a35cb5 e0a380e0 e0a31000 0000b438 e0a3bd58
[   18.692338] bf60: e0a3bba8 e0a399bc 000057f0 00006350 00000000 00000000 00000000 00002644
[   18.700485] bf80: 00000029 0000002a 00000020 0000001b 00000014 00000000 a60af500 015be1c8
[   18.708633] bfa0: 00000000 c0009000 a60af500 015be1c8 0000000d b6e563a0 00000000 b6e56eb4
[   18.716780] bfc0: a60af500 015be1c8 00000000 0000017b 00020000 004d9110 00000000 015ca820
[   18.724929] bfe0: bea6a7c8 bea6a7b8 b6e4d610 b6d27800 60000010 0000000d 00000000 00000000
[   18.733085] [<c00152f0>] (pcibios_map_irq) from [<c0261508>] (pci_assign_irq+0xb0/0xf8)
[   18.741061] [<c0261508>] (pci_assign_irq) from [<c025aa68>] (pci_device_probe+0x20/0xf4)
[   18.749123] [<c025aa68>] (pci_device_probe) from [<c02a4478>] (really_probe+0x210/0x398)
[   18.757182] [<c02a4478>] (really_probe) from [<c02a4954>] (__driver_attach+0xb8/0x120)
[   18.765070] [<c02a4954>] (__driver_attach) from [<c02a25f0>] (bus_for_each_dev+0x5c/0x80)
[   18.773217] [<c02a25f0>] (bus_for_each_dev) from [<c02a388c>] (bus_add_driver+0x1ac/0x224)
[   18.781452] [<c02a388c>] (bus_add_driver) from [<c02a50bc>] (driver_register+0xb4/0xf8)
[   18.789459] [<c02a50bc>] (driver_register) from [<bf13201c>] (mv_init+0x1c/0xa0 [sata_mv])
[   18.797713] [<bf13201c>] (mv_init [sata_mv]) from [<c000ab60>] (do_one_initcall+0x60/0x178)
[   18.806036] [<c000ab60>] (do_one_initcall) from [<c007c310>] (do_init_module+0x60/0x1d4)
[   18.814094] [<c007c310>] (do_init_module) from [<c007b8f0>] (load_module.constprop.15+0x1f38/0x1fd4)
[   18.823191] [<c007b8f0>] (load_module.constprop.15) from [<c007bbc0>] (sys_finit_module+0xb0/0xc4)
[   18.832116] [<c007bbc0>] (sys_finit_module) from [<c0009000>] (ret_fast_syscall+0x0/0x50)
[   18.840257] Exception stack(0xc710bfa8 to 0xc710bff0)
[   18.845291] bfa0:                   a60af500 015be1c8 0000000d b6e563a0 00000000 b6e56eb4
[   18.853431] bfc0: a60af500 015be1c8 00000000 0000017b 00020000 004d9110 00000000 015ca820
[   18.861575] bfe0: bea6a7c8 bea6a7b8 b6e4d610 b6d27800
[   18.866606] Code: 00000000 00000000 00000000 03ff0000 (87fffffe) 
[   18.872668] ---[ end trace 01cec3a4f73b5b24 ]---
I confirmed that my Stretch (4.9) kernel/image works on the rack-mounted TS-RXL just like the TS-XL.

I took a closer look at the changed between 4.9 and 4.19 and found that there were some large changes to how PCI is handled for the 4.13 kernel that likely broke MV78100 PCI support which would explain why my fix for the 4.9 kernel doesn't help for 4.19.

I honestly don't know where to begin trying to correct that and would appreciate any advice available.

In the meantime I'll work on cleaning up the 4.19/5.2 configs and get them posted.
Tons of excellent work here @1000001101000 !
I am reviewing all that, now that I have again a room to work in, where there is a bit of heat. :-)

Reviewing your patch to get PCI working, I am a bit surprised by this instruction. Since you confirm that it works on XL/WLX and RLX, we should be good. Do you mind explaning how you found the fix?

Cheers,
I don't remember the exact order of things but I noticed that only one PCI channel seemed to be initialized during boot and that it happened to be the incorrect one for the SATA chip. I eventually noticed that the code in question is meant to assign each channel to a separate CPU, but this is the single-cpu variant of the soc.

I eventually noticed one of the boards was set up this way and duplicated it:
https://github.com/torvalds/linux/blob/b41dae061bbd722b9d7fa828f35d22035b218e18/arch/arm/mach-mv78xx0/rd78x00-masa-setup.c#L72

I thought for a while that had failed because I was still getting an error
Invalid MBus window size: 0x30000000

Fortunately, the code that outputs this error is very clear about what the problem is which made it reasonably simple to track back where the bad value was coming from and correct it.

So far I haven't had the same luck with the changes made to the PCI code for 4.13+

Is there anything you need from me to get started?

You can install Debian Stretch (I haven't made a Buster one yet) on your device using the installer images I have posted here:
https://github.com/1000001101000/Terastation-III-research/tree/master/Stretch

You can then install a newer kernel (anything newer than 4.12 is TS-WXL only because of the PCI issue) I'll post my 5.2 kernel image shortly:
https://github.com/1000001101000/Terastation-III-research/tree/master/PPA/pool/main/l

You should be able to do a dist-upgrade to buster at that point if you'd like.

I've attached my config file for building the 5.2 kernel. You should be able to build kernels as needed with the "bindeb-pkg" option which will create packages ready to be installed using dpkg, The installer sets up the script to automatically generate *.buffalo images as needed. You can see the build script I'm using:
https://github.com/1000001101000/Terastation-III-research/blob/master/Stretch/build/kernel/build_kernel.sh

Let me know what else you need.



Edited 1 time(s). Last edit at 09/19/2019 11:46AM by 1000001101000.
Attachments:
open | download - custom-config-5.2 (182.4 KB)
I think that I have everything, thanks for your extensive information!

I have to dig into the docs of the SoC to understand what is going on there. For my own knowledge, your RXL are 78100 or 78200?

Reading my original patch in the repo, I remember asking nicolas pitre (employee at marvell at the time), for some review (see this). As the mv78100 has only only one core, we wanted to allocate everything to it.

I need to dig a little closer to the pci_init routines (been 9 years now).

Cheers,
They are all 78100. The boards are all nearly identical as well.
I noticed something interesting recently. It looks like FreeBSD has some degree of support for the MV78100, including device-tree support.

https://github.com/freebsd/freebsd/blob/master/sys/dts/arm/db78100.dts
I discovered while working on some other devices that my strange workaround for to make the initrd images work isn't actually needed if the initramfs size is less than 8MB or so. I've reworked the installer images to be small enough to fit this limitation and included logic to configure initramfs-tools to generate small enough images (MODULES=dep).

This means working kernels for the Terastation III devices can be compiled with just the following config options added to the Debian configuration:
CONFIG_ARCH_MV78XX0=y
CONFIG_MACH_TERASTATION_WXL=y

Though my patch is still required for PCI sata to work on the TS-XL and TS-RXL

This allowed me to publish a new "armel" installer image for Debian Stretch and Debian Buster* which supports the Terastation 2 Pro (TS-HTGL/TS-RHTGL), Terastation III (TS-XL/TS-WXL/TS-RXL) and Terastation ES (TS-XEL).

https://github.com/1000001101000/Debian_on_Buffalo

**For devices using PCI sata I'm using a version 4.12 kernel because changes to 4.13+ broke PCI support for non-DTB MV78100 and Orion5x devices
Hi, guys.

Today I tried to install buster from @1000001101000's github on my TS-XL.
I went by 'erase all' route. Created tiny (128 MB) /dev/sda1 partition, copied initrd.buffalo and uImage.buffalo, successfully launched intaller, logged as installer:install, went through an install routine.

I created 8 GB root partition and 1 GB swap. Everything went smooth until reboot. When terastation has gone through init I found it doesn't accept my user's password, root password (obvious why). I was surprised by 'unprotected connection' putty message and tried installer:install again.

I launched the shell, chrooted to /target/ and found everything installed successfully but initrd.buffalo still launches an installer.

I think I missed some very simple, very obvious and very dumb steps. But can't figure it out.

Can anyone lend me a hand?
Oh, I forgot to ask. Is booting from /sda1 mandatory? Is it possible to install the system to an external (or better internal) flash drive and completely boot from it? And HDDs leave for data partitions.
Yes, for this device uboot is configured to load from the first partition of one of the drives. I think it goes with the first one it finds a valid image on but it does compare the timestamps on each and may default to the newest one if multiple are found.

For the debian installer to work properly you must specify the first partition (or preferably a raid1 array made up of the first partitions) as ext3 and /boot. I’ve tweaked the installer logic so it will set the appropriate inode size and metadata version automatically (I don’t recall if I ever mentioned it on this forum).

any other configuration would require altering uboot which would be difficult on this device because:
-buffalo has not published their uboot source
-the serial port on the device has the rx pin disconnected
-the mainline kernel does not support mtdblock devices for this SoC currently
-the device appears to boot a hardcoded bootcmd (changing the env from within the stock firmware doesn't change the boot sequence)

specifying the boot partition should get things working, if you still have trouble feel free to open an issue on the github project
Quick update about kernel versions for these devices since I've been working on automating building kernels for them recently.

TS-WXL:
Working fine with all the kernels I've tested, most recently 5.4.6. version ~4.12 - 5.1 require a patch to deal with an mvmdio bug which was eventually fixed.

TS-XL, TS-RXL (and the TS-HTGL (ts2pro) for that matter):
working on versions up to 4.12 with a patch I put together which fixes a bug with the MV78100 pci initialization. Large PCI changes were introduced as part of 4.13 which broke PCI for orion5x/MV78100 devices. I have spent a little time looking for a way to correct this issue but it's more complicated than the other issues I've dealt.

Stretch and Buster installer images and kernel packages for these devices can be found at:
https://github.com/1000001101000/Debian_on_Buffalo/tree/master/PPA
Turns out the PCI issue for non-DTB devices was less complicated than I thought…. Or at least working around it is fairly simple. The PCI setup attaches a map_irq function to a function pointer so that the proper irq can be assigned when a device is detected. If the driver making the call is in a kernel module that call crosses a namespace boundary and results in a kernel panic. This issue can be avoided by just compiling mv_sata and related drivers into the kernel instead of modules.

I’ve now got my TS-XL running Bullseye with kernel 5.10 as a result. I’m working on incorporating such a kernel along with some other tweaks into my Debian installer to restore support for these devices.
Hello. My TS-XL has been running this for several years. But now I have moved to another country (I am from Ukraine, so...) and found things I want to correct.

1. The buttons are not working. Really I need only the power button to send the system shutdown signal. I read the project wiki and took a look here https://github.com/1000001101000/Python_buffalo_libmicon but seems I am not smart enough to understand how to do it.
Can one configure the button reactions? Maybe I missed some config? I just need to shut down it from time to time.

2. Is possible to change the display indication to something useful, like temperature and fan speed?

3. I want to reduce noice and slow the fan a bit down. I found instruction in the wiki. But what the temperature is ok and how to see the current one?
Good to hear from you!

What version of Debian/kernel are you running? (It's not important to my answer, I'm just curious).

Sadly, I've only really implemented the minimum required to successfully use the device (disable the onboard watchdog timer, set a welcome message, fan daemon so rackmount devices aren't so loud). Beyond that I've only provided examples of how control various features. Pretty much everything you're looking for is covered in one of those examples though:

ts3000_examples.py: If you run this on the ts-xl it should cycle through all the leds and lcd colors/modes. The code provides examples of how to set most things include put text on the display.
micon_fan_daemon.py: If you run it manually with a parameter of "debug" it will print out the value of it's temperature sensor.
button_test.py: This should print the button# for any button pressed (it varies by model)
button_daemon.py: I....don't remember writing this. It checks for a specifc button# being pressed in a loop and triggers an action if it is held down.
micon_dump.py: prints the current value for all values stored by the microcontroller, this can be used to view the current temperature etc.

your best bet might be to take the fan or button daemon as a starting point and add stuff to it. Only one process can talk to the microcontroller at a time so if you have something constantly polling for button presses you'd need to have it also manage the other functions in between checking for buttons.
Thanks, I'll check everything and will try to figure it out. Or ask my younger brother, who's a Linux admin :-)
For now tried to cycle modes and to get buttons pressed - it's a fun :)


Here is the result of cat /proc/version

Linux version 4.12.13 (jeremy@earth) (gcc version 8.3.0 (Debian 8.3.0-2) ) #7 Wed Jul 7 22:34:27 CDT 2021


Checked my previous questions. Looks like Debian was set up on my NAS 2 years ago - looks like ages now. It runs Openmediavault - a bit slow but overall good.
Tried everything out.

The button daemon makes everything I needed, it shuts down the system by the button press.
The example makes the display useful, I just commented on unneeded parts like disco lights and beep. Still don't know how to add the temperature, but this is not so important.

Thank you so much!
I didn't figure out how to show the fanspeed and temperature from the sample. I checked libmicon there is lcd_disp_temp_on and lcd_disp_fanspeed_on, as well as "off". But how can I summon it to the display?
Here is some sample code to read those values and print them on the LCD. I don't know quite where the temp sensor is, I assume it's Celsius. I printed the two fan values I'm aware of. The first is the speed setting (0-3) the second might be the PWM value but I don't really know.

#!/usr/bin/python3

import libmicon
import socket
import time

test = libmicon.micon_api("/dev/ttyS1")

micon_temp=test.send_read_cmd(0x37)
micon_temp=int.from_bytes(micon_temp,"big")

micon_fan1=test.send_read_cmd(0x33)
micon_fan1=int.from_bytes(micon_fan1,"big")

micon_fan2=test.send_read_cmd(0x38)
micon_fan2=int.from_bytes(micon_fan2,"big")

test.set_lcd_buffer(libmicon.lcd_set_buffer0,"Temp: "+str(micon_temp)+"C?","Fan: "+str(micon_fan1)+","+str(micon_fan2)+"??")
test.cmd_force_lcd_disp(libmicon.lcd_disp_buffer0)

display0=test.send_read_cmd(libmicon.lcd_set_buffer0)  ## 0x0a
display0=display0.decode('utf-8')

print (display0[0:15])
print (display0[16:])
Thanks a lot! Works like a charm!
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: