forked from amouiche/qnap_mtd_resize_for_bullseye
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
resources: various logs and uboot env dump for QNAP_TS419_family
- Loading branch information
Showing
3 changed files
with
220 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
baudrate=115200 | ||
loads_echo=0 | ||
ipaddr=192.168.0.50 | ||
serverip=192.168.0.1 | ||
rootpath=/mnt/ARM_FS/ | ||
netmask=255.255.255.0 | ||
run_diag=yes | ||
console=console=ttyS0,115200 | ||
CASset=min | ||
MALLOC_len=1 | ||
ethprime=egiga0 | ||
bootargs=console=ttyS0,115200 root=/dev/ram initrd=0xa00000,0x900000 ramdisk=34816 | ||
bootcmd=uart1 0x68;cp.l 0xf8200000 0x800000 0x80000;cp.l 0xf8400000 0xa00000 0x240000;bootm 0x800000 | ||
ethaddr=00:08:9B:C3:07:2B | ||
ethmtu=1500 | ||
usb0Mode=host | ||
netretry=no | ||
rcvrip=169.254.100.100 | ||
loadaddr=0x02000000 | ||
autoload=no | ||
ethact=egiga0 | ||
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 | ||
bootdelay=1 | ||
disaMvPnp=no | ||
enaAutoRecovery=yes | ||
pcieTune=no | ||
eth1addr=00:08:9B:C3:07:2C |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
baudrate=115200 | ||
loads_echo=0 | ||
ipaddr=192.168.0.50 | ||
serverip=192.168.0.1 | ||
rootpath=/mnt/ARM_FS/ | ||
netmask=255.255.255.0 | ||
run_diag=yes | ||
console=console=ttyS0,115200 | ||
CASset=min | ||
MALLOC_len=1 | ||
ethprime=egiga0 | ||
ethaddr=00:08:9B:C3:07:2B | ||
ethmtu=1500 | ||
usb0Mode=host | ||
netretry=no | ||
rcvrip=169.254.100.100 | ||
loadaddr=0x02000000 | ||
autoload=no | ||
ethact=egiga0 | ||
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 | ||
bootdelay=1 | ||
disaMvPnp=no | ||
enaAutoRecovery=yes | ||
pcieTune=no | ||
eth1addr=00:08:9B:C3:07:2C | ||
bootargs_backup=console=ttyS0,115200 root=/dev/ram initrd=0xa00000,0x900000 ramdisk=34816 | ||
bootcmd_backup=uart1 0x68;cp.l 0xf8200000 0x800000 0x80000;cp.l 0xf8400000 0xa00000 0x240000;bootm 0x800000 | ||
bootargs=console=ttyS0,115200 root=/dev/ram initrd=0xb00000,0xc00000 ramdisk=34816 cmdlinepart.mtdparts="spi0.0:512k@0(uboot)ro,3M@0x100000(Kernel),12M@0x400000(RootFS1),2M@0x200000(Kernel_legacy),256k@0x80000(U-Boot Config),256k@0xc0000(NAS Config)" mtdparts="spi0.0:512k@0(uboot)ro,3M@0x100000(Kernel),12M@0x400000(RootFS1),2M@0x200000(Kernel_legacy),256k@0x80000(U-Boot Config),256k@0xc0000(NAS Config)" | ||
bootcmd=uart1 0x68;cp.l 0xf8100000 0x800000 0xc0000;cp.l 0xf8400000 0xb00000 0x300000;bootm 0x800000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
root@xxxxx:~# ./qnap_mtd_resize.py | ||
|
||
[Check of the QNAP model and see if supported] | ||
kirkwood-qnap: machine: QNAP TS419 family | ||
DTB file: kirkwood-ts419-6282.dtb | ||
Partition resize was not tested on this device yet. Do you wan't to continue ? (y/N) | ||
y | ||
In case of success, please report the DTB file indication. | ||
|
||
|
||
|
||
|
||
Checking: /sbin/flashcp -V | ||
Checking: /sbin/flash_erase --version | ||
Checking: /usr/bin/fw_setenv -v | ||
Compiled with U-Boot 2019.01+dfsg-7 | ||
Checking: /usr/bin/fw_printenv -v | ||
Compiled with U-Boot 2019.01+dfsg-7 | ||
|
||
[find on which MTD device partitions are currently mounted] | ||
spi0.0 | ||
|
||
[Dump current U-boot config'] | ||
Current U-boot bootcmd: | ||
uart1 0x68;cp.l 0xf8200000 0x800000 0x80000;cp.l 0xf8400000 0xa00000 0x240000;bootm 0x800000 | ||
Current U-boot bootargs: | ||
console=ttyS0,115200 root=/dev/ram initrd=0xa00000,0x900000 ramdisk=34816 | ||
|
||
[Prepare new 'bootcmd'] | ||
Old: uart1 0x68;cp.l 0xf8200000 0x800000 0x80000;cp.l 0xf8400000 0xa00000 0x240000;bootm 0x800000 | ||
New: uart1 0x68;cp.l 0xf8100000 0x800000 0xc0000;cp.l 0xf8400000 0xb00000 0x300000;bootm 0x800000 | ||
|
||
[Prepare new 'bootargs'] | ||
Old: console=ttyS0,115200 root=/dev/ram initrd=0xa00000,0x900000 ramdisk=34816 | ||
New: console=ttyS0,115200 root=/dev/ram initrd=0xb00000,0xc00000 ramdisk=34816 cmdlinepart.mtdparts="spi0.0:512k@0(uboot)ro,3M@0x100000(Kernel),12M@0x400000(RootFS1),2M@0x200000(Kernel_legacy),256k@0x80000(U-Boot Config),256k@0xc0000(NAS Config)" mtdparts="spi0.0:512k@0(uboot)ro,3M@0x100000(Kernel),12M@0x400000(RootFS1),2M@0x200000(Kernel_legacy),256k@0x80000(U-Boot Config),256k@0xc0000(NAS Config)" | ||
|
||
[Prepare fw_setenv script (/tmp/fw_setenv.script)] | ||
|
||
[Dump current 'NAS config' and 'Kernel' images] | ||
+ cat /dev/mtd5 | ||
[Resize 'NAS config' dump from 1280KB to 256KB.] | ||
+ /usr/sbin/modprobe loop | ||
+ /usr/sbin/losetup /dev/loop0 /tmp/mtd_nas_config.dump | ||
+ /usr/sbin/e2fsck -p -v /dev/loop0 | ||
/dev/loop0 was not cleanly unmounted, check forced. | ||
|
||
18 inodes used (14.06%, out of 128) | ||
2 non-contiguous files (11.1%) | ||
0 non-contiguous directories (0.0%) | ||
# of inodes with ind/dind/tind blocks: 0/0/0 | ||
54 blocks used (5.27%, out of 1024) | ||
0 bad blocks | ||
0 large files | ||
|
||
7 regular files | ||
2 directories | ||
0 character device files | ||
0 block device files | ||
0 fifos | ||
0 links | ||
0 symbolic links (0 fast symbolic links) | ||
0 sockets | ||
------------ | ||
9 files | ||
+ true | ||
+ /usr/sbin/e2fsck -p -v /dev/loop0 | ||
/dev/loop0: clean, 18/128 files, 54/1024 blocks | ||
+ /usr/sbin/resize2fs /dev/loop0 128 | ||
resize2fs 1.44.5 (15-Dec-2018) | ||
Resizing the filesystem on /dev/loop0 to 128 (1k) blocks. | ||
The filesystem on /dev/loop0 is now 128 (1k) blocks long. | ||
|
||
+ /usr/sbin/losetup -d /dev/loop0 | ||
|
||
[Concatenate first 256K of 'NAS config' with first 1MB of Kernel > /tmp/mtd_nas_config.new] | ||
|
||
[Prepare second 1MB of kernel tail > /tmp/mtd_kernel.tail] | ||
------------------------------------------------------------ | ||
!!!! Warning !!!! | ||
|
||
Everything is fine up to now. | ||
Next steps will write the flash and may be subject to failures. | ||
|
||
It is highly recommended to perform a MTD backup and save the files | ||
somewhere (USB device, PC) | ||
|
||
cat /dev/mtd0 > /tmp/mtd0.uboot.backup | ||
cat /dev/mtd1 > /tmp/mtd1.kernel.backup | ||
cat /dev/mtd2 > /tmp/mtd2.rootfs1.backup | ||
cat /dev/mtd3 > /tmp/mtd3.rootfs2.backup | ||
cat /dev/mtd4 > /tmp/mtd4.uboot-config.backup | ||
cat /dev/mtd5 > /tmp/mtd5.nas-config.backup | ||
/usr/bin/fw_printenv -c /tmp/fw_env.config > /tmp/uboot_config.backup.txt | ||
cd /tmp | ||
tar cvzf mtd_backup.tgz mtd?.*.backup uboot_config.backup.txt | ||
|
||
# now use scp / sftp to push/pull mtd_backup.tgz on another PC. | ||
|
||
Be sure you will not cut the power until the end of operations. | ||
In case of failure, you way need to recover with a Serial Console | ||
to run U-boot commands | ||
|
||
https://www.cyrius.com/debian/kirkwood/qnap/ts-219/serial/ | ||
|
||
Continue and flash the new partitions ? (y/N) | ||
y | ||
|
||
[Flash 'NAS config' partition content (ie 'NAS config' + head of Kernel) (still a 'safe' op)] | ||
+ /sbin/flashcp -v /tmp/mtd_nas_config.new /dev/mtd5 | ||
Erasing blocks: 5/5 (100%) | ||
Writing data: 1280k/1280k (100%) | ||
Verifying data: 1280k/1280k (100%) | ||
|
||
[Change U-boot config with new values)] | ||
+ /usr/bin/fw_setenv -c /tmp/fw_env.config -s /tmp/fw_setenv.script | ||
|
||
[Flash tail of the kernel in old 'Kernel' Partition] | ||
+ /sbin/flashcp -v /tmp/mtd_kernel.tail /dev/mtd1 | ||
Erasing blocks: 4/4 (100%) | ||
Writing data: 1024k/1024k (100%) | ||
Verifying data: 1024k/1024k (100%) | ||
------------------------------------------------------------ | ||
|
||
SUCCESS. You can reboot now. | ||
|
||
Notes: | ||
- Don't perform kernel or system update before the next reboot... | ||
so don't wait too long. | ||
- Consider compressing initrd with 'xz' to optimize the size with: | ||
|
||
echo "COMPRESS=xz" > /etc/initramfs-tools/conf.d/compress | ||
|
||
|
||
root@xxx:~# | ||
|
||
|