Welcome! Log In Create A New Profile

Advanced

Debian on Synology DS211

Posted by Ivanj 
Re: Debian on Synology DS211
November 19, 2024 05:57PM
> Yes, of course, in all previous examples I have
> removed the USB, since I wanted to boot from the
> SATA connected HDD only and not use USB at all.

Cool!

> Only at the end I have used the USB to boot and
> test whether the 12TB HDD will work.
> I assume that USB will be slower to run the OS
> from, so I wanted to use the much faster SATA.and
> a HDD.

Yes, indeed. If you have SATA, always best to have the rootfs on it. And the 12TB disk should work in u-boot. We just don't have the correct regulator, I think.

This log seems truncated, there is nothing on it:

upper_sata1_1TBHDD.txt (1 byte)

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian on Synology DS211
November 20, 2024 03:02PM
Ivanj,


bodhi Wrote:
-------------------------------------------------------
> > Yes, of course, in all previous examples I have
> > removed the USB, since I wanted to boot from
> the
> > SATA connected HDD only and not use USB at all.
>
> Cool!
>
> > Only at the end I have used the USB to boot and
> > test whether the 12TB HDD will work.
> > I assume that USB will be slower to run the OS
> > from, so I wanted to use the much faster
> SATA.and
> > a HDD.
>
> Yes, indeed. If you have SATA, always best to have
> the rootfs on it. And the 12TB disk should work in
> u-boot. We just don't have the correct regulator,
> I think.
>
> This log seems truncated, there is nothing on it:
>
> upper_sata1_1TBHDD.txt (1 byte)

Here is the update DTB. Please copy to your USB rootfs /boot/dts/ and try booting USB rootfs and with 2 data HDDs in the slots. See if both HDDs will be enumerated in Debian.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 1 time(s). Last edit at 11/20/2024 03:26PM by bodhi.
Attachments:
open | download - kirkwood-ds211.dtb (21.9 KB)
open | download - kirkwood-ds211.dts (734 bytes)
Re: Debian on Synology DS211
November 20, 2024 04:01PM
Bodhi,

With the new dtb file both SATA slots are working and recognize the drives!
[  638.325500] ata2: link is slow to respond, please be patient (ready=0)
[  642.385518] ata2: SRST failed (errno=-16)
[  648.365503] ata2: link is slow to respond, please be patient (ready=0)
[  649.835513] ata2: SATA link up 3.0 Gbps (SStatus 123 SControl F300)
[  649.844839] ata2.00: supports DRM functions and may not be fully accessible
[  649.852573] ata2.00: ATA-10: ST12000NM0127, G006, max UDMA/133
[  649.860574] ata2.00: 23437770752 sectors, multi 0: LBA48 NCQ (depth 31/32)
[  649.902322] ata2.00: Features: Trust
[  649.911162] ata2.00: supports DRM functions and may not be fully accessible
[  649.922670] ata2.00: configured for UDMA/133
[  649.929053] scsi 1:0:0:0: Direct-Access     ATA      ST12000NM0127    G006 PQ: 0 ANSI: 5
[  649.950875] sd 1:0:0:0: [sdb] 23437770752 512-byte logical blocks: (12.0 TB/10.9 TiB)
[  649.965619] sd 1:0:0:0: Attached scsi generic sg1 type 0
[  649.973779] sd 1:0:0:0: [sdb] 4096-byte physical blocks
[  649.986057] sd 1:0:0:0: [sdb] Write Protect is off
[  649.991618] sd 1:0:0:0: [sdb] Mode Sense: 00 3a 00 00
[  649.991700] sd 1:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[  650.024126] sd 1:0:0:0: [sdb] Preferred minimum I/O size 4096 bytes
[  650.148809]  sdb: sdb1
[  650.152362] sd 1:0:0:0: [sdb] Attached SCSI disk
[  665.305516] ata1: SATA link up 3.0 Gbps (SStatus 123 SControl F300)
[  665.317090] ata1.00: ATA-8: APPLE HDD HTS541010A9E632, JA0AB5N0, max UDMA/133
[  665.324981] ata1.00: 1953525168 sectors, multi 16: LBA48 NCQ (depth 31/32)
[  665.338560] ata1.00: configured for UDMA/133
[  665.344002] scsi 0:0:0:0: Direct-Access     ATA      APPLE HDD HTS541 B5N0 PQ: 0 ANSI: 5
[  665.366373] sd 0:0:0:0: [sdc] 1953525168 512-byte logical blocks: (1.00 TB/932 GiB)
[  665.374792] sd 0:0:0:0: [sdc] 4096-byte physical blocks
[  665.381177] sd 0:0:0:0: Attached scsi generic sg2 type 0
[  665.401146] sd 0:0:0:0: [sdc] Write Protect is off
[  665.413484] sd 0:0:0:0: [sdc] Mode Sense: 00 3a 00 00
[  665.413619] sd 0:0:0:0: [sdc] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[  665.435708] sd 0:0:0:0: [sdc] Preferred minimum I/O size 4096 bytes
[  665.535090]  sdc: sdc1
[  665.538693] sd 0:0:0:0: [sdc] Attached SCSI disk

