Welcome! Log In Create A New Profile

Advanced

Debian on Synology RS816 (Armada 385)

Posted by zifxify 
Re: Debian on Synology RS816 (Armada 385)
May 18, 2019 08:41PM
@bodhi
Test 4
Single HDD, gtp, ext4, separate /boot partition

Boot command
setenv ipaddr 192.168.1.250
setenv serverip 192.168.1.2
setenv load_dtb_addr 0x1000000
setenv load_image_addr 0x02000000
setenv load_image 'echo loading zImage from tftpserver ...; tftpboot $load_image_addr zImage'
setenv load_dtb 'echo loading DTB from tftpserver ...; tftpboot $load_dtb_addr armada-385-synology-rs816-v12.dtb'
setenv set_bootargs 'setenv bootargs "console=ttyS0,115200 root=/dev/sda2 initrd=/dev/sda1/initrd.img-5.1.2-rj rootdelay=20  $mtdparts earlyprintk=serial"'
setenv bootcmd_exec 'echo Booting Debian . . .; run set_bootargs; setenv fdt_skip_update yes; setenv initrd_high 0xffffffff; run load_image; run load_dtb; bootz $load_image_addr - $load_dtb_addr'
setenv bootcmd 'run bootcmd_exec; run bootspi'

Result
root@debian:~#

df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       1.8T 1003M  1.7T   1% /
devtmpfs        501M     0  501M   0% /dev
tmpfs           101M  1.2M  100M   2% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           201M     0  201M   0% /dev/shm
/dev/sda1        88M   28M   54M  35% /boot
tmpfs           501M     0  501M   0% /tmp


lsmod
Module                  Size  Used by
sg                     32768  0
uio_pdrv_genirq        16384  0
uio                    20480  1 uio_pdrv_genirq

Thats all there is normally unless raid is used the bulk are built in but commands like modprobe raid1 work

Comment
Not sure if I need full initrd path I will test with shorthand versions but at least it works :)

Next test small /boot partition and / on raid 5. I am still getting interrupted a LOT and this is a longer setup so maybe a while.
Re: Debian on Synology RS816 (Armada 385)
May 18, 2019 08:42PM
Richard,


> I was just wondering on that, the current kernel
> config builds all the raid drivers as modules so,
> yes, it would need uInitrd but if I build the raid
> modules into the kernel ?

Yes.

> On Arch the static
> version of mdadm gets placed in the initrams image
> so I'm guessing without it it wouldn't work. The
> zImage is just built in the kernel and would have
> no way to do this so I presume it just wouldn't
> work but thought I'd ask anyway.

I suspect that Arch does not want zImage to grow too big. But no reason why it can't be in the kernel proper.

However, hold on that thought for a minute! I'll come back with some suggestion for Debian rootfs.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian on Synology RS816 (Armada 385)
May 18, 2019 08:44PM
Richard,

> Result
>
> root@debian:~#
>
>
> df -h
>
> Filesystem      Size  Used Avail Use% Mounted on
> /dev/root       1.8T 1003M  1.7T   1% /
> devtmpfs        501M     0  501M   0% /dev
> tmpfs           101M  1.2M  100M   2% /run
> tmpfs           5.0M     0  5.0M   0% /run/lock
> tmpfs           201M     0  201M   0% /dev/shm
> /dev/sda1        88M   28M   54M  35% /boot
> tmpfs           501M     0  501M   0% /tmp
>
>
>
> lsmod
>
> Module                  Size  Used by
> sg                     32768  0
> uio_pdrv_genirq        16384  0
> uio                    20480  1 uio_pdrv_genirq
>
>
> Thats all there is normally unless raid is used
> the bulk are built in but commands like modprobe
> raid1 work
>
> Comment
> Not sure if I need full initrd path I will test
> with shorthand versions but at least it works :)

Cool! looks like the options are wild open now :) I also posted some thoughts right above.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian on Synology RS816 (Armada 385)
May 18, 2019 10:17PM
@bodhi
Just a progress update
Raid test failed at kernel panic but I think I have a few things to work through in my install routine and potential device re-numbering when install usb is not there.

I will run a few more tests then I think I will build the raid modules in to rule that one out.
Re: Debian on Synology RS816 (Armada 385)
May 18, 2019 10:35PM
Richard,

