Thanks @frolic for your answer!!
Here is a better explanation where I get stuck:
steps 1-9 (deploying the initramfs, loading the 2nd image (fg-30e-squashfs-sysupgrade.bin) and sysupgrade it work.
But then the system boots itself into void (as can be seen in the logs):
No dtb image in there. Try more
Initializing firewall...
here is what I did:
root@OpenWrt:~#
root@OpenWrt:~# wget https://downloads.openwrt.org/snapshots/targets/mvebu/corte
xa9/openwrt-mvebu-cortexa9-fortinet_fg-30e-squashfs-sysupgrade.bin
Downloading 'https://downloads.openwrt.org/snapshots/targets/mvebu/cortexa9/openwrt-mvebu-cortexa9-fortinet_fg-30e-squashfs-sysupgrade.bin'
Connecting to 199.232.82.132:443
Writing to 'openwrt-mvebu-cortexa9-fortinet_fg-30e-squashfs-sysupgrade.bin'
openwrt-mvebu-cortex 100% |*******************************| 6270k 0:00:00 ETA
Download completed (6420794 bytes)
root@OpenWrt:~#
root@OpenWrt:~# ls -l
-rw-r--r-- 1 root root 6420794 Aug 30 11:02 openwrt-mvebu-cortexa9-fortinet_fg-30e-squashfs-sysupgrade.bin
root@OpenWrt:~#
root@OpenWrt:~# sysupgrade ./openwrt-mvebu-cortexa9-fortinet_fg-30e-squashfs-sys
upgrade.bin
Fri Aug 30 11:03:08 UTC 2024 upgrade: Image not in /tmp, copying...
Cannot save config while running from ramdisk.
Fri Aug 30 11:03:09 UTC 2024 upgrade: Commencing upgrade. Closing all shell sessions.
Hangup
-ash: can't set tty process group: Not a tty
[1]+ Hangup sysupgrade ./openwrt-mvebu-cortexa9-fortinet_fg-30e-squashfs-sysupgrade.bin
root@OpenWrt:~# Watchdog handover: fd=3
- watchdog -
Watchdog does not have CARDRESET support
Fri Aug 30 11:03:09 UTC 2024 upgrade: Sending TERM to remaining processes ...
Fri Aug 30 11:03:09 UTC 2024 upgrade: Sending signal TERM to netifd (1631)
Fri Aug 30 11:03:13 UTC 2024 upgrade: Sending KILL to remaining processes ...
Fri Aug 30 11:03:13 UTC 2024 upgrade: Sending signal KILL to netifd (1631)
[ 391.900341] stage2 (3462)op_caches: Fri Aug 30 11:03:21 UTC 2024 upgrade: Switching to ramdisk...
Fri Aug 30 11:03:22 UTC 2024 upgrade: Performing system upgrade...
fwinfo: offset-> 0x184, blocks-> 0x1ee8 (len: 0x003dce83)
1+0 records in
1+0 records out
fwinfo: offset-> 0x18c, blocks-> 0x1201 (len: 0x00240004)
1+0 records in
1+0 records out
Unlocking kernel ...
Writing from <stdin> to kernel ...
Unlocking rootfs ...
Writing from <stdin> to rootfs ...
Appending jffs2 data from /tmp/sysupgrade.tgz to rootfs..
.File /tmp/sysupgrade.tgz does not exist
Fri Aug 30 11:03:56 UTC 2024 upgrade: Upgrade completed
Fri Aug 30 11:03[ 427.263441] reboot: Restg syst
FortiGate-30E (12:44-07.08.2016)
Ver:05000014
Serial number: FGT30E3U16022597
CPU(00): 1332MHz
Total RAM: 1GB
Initializing boot device...
Initializing MAC... egiga0
Please wait for OS to boot, or press any key to display configuration menu..........
Booting OS...
Reading boot image... 4050944 bytes.
No dtb image in there. Try more
Initializing firewall...
select [B]: Boot with backup firmware and set as default.
Note:
and
are not related to this issue.
The mtd partitions mounted to / and others will be unmounted and those are unusable while upgrading by sysupgrade, so the image will be copied to /tmp/ before upgrading.
And, user configurations won't be kept on sysupgrade while running initramfs image and /tmp/sysupgrade.tgz won't be generated. So that error will be showed.
I tried the way you sent, but still the same. After apply the openwrt-mvebu-cortexa9-fortinet_fg-30e-squashfs-sysupgrade.bin image, it boots itself and then stuck in initializing firewall.
bootmenu ---> [I]: System information. ---> [S]: Set serial port baudrate.
If it is set to anything other than 9600bps, set it to 9600bps. Only that baudrate is supported on OpenWrt for FortiGate/FortiWiFi devices.
And, don't use D or B on Save as Default firmware/Backup firmware/Run image without saving:[D/B/R]? prompt. initramfs/sysupgrade images are not for direct flashing.
BTW, I tried the steps in the commit on my FG-30E with the official firmware images, but the problem in this topic did not reoccur.
I did everything as you said and my fortigate stopped in initializing firewall again.
Baudrate is 9600
image initramfs applied using R option on Save as Default firmware/Backup firmware/Run image without saving:[D/B/R]
image squashfs-sysupgrade applied
Here is the result of the hexdump.
I have 3 non-booting devices on hand at now, but there were no differences in the hexdump results for any of the non-booting devices.