The next step is a new uBoot?
Re: Debian on Synology DS211
November 20, 2024 05:11PM
Ivanj,

> With the new dtb file both SATA slots are working
> and recognize the drives!
>
> [  638.325500] ata2: link is slow to respond,
> please be patient (ready=0)
> [  642.385518] ata2: SRST failed (errno=-16)
> [  648.365503] ata2: link is slow to respond,
> please be patient (ready=0)
> [  649.835513] ata2: SATA link up 3.0 Gbps
> (SStatus 123 SControl F300)
> [  649.844839] ata2.00: supports DRM functions and
> may not be fully accessible
> [  649.852573] ata2.00: ATA-10: ST12000NM0127,
> G006, max UDMA/133
> [  649.860574] ata2.00: 23437770752 sectors, multi
> 0: LBA48 NCQ (depth 31/32)
> [  649.902322] ata2.00: Features: Trust
> [  649.911162] ata2.00: supports DRM functions and
> may not be fully accessible
> [  649.922670] ata2.00: configured for UDMA/133
> [  649.929053] scsi 1:0:0:0: Direct-Access     ATA
>      ST12000NM0127    G006 PQ: 0 ANSI: 5
> [  649.950875] sd 1:0:0:0: [sdb] 23437770752
> 512-byte logical blocks: (12.0 TB/10.9 TiB)
> [  649.965619] sd 1:0:0:0: Attached scsi generic
> sg1 type 0
> [  649.973779] sd 1:0:0:0: [sdb] 4096-byte
> physical blocks
> [  649.986057] sd 1:0:0:0: [sdb] Write Protect is
> off
> [  649.991618] sd 1:0:0:0: [sdb] Mode Sense: 00 3a
> 00 00
> [  649.991700] sd 1:0:0:0: [sdb] Write cache:
> enabled, read cache: enabled, doesn't support DPO
> or FUA
> [  650.024126] sd 1:0:0:0: [sdb] Preferred minimum
> I/O size 4096 bytes
> [  650.148809]  sdb: sdb1
> [  650.152362] sd 1:0:0:0: [sdb] Attached SCSI
> disk
> [  665.305516] ata1: SATA link up 3.0 Gbps
> (SStatus 123 SControl F300)
> [  665.317090] ata1.00: ATA-8: APPLE HDD
> HTS541010A9E632, JA0AB5N0, max UDMA/133
> [  665.324981] ata1.00: 1953525168 sectors, multi
> 16: LBA48 NCQ (depth 31/32)
> [  665.338560] ata1.00: configured for UDMA/133
> [  665.344002] scsi 0:0:0:0: Direct-Access     ATA
>      APPLE HDD HTS541 B5N0 PQ: 0 ANSI: 5
> [  665.366373] sd 0:0:0:0: [sdc] 1953525168
> 512-byte logical blocks: (1.00 TB/932 GiB)
> [  665.374792] sd 0:0:0:0: [sdc] 4096-byte
> physical blocks
> [  665.381177] sd 0:0:0:0: Attached scsi generic
> sg2 type 0
> [  665.401146] sd 0:0:0:0: [sdc] Write Protect is
> off
> [  665.413484] sd 0:0:0:0: [sdc] Mode Sense: 00 3a
> 00 00
> [  665.413619] sd 0:0:0:0: [sdc] Write cache:
> enabled, read cache: enabled, doesn't support DPO
> or FUA
> [  665.435708] sd 0:0:0:0: [sdc] Preferred minimum
> I/O size 4096 bytes
> [  665.535090]  sdc: sdc1
> [  665.538693] sd 0:0:0:0: [sdc] Attached SCSI
> disk
>
>
> The next step is a new uBoot?

Nice!

Yes, I'll build another u-boot version.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian on Synology DS211
November 20, 2024 10:28PM
Re: Debian on Synology DS211
April 21, 2025 06:45PM
Hello Bodhi,

It seems that i messed up my env. I was trying to add net console capability, and seems that over serial console some characters got gobbled up and I probably messed up my env. Now I can't boot the uboot.

I get this in the serial console and it just get's stuck there:
U-Boot 2024.10-tld-1 (Dec 02 2024 - 12:37:41 -0800)
Synology DS211

SoC:   Kirkwood 88F6282_A0
DRAM:  256 MiB
Core:  17 devices, 12 uclasses, devicetree: separate
Loading Environment from SPIFlash... SF: Detected m25p32 with page size 256 Bytes, erase size 64 KiB, tB
OK

I tried the kwboot but got the same.
If I could boot with different env, I should be able to fix this issue by rewriting the SPI env.

AI is suggesting the following:
Loading a custom U-Boot image via kwboot with a configuration that doesn't load from SPI flash (e.g., CONFIG_ENV_IS_NOWHERE), allowing manual environment setup.
Setting bootcmd at the prompt to load from USB, then saving it to SPI flash for persistence.
Alternatively, compiling a U-Boot image with CONFIG_ENV_IS_IN_FAT to load the environment from a USB drive, though this is advanced.


My last known env when I was able to boot to debian was:
root@debian:~# fw_printenv 
baudrate=115200
bootcmd=run bootcmd_uenv; run scan_disk; run set_bootargs; run bootcmd_exec; reset
bootcmd_exec=if run load_uimage; then; if run load_initrd; then if run load_dtb; then bootm $load_uimage_addr $load_initrd_addr $load_dtb_addr; else bootm $load_uimage_addr $load_initrd_addr; fi; else if run load_dtb; then bootm $load_uimage_addr - $load_dtb_addr; else bootm $load_uimage_addr; fi; fi; fi
bootcmd_uenv=run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi
bootdelay=10
bootdev=usb
console=ttyS0,115200
device=0:1
devices=usb sata
disks=0 1 2 3
dtb_file=/boot/dts/kirkwood-ds211.dtb
ethaddr=EA:37:F4:FB:17:D5
if_netconsole=ping $serverip
ipaddr=10.0.0.27
load_dtb=echo loading DTB $dtb_file ...; load $bootdev $device $load_dtb_addr $dtb_file
load_dtb_addr=0x1c00000
load_initrd=echo loading uInitrd ...; load $bootdev $device $load_initrd_addr /boot/uInitrd
load_initrd_addr=0x2100000
load_uimage=echo loading uImage ...; load $bootdev $device $load_uimage_addr /boot/uImage
load_uimage_addr=0x800000
mtdparts=mtdparts=spi0.0:512K(u-boot),64K@768K(u-boot-env),3M@1M(data)
ncip=10.0.0.195
preboot_nc=setenv nc_ready 0; for pingstat in 1 2 3; do; sleep 1; if run if_netconsole; then setenv nc_ready 1; fi; done; if test $nc_ready -eq 1; then run start_netconsole; fi
scan_disk=echo running scan_disk ...; scan_done=0; setenv scan_usb "usb reset; sleep 1; usb reset";  setenv scan_sata "sata init";  setenv scan_mmc "mmc rescan"; for dev in $devices; do if test $scan_done -eq 0; then echo Scan device $dev; run scan_$dev; for disknum in $disks; do if test $scan_done -eq 0; then echo device $dev $disknum:1; if load $dev $disknum:1 $load_uimage_addr /boot/uImage 1; then scan_done=1; echo Found bootable drive on $dev $disknum; setenv device $disknum:1; setenv bootdev $dev; fi; fi; done; fi; done
serverip=10.0.0.195
set_bootargs=setenv bootargs console=ttyS0,115200 root=LABEL=rootfs rootfstype=ext4 rootdelay=10 $mtdparts $custom_paras
start_netconsole=setenv ncip $serverip; setenv bootdelay 10; setenv stdin serial,nc; setenv stdout serial,nc; setenv stderr serial,nc
stderr=serial,nc
stdin=serial,nc
stdout=serial,nc
uenv_addr=0x810000
uenv_import=echo importing envs ...; env import -t $uenv_addr $filesize
uenv_init_devices=echo Initializing devices...; setenv init_usb "usb reset; sleep 1; usb reset"; setenv init_sata sata init;  setenv init_mmc mmc rescan; for devtype in $devices; do run init_$devtype; done;
uenv_load=run uenv_init_devices; setenv uenv_loaded 0; for devtype in $devices; do for disknum in $disks; do if test $uenv_loaded -eq 0; then setenv device_type $devtype; setenv disk_number $disknum; run uenv_read; fi; done; done;
uenv_read=echo Loading envs from $device_type $disk_number...; if load $device_type  $disk_number:1 $uenv_addr /boot/uEnv.txt; then setenv uenv_loaded 1; echo ... envs loaded; fi
root@debian:~#

I suspect it has to be something with the netconsole configs.

Please help, since I have bricked the DS211.
Re: Debian on Synology DS211
April 21, 2025 09:56PM
Ivan,

> It seems that i messed up my env. I was trying to
> add net console capability, and seems that over
> serial console some characters got gobbled up and
> I probably messed up my env. Now I can't boot the
> uboot.
>
> I get this in the serial console and it just get's
> stuck there:
>
> U-Boot 2024.10-tld-1 (Dec 02 2024 - 12:37:41
> -0800)
> Synology DS211
> 
> SoC:   Kirkwood 88F6282_A0
> DRAM:  256 MiB
> Core:  17 devices, 12 uclasses, devicetree:
> separate
> Loading Environment from SPIFlash... SF: Detected
> m25p32 with page size 256 Bytes, erase size 64
> KiB, tB
> OK
>

> I tried the kwboot but got the same.
> If I could boot with different env, I should be
> able to fix this issue by rewriting the SPI env.

That's the right idea! but first, try this to see it will fix this problem.

Open 2 terminals on server 10.0.0.195 (if this is also where you start serial console). If not, run serial console on the terminal where you just did. And go to 10.0.0.195 and start netconsole monitor.

Power up, and observe both consoles. As soon as the serial console seems to hang, on the other terminal, the netconsole should start running and output its banner, interrupt the count down and now you have control of the box.

Now you can transfer the control back to serial console this way,

At u-boot prompt of netconsole monitor,
setenv reset_serial 'echo Reset console to serial...; setenv stderr serial; setenv stdin serial; setenv stdout serial'
run reset_serial

=========

The problem might be that I've missed a patch on this u-boot (where I automatically force fix this potential problem before booting Linux).

The problem with netconsole is that the code is not robust enough so it's easy to make a mistake in the envs and got stuck. If the above does not work, I'll just rebuild a new version and make sure the patch is there. I can also build a version that ignores the envs on flash (CONFIG_ENV_IS_NOWHERE). It's the first time I see AI suggesting something close to the solution (but not quite there, because as a user you don't want to build u-boot, you just want some workaround).

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 1 time(s). Last edit at 04/21/2025 09:58PM by bodhi.
Re: Debian on Synology DS211
April 22, 2025 07:19PM
Hello Bodhi,

Thanks for your response.
I didn't mention it, but I did run "nc -l -u -p 6666" on the server 10.0.0.195, however It wouldn't connect.
I tried it again to double check, but no joy.
I also tried pushing the reset button for 10 secs, while turning on the DS211, and also during running it, still everything remains the same.

Unfortunately, it seems that I would have to bother you for another u-boot build.

Thank you!



Edited 1 time(s). Last edit at 04/22/2025 07:20PM by Ivanj.
Re: Debian on Synology DS211
April 22, 2025 07:44PM
Ivan,

> Unfortunately, it seems that I would have to
> bother you for another u-boot build.

It's OK! we still have unknowns to figure out. The rescue u-boot will enable the testing of the 2nd HDD bay too.

https://forum.doozan.com/read.php?3,138456

Quote

This u-boot currently can boot USB rootfs. When booting with USB rootfs, both bays can host large disks (e.g. 3TB or 12TB). Booting SATA rootfs is limited to the upper bay, and capacity <= 2TB disk).

The large HDD issue is unfortunately harder. It seems that it's broken in mainline. I will take too much time for me to track it down (I will try that enventually since it is affecting all Kirkwood boxes).

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian on Synology DS211
April 22, 2025 08:16PM
I managed to boot into original u-boot, but not to debian:

ivan@strelac ~ $ sudo kwboot  -t -B 115200 /dev/ttyUSB0 -b /home/ivan/tools/os/linux/ds211/backup/u-boot-DS211_533ddr3x8cs0size512_flash.bin -p
kwboot version 2025.04
Detected kwbimage v0 with SPI boot signature
Patching image boot signature to UART
Sending boot message. Please reboot the target.../
Sending boot image header (512 bytes)...
 25 % [....                                                                  ]
Done
Sending boot image data (469728 bytes)...
  0 % [......................................................................]
  1 % [......................................................................]
  3 % [......................................................................]
  5 % [......................................................................]
  7 % [......................................................................]
  9 % [......................................................................]
 11 % [......................................................................]
 13 % [......................................................................]
 15 % [......................................................................]
 17 % [......................................................................]
 19 % [......................................................................]
 21 % [......................................................................]
 22 % [......................................................................]
 24 % [......................................................................]
 26 % [......................................................................]
 28 % [......................................................................]
 30 % [......................................................................]
 32 % [......................................................................]
 34 % [......................................................................]
 36 % [......................................................................]
 38 % [......................................................................]
 40 % [......................................................................]
 41 % [......................................................................]
 43 % [......................................................................]
 45 % [......................................................................]
 47 % [......................................................................]
 49 % [......................................................................]
 51 % [......................................................................]
 53 % [......................................................................]
 55 % [......................................................................]
 57 % [......................................................................]
 59 % [......................................................................]
 61 % [......................................................................]
 62 % [......................................................................]
 64 % [......................................................................]
 66 % [......................................................................]
 68 % [......................................................................]
 70 % [......................................................................]
 72 % [......................................................................]
 74 % [......................................................................]
 76 % [......................................................................]
 78 % [......................................................................]
 80 % [......................................................................]
 82 % [......................................................................]
 83 % [......................................................................]
 85 % [......................................................................]
 87 % [......................................................................]
 89 % [......................................................................]
 91 % [......................................................................]
 93 % [......................................................................]
 95 % [......................................................................]
 97 % [......................................................................]
 99 % [..............................                                        ]