OK so regroup and look at the overall status.

1. We know that it is OK to boot without uInitrd, using Debian-4.12.4-mvebu-tld-1-rootfs-bodhi.tar.bz2 , with new kernel linux-5.1.2-mvebu-tld-1 installed and using root device root/dev/sda1:

https://forum.doozan.com/read.php?2,76314,84534#msg-84534

This basically solved the flash size issue. So zImage can be flashed and we'll live with the restriction that we can't use lable to find rootfs.

One suggestion is when you build test kernel, make sure that you use my patch and config, and name your kernel using this convention so we know what version we are referering to.

linux-5.1.2-mvebu-tld-1-rj-1


2. Using RAID, we will need to go back to uInitrd solution. Eventhough in your environment, you can run your own custom built kernel to include mdm, it will not work for linux-5.1.2-mvebu-tld-1 to do that.

We can come back to this test after you know you can load just zImage and enumerate the RAID array, and mount rootfs. The rest is a little bit elaborate, where we will repartition the MTDs and flash zImage.


3. So I think the next test should be the HDD raw sector loading test that we will store all 3 kernel files on the 1st HDD. This should be port SATA0. When it is proven to work, this will be my recommendation for new users who want to install Debian on this box.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian on Synology RS816 (Armada 385)
May 18, 2019 10:39PM
@bodhi
I will rebuild kernel with raid built in so we get that in zImage, I'm not sure why initrd.img didn't kick in to bring the raid up as under the current test this is sat on a std partition but building the raid modules in wont do any harm and eliminates one more variable.

This is going to take a while.
Re: Debian on Synology RS816 (Armada 385)
May 19, 2019 06:28AM
@bodhi
A day marked by interruptions and long builds but we are getting there.
This whole question of booting from raid had taken on a bit of a life of its own so I decided to get back to basics. I'm old enough to remember the early days of raid support in linux where you could actually just use the kernel itself to handle it for you. This code has stagnated as best I can see but still offers us a simplified raid solution.

Test 6
4 drive raid1, meta-0.9, mbr, ext4, rootfs including boot on /dev/md0 raid modules compiled in.

Boot command
setenv ipaddr 192.168.1.250
setenv serverip 192.168.1.2
setenv load_dtb_addr 0x1000000
setenv load_image_addr 0x02000000
setenv load_image 'echo loading zImage from tftpserver ...; tftpboot $load_image_addr zImage'
setenv load_dtb 'echo loading DTB from tftpserver ...; tftpboot $load_dtb_addr armada-385-synology-rs816-v12.dtb'
setenv set_bootargs 'setenv bootargs "console=ttyS0,115200 root=/dev/md0 rootdelay=20  $mtdparts earlyprintk=serial"'
setenv bootcmd_exec 'echo Booting Debian . . .; run set_bootargs; setenv fdt_skip_update yes; setenv initrd_high 0xffffffff; run load_image; run load_dtb; bootz $load_image_addr - $load_dtb_addr'
setenv bootcmd 'run bootcmd_exec; run bootspi'

Result
root@debian:~#

lsblk
NAME      MAJ:MIN RM  SIZE RO TYPE  MOUNTPOINT
sda         8:0    1  1.8T  0 disk
|-sda1      8:1    1 18.6G  0 part
| `-md0     9:0    0 18.6G  0 raid1 /
|-sda2      8:2    1  1.9G  0 part
| `-md1     9:1    0  1.9G  0 raid1 [SWAP]
`-sda3      8:3    1  1.8T  0 part
  `-md2     9:2    0  5.4T  0 raid5 /data
sdb         8:16   1  1.8T  0 disk
|-sdb1      8:17   1 18.6G  0 part
| `-md0     9:0    0 18.6G  0 raid1 /
|-sdb2      8:18   1  1.9G  0 part
| `-md1     9:1    0  1.9G  0 raid1 [SWAP]
`-sdb3      8:19   1  1.8T  0 part
  `-md2     9:2    0  5.4T  0 raid5 /data
sdc         8:32   1  1.8T  0 disk
|-sdc1      8:33   1 18.6G  0 part
| `-md0     9:0    0 18.6G  0 raid1 /
|-sdc2      8:34   1  1.9G  0 part
| `-md1     9:1    0  1.9G  0 raid1 [SWAP]
`-sdc3      8:35   1  1.8T  0 part
  `-md2     9:2    0  5.4T  0 raid5 /data
sdd         8:48   1  1.8T  0 disk
|-sdd1      8:49   1 18.6G  0 part
| `-md0     9:0    0 18.6G  0 raid1 /
|-sdd2      8:50   1  1.9G  0 part
| `-md1     9:1    0  1.9G  0 raid1 [SWAP]
`-sdd3      8:51   1  1.8T  0 part
  `-md2     9:2    0  5.4T  0 raid5 /data
mtdblock0  31:0    0    4M  0 disk
mtdblock1  31:1    0    4M  0 disk

df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        19G  806M   17G   5% /
devtmpfs        501M     0  501M   0% /dev
tmpfs           101M  1.3M   99M   2% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           582M     0  582M   0% /dev/shm
/dev/md2        5.4T   89M  5.1T   1% /data
tmpfs           501M     0  501M   0% /tmp

parted -l
Model: ATA ST2000VN004-2E41 (scsi)
Disk /dev/sda: 2000GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  20.0GB  20.0GB  primary  ext4         raid
 2      20.0GB  22.0GB  2001MB  primary               raid
 3      22.0GB  2000GB  1978GB  primary               raid


Model: ATA ST2000VN004-2E41 (scsi)
Disk /dev/sdb: 2000GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  20.0GB  20.0GB  primary  ext4         raid
 2      20.0GB  22.0GB  2001MB  primary               raid
 3      22.0GB  2000GB  1978GB  primary               raid


Model: ATA ST2000VN004-2E41 (scsi)
Disk /dev/sdc: 2000GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  20.0GB  20.0GB  primary  ext4         raid
 2      20.0GB  22.0GB  2001MB  primary               raid
 3      22.0GB  2000GB  1978GB  primary               raid


Model: ATA ST2000VN004-2E41 (scsi)
Disk /dev/sdd: 2000GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  20.0GB  20.0GB  primary  ext4         raid
 2      20.0GB  22.0GB  2001MB  primary               raid
 3      22.0GB  2000GB  1978GB  primary               raid


Error: /dev/mtdblock0: unrecognised disk label
Model: Unknown (unknown)
Disk /dev/mtdblock0: 4194kB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags:

Model: Linux Software RAID Array (md)
Disk /dev/md2: 5935GB
Sector size (logical/physical): 512B/4096B
Partition Table: loop
Disk Flags:

Number  Start  End     Size    File system  Flags
 1      0.00B  5935GB  5935GB  ext4


Model: Linux Software RAID Array (md)
Disk /dev/md0: 20.0GB
Sector size (logical/physical): 512B/4096B
Partition Table: loop
Disk Flags:

Number  Start  End     Size    File system  Flags
 1      0.00B  20.0GB  20.0GB  ext4


Error: /dev/mtdblock1: unrecognised disk label
Model: Unknown (unknown)
Disk /dev/mtdblock1: 4194kB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags:

Model: Linux Software RAID Array (md)
Disk /dev/md1: 1999MB
Sector size (logical/physical): 512B/4096B
Partition Table: loop
Disk Flags:

Number  Start  End     Size    File system     Flags
 1      0.00B  1999MB  1999MB  linux-swap(v1)

Comment
We have demonstrated we can boot from a simple partition with gpt and I believe my failure in test 5 (/boot on non-raid with / on raid5) was more an install procedure error than anything else. We have also demonstrated a solution to run the whole rootfs from raid provided an end user can live with the restrictions of mbr, meta-0.9 and raid1.

In order to offer a full raid /boot solution for large HDD's on gpt we need to see if we can expand the functionality of zImage in some way to include static mdadm as per uInitrd (I can't currently think how this can be achieved) alternatively a small non-raid partition for /boot with / on raid will work.

I think the above confirms we can flash zImage and dtb to flash which to my mind says we have won!

I'm in need of a break and a glass or two of shiraz but I will upload the info you need to help me with SPI flash tomorrow if you can help me with that I'd much appreciate it,

Shout out if you want me to try anything else.
Re: Debian on Synology RS816 (Armada 385)
May 19, 2019 06:46AM
@bodhi
SPI flash info
From Debian
cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00400000 00001000 "boot"
mtd1: 00400000 00001000 "spi-rootfs"

cat /etc/fw_env.config
# MTD device name	Device offset	Env. size	Flash sector size	Number of sectors
/dev/mtd1               0x3E0000        0x10000      0x00001000

fw_printenv
CASset=max
MALLOC_len=5
MPmode=SMP
ata_hdd_detect=syno_hdd_detect=39,39,39,39
ata_hdd_enable=syno_hdd_enable=37,37,37,37
autoload=no
baudrate=115200
boot_order=hd_scr usb_scr mmc_scr hd_img usb_img mmc_img pxe net_img net_scr
bootargs= 
bootargs_dflt=$console $nandEcc $mtdparts_lgcy $bootargs_root nfsroot=$serverip:$rootpath ip=$ipaddr:$serverip$bootargs_end $mvNetConfig video=dovefb:lcd0:$lcd0_params clcd.lcd0_enable=$lcd0_enable clcd.lcd_panel=$lcd_panel
bootargs_end=:10.4.50.254:255.255.255.0:Armada38x:eth0:none
bootargs_root=root=/dev/nfs rw
bootcmd=run bootcmd_exec; run bootspi
bootcmd_auto=stage_boot $boot_order
bootcmd_exec=echo Booting Debian . . .; run set_bootargs; setenv fdt_skip_update yes; setenv initrd_high 0xffffffff; run load_image; run load_dtb; bootz $load_image_addr - $load_dtb_addr
bootcmd_fdt=tftpboot 0x2000000 $image_name;tftpboot $fdtaddr $fdtfile;setenv bootargs $console $nandEcc $mtdparts $bootargs_root nfsroot=$serverip:$rootpath ip=$ipaddr:$serverip$bootargs_end $mvNetConfig video=dovefb:lcd0:$lcd0_params clcd.lcd0_enable=$lcd0_enable clcd.lcd_panel=$lcd_panel; bootz 0x2000000 - $fdtaddr;
bootcmd_fdt_boot=tftpboot 0x2000000 $image_name; setenv bootargs $console $nandEcc $mtdparts $bootargs_root nfsroot=$serverip:$rootpath ip=$ipaddr:$serverip$bootargs_end $mvNetConfig video=dovefb:lcd0:$lcd0_params clcd.lcd0_enable=$lcd0_enable clcd.lcd_panel=$lcd_panel; bootz 0x2000000 - $fdtaddr;
bootcmd_fdt_edit=tftpboot $fdtaddr $fdtfile; fdt addr $fdtaddr; setenv bootcmd $bootcmd_fdt_boot
bootcmd_lgcy=tftpboot 0x2000000 $image_name;setenv bootargs $console $nandEcc $mtdparts_lgcy $bootargs_root nfsroot=$serverip:$rootpath ip=$ipaddr:$serverip$bootargs_end  video=dovefb:lcd0:$lcd0_params clcd.lcd0_enable=$lcd0_enable clcd.lcd_panel=$lcd_panel;  bootm $loadaddr; 
bootdelay=3
bootftp=run syno_bootargs;tftpboot $loadaddr_kernel $file_kernel;tftpboot $loadaddr_rootfs $file_rootfs;sf probe; sf read $loadaddr_dt $spi_pt_addr_dt $spi_pt_size_dt;fdt addr $loadaddr_dt;bootm $loadaddr_kernel $loadaddr_rootfs $loadaddr_dt;
bootspi=run syno_bootargs;sf probe 0 50000000;sf read $loadaddr_kernel $spi_pt_addr_kernel $spi_pt_size_kernel;sf read $loadaddr_rootfs $spi_pt_addr_rootfs $spi_pt_size_rootfs;sf read $loadaddr_dt $spi_pt_addr_dt $spi_pt_size_dt;bootm $loadaddr_kernel $loadaddr_rootfs $loadaddr_dt;
cacheShare=no
clean_env=sf probe; sf erase $spi_pt_addr_env $spi_pt_size_env; 
console=console=ttyS0,115200
device_partition=0:1
disaMvPnp=no
eeeEnable=no
enaClockGating=no
enaCpuStream=no
enaFPU=yes
enaMonExt=no
enaWrAllo=no
eth1addr=00:50:43:1c:24:27
eth1mtu=1500
eth2addr=00:50:43:1c:1c:27
eth2mtu=1500
eth3addr=00:50:43:24:1c:1c
eth3mtu=1500
ethact=egiga0
ethaddr=00:50:43:1c:24:27
ethmtu=1500
ethprime=egiga0
fdt_addr=2040000
fdt_skip_update=yes
fdtaddr=0x1000000
fdtfile=armada-38x.dtb
file_flash=armada38x/flash.bin
file_kernel=armada38x/uImage
file_rootfs=armada38x/rd.bin
file_uboot=armada38x/uboot.bin
ide_path=/
image_name=uImage
initrd_high=8000000
initrd_name=uInitrd
ipaddr=192.168.1.250
kernel_addr_r=2080000
lcd0_enable=0
lcd0_params=640x480-16@60
lcd_panel=0
limit_dram_size=yes
load_dtb=echo loading DTB from tftpserver ...; tftpboot $load_dtb_addr armada-385-synology-rs816-v12.dtb
load_dtb_addr=0x1000000
load_image=echo loading zImage from tftpserver ...; tftpboot $load_image_addr zImage
load_image_addr=0x02000000
load_initrd=echo loading uInitrd from tftpserver ...; tftpboot $load_initrd_addr uInitrd
load_initrd_addr=0x3000000
loadaddr=0x02000000
loadaddr_dt=0x1000000
loadaddr_kernel=0x2000000
loadaddr_rootfs=0x3000000
loads_echo=0
mtdids=spi0=spi_flash
mtdparts=mtdparts=spi0.0:4m(boot),-(spi-rootfs)
mtdparts_lgcy=mtdparts=spi_flash:4m(boot),-(spi-rootfs)
mvNetConfig=mv_net_config=4,(00:50:43:11:11:11,0:1:2:3),mtu=1500
mv_pon_addr=00:50:43:27:1c:1c
netbsd_en=no
netretry=no
pcieTune=no
pexMode=RC
pxe_files_load=:default.arm-armadaxp-db:default.arm-armadaxp:default.arm
pxefile_addr_r=3100000
ramdisk_addr_r=2880000
rootpath=/srv/nfs/
run_script=no
sata_delay_reset=0
sata_dma_mode=yes
script_addr_r=3000000
script_name=boot.scr
sd_detection_dat3=no
serverip=192.168.1.2
set_bootargs=setenv bootargs "console=ttyS0,115200 root=/dev/md0 rootdelay=20  $mtdparts earlyprintk=serial"
spi_pt_addr_dt=0x0E0000
spi_pt_addr_env=0x7e0000
spi_pt_addr_kernel=0x0F0000
spi_pt_addr_rootfs=0x3C0000
spi_pt_size_dt=0x010000
spi_pt_size_env=0x010000
spi_pt_size_kernel=0x2D0000
spi_pt_size_rootfs=0x410000
standalone=fsload 0x2000000 $image_name;setenv bootargs $console $nandEcc $mtdparts_lgcy root=/dev/mtdblock0 rw ip=$ipaddr:$serverip$bootargs_end; bootm 0x2000000;
stderr=serial
stdin=serial
stdout=serial
syno_boot_dev=/dev/md0
syno_bootargs=setenv bootargs console=ttyS0,115200 ip=off initrd=$loadaddr_rootfs root=$syno_boot_dev rw $syno_extra_args syno_hw_version=$syno_hw_version hd_power_on_seq=$syno_hdd_powerup_seq ihd_num=$syno_hdd_powerup_seq netif_num=$syno_net_if_num $ata_hdd_detect $ata_hdd_enable flash_size=8
syno_extra_args=HddHotplug=4 sata_remap=0>4:4>0
syno_hdd_powerup_seq=4
syno_hw_version=RS816
syno_net_if_num=2
upd_flash=setenv tftpfile $file_flash; tftpboot $loadaddr $tftpfile; if test $? -eq 0; then echo "This may take a while, please be patient..."; sf probe; sf erase 0 +$filesize; sf write $loadaddr 0 $filesize; echo "
Flash Update Done"; fi; 
upd_kernel=setenv tftpfile $file_kernel; mw.b $loadaddr 0xFF $spi_pt_size_kernel; tftpboot $loadaddr $tftpfile; if test $? -eq 0; then sf probe; sf erase $spi_pt_addr_kernel $spi_pt_size_kernel; sf write $loadaddr $spi_pt_addr_kernel $spi_pt_size_kernel; echo "
Kernel Update Done"; fi; 
upd_rootfs=setenv tftpfile $file_rootfs; mw.b $loadaddr 0xFF $spi_pt_size_rootfs; tftpboot $loadaddr $tftpfile; if test $? -eq 0; then sf probe; sf erase $spi_pt_addr_rootfs +$filesize; sf write $loadaddr $spi_pt_addr_rootfs $filesize; echo "
Rootfs Update Done"; fi; 
upd_uboot=setenv tftpfile $file_uboot; tftpboot $loadaddr $tftpfile; if test $? -eq 0; then sf probe; sf erase 0 +$filesize; sf write $loadaddr 0 $filesize; echo "
Uboot Update Done"; fi; 
usb0Mode=host
usbActive=0
usbType=2
usb_setup=setenv usbActive 1; setenv usbType 3; usb start;
vxworks_en=no
yuk_ethaddr=00:00:00:EE:51:81

From interupted u-boot I have entered our new boot env's then
saveenv
reset

And just allowed to boot which runs to Debian

EDIT
flash component sizes
-rw-r--r--  1 richard richard  18K May 17 10:50 armada-385-synology-rs816-v12.dtb
-rw-r--r--  1 richard richard 4.7M May 19 14:35 zImage



Edited 1 time(s). Last edit at 05/19/2019 03:13PM by richjn.
Re: Debian on Synology RS816 (Armada 385)
May 19, 2019 05:30PM
Richard,

Quote

Test 6
4 drive raid1, meta-0.9, mbr, ext4, rootfs including boot on /dev/md0 raid modules compiled in.
Result
root@debian:~#

Good works!

Quote
bodhi
3. So I think the next test should be the HDD raw sector loading test that we will store all 3 kernel files on the 1st HDD. This should be port SATA0. When it is proven to work, this will be my recommendation for new users who want to install Debian on this box.

While I'm preparing the flash instruction, you should proceed with the HDD sector loading test. It is not that important to Arch, but to Debian it is quite important. And to users (both Arch and Debian) who have multiple disk partitions on the box.

Since I don't have the hardware, I'm going slow with the flashing instruction to make sure it is correct. But it is not rocket science so not a big deal :)

-bodhi
===========================
Forum Wiki
bodhi's corner



Edited 1 time(s). Last edit at 05/19/2019 05:42PM by bodhi.
Re: Debian on Synology RS816 (Armada 385)
May 19, 2019 06:00PM
@bodhi
Thanks for preparing the flash instructions, much appreciated.

Quick question, are you posting above my posts ? twice now I seem to have "missed" relevant posts, for example the kernel naming convention, I did not see this till just now.

I will try the raw sector install on a single HDD and report back.
Re: Debian on Synology RS816 (Armada 385)
May 19, 2019 06:44PM
Richard,

> Quick question, are you posting above my posts ?
> twice now I seem to have "missed" relevant posts,
> for example the kernel naming convention, I did
> not see this till just now.

I think we were posting at the same interval of a few minutes. May be you did not refresh the screen before posting. So when you come back to the thread, it looks as though there is no new post.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian on Synology RS816 (Armada 385)
May 19, 2019 06:51PM
Richard,

By the way, I tried to make a minimal Initrd but the smallest I can get (lzma compression) is over 3MB. So it will not fit in flash.

-rw-r--r--  1 root root 3.2M May 18 18:52 initrd.img-5.1.2-mvebu-tld-1

I think Arch initrd is a little bit over 4MB.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian on Synology RS816 (Armada 385)
May 19, 2019 08:23PM
@bodhi

Test 7
zImage, uInitrd in raw HDD sector, pull DTB from tftp

I am not getting far with this but probably because I don't know what I am doing!

Steps so far
1) partition single HDD 1 partition offset 128mb to allow for zImage etc

2) Install rootfs to /dev/sda1 as normal

3) Copy zImage & uInitrd to space before partition
dd if=zImage of=/dev/sda bs=1M seek=10
dd if=uInitrd of=/dev/sda bs=1M seek=20

4) Check they can be seen
Marvell>> ide read 0x4F00 0x800 0x1800

Warning: Please run 'ide reset' before running other ide commands

Marvell>> ide reset

Reset IDE:
Marvell Serial ATA Adapter
no device found

Probably a noob mistake but I think I will need talking through this one



Edited 1 time(s). Last edit at 05/19/2019 08:27PM by richjn.
Re: Debian on Synology RS816 (Armada 385)
May 19, 2019 08:37PM
@bodhi
Quote
bodhi
2. Using RAID, we will need to go back to uInitrd solution. Eventhough in your environment, you can run your own custom built kernel to include mdm, it will not work for linux-5.1.2-mvebu-tld-1 to do that.

If you compile the raid modules as built in you can do what I have done at least on mbr, no need to do anything else.

For large gpt disks it is sufficient to have /boot on a small gpt partition and everything else on raid. zImage can be loaded from flash and will see the gpt /boot partition with initrd.img doing the rest to bring up the raid.
Re: Debian on Synology RS816 (Armada 385)
May 19, 2019 08:41PM
Hi Rich,

Try selecting the ide device before trying to read, eg; ide device 1 command.

If that doesn’t help give us the output of help ide to see if the ide command has been neutered.

J
Re: Debian on Synology RS816 (Armada 385)
May 19, 2019 08:47PM
@jdwl101

Thanks for the help! u-boot is all new to me.

No matter what "ide" command I enter I just get "Warning: Please run 'ide reset' before running other ide commands"

Marvell>> help ide
ide - ide     - IDE sub-system


Usage:
ide reset - reset IDE controller
ide info  - show available IDE devices
ide device [dev] - show or set current device
ide part [dev] - print partition table of one or all IDE devices
ide read  addr blk# cnt
ide write addr blk# cnt - read/write `cnt' blocks starting at block `blk#'
    to/from memory address `addr'

Re: Debian on Synology RS816 (Armada 385)
May 20, 2019 12:48AM
Richard,

> No matter what "ide" command I enter I just get
> "Warning: Please run 'ide reset' before running
> other ide commands"

It means the HDD is not initialized. Recall the memory pokes that we removed from the bootcmd? Try

mw 0xf10a2620 0x251
mw 0xf10a2e20 0x251

And then

ide reset

If I'm guessing correctly, this is the issue with the HDD power is not applied (and we need to use a power regulator in the DTS to activate the SATA ports). I hope those stock memory pokes are just that (but we never bother trying to figure out what their purposes are).

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian on Synology RS816 (Armada 385)
May 20, 2019 01:22AM
Richard,

> 2. Using RAID, we will need to go back to uInitrd
> solution. Eventhough in your environment, you can
> run your own custom built kernel to include mdm,
> it will not work for linux-5.1.2-mvebu-tld-1 to do
> that.
> [/quote]
>
> If you compile the raid modules as built in you
> can do what I have done at least on mbr, no need
> to do anything else.

Of course, but we are not doing that in the current Debian rootfs.

What I plan to do is to include the rest of the major files systems in the kernel (XFS, MDM RAID, LVM,...) but not BTRFS (it will stay as a loadable module). We have gotten over the magical threshold of 4MB for zImnage/uImage, so there is no point to try trimming down the kernel image anymore.

4MB was the limitation for old stock u-boot on many NAS bxoes.

But that will not come until my Debian Buster rootfs release.

-bodhi
===========================
Forum Wiki
bodhi's corner



Edited 1 time(s). Last edit at 05/20/2019 01:28AM by bodhi.
Re: Debian on Synology RS816 (Armada 385)
May 20, 2019 03:21AM
@bodhi
Quote
bodhi
It means the HDD is not initialized. Recall the memory pokes that we removed from the bootcmd? Try
mw 0xf10a2620 0x251
mw 0xf10a2e20 0x251
ide reset


Yes, I do recall and I think you make a very good point. Unfortunately those two memory pokes don't bring up any sata ports (I tried all four)
Re: Debian on Synology RS816 (Armada 385)
May 20, 2019 06:36AM
Richard,

Please dump both of the GPIO memory content and post here.

md.l f1018100 1
md.l f1018140 1

The idea is we can work out the math to turn on GPIO 37 (gpio1 5).

Bit 0 is right-most. Bank 1 is the 2nd address (f1018140).

And to turn on the bit, we set that bit 5 to 1, and write the result xxxxxx back to the memory location.

mw.l f1018140 xxxxxx
ide reset


Warning: Please do this only with the testing HDD plugged in.

-bodhi
===========================
Forum Wiki
bodhi's corner



Edited 4 time(s). Last edit at 05/20/2019 06:48AM by bodhi.
Re: Debian on Synology RS816 (Armada 385)
May 20, 2019 07:04AM
Richard,

And also turn on GPIO 15 on bank 0.

Display the content
md.l f1018100 1

Turn on bit 15 on the result above.

Write it back and reset
mw.l f1018100 xxxxxx
ide reset

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian on Synology RS816 (Armada 385)
May 20, 2019 07:16AM
@bodhi

md.l f1018100 1
f1018100: 00000000

md.l f1018140 1
f1018140: 00040000

I'm not sure what to echo back ?
Re: Debian on Synology RS816 (Armada 385)
May 20, 2019 07:27AM
Richard,


md.l f1018140 1 
f1018140: 00040000

So the result is 8 bytes.
00040000

We turn on bit 5


0    0   0   4    0    0        0            0
                                0010      0000

result = 00040020

And, write it back

mw.l f1018140    00040020

Not sure if my math is correct :)) You can do the same for GPIO 15 on bank 0.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian on Synology RS816 (Armada 385)
May 20, 2019 07:29AM
BTW, I will post the flash instruction tomorrow. All done, but need more editing.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian on Synology RS816 (Armada 385)
May 20, 2019 07:38AM
@bodhi

Your math is correct :)

ide reset
Reset IDE:
Marvell Serial ATA Adapter
no device found

On a second ide reset
no IDE devices available

EDIT
The drive is powered up



Edited 1 time(s). Last edit at 05/20/2019 07:39AM by richjn.
Re: Debian on Synology RS816 (Armada 385)
May 20, 2019 07:40AM
@bodhi

Quote

BTW, I will post the flash instruction tomorrow. All done, but need more editing.

Thank you
Re: Debian on Synology RS816 (Armada 385)
May 20, 2019 07:52AM
@bodhi
Away for 8 - 9 hours
Re: Debian on Synology RS816 (Armada 385)
May 20, 2019 08:27AM
Richard,

> The drive is powered up

Cool :) is that GPIO 15?

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian on Synology RS816 (Armada 385)
May 20, 2019 05:17PM
@bodhi
Quote

Cool :) is that GPIO 15?

My comment that your math was correct was simply based on the fact it worked so the drive powered up was GPIO1 5 (viewed from front panel numbering from left to right drive 3 and 4) Although this powered up the drive u-boot still reported no drives.

I didn't try GPIO 15 mainly because even with your example in front of me I had no clue of the math involved , I'm a bit embarrassed about that and would like to learn so I will go away and research it but for expedience I can continue to test if you can calculate the write back value for for me.
Re: Debian on Synology RS816 (Armada 385)
May 20, 2019 06:23PM
Richard,

> I didn't try GPIO 15 mainly because even with your
> example in front of me I had no clue of the math
> involved

That's OK. There is always the first time we learn anything. Especially some obscure low-level stuff like this.


Here is the 1st bank dump (md.l command displays the memory content of that location f1018100)

md.l f1018100 1 

Ouput (address:value) is:

f1018100: 00000000

So we got 32-bit hex number that all 0's.

We turn on bit 15 in that hex number (from right to left, bit 0 is righ-most, we count backward to bit 15).


0    0   0   0        0           0              0              0
                      1000      0000          0000          0000

So the command to turn on bit 15 is (mw.l command writes the hex number 00080000 to location f1018100):

mw.l f1018100    00080000

And then do ide reset to activate port 0.

ide reset

-bodhi
===========================
Forum Wiki
bodhi's corner



Edited 1 time(s). Last edit at 05/20/2019 06:50PM by bodhi.
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: