{"action":"opened","issue":{"url":"https://api.github.com/repos/corna/me_cleaner/issues/50","repository_url":"https://api.github.com/repos/corna/me_cleaner","labels_url":"https://api.github.com/repos/corna/me_cleaner/issues/50/labels{/name}","comments_url":"https://api.github.com/repos/corna/me_cleaner/issues/50/comments","events_url":"https://api.github.com/repos/corna/me_cleaner/issues/50/events","html_url":"https://github.com/corna/me_cleaner/issues/50","id":248260828,"number":50,"title":"Unable to shrink ME","user":{"login":"lenzj","id":7076515,"avatar_url":"https://avatars0.githubusercontent.com/u/7076515?v=4","gravatar_id":"","url":"https://api.github.com/users/lenzj","html_url":"https://github.com/lenzj","followers_url":"https://api.github.com/users/lenzj/followers","following_url":"https://api.github.com/users/lenzj/following{/other_user}","gists_url":"https://api.github.com/users/lenzj/gists{/gist_id}","starred_url":"https://api.github.com/users/lenzj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lenzj/subscriptions","organizations_url":"https://api.github.com/users/lenzj/orgs","repos_url":"https://api.github.com/users/lenzj/repos","events_url":"https://api.github.com/users/lenzj/events{/privacy}","received_events_url":"https://api.github.com/users/lenzj/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-08-06T17:39:14Z","updated_at":"2017-08-06T17:39:14Z","closed_at":null,"body":"Following [internal flashing instructions with coreboot](https://github.com/corna/me_cleaner/wiki/Internal-flashing-with-coreboot), and the process without shrinking works fine, however I am unable to execute the instructions around shrinking the ME.  I'm using me_cleaner [f4e3d14](https://github.com/corna/me_cleaner/commit/f4e3d1401efa79a3d40190c8a86293b601a0e87e), and ifdtool is from coreboot [5cb2263](https://review.coreboot.org/cgit/coreboot.git/commit/?id=5cb2263004c2068090ecdf955d3da01fd46daee7).  The steps and output I followed are below:\r\n```\r\n$ me_cleaner.py -O stock-BIOS-compressed.rom -r ../original/stock-BIOS.rom\r\nFull image detected\r\nThe ME/TXE region goes from 0x3000 to 0x4ff000\r\nFound FPT header at 0x3010\r\nFound 19 partition(s)\r\nFound FTPR header: FTPR partition spans from 0xcf000 to 0x145000\r\nME/TXE firmware version 7.1.40.1161\r\nRemoving extra partitions...\r\nRemoving extra partition entries in FPT...\r\nRemoving EFFS presence flag...\r\nCorrecting checksum (0xed)...\r\nReading FTPR modules list...\r\n UPDATE           (LZMA   , 0x1131bd - 0x11324f): removed\r\n BUP              (Huffman, fragmented data    ): NOT removed, essential\r\n KERNEL           (Huffman, fragmented data    ): removed\r\n POLICY           (Huffman, fragmented data    ): removed\r\n HOSTCOMM         (LZMA   , 0x11324f - 0x118808): removed\r\n RSA              (LZMA   , 0x118808 - 0x11d2b9): removed\r\n CLS              (LZMA   , 0x11d2b9 - 0x121ccb): removed\r\n TDT              (LZMA   , 0x121ccb - 0x127e79): removed\r\n FTCS             (Huffman, fragmented data    ): removed\r\nRelocating FTPR from 0xcf000 - 0x145000 to 0x3400 - 0x79400...\r\n Adjusting FPT entry...\r\n Adjusting LUT start offset...\r\n Adjusting Huffman start offset...\r\n Adjusting chunks offsets...\r\n Moving data...\r\nThe ME minimum size should be 86016 bytes (0x15000 bytes)\r\nThe ME region can be reduced up to:\r\n 00003000:00017fff me\r\nChecking FTPR RSA signature... VALID\r\nDone! Good luck!\r\n```\r\nExecute ifdtool to extract layout from original stock BIOS:\r\n```\r\n$ ifdtool -f layout.txt ../original/stock-BIOS.rom\r\nFile ../original/stock-BIOS.rom is 8388608 bytes\r\nWrote layout to layout.txt\r\n```\r\nModify layout.txt to reflect shrinking ME from:\r\n```\r\n00000000:00000fff fd\r\n00500000:007fffff bios\r\n00003000:004fffff me\r\n00001000:00002fff gbe\r\n```\r\nto:\r\n```\r\n00000000:00000fff fd\r\n00018000:007fffff bios\r\n00003000:00017fff me\r\n00001000:00002fff gbe\r\n```\r\nExecuted ifdtool with the new layout.txt:\r\n```\r\n$ ifdtool -n layout.txt stock-BIOS-compressed.rom\r\nFile stock-BIOS-compressed.rom is 8388608 bytes\r\nDANGER: Region Intel ME is shrinking.\r\n    The region will be truncated to fit.\r\n    This may result in an unusable image.\r\nCopy Descriptor 0 (Flash Descriptor) (4096 bytes)\r\n   from 00000000+00000000:00000fff (      4096)\r\n     to 00000000+00000000:00000fff (      4096)\r\nCopy Descriptor 1 (BIOS) (3145728 bytes)\r\n   from 00500000+00000000:007fffff (   3145728)\r\n     to 00018000+004e8000:007fffff (   8290304)\r\nCopy Descriptor 2 (Intel ME) (86016 bytes)\r\n   from 00003000+004e8000:004fffff (   5230592)\r\n     to 00003000+00000000:00017fff (     86016)\r\nCopy Descriptor 3 (GbE) (8192 bytes)\r\n   from 00001000+00000000:00002fff (      8192)\r\n     to 00001000+00000000:00002fff (      8192)\r\nWriting new image to stock-BIOS-compressed.rom.new\r\n```\r\nChecked the integrity of the resulting BIOS file with me_cleaner and found that it was corrupted:\r\n```\r\n$ me_cleaner.py -c stock-BIOS-compressed.rom.new\r\nFull image detected\r\nThe ME/TXE region is corrupted or missing\r\n```\r\nRunning the same check on the original file looks fine:\r\n```\r\n$ me_cleaner.py -c stock-BIOS-compressed.rom\r\nFull image detected\r\nThe ME/TXE region goes from 0x3000 to 0x4ff000\r\nFound FPT header at 0x3010\r\nFound 1 partition(s)\r\nFound FTPR header: FTPR partition spans from 0x3400 to 0x79400\r\nME/TXE firmware version 7.1.40.1161\r\nChecking FTPR RSA signature... VALID\r\n```\r\nI don't know if it helps, but below is a diff of the ifdtool dump from the two images:\r\n```diff\r\n1c1\r\n< File stock-BIOS-compressed.rom is 8388608 bytes\r\n---\r\n> File stock-BIOS-compressed.rom.new is 8388608 bytes\r\n150,153c150,153\r\n< FLREG1:    0x07ff0500\r\n<   Flash Region 1 (BIOS): 00500000 - 007fffff\r\n< FLREG2:    0x04ff0003\r\n<   Flash Region 2 (Intel ME): 00003000 - 004fffff\r\n---\r\n> FLREG1:    0x07ff0018\r\n>   Flash Region 1 (BIOS): 00018000 - 007fffff\r\n> FLREG2:    0x00170003\r\n>   Flash Region 2 (Intel ME): 00003000 - 00017fff\r\n156c156\r\n< FLREG4:    0x00001fff\r\n---\r\n> FLREG4:    0x00000fff\r\n```\r\nAny ideas or suggestions?  Thanks!"}}
{"actor":{"display_login":"lenzj"}}