I just noticed that ifdtool doesn't work correctly if the layout and density are changed simultaneously:
% ./coreboot-4.6/util/ifdtool/ifdtool -n /tmp/layout.txt -D 16 /tmp/test.rom File /tmp/test.rom is 8388608 bytes The image has changed in size. The old image is 8388608 bytes. The new image is 16777216 bytes. Copy Descriptor 0 (Flash Descriptor) (65536 bytes) from 00000000+00000000:0000ffff ( 65536) to 00000000+00000000:0000ffff ( 65536) Copy Descriptor 1 (BIOS) (4128768 bytes) from 00400000+00000000:007effff ( 4128768) to 00410000+00800000:00ffffff ( 12517376) Copy Descriptor 2 (Intel ME) (4128768 bytes) from 00010000+00000000:003fffff ( 4128768) to 00010000+00000000:003fffff ( 4128768) Copy Descriptor 4 (Platform Data) (65536 bytes) from 007f0000+00000000:007fffff ( 65536) to 00400000+00000000:0040ffff ( 65536) Writing new image to /tmp/test.rom.new Setting chip density to 16MB Writing new image to /tmp/test.rom.new
The resulting file has only the density change; the layout changes have been discarded. Instead it is necessary to run two commands:
% ./coreboot-4.6/util/ifdtool/ifdtool -n /tmp/layout.txt /tmp/test.rom File /tmp/test.rom is 8388608 bytes The image has changed in size. The old image is 8388608 bytes. The new image is 16777216 bytes. Copy Descriptor 0 (Flash Descriptor) (65536 bytes) from 00000000+00000000:0000ffff ( 65536) to 00000000+00000000:0000ffff ( 65536) Copy Descriptor 1 (BIOS) (4128768 bytes) from 00400000+00000000:007effff ( 4128768) to 00410000+00800000:00ffffff ( 12517376) Copy Descriptor 2 (Intel ME) (4128768 bytes) from 00010000+00000000:003fffff ( 4128768) to 00010000+00000000:003fffff ( 4128768) Copy Descriptor 4 (Platform Data) (65536 bytes) from 007f0000+00000000:007fffff ( 65536) to 00400000+00000000:0040ffff ( 65536) Writing new image to /tmp/test.rom.new
% ./coreboot-4.6/util/ifdtool/ifdtool -D 16 /tmp/test.rom.new File /tmp/test.rom.new is 16777216 bytes Setting chip density to 16MB Writing new image to /tmp/test.rom.new.new