Re: Debian on Synology RS816 (Armada 385)
May 16, 2019 11:29PM
Flashing kernel to SPI flash.

(Repost Richard's post and update)


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               0x0000          0x80000         0x20000                 4

fw_printenv
Warning: Bad CRC, using default environment
bootcmd=run distro_bootcmd
bootdelay=2
baudrate=115200
stdin=serial,cros-ec-keyb,usbkbd
stdout=serial,vidconsole
stderr=serial,vidconsole
ethaddr=00:00:11:22:33:44
eth1addr=00:00:11:22:33:45
eth3addr=00:00:11:22:33:46
eth5addr=00:00:11:22:33:47
ipaddr=1.2.3.4
host_boot=if host dev ${devnum}; then setenv devtype host; run scan_dev_for_boot_part; fi
sata_boot=if sata dev ${devnum}; then setenv devtype sata; run scan_dev_for_boot_part; fi
scsi_init=if ${scsi_need_init}; then setenv scsi_need_init false; scsi scan; fi
scsi_boot=run scsi_init; if scsi dev ${devnum}; then setenv devtype scsi; run scan_dev_for_boot_part; fi
virtio_boot=if virtio dev ${devnum}; then setenv devtype virtio; run scan_dev_for_boot_part; fi
boot_prefixes=/ /boot/
boot_scripts=boot.scr.uimg boot.scr
boot_script_dhcp=boot.scr.uimg
boot_targets=host1 host0
boot_syslinux_conf=extlinux/extlinux.conf
boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr} ${prefix}${boot_syslinux_conf}
scan_dev_for_extlinux=if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${boot_syslinux_conf}; then echo Found ${prefix}${boot_syslinux_conf}; run boot_extlinux; echo SCRIPT FAILED: continuing...; fi
boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefix}${script}; source ${scriptaddr}
scan_dev_for_scripts=for script in ${boot_scripts}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${script}; then echo Found U-Boot script ${prefix}${script}; run boot_a_script; echo SCRIPT FAILED: continuing...; fi; done
scan_dev_for_boot=echo Scanning ${devtype} ${devnum}:${distro_bootpart}...; for prefix in ${boot_prefixes}; do run scan_dev_for_extlinux; run scan_dev_for_scripts; done;
scan_dev_for_boot_part=part list ${devtype} ${devnum} -bootable devplist; env exists devplist || setenv devplist 1; for distro_bootpart in ${devplist}; do if fstype ${devtype} ${devnum}:${distro_bootpart} bootfstype; then run scan_dev_for_boot; fi; done
bootcmd_host1=setenv devnum 1; run host_boot
bootcmd_host0=setenv devnum 0; run host_boot
distro_bootcmd=setenv scsi_need_init; for target in ${boot_targets}; do run bootcmd_${target}; done
bootm_size=0x10000000
kernel_addr_r=0x1000000
fdt_addr_r=0xc00000
ramdisk_addr_r=0x2000000
scriptaddr=0x1000
pxefile_addr_r=0x2000

UPDATE 1:

The mtds are OK. But /etc/fw_env.config has wrong definition.

Modify /etc/fw_env.config to have this content

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

And try (no need to reboot)
fw_printenv

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian on Synology RS816 (Armada 385)
May 16, 2019 11:43PM
@bodhi
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=mw 0xf10a2620 0x251;mw 0xf10a2e20 0x251;usb xhciinit; run bootspi
bootcmd_auto=stage_boot $boot_order
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
kernel_addr_r=2080000
lcd0_enable=0
lcd0_params=640x480-16@60
lcd_panel=0
limit_dram_size=yes
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
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
vxworks_en=no
yuk_ethaddr=00:00:00:EE:51:81
Re: Debian on Synology RS816 (Armada 385)
May 17, 2019 12:35AM
Richard,

Please refresh my memory.

How do zifxify and you boot now? entering commands at u-boot prompt? can you save them? (list them here if you never tried to save them).

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian on Synology RS816 (Armada 385)
May 17, 2019 12:46AM
@bodhi
I interupt u-boot and enter the following, just to note I dropped starting usb once I had gone over to an HDD install. Also my 20 second rootfs delay was just from testing not actually needed. I use rootfs LABEL but actual device is /dev/md0, lastly my rootfs is ext4 in case it make any difference.

setenv ipaddr 192.168.1.250
setenv serverip 192.168.1.2
setenv load_dtb_addr 0x1000000
setenv load_initrd_addr 0x3000000
setenv load_image_addr 0x02000000
setenv load_image 'echo loading zImage from tftpserver ...; tftpboot $load_image_addr zImage'
setenv load_initrd 'echo loading uInitrd from tftpserver ...; tftpboot $load_initrd_addr uInitrd'
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=LABEL=rootfs 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_initrd; run load_dtb; bootz $load_image_addr $load_initrd_addr $load_dtb_addr'
setenv bootcmd 'mw 0xf10a2620 0x251;mw 0xf10a2e20 0x251;usb xhciinit; run bootcmd_exec; run bootspi'

I have never tried to save them



Edited 1 time(s). Last edit at 05/17/2019 12:48AM by richjn.
Re: Debian on Synology RS816 (Armada 385)
May 17, 2019 01:09AM
Richard,

Looking at the stock bootcmd

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;


And what we have done to boot Debian:

setenv bootcmd_exec 'echo Booting Debian . . .; run set_bootargs; setenv fdt_skip_update yes; setenv initrd_high 0xffffffff; run load_image; run load_initrd; run load_dtb; bootz $load_image_addr $load_initrd_addr $load_dtb_addr'

setenv bootcmd 'mw 0xf10a2620 0x251;mw 0xf10a2e20 0x251;usb xhciinit; run bootcmd_exec; run bootspi'

You have run these commands too many time. It is safe to save them. So that the next series of test will be more convenient.

Before you save them, copy/paste your current envs to a notepad.

====

And at the u-boot prompt:
setenv ipaddr 192.168.1.250
setenv serverip 192.168.1.2
setenv load_dtb_addr 0x1000000
setenv load_initrd_addr 0x3000000
setenv load_image_addr 0x02000000
setenv load_image 'echo loading zImage from tftpserver ...; tftpboot $load_image_addr zImage'
setenv load_initrd 'echo loading uInitrd from tftpserver ...; tftpboot $load_initrd_addr uInitrd'
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=LABEL=rootfs 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_initrd; run load_dtb; bootz $load_image_addr $load_initrd_addr $load_dtb_addr'
setenv bootcmd 'mw 0xf10a2620 0x251;mw 0xf10a2e20 0x251;usb xhciinit; run bootcmd_exec; run bootspi'

saveenv

And then boot to Debian
reset
In Debian, reboot, come back to serial console and interrupt countdown, and try booting stock
run bootspi

After you've verified this work for a couple times, I'll look at the address and see how we should repartition the mtds to store kernel files.

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



Edited 2 time(s). Last edit at 05/17/2019 01:11AM by bodhi.
Re: Debian on Synology RS816 (Armada 385)
May 17, 2019 01:40AM
@bodhi
All went well until after the
run bootspi

This booted to stock but on returning to try and boot Debian I am getting dropped to an intramfs prompt. i.e. rootfs not found. I will boot back in via a usb drive and see if stock has overwritten something.

Back when I have got to the answer.
Re: Debian on Synology RS816 (Armada 385)
May 17, 2019 01:52AM
Richard,


> This booted to stock but on returning to try and
> boot Debian I am getting dropped to an intramfs
> prompt. i.e. rootfs not found. I will boot back in
> via a usb drive and see if stock has overwritten
> something.
>


Could be the bootargs. Post the log of the boot to Debian if you're not sure.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian on Synology RS816 (Armada 385)
May 17, 2019 02:04AM
@bodhi
No, not bootargs I'm afraid.
Booting into stock deleted my rootfs which was /dev/md0 I'm only speculating but stock uses /dev/md0 as its boot device so maybe it was trying to recover it. I have recovered the raid device but was unable to rescue the file system. I will need to start over.

These things happen when you are breaking new ground :)

Will post back when I'm up and running
Re: Debian on Synology RS816 (Armada 385)
May 17, 2019 02:25AM
Richard,

> @bodhi
> No, not bootargs I'm afraid.
> Booting into stock deleted my rootfs which was
> /dev/md0

I see.

> I'm only speculating but stock uses
> /dev/md0 as its boot device so maybe it was trying
> to recover it. I have recovered the raid device
> but was unable to rescue the file system. I will
> need to start over.
>
> These things happen when you are breaking new
> ground :)
>

During testing, the best storage device to house the rootfs is USB. I always assume that is the case (that you are booting with). Sorry, I must have missed where you indicated that you are actually using the HDD RAID to store the rootfs :)

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



Edited 1 time(s). Last edit at 05/17/2019 02:28AM by bodhi.
Re: Debian on Synology RS816 (Armada 385)
May 17, 2019 02:43AM
A little bit of a road block :)

The SPI flash size is 8MB. At minimum 1MB must be reserved for u-boot. And the kernel files size are:

zImage
4.5MB
uInitrd
8.3MB
armada-385-synology-rs816.dtb
18K

Looks like we need to work on u-boot a bit more.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian on Synology RS816 (Armada 385)
May 17, 2019 02:49AM
@bodhi
I have mentioned it several times actually but as I said these things happen so we press on :)
Quote
richjn
I use rootfs LABEL but actual device is /dev/md0
Re: Debian on Synology RS816 (Armada 385)
May 17, 2019 02:51AM
Richard,

Quote

setenv bootcmd 'mw 0xf10a2620 0x251;mw 0xf10a2e20 0x251;usb xhciinit; run bootcmd_exec; run bootspi'

I was hoping that we don't need to understand this 2 memory pokes, and the USB 3.0 init, in this stock bootcmd. However, looks like we do need to figure out at least what this command does.
usb xhciinit
On the surface, it looks like the USB 3.0 port on this box is activated by that. Is there one or more USB 3.0 ports availbe outside?

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian on Synology RS816 (Armada 385)
May 17, 2019 03:48AM
@bodhi
Two ports available but I confess I'm not sure at the moment if it is needed or not. When I moved over to a HDD install I deleted the following from the env variables you had supplied originally to zifxify

setenv usb_setup 'setenv usbActive 1; setenv usbType 3; usb start;'

And then from the setenv bootcmd_exec
run usb_setup;

In the setenv bootcmd I left the xhciinit bit because I wasn't sure about it.

Maybe I should just try without it and see what happens ?
Re: Debian on Synology RS816 (Armada 385)
May 17, 2019 04:08AM
Richard,

> setenv usb_setup 'setenv usbActive 1; setenv
> usbType 3; usb start;'

> Maybe I should just try without it and see what
> happens ?

Yes, definitely.

Flash is good when there are plenty to use. But I did not think clearly... We don't care for flash at all, if we can easily make stock u-boot recognize USB and HDD.

The ideal solution is figuring out how to activate USB and HDD in u-boot. If stock u-boot has a command for it, then it's all the better.

Worse case, we'll just poke the GPIOs. We actually know how go about that (we knew what GPIO to poke already).

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian on Synology RS816 (Armada 385)
May 17, 2019 04:45AM
@bodhi
I thought stock u-boot was unable to load zImage from USB due to lack of ext2ls or ext2load ?

I have reduced the "setenv bootcmd"

From
setenv bootcmd 'mw 0xf10a2620 0x251;mw 0xf10a2e20 0x251;usb xhciinit; run bootcmd_exec; run bootspi'

To
setenv bootcmd 'run bootcmd_exec; run bootspi'

And we boot no problem from HDD (with zImage, uInitrd, DTB via tftp) USB are visible remove / re-insert, mount etc
Re: Debian on Synology RS816 (Armada 385)
May 17, 2019 05:15AM
@bodhi

Just ran help from u-boot and there appears to be a boot from usb option (bottom of list) and a diskboot (mid list)