Done
Finishing transfer
[Type Ctrl-\ + c to quit]

         __  __                      _ _
        |  \/  | __ _ _ ____   _____| | |
        | |\/| |/ _` | '__\ \ / / _ \ | |
        | |  | | (_| | |   \ V /  __/ | |
        |_|  |_|\__,_|_|    \_/ \___|_|_|
 _   _     ____              _
| | | |   | __ )  ___   ___ | |_ 
| | | |___|  _ \ / _ \ / _ \| __| 
| |_| |___| |_) | (_) | (_) | |_ 
 \___/    |____/ \___/ \___/ \__|  ** LOADER **
 ** MARVELL BOARD: Synology Disk Station LE 

U-Boot 1.1.4 (Dec  6 2018 - 00:23:15) Marvell version: 3.5.3

U-Boot code: 00600000 -> 0067FFF0  BSS: -> 0068B3D4

Soc: 88F6282 A0 CPU running @ 1600Mhz L2 running @ 533Mhz
SysClock = 533Mhz , TClock = 200Mhz 

DRAM (DDR3) CAS Latency = 7 tRP = 7 tRAS = 20 tRCD=7
DRAM CS[0] base 0x00000000   size 512MB 
DRAM Total size 512MB  16bit width
Addresses 8M - 0M are saved for the U-Boot usage.
Mem malloc Initialization (8M - 7M): Done
Using default environment

[4096kB@f8000000] Flash:  4 MB

CPU : Marvell Feroceon (Rev 1)

Streaming disabled 
Write allocate disabled


USB 0: host mode
PEX 0: interface detected no Link.
PEX 1: interface detected no Link.

Synology Model: DS211
Fan Status: Good

Net:   egiga0 [PRIME], egiga1
Hit any key to stop autoboot:  0 
## Booting image at f8080000 ...
   Image Name:   Linux-2.6.32.12
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    1553596 Bytes =  1.5 MB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... Bad Data CRC
Marvell>> setenv ipaddr 10.0.0.27; setenv serverip 10.0.0.195; setenv netmask 255.255.255.0; setenv bootargs 'console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 earlyprintk=serial'
Marvell>> mw 0x800000 0 1; tftpboot 0x800000 os/linux/ds211/uImage; tftpboot 0x2100000 os/linux/ds211/uInitrd; printenv; bootm 0x800000 0x2100000
Using egiga0 device
TFTP from server 10.0.0.195; our IP address is 10.0.0.27
Filename 'os/linux/ds211/uImage'.
Load address: 0x800000
Loading: #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 ##########################################
done
Bytes transferred = 5871096 (5995f8 hex)
Using egiga0 device
TFTP from server 10.0.0.195; our IP address is 10.0.0.27
Filename 'os/linux/ds211/uInitrd'.
Load address: 0x2100000
Loading: #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 ############################
done
Bytes transferred = 5797335 (5875d7 hex)
bootcmd=bootm F8080000 F8280000
baudrate=115200
loads_echo=0
rootpath=/mnt/ARM_FS/
run_diag=yes
stdin=serial
stdout=serial
stderr=serial
console=console=ttyS0,115200 mtdparts=spi_flash:0x80000@0(uboot)ro,0x300000@0x100000(root)
mainlineLinux=no
enaMonExt=no
enaCpuStream=no
enaWrAllo=no
pexMode=RC
disL2Cache=no
setL2CacheWT=yes
disL2Prefetch=yes
enaICPref=yes
enaDCPref=yes
sata_dma_mode=yes
MALLOC_len=1
ethprime=egiga0
netbsd_en=no
vxworks_en=no
bootargs_root=root=/dev/nfs rw
bootargs_end=:::DB88FXX81:eth0:none
image_name=uImage
standalone=fsload 0x2000000 $(image_name);setenv bootargs $(console) root=/dev/mtdblock0 rw ip=$(ipaddr):$(serverip)$(bootargs_end) $(mvPhoneConfig); bootm 0x2000000;
lcd0_enable=0
lcd0_params=640x480-16@60
bootdelay=3
disaMvPnp=no
ethaddr=00:50:43:3c:3b:5d
ethmtu=1500
mvPhoneConfig=mv_phone_config=dev[0]:fxs,dev[1]:fxo
mvNetConfig=mv_net_config=(00:11:88:0f:62:81,0:1:2:3),mtu=1500
usb0Mode=host
pcieTune=no
pcieTune1=no
ethact=egiga0
bootargs=console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 earlyprintk=serial
filesize=5875d7
fileaddr=2100000
netmask=255.255.255.0
ipaddr=10.0.0.27
serverip=10.0.0.195

Environment size: 1144/4092 bytes
## Booting image at 00800000 ...
   Image Name:   Linux-6.11.6-kirkwood-tld-1
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    5871032 Bytes =  5.6 MB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... OK
OK
## Loading Ramdisk Image at 02100000 ...
   Image Name:   initramfs-6.11.6-kirkwood-tld-1
   Image Type:   ARM Linux RAMDisk Image (gzip compressed)
   Data Size:    5797271 Bytes =  5.5 MB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK

Starting kernel ...


Error: invalid dtb and unrecognized/unsupported machine ID
  r1=0x00000b3c, r2=0x00000100
  r2[]=05 00 00 00 01 00 41 54 00 00 00 00 00 00 00 00
Available machine support:

ID (hex)	NAME
ffffffff	Generic DT based system
ffffffff	Marvell Kirkwood (Flattened Device Tree)

Please check your kernel config and/or bootloader.

Perhaps I can flash the env that I can upload from tftp "uboot.2024.10-tld-1.ds211.environment"?
I was too afraid to do it myself, maybe you can instruct me how to do it, and restore the original env?
Re: Debian on Synology DS211
April 22, 2025 10:34PM
> I managed to boot into original u-boot, but not to
> debian:

Cool!

> Error: invalid dtb and unrecognized/unsupported
> machine ID

Remember when you boot Debian with stock u-boot you had to append the DTB to uImage? So now all you need to do is to use that uImage, or create a new one. Take your USB rootfs to another Linux box and recreate it. Assuming it's mounted at /media/sdb1.

cd /media/sdb1/boot
cp -a zImage-6.11.6-kirkwood-tld-1  zImage.fdt
cat dts/kirkwood-ds112-v10j.dtb  >> zImage.fdt
mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n Linux-6.11.6-kirkwood-tld-1 -d zImage.fdt  uImage
sync
Note that you should still have uImage.orig in this /boot directory, which you will need to switch to when you reboot with the new u-boot already flashed.

> Perhaps I can flash the env that I can upload from
> tftp "uboot.2024.10-tld-1.ds211.environment"?
> I was too afraid to do it myself, maybe you can
> instruct me how to do it, and restore the original
> env?

So now you can kwboot the stock u-boot again, and it will boot into Debian.

But before booting all the way, you need to change the mtdpart env so you can flash the default env image.

- kwboot like you did
ivan@strelac ~ $ sudo kwboot  -t -B 115200 /dev/ttyUSB0 -b /home/ivan/tools/os/linux/ds211/backup/u-boot-DS211_533ddr3x8cs0size512_flash.bin -p
- interrupt countdown

- And set mtdparts like we expect it to be, and pass it into Debian.
setenv mtdparts 'mtdparts=spi0.0:512K(u-boot),64K@768K(u-boot-env),3M@1M(data)'
and also adjust the bootargs to include $mtdparts
setenv ipaddr 10.0.0.27; setenv serverip 10.0.0.195; setenv netmask 255.255.255.0; setenv bootargs 'console=ttyS0,115200 root=LABEL=rootfs $mtdparts rootdelay=10 earlyprintk=serial'
And then continue booting like you did with tftp.

Now in Debian, you should see as in Step 1 of the installation

Quote

cat /proc/mtd
dev: size erasesize name
mtd0: 00080000 00010000 "u-boot"
mtd1: 00010000 00010000 "u-boot-env"

cat /sys/class/mtd/mtd0/offset /sys/class/mtd/mtd1/offset
0
786432

Now you can either list the envs and fix problem
fw_printenv

Or reflash the default envs image as described in Step 6.

Quote

6. Flash default u-boot envs image

Be extra careful with the next command, you should see output that look like below. If there is error, then do not reboot, post your problem here so we can help.


Write the envs image
flashcp -v uboot.2024.10-tld-1.ds211.environment.img /dev/mtd1
Expected output:
Erasing blocks: xxx/xxx (100%)
Writing data: 64k/0k (100%)
Verifying data: 64k/0k (100%)

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 1 time(s). Last edit at 04/22/2025 10:36PM by bodhi.
Re: Debian on Synology DS211
April 23, 2025 05:30PM
Hello Bodhi,

You have put this in the last post:
Quote
bodhi
cat dts/kirkwood-ds112-v10j.dtb >> zImage.fdt

That file doesn't exist. I instead used "dts/kirkwood-ds211.dtb", and also tried "kirkwood-ds112.dtb" but still same result:
Starting kernel ...


Error: invalid dtb and unrecognized/unsupported machine ID
  r1=0x00000b3c, r2=0x00000100
  r2[]=05 00 00 00 01 00 41 54 00 00 00 00 00 00 00 00
Available machine support:

ID (hex)	NAME
ffffffff	Generic DT based system
ffffffff	Marvell Kirkwood (Flattened Device Tree)

Please check your kernel config and/or bootloader.
Re: Debian on Synology DS211
April 23, 2025 06:17PM
Ivan,

> You have put this in the last post:
>
Quote
bodhi
> cat dts/kirkwood-ds112-v10j.dtb >> zImage.fdt
>
>
> That file doesn't exist.

I've attached the DTB to this post. Recreate the uImage.

cd /media/sdb1/boot
cp -a zImage-6.11.6-kirkwood-tld-1  zImage.fdt
cat dts/kirkwood-ds112-v10j.dtb  >> zImage.fdt
mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n Linux-6.11.6-kirkwood-tld-1 -d zImage.fdt  uImage

> Starting kernel ...
> 
> 
> Error: invalid dtb and unrecognized/unsupported
> machine ID


I think you might have forgot to copy the new uImage to the tftp folder! too bad this stock u-boot does not print out the timestamp so we can tell right away.

Please post the boot log.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Attachments:
open | download - kirkwood-ds112-v10j.dtb (21.8 KB)
Re: Debian on Synology DS211
April 23, 2025 08:49PM
Well that's embarrassing, I used a old path for the tftp, so it was using wrong uImage, while I was updating in different folder.
Managed to boot, and flash the env image. Then I was able to boot with the new u-boot, and all is working again.

Thank you for your help!
Re: Debian on Synology DS211
April 23, 2025 09:36PM
Cool! glad it went well.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian on Synology DS211
April 23, 2025 10:16PM
Quote

cat dts/kirkwood-ds112-v10j.dtb >> zImage.fdt

Oops! I think I mixed up this box and the ds112-v10j. They are close enough that there is no problem with the HDDs on this DS211 box.

But please use kirkwood-ds211.dtb for your rootfs.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 1 time(s). Last edit at 04/23/2025 10:26PM by bodhi.
Re: Debian on Synology DS211
April 24, 2025 04:48AM
Yep, I did use kirkwood-ds211.dtb, since I assumed that there is a mix up, and it worked.
Re: Debian on Synology DS211
April 24, 2025 08:24PM
Hello Bodhi,

I wanted to have a fresh start, since I was messing with the rootfs, and have followed your instructions at https://forum.doozan.com/read.php?2,12096,page=1 and created new rootfs with Latest released rootfs: Debian-6.5.7-kirkwood-tld-1-rootfs-bodhi.tar.bz2 (01 Nov 2023).
Booted to it, then run "apt-get update; apt-get upgrade", and then followed the procedure on the same topic to install Latest released kernel: linux-6.13.8-kirkwood-tld-1-bodhi.tar.bz2 (25 Mar 2025).
Then booted to it. Is this the right process the update and upgrade? Do I just run "apt-get update; apt-get upgrade" and keep an eye for "update-initramfs"? And when you release a new kernel then just follow the procedure to upgrade to it?

Anyhow I can't see my env anymore from Debian. I have not changed the env at all, just kept the one that was flashed.

root@debian:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00080000 00010000 "u-boot"
mtd1: 00010000 00010000 "u-boot-env"
mtd2: 00300000 00010000 "data"
root@debian:~# cat /sys/class/mtd/mtd0/offset /sys/class/mtd/mtd1/offset
0
786432
root@debian:~# fw_printenv
Cannot read environment, using default
Cannot read default environment from file
root@debian:~# cat /etc/fw_env.config
# MTD device name	Device offset	Env. size	Flash sector size	Number of sectors
/dev/mtd0 0xc0000 0x20000 0x20000
root@debian:~#

Here is the env from u-boot:
DS211> printenv
baudrate=115200
bootcmd=run bootcmd_uenv; run scan_disk; run set_bootargs; run bootcmd_exec; reset
bootcmd_exec=if run load_uimage; then; if run load_initrd; then if run load_dtb; then bootm $load_uimagi
bootcmd_uenv=run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi
bootdelay=10
bootdev=usb
console=ttyS0,115200
device=0:1
devices=usb sata
disks=0 1 2 3
dtb_file=/boot/dts/kirkwood-ds211.dtb
ethaddr=2a:ef:31:d6:85:db
fdtcontroladdr=fb6d7b0
if_netconsole=ping $serverip
load_dtb=echo loading DTB $dtb_file ...; load $bootdev $device $load_dtb_addr $dtb_file
load_dtb_addr=0x1c00000
load_initrd=echo loading uInitrd ...; load $bootdev $device $load_initrd_addr /boot/uInitrd
load_initrd_addr=0x2100000
load_uimage=echo loading uImage ...; load $bootdev $device $load_uimage_addr /boot/uImage
load_uimage_addr=0x800000
mtdparts=mtdparts=spi0.0:512K(u-boot),64K@768K(u-boot-env),3M@1M(data)
preboot_nc=setenv nc_ready 0; for pingstat in 1 2 3; do; sleep 1; if run if_netconsole; then setenv nc_i
scan_disk=echo running scan_disk ...; scan_done=0; setenv scan_usb "usb reset; sleep 1; usb reset";  see
set_bootargs=setenv bootargs console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $mtdparts $custom_paras
start_netconsole=setenv ncip $serverip; setenv bootdelay 10; setenv stdin serial,nc; setenv stdout seri;
stderr=serial
stdin=serial
stdout=serial
uenv_addr=0x810000
uenv_import=echo importing envs ...; env import -t $uenv_addr $filesize
uenv_init_devices=echo Initializing devices...; setenv init_usb "usb reset; sleep 1; usb reset"; setenv;
uenv_load=run uenv_init_devices; setenv uenv_loaded 0; for devtype in $devices; do for disknum in $disk;
uenv_read=echo Loading envs from $device_type $disk_number...; if load $device_type  $disk_number:1 $uei
ver=U-Boot 2024.10-tld-1 (Dec 02 2024 - 12:37:41 -0800)\
Synology DS211

Environment size: 2888/65532 bytes
DS211> 
Re: Debian on Synology DS211
April 24, 2025 10:24PM
Ivan,

> root@debian:~# cat /etc/fw_env.config
> # MTD device name	Device offset	Env. size	Flash
> sector size	Number of sectors
> /dev/mtd0 0xc0000 0x20000 0x20000


For the new u-boot the /etc/fw_env.config needs to be like below. Sorry I did not give you a warning! this change is necessary. I thought you did change the fw_env.config when you installed it the first time.

Installation Instruction:

Quote

1.a U-Boot envs config

It should be defined as followed in your /etc/fw_env.config

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

If you don't have /etc/fw_env.config file in your system then go ahead and create this file:
echo "/dev/mtd1 0x0 0x10000 0x10000" > /etc/fw_env.config

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian on Synology DS211
April 25, 2025 10:59PM
Quote

Booted to it, then run "apt-get update; apt-get upgrade", and then followed the procedure on the same topic to install Latest released kernel: linux-6.13.8-kirkwood-tld-1-bodhi.tar.bz2 (25 Mar 2025).
Then booted to it. Is this the right process the update and upgrade? Do I just run "apt-get update; apt-get upgrade" and keep an eye for "update-initramfs"? And when you release a new kernel then just follow the procedure to upgrade to it?

Boot to it. Wait for the system clock synch. Some box has no RTC (or the battery is bad), so the system will be slow to sync by NTP.
date
If the system time is OK, execute each command separately. You'd want to see the apt-get update completes successfully.
apt-get update
apt-get upgrade
Then check the initramfs.
ls -larth /boot

If apt-get upgrade has generated a new initramfs, then use mkimage to generate a new uInitrd.

Installing new kernel will not affect the Debian version. It is a separate procedure, thus there is no need to upgrade Debian after each new kernel installation.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian on Synology DS211
May 03, 2025 05:53AM
Hello Bodhi,

I am having some new problems with my DS211.
I have removed the previous HD, transported it, updated the rootfs to the latest Linux Kernel 6.13.8 (without HDD int he bays).
Also, I want to use second USB flash disk for swap, that is counterfeit with actually has usable 304.5M, while reporting 61T - determined by f3probe and partitioned to the usable size. I thought this could make a good swap, possibly.

Problems:
1. The swap USB works fine when I inserted it, was recognized, swap partition mounted with no issues, and I have added it /etc/fstab.
But when rebooting, it is not recognized properly (in u-boot?) and Debian doesn't mount it, not us visible in lsblk. If I unplug it and plug it in, then it works just fine.

2. Now the 12TB HDD is not recognized by Debian, I have also tried another 500GB disk that works fine elsewhere, and complete silence. There is nothing in dmesg. Very strange. I have tried both bays and hot plugging it, and there is nothing in dmesg.
I see in the logs that it considers the USBs to be SCSI devices, which seems peculiar.

The output of:
dm tree
sata init
sata part
dm tree
Is here attached as DS210j-console-log-with-uboot-sata-commands.03.05.2025.txt

Attached are the boot log when 12TB is in the lower bay, and swap USB in the front USB slot (DS210j-console-log.03.05.2025.txt) .
Also another serial log without the swap USB (DS210j-no-usb-swap-console-log.03.05.2025.txt)

Also worth noting is that the 12TB drive is a btrfs. I did intstall btrfs-progs in Debian and that created a new initrd.img-6.13.8-kirkwood-tld-1, so I run:
mkimage -A arm -O linux -T ramdisk -C gzip -a 0x00000000 -e 0x00000000 -n initramfs-6.13.8-kirkwood-tld-1 -d initrd.img-6.13.8-kirkwood-tld-1 uInitrd
to generate new uInitrd.



Edited 3 time(s). Last edit at 05/03/2025 06:57AM by Ivanj.
Attachments:
open | download - DS210j-console-log.03.05.2025.txt (26.9 KB)
open | download - DS210j-no-usb-swap-console-log.03.05.2025.txt (30.1 KB)
open | download - DS210j-console-log-with-uboot-sata-commands.03.05.2025.txt (28.7 KB)
Re: Debian on Synology DS211
May 03, 2025 01:58PM
Ivan,

I thought I mentioned here that you should flash back to the Nov 22nd version.

uboot.2024.10-tld-1.ds211.bodhi.tar.nov_22_version

However, since I've got another u-boot version. Let me upload it and you can kwboot to see if it's better.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian on Synology DS211
May 03, 2025 02:41PM
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: