amouiche / qnap_mtd_resize_for_bullseye

Script for resizing MTD partitions on a QNAP device in order to be able to upgrade from buster to bullseye
GNU General Public License v2.0
51 stars 11 forks source link

Manual partition migration #18

Closed lpaolini closed 2 years ago

lpaolini commented 2 years ago

Hi, I have a QNAP TS-221P running Debian 11 thanks to your script (and some manual intervention) and everything works like a charm.

Now I'm upgrading my disks, manually degrading the RAID-1 to rebuild the two volumes one at a time.

At the end of the process, the old disks will be installed on another QNAP, a TS-219P, whose partitions have not been updated to fit Debian 11 yet.

My plan is to install the old disks into the TS-219P, boot the existing kernel (from previously installed Debian 10), and run flash-kernel for flashing the new kernel.

Before that I would need to update partition table though. Can you help me with the the necessary steps to achieve the same result as running your script but running U-Boot commands instead?

         __  __                      _ _
        |  \/  | __ _ _ ____   _____| | |
        | |\/| |/ _` | '__\ \ / / _ \ | |
        | |  | | (_| | |   \ V /  __/ | |
        |_|  |_|\__,_|_|    \_/ \___|_|_|
 _   _     ____              _
| | | |   | __ )  ___   ___ | |_
| | | |___|  _ \ / _ \ / _ \| __|
| |_| |___| |_) | (_) | (_) | |_
 \___/    |____/ \___/ \___/ \__|  ** LOADER **
 ** MARVELL BOARD: DB-88F6281A-BP LE

U-Boot 1.1.4 (Apr 23 2009 - 19:01:28) Marvell version: 3.4.4

U-Boot code: 00600000 -> 0067FFF0  BSS: -> 00690DCC

Soc: 88F6281 A0 (DDR2)
CPU running @ 1200Mhz L2 running @ 400Mhz
SysClock = 400Mhz , TClock = 200Mhz

DRAM CAS Latency = 5 tRP = 5 tRAS = 18 tRCD=6
DRAM CS[0] base 0x00000000   size 256MB
DRAM CS[1] base 0x10000000   size 256MB
DRAM Total size 512MB  16bit width
[16384kB@f8000000] Flash: 16 MB
Addresses 8M - 0M are saved for the U-Boot usage.
Mem malloc Initialization (8M - 7M): Done

CPU : Marvell Feroceon (Rev 1)

Streaming disabled
Write allocate disabled

USB 0: host mode
PCI 0: PCI Express Root Complex Interface
PEX interface detected Link X1
Net:   egiga0 [PRIME]
Hit any key to stop autoboot:  0
QNAP: Recovery Button pressed: 0
Marvell>>
Marvell>>
Marvell>> printenv
baudrate=115200
loads_echo=0
rootpath=/mnt/ARM_FS/
console=console=ttyS0,115200 mtdparts=cfi_flash:0xf40000(root),0xc0000(uboot)ro
CASset=min
MALLOC_len=1
ethprime=egiga0
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;
ethaddr=00:00:00:00:05:09
mvPhoneConfig=mv_phone_config=dev0:fxs,dev1:fxo
mvNetConfig=mv_net_config=(00:11:88:0f:62:81,0:1:2:3),mtu=1500
usb0Mode=host
yuk_ethaddr=00:00:00:EE:51:81
netretry=no
rcvrip=169.254.100.100
loadaddr=0x02000000
autoload=no
ethact=egiga0
update=tftp 0x800000 uImage; tftp 0xa00000 rootfs.gz;bootm 0x800000
filesize=36464c
fileaddr=A00000
bootcmd=cp.b 0xf8200000 0x800000 0x200000;cp.b 0xf8400000 0xa00000 0x900000;bootm 0x800000
ipaddr=172.17.21.248
serverip=172.17.21.7
netmask=255.255.254.0
bootargs=console=ttyS0,115200 root=/dev/ram initrd=0xa00000,0x900000 ramdisk=32768
bootp_vendor_class=F_TS-219PE
stdin=serial
stdout=serial
stderr=serial
mainlineLinux=no
enaMonExt=no
enaCpuStream=no
enaWrAllo=no
pexMode=RC
disL2Cache=no
setL2CacheWT=yes
disL2Prefetch=yes
enaICPref=yes
enaDCPref=yes
sata_dma_mode=yes
netbsd_en=no
vxworks_en=no
bootdelay=3
disaMvPnp=no
enaAutoRecovery=yes

Environment size: 1331/4092 bytes
lpaolini commented 2 years ago

Actually, I could just boot it (with existing Debian 10 kernel) and use your script, right?

amouiche commented 2 years ago

[Not sure you received the answer I sent with an email... github didn't seem to relay it]

It will actually boot the kernel, mount the inirtd, but /etc/fstab (in initrd I expect) will not provide the correct root uuid, I'm looking for the the content if initrd so see what can be done

Arnaud

amouiche commented 2 years ago

Actually, the /sbin/init of the initrd seems to read "conf/param.conf" (still from the inirtd cpio archive) to know which real root should be mounted. I'm not really aware of the whole initrd process but maybe the kernel cmdline option

root= "" the device node to mount as the root file system. The recommended usage is to specify the UUID as followed "root=UUID=xxx".

Can be used to override temporary the ROOT=xxxx option from conf/param.conf, the time to fully boot (the simpliest is to use a serial console, stop in the uboot bootloader and modify the boot_args manually)

then

lpaolini commented 2 years ago

Hi Arnaud,

After a bit of trial and error I managed to do what I wanted. Basically I reinstalled Debian Buster on a temporary disk, run your script, rebooted, upgraded to Bullseye, rebooted, replaced the RootFS1 partition with a backup from the other NAS, plugged in the old disks from the other NAS and... it worked!

Now I'm fighting with #20 ...

Many thanks, Luca