Marvell>> help
?       - alias for 'help'
Creset  - Creset        - Run 'reset' or boot command in a loop, while counting.

SatR    - Sample At Reset sub-system
WOLTest - WOLTest       - Wake On Lan u-boot testing

active_units- print active units on board
base    - print or set address offset
bdinfo  - print Board Info structure
boot    - boot default, i.e., run 'bootcmd'
bootd   - boot default, i.e., run 'bootcmd'
bootelf - Boot from an ELF image in memory
bootm   - boot application image from memory
bootp   - boot image via network using BOOTP/TFTP protocol
bootvx  - Boot vxWorks from an ELF image
bootz   - boot Linux zImage image from memory
cmp     - memory compare
coninfo - print console devices and information
cp      - memory copy
cpss_env- set cpss environment variables permanently

crc32   - checksum calculation
date    - get/set/reset date & time
ddrPhyRead- ddrPhyRead - Read DDR PHY register

ddrPhyWrite- ddrPhyWrite - Write DDR PHY register

dhcp    - boot image via network using DHCP/TFTP protocol
diskboot- diskboot- boot from IDE device

dma     - dma   - Perform DMA using the XOR engine

echo    - echo args to console
editenv - edit environment variable
eeprom  - EEPROM sub-system
env     - environment handling commands
exit    - exit script
false   - do nothing, unsuccessfully
fdt     - flattened device tree utility commands
flash_part_print- flash_part_print  - print spi/nand FLASH memory information

go      - start application at address 'addr'
help    - print command description/usage
i2c     - I2C sub-system
ide     - ide     - IDE sub-system

iminfo  - print header information for application image
imxtract- extract a part of a multi-image
ir      - ir    - reading and changing MV internal register values.

itest   - return true/false on integer compare
loadb   - load binary file over serial line (kermit mode)
loads   - load S-Record file over serial line
loadx   - load binary file over serial line (xmodem mode)
loady   - load binary file over serial line (ymodem mode)
loop    - infinite loop on address range
map     - map   - Display address decode windows

md      - memory display
me      - me    - PCIe master enable

mm      - memory modify (auto-incrementing address)
mmc     - MMC sub system
mmcinfo - display MMC info
mp      - mp    - map PCIe BAR

mtdburn - Burn a Linux image and Filesystem` on the NAND/SPI flash.

mtest   - simple RAM read/write test
mw      - memory write (fill)
nfs     - boot image via network using NFS protocol
nm      - memory modify (constant address)
pci     - list and access PCI Configuration Space
pciePhyRead- phyRead    - Read PCI-E Phy register

pciePhyWrite- pciePhyWrite      - Write PCI-E Phy register

phyRead - phyRead       - Read Phy register

phyWrite- phyWrite      - Write Phy register

ping    - send ICMP ECHO_REQUEST to network host
printenv- print environment variables
pxe     - commands to get and boot from pxe files
qsgmii_sel-  Select SFP or QSGMII modes on bc2.

rcvr    - rcvr  - Start recovery process (with TFTP server)

reset   - Perform RESET of the CPU
resetenv- resetenv      - Erase environment sector to reset all variables to default.

run     - run commands in an environment variable
saveenv - save environment variables to persistent storage
scsi    - SCSI sub-system
scsiboot- boot from SCSI device
se      - se    - PCIe Slave enable

setenv  - set environment variables
sf      - SPI flash sub-system
sg      - sg    - scanning the PHYs status

showvar - print local hushshell variables
sleep   - delay execution for some time
smiscan - smiscan - Scan for marvell smi devices.

source  - run script from memory
sp      - scan and detect all devices on PCI-e interface
sspi    - SPI utility command
switchCountersRead- switchCntPrint      - Read switch port counters.

switchPhyRegRead- - Read switch register

switchPhyRegWrite- - Write switch register

switchRegRead- switchRegRead    - Read switch register

switchRegWrite- switchRegWrite  - Write switch register

syno_pwoff- syno_pwoff    - bring the system down

syno_up - syno_up       - Send a character to microp

sysboot - command to get and boot from syslinux files
temp    - temp  - Display the device temperature.

tempCmd0- tempCmd - This command allocated for monitor extinction

tempCmd1- tempCmd - This command allocated for monitor extinction

tempCmd2- tempCmd - This command allocated for monitor extinction

tempCmd3- tempCmd - This command allocated for monitor extinction

test    - minimal test like /bin/sh
tftpboot- boot image via network using TFTP protocol
training- training      - prints the results of the DDR3 Training.

trainingStability- training     - prints the results of the DDR3 Training.

true    - do nothing, successfully
ts_report- ts_report    - report touch screen coordinate

ts_test - ts_test       - test touch screen

usb     - USB sub-system
usbboot - boot from USB device
version - print monitor, compiler and linker version
whoAmI  - - reading CPU ID



Edited 1 time(s). Last edit at 05/17/2019 05:16AM by richjn.
Re: Debian on Synology RS816 (Armada 385)
May 17, 2019 05:20AM
Richard,

> I thought stock u-boot was unable to load zImage
> from USB due to lack of ext2ls or ext2load ?

I can't recall whether this is true, that brain cells have been loaded with diffferent topics :)) seriously. I need to reread the thread to remember. So if you could, verify this by
help
to see the available commands. See if fatload, load, ext2load, ex4load are avaible.

> And we boot no problem from HDD (with zImage,
> uInitrd, DTB via tftp) USB are visible remove /
> re-insert, mount etc

That is expected. u-boot only deals with kernel files. After the kernel has booted, every devices will be available because the kernel is capable of all that.

The issue is whether u-boot can activate USB or HDD to load the kernel files uImage, zImage, uInitrd, DTB... Currently, as we knew, stock u-boot is quite limited, so we can only load kernel files using tftp.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian on Synology RS816 (Armada 385)
May 17, 2019 05:23AM
Richard,

> Just ran help from u-boot and there appears to be
> a boot from usb option (bottom of list) and a
> diskboot (mid list)

You've read my mind :)

> loadb - load binary file over serial line
> (kermit mode)

> scsiboot- boot from SCSI device

> tftpboot- boot image via network using TFTP
> protocol

> usb - USB sub-system
> usbboot - boot from USB device

There we go. These commands are capable of booting from storage devices.

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



Edited 1 time(s). Last edit at 05/17/2019 05:24AM by bodhi.
Re: Debian on Synology RS816 (Armada 385)
May 17, 2019 05:25AM
So there is no ext2/ext4 load or fatload.

Bummer! this stock u-boot is really too limited. I have to think what should be the best way forward.

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



Edited 1 time(s). Last edit at 05/17/2019 05:27AM by bodhi.
Re: Debian on Synology RS816 (Armada 385)
May 17, 2019 05:26AM
@bodhi

Marvell>> help diskboot
diskboot - diskboot- boot from IDE device


Usage:
diskboot loadAddr dev:part

Marvell>> help usbboot
usbboot - boot from USB device

Usage:
usbboot loadAddr dev:part

Same for scsiboot
Marvell>> help scsiboot
scsiboot - boot from SCSI device

Usage:
scsiboot loadAddr dev:part



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

Bummer! this stock u-boot is really too limited. I have to think what should be the best way forward

I'm typing whilst you are posting, sorry about that, if this is a dead line I'm ready to try again with Sp1 flash if its ok with you ?
Re: Debian on Synology RS816 (Armada 385)
May 17, 2019 06:00AM
Richard,

> I'm typing whilst you are posting, sorry about
> that, if this is a dead line I'm ready to try
> again with Sp1 flash if its ok with you ?

Not sure what you meant by SP1? if you meant SPI, it is not feasible because it is to small (some change in booting scheme needed if we use SPI flash).

For now, I think, keep booting with tftp. I need some time to think it through.

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

Not sure what you meant by SP1?

Yeah I meant SPI it's been a long day.

I will leave you in peace to think it all through.

Meanwhile just out of curiosity I will see if I can reduce the zImage size by knocking out as many built in modules as I can.
Re: Debian on Synology RS816 (Armada 385)
May 17, 2019 06:27AM
@bodhi

Quote

The SPI flash size is 8MB. At minimum 1MB must be reserved for u-boot. And the kernel files size are:

And I missed this post from you altogether!!

Everything you said consequently now falls into place and hopefully now you know I missed the post you don't think I've not been listening.
Re: Debian on Synology RS816 (Armada 385)
May 17, 2019 04:45PM
@bodhi
Hi
I think we were both trying to do too many things at once and on my side with the final post in sight I was guilty of being just too keen to get it done...... lesson learnt!

I haven't tried reducing the zImage / uInitrd size as yet because although its an option it is probably a less desirable solution as it would be an RS816 specific one.

My other thought is can we load zImage into flash on an assumption it loads enough drivers to then use u-boot scsiboot to load the uInitrd direct from the rootfs ?
Re: Debian on Synology RS816 (Armada 385)
May 17, 2019 06:06PM
Richard,

I think it is running well enough now. So the issue of loading kernel from disk can take its time to resolve. Here are the options.

1. Modify stock u-boot to enable ext2load command (my prefered approach).

What I usually do here is rebuild stock u-boot and use kwboot to boot it with UART. See example here. Having a rescue mechanism working while you are messing with the box u-boot is a must do.

And then if kwboot is successful, modify stock u-boot and boot it with UART. Test thoroughly, and then flash it.

2. Loading zImage, uInitrd, and DTB from the HDD raw sector.

This approach is the simple one. We test stock u-boot to see if it can load kernel files from HDD unused sector. Usually, this is best done with an HDD that is not in RAID array. But it will work with RAID too.

See here the Wiki thread for Howto:

Quote

Booting Debian on Pogoplug

How to set up U-Boot for booting in multiple drives configuration
Backup and Restore NAND mtds
UART Booting HowTo for Selected Kirkwood Devices
Migrating from Arch to Debian?
How to boot new Debian rootfs using stock u-boot tftp - Pogo E02
How to boot new Debian rootfs on USB using stock u-boot - NSA325
How to boot Debian rootfs on a GPT HDD with stock u-boot (kernel files stored in HDD raw sector), 2nd HowTo post

The 1st Howto is simpler, where no RAID got involved. The 2nd Howto has some precaution for RAID.

=====

So I think you can try the option 2 first. While I'll see of I can rebuild stock u-boot using their GPL.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian on Synology RS816 (Armada 385)
May 17, 2019 06:53PM
@bodhi
I will try to reduce zImage, uInitrd and DTS to below 7mb first as its my preferred option to boot from flash.

Even if I succeed I am happy to test an HDD raw sector boot as others may prefer to go that way especially if you are unable to rebuild stock u-boot.
Re: Debian on Synology RS816 (Armada 385)
May 17, 2019 07:07PM
Richard,

> I will try to reduce zImage, uInitrd and DTS to
> below 7mb first as its my preferred option to boot
> from flash.

Sure. But the small uInitrd is not useful. You could squeeze them all in about 7MB, and in the future find that you cannot install new module :)

My goal always has been to make it possible to run a full blown Debian system on disk.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian on Synology RS816 (Armada 385)
May 17, 2019 07:10PM
RS816 fan speed control

The fans are all pre-configured in @bodhi upcoming 5.1.x rootfs
To control the fan speed on this box you can install Debian fancontrol.

To install
# apt-get install fancontrol

To configure
# pwmconfig

Or if you prefer download the attached fancontrol config file and install it to /etc

Then start the fan control daemon
# service fancontrol start
Attachments:
open | download - fancontrol (426 bytes)
Re: Debian on Synology RS816 (Armada 385)
May 17, 2019 07:17PM
@bodhi
Quote

My goal always has been to make it possible to run a full blown Debian system on disk.

Very happy to test anything you ask me to in the interest of achieving your goal and generally helping others get this box up and running.

I will see how "close to the wire" I am with my attempts to reduce size if too close I will drop my preferred option.
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: