André Przywara
authored
The env_fat_get_dev_part() function mostly returns a fixed string, set via some Kconfig variable. However when the first character is a colon, that means that the boot device number is determined at runtime, and patched in. This requires altering the string. So far this was done via some ugly and actually illegal direct write to the .rodata string storage. We got away with this because U-Boot maps everything as read/write/execute so far. A proposed patch set actually enforces read-only (and no-execute) permissions in the page tables, so this routine now causes an exception: ======================= Loading Environment from FAT... "Synchronous Abort" handler, esr 0x9600004f, far 0xfffb7d4c elr: 000000004a054228 lr : 000000004a05421c (reloc) elr: 00000000fff7c228 lr : 00000000fff7c21c ..... ======================= Rewrite the routine to do away with the dodgy string manipulation, instead allocate the string in the r/w .data section, where we can safely manipul...