Closed luisteraar closed 1 month ago
Ofgwrite ceases if boot partitions not on system boot device is.
That's wrong afaik. For example sf8008 can boot from sd card kernel partition.
ofgwrite looks in /proc/cmdline to find boot path would it not be better if ofgwrite looks in the STARTUP* for the paths
ofgwrite reads /proc/cmdline to get the current used kernel device. Getting current kernel device from STARTUP file doesn’t work as a user can switch to other multiboot slot without rebooting. Then STARTUP file doesn't contain the current used kernel device.
ofgwrite tries to find other multiboot partitions according to the partition names. So if slot1 is the current slot and the user wants to flash into slot2 a kernel2 and rootfs2 named partition needs to be there. Reading the device names from the STARTUP* files might be possible. But in some rare cases this might lead to data loss. E.g. user has sd card with 3 slots and so 3 STARTUP files for this sd card. Then he switches this sd card with another sd card (without multiboot partitions and with data on it!) and then he tries to flash an image. Ofgwrite would only reads the STARTUPx file and overwrites the data partition on the sd card....
What do you want to archive? How do you want to extend it?
Thanks for the attention
Extended multiboot works fine (on some boxes) Problem is enigma2 gui gives for example at flash port 5 the command /usr/bin/ofgwrite -r -k -m5 /media/hdd/images/openatv-7.4-zgemmah92hse-20240705multi.unzipped/h9se This results in a failure . Reason ofgwrite looks in /proc/cmdline for the bootdevice slot 5 has a different bootdevice as slot 1..4. Correct boot/flash information can be found in the STARTUP?????_N where N is slot number.
Flashing in my case with ofgwrite -kmmcblk1p2 -rmmcblk1p1 -m5 /media/hdd/images/openatv-7.4-zgemmah92hse-20240705multi.unzipped/h9se works perfectly. mmcblk1p2 and mmcblk1p1 can be found in STARTUP?????_5
I think the solution is (temporarily) if -r and -k is not filled and -mx is greater than 4 then use info from STARTUP file cmd boot 1 bootargs=root=/dev/mmcblk0p23 rootsubdir=linuxrootfs1 rootfstype=ext4 kernel=/dev/mmcblk0p19 cmd boot 5 bootargs=root=/dev/mmcblk1p1 rootsubdir=linuxrootfs5 rootfstype=ext4 kernel=/dev/mmcblk1p2
ls -al /dev/block/by-name/ lrwxrwxrwx 1 root root 9 Jul 6 16:52 -sda1 -> /dev/sda1 drwxr-xr-x 2 root root 640 Jul 6 16:52 . drwxr-xr-x 3 root root 60 Jul 6 16:52 .. lrwxrwxrwx 1 root root 14 Jul 6 16:52 baseparam -> /dev/mmcblk0p6 lrwxrwxrwx 1 root root 15 Jul 6 16:52 boot -> /dev/mmcblk0p10 lrwxrwxrwx 1 root root 14 Jul 6 16:52 bootargs -> /dev/mmcblk0p2 lrwxrwxrwx 1 root root 14 Jul 6 16:52 bootoptions -> /dev/mmcblk0p4 lrwxrwxrwx 1 root root 15 Jul 6 16:52 cache -> /dev/mmcblk0p16 lrwxrwxrwx 1 root root 14 Jul 6 16:52 deviceinfo -> /dev/mmcblk0p5 lrwxrwxrwx 1 root root 15 Jul 6 16:52 dtbo -> /dev/mmcblk0p17 lrwxrwxrwx 1 root root 15 Jul 6 16:52 e2tv -> /dev/mmcblk0p15 lrwxrwxrwx 1 root root 14 Jul 6 16:52 fastboot -> /dev/mmcblk0p1 lrwxrwxrwx 1 root root 14 Jul 6 16:52 fastplay -> /dev/mmcblk0p9 lrwxrwxrwx 1 root root 15 Jul 6 16:52 linuxkernel1 -> /dev/mmcblk0p19 lrwxrwxrwx 1 root root 15 Jul 6 16:52 linuxkernel2 -> /dev/mmcblk0p20 lrwxrwxrwx 1 root root 15 Jul 6 16:52 linuxkernel3 -> /dev/mmcblk0p21 lrwxrwxrwx 1 root root 15 Jul 6 16:52 linuxkernel4 -> /dev/mmcblk0p22 lrwxrwxrwx 1 root root 14 Jul 6 16:52 linuxkernel5 -> /dev/mmcblk1p2 lrwxrwxrwx 1 root root 14 Jul 6 16:52 linuxkernel6 -> /dev/mmcblk1p3 lrwxrwxrwx 1 root root 14 Jul 6 16:52 linuxkernel7 -> /dev/mmcblk1p4 lrwxrwxrwx 1 root root 14 Jul 6 16:52 linuxkernel8 -> /dev/mmcblk1p5 lrwxrwxrwx 1 root root 14 Jul 6 16:52 logo -> /dev/mmcblk0p8 lrwxrwxrwx 1 root root 15 Jul 6 16:52 misc -> /dev/mmcblk0p12 lrwxrwxrwx 1 root root 14 Jul 6 16:52 mmc -> /dev/mmcblk1p6 lrwxrwxrwx 1 root root 14 Jul 6 16:52 pqparam -> /dev/mmcblk0p7 lrwxrwxrwx 1 root root 14 Jul 6 16:52 recovery -> /dev/mmcblk0p3 lrwxrwxrwx 1 root root 15 Jul 6 16:52 securestore -> /dev/mmcblk0p18 lrwxrwxrwx 1 root root 15 Jul 6 16:52 system -> /dev/mmcblk0p13 lrwxrwxrwx 1 root root 15 Jul 6 16:52 trustedcore -> /dev/mmcblk0p11 lrwxrwxrwx 1 root root 15 Jul 6 16:52 userdata -> /dev/mmcblk0p23 lrwxrwxrwx 1 root root 14 Jul 6 16:52 userdata-mmcblk1p1 -> /dev/mmcblk1p1 lrwxrwxrwx 1 root root 15 Jul 6 16:52 vendor -> /dev/mmcblk0p14
Can you please execute this and post the output: /usr/bin/ofgwrite -n -r -k -m5 /media/hdd/images/openatv-7.4-zgemmah92hse-20240705_multi.unzipped/h9se
-n means simulate flashing. It shows messages on the screen and in the console, but doesn't actually flash the system.
I see this comment and check in the code: // Check whether rootfs is on the same device as current used rootfs This might be the problem. But I want to check whether this is the real problem or whether other error occurs earlier.
ofgwrite Utility v4.6.8 Author: Betacentauri Based upon: mtd-utils-native-1.5.1 and busybox 1.24.1 Use at your own risk! Make always a backup before use! Don't use it if you use multiple ubi volumes in ubi layer!
Flashing rootfs Flashing kernel Flashing multiboot partition 5 Searching image files in /media/hdd/images/openatv-7.4-zgemmah92hse-20240705_multi.unzipped/h9se resolved to /media/hdd/images/openatv-7.4-zgemmah92hse-20240705_mult Found rootfs file: /media/hdd/images/openatv-7.4-zgemmah92hse-20240705_multi.unzipped/h9se/rootfs.tar.bz2 Found kernel file: /media/hdd/images/openatv-7.4-zgemmah92hse-20240705_multi.unzipped/h9se/uImage Found EXT4 rootfs Found mounted /newroot Found mountpoint for rootfs file: /media/hdd
Found /proc/mtd entries: Device: Size: Erasesize: Name: Image: Using kernel mtd device: Using rootfs mtd device: Read /proc/cmdline Kexec mode is: Current rootfs is: /dev/mmcblk0p23 Current kernel is: /dev/mmcblk0p20 Current root sub dir is: linuxrootfs2
Found cmdLine rootfs device: /dev/mmcblk0p23 Error: Wrong formatted blkdevparts in /proc/cmdline Execute: fdisk -l Found valid GPT with protective MBR; using GPT
Rootfs(/dev/mmcblk1) is on different device than current rootfs(/dev/mmcblk0p23). Maybe wrong device selected. -> Aborting Using /dev/mmcblk1p2 as kernel device Flashing currently not running image Error: Cannot flash rootfs, because no rootfs device was found
cat /proc/cmdline root=/dev/mmcblk0p23 rootsubdir=linuxrootfs2 rootfstype=ext4 kernel=/dev/mmcblk0p20 console=ttyAMA0,115200 blkdevparts=mmcblk0:1M(fastboot),1M(bootargs),18M(recovery),2M(bootoptions),2M(deviceinfo),4M(baseparam),4M(pqparam),4M(logo),40M(fastplay),20M(boot),20M(trustedcore),4M(misc),1024M(system),204M(vendor),306M(e2tv),250M(cache),2M(dtbo),8M(securestore),16M(linuxkernel1),16M(linuxkernel2),16M(linuxkernel3),16M(linuxkernel4),-(userdata) mem=987M mmz=ddr,0,0,44M vmalloc=500M
mkdir /media/tmp root@zgemmah92hse:/media/hdd/images# mount /dev/mmcblk1p1 /media/tmp/ root@zgemmah92hse:/media/hdd/images# ls /media/tmp/
linuxrootfs5 linuxrootfs7 linuxrootfs6 linuxrootfs8
I have remove a restriction in ofgwrite.c for not rootfs on other device it runs better Now should be look at other devices for kernel partition ofgwrite.c:1399 // if (strncmp(rootfs_device, current_rootfs_device, strlen(rootfs_device)) != 0) // { // my_printf("Rootfs(%s) is on different device than current rootfs(%s). Maybe wrong device selected. -> Aborting\n", dev, current_rootfs_device); // return; // }
ofgwrite -n -k -r -m9 /media/hdd/images/pure2/h9se mkdir: can't create directory '/newroot': File exists
ofgwrite Utility v4.6.8 Author: Betacentauri Based upon: mtd-utils-native-1.5.1 and busybox 1.24.1 Use at your own risk! Make always a backup before use! Don't use it if you use multiple ubi volumes in ubi layer!
Flashing kernel Flashing rootfs Flashing multiboot partition 9 Searching image files in /media/hdd/images/pure2/h9se resolved to /media/hdd/images/pure2/h9se Found rootfs file: /media/hdd/images/pure2/h9se/rootfs.tar.bz2 Found kernel file: /media/hdd/images/pure2/h9se/uImage Found EXT4 rootfs Found mounted /newroot Found mountpoint for rootfs file: /media/hdd
Found /proc/mtd entries: Device: Size: Erasesize: Name: Image: Using kernel mtd device: Using rootfs mtd device: Read /proc/cmdline Kexec mode is: Current rootfs is: /dev/mmcblk1p1 Current kernel is: /dev/mmcblk1p3 Current root sub dir is: linuxrootfs6
Found cmdLine rootfs device: /dev/mmcblk0p23 Error: Wrong formatted blkdevparts in /proc/cmdline Execute: fdisk -l Found valid GPT with protective MBR; using GPT
No modified files, so no updates needed. hans@ASUSLaptop:~$ cat aaaaaaa I have remove a restriction in ofgwrite.c for not rootfs on other device it runs better Now should be look at other devices for kernel partition ofgwrite.c:1399 // if (strncmp(rootfs_device, current_rootfs_device, strlen(rootfs_device)) != 0) // { // my_printf("Rootfs(%s) is on different device than current rootfs(%s). Maybe wrong device selected. -> Aborting\n", dev, current_rootfs_device); // return; // }
ofgwrite -n -k -r -m9 /media/hdd/images/pure2/h9se mkdir: can't create directory '/newroot': File exists
ofgwrite Utility v4.6.8 Author: Betacentauri Based upon: mtd-utils-native-1.5.1 and busybox 1.24.1 Use at your own risk! Make always a backup before use! Don't use it if you use multiple ubi volumes in ubi layer!
Flashing kernel Flashing rootfs Flashing multiboot partition 9 Searching image files in /media/hdd/images/pure2/h9se resolved to /media/hdd/images/pure2/h9se Found rootfs file: /media/hdd/images/pure2/h9se/rootfs.tar.bz2 Found kernel file: /media/hdd/images/pure2/h9se/uImage Found EXT4 rootfs Found mounted /newroot Found mountpoint for rootfs file: /media/hdd
Found /proc/mtd entries: Device: Size: Erasesize: Name: Image: Using kernel mtd device: Using rootfs mtd device: Read /proc/cmdline Kexec mode is: Current rootfs is: /dev/mmcblk1p1 Current kernel is: /dev/mmcblk1p3 Current root sub dir is: linuxrootfs6
Found cmdLine rootfs device: /dev/mmcblk0p23 Error: Wrong formatted blkdevparts in /proc/cmdline Execute: fdisk -l Found valid GPT with protective MBR; using GPT
Using /dev/mmcblk1p1 as rootfs device Flashing currently not running image Error: Cannot flash kernel, because no kernel device was found
It works now here the selution remove line 1399 till 1404 of ofgwrite.c Do ypu change it as maintainer or should i do a PR ?
Thanks for the log. I'll take a look at it in the next few days.
I (we) look for a way extended multiboot to make. Ofgwrite ceases if boot partitions not on system boot device is. ofgwrite looks in /proc/cmdline to find boot path would it not be better if ofgwrite looks in the STARTUP* for the paths