Bug#994065: flash-kernel: Overwriting an entry doesn't support to remove a field
Package: flash-kernel
Version: 3.104
Severity: normal
Hello,
for the Netgear ReadyNAS 104 there is an entry in the shipped db that
looks as follows:
Machine: NETGEAR ReadyNAS 104
DTB-Id: armada-370-netgear-rn104.dtb
DTB-Append: yes
Mtd-Kernel: uImage
Mtd-Initrd: minirootfs
U-Boot-Kernel-Address: 0x04000000
U-Boot-Initrd-Address: 0x05000000
Required-Packages: u-boot-tools
Bootloader-Sets-Incorrect-Root: yes
As the minirootfs partition is too small to hold a bullseye initramfs I
want to increase the uImage partition, remove the minirootfs partition
and use in /etc/flash-kernel/db:
Machine: NETGEAR ReadyNAS 104
DTB-Id: armada-370-netgear-rn104.dtb
DTB-Append: yes
U-Boot-Multi-Address: 0x2000000
Mtd-Kernel: uImage
Required-Packages: u-boot-tools
Bootloader-Sets-Incorrect-Root: yes
However this doesn't do what I intend because flash-kernel merges the
two entries which results in the following config:
Machine: NETGEAR ReadyNAS 104
DTB-Id: armada-370-netgear-rn104.dtb
DTB-Append: yes
U-Boot-Multi-Address: 0x2000000
Mtd-Kernel: uImage
Required-Packages: u-boot-tools
Bootloader-Sets-Incorrect-Root: yes
Mtd-Initrd: minirootfs
U-Boot-Kernel-Address: 0x04000000
U-Boot-Initrd-Address: 0x05000000
which is broken and makes flash-kernel stumble.
As for other use-cases (i.e. just overwriting a single field) the merge
mechanism is quite useful, my thought is to write something like the
following to /etc/flash-kernel/db:
Machine: NETGEAR ReadyNAS 104
DTB-Id: armada-370-netgear-rn104.dtb
DTB-Append: yes
U-Boot-Multi-Address: 0x2000000
Mtd-Kernel: uImage
Required-Packages: u-boot-tools
Bootloader-Sets-Incorrect-Root: yes
# machine-entry-complete
and make get_machine_field() return 1 if it sees the
machine-entry-complete entry in state "fields".
The ugly detail here however is that the comment becomes magic which I
don't like much. (Sidenote: I could write "Machine: dummy" instead of
the above comment. Apart from emitting an error message flash-kernel's
behaviour becomes right :-)
Any better ideas?
Best regards
Uwe
Reply to: