How to do this with CBROM?

Discussion in 'Windows Vista' started by knoblauch, Oct 20, 2008.

  1. knoblauch

    knoblauch MDL Novice

    Oct 11, 2007
    43
    0
    0
    15. ISA ROM[1] 00400h(1.00K) 00363h(0.85K) IASUS.BIN
    (SP) NCPUCODE 04000h(16.00K) 04000h(16.00K) NCPUCODE.BIN

    Total compress code space = 62000h(392.00K)
    Total compressed code size = 620ADh(392.17K)
    Remain compress code space = FFFFFF53h(4194303.83K)

    This is about Gigabyte's Award BIOS.
    Want to add an ISA Module to a original BIOS, but it is a bit larger than the "Remain compress code space". But in the above BIOS module it has been done. Is there a special commdline switch in CBROM 1.82 to force it adding a oversized module? Or some other tool to do this?
     
  2. knoblauch

    knoblauch MDL Novice

    Oct 11, 2007
    43
    0
    0
    Just found out using older version of CBROM(2.20) would do the trick. But would this kind of oversized BIOS code bring some sideeffects?

    :confused:
     
  3. Yen

    Yen Admin
    Staff Member

    May 6, 2007
    11,373
    11,252
    340
    It depends on what modules are inside the bios.
    Basically you cannot add a larger module than remained space.

    15. ISA ROM[1] 00400h(1.00K) 00363h(0.85K) IASUS.BIN
    (SP) NCPUCODE 04000h(16.00K) 04000h(16.00K) NCPUCODE.BIN

    Total compress code space = 62000h(392.00K)
    Total compressed code size = 620ADh(392.17K)
    Remain compress code space = FFFFFF53h(4194303.83K)
    This values are not logical:confused:

    The bios works? Would you please upload it?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. knoblauch

    knoblauch MDL Novice

    Oct 11, 2007
    43
    0
    0
    #4 knoblauch, Oct 21, 2008
    Last edited by a moderator: May 23, 2017
    (OP)
  5. Yen

    Yen Admin
    Staff Member

    May 6, 2007
    11,373
    11,252
    340
    There are ways to add larger modules as far as you find free space. The real free space is usually greater than the remain compress code space shown at cbrom. Of course every bios size is a multiple of 128 and the bios file size may NOT extend!!!
    A 'oversized' one I haven't tried before....

    I don't have tools right here to check.
    Do you want to make a 'oversized ISA mod.' or a SSV1 mod?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. knoblauch

    knoblauch MDL Novice

    Oct 11, 2007
    43
    0
    0
    I kinda like to try both ways. But I am stucked by the problems above now.

    It would be great if you could give me some help for this. :p
     
  7. Yen

    Yen Admin
    Staff Member

    May 6, 2007
    11,373
    11,252
    340
    Ok, I'll reply when I'm at home again.
    Basse probably used cbrom 2.20 as well. Is the resulting mod different?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. knoblauch

    knoblauch MDL Novice

    Oct 11, 2007
    43
    0
    0
    I tried using 2.20 add isa module into f7f bios. At first, cbrom says ok.

    But then I found out some micro code is missing after that(on the bottom of cbrom 1.82's /D output). And using modbin6.exe to open that rom result an error msg: Boot Block not found. the same with the BIOS from Basse.
     
  9. 911medic

    911medic MDL Guru

    Aug 13, 2008
    5,778
    492
    180
    #9 911medic, Oct 21, 2008
    Last edited: Oct 21, 2008
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  10. Yen

    Yen Admin
    Staff Member

    May 6, 2007
    11,373
    11,252
    340
    I agree.:)

    Basse confirmed it to work, eventhough he messed up some micro code and BB. Fortune favors fools:D ...I don't think it works....
    The CPU microcode module was structured in another way at older Award bioses, so cbrom2.20 doesn't know about the new structure.

    If you want to force the isa module to fit, you have to do it manually. But this way I wouldn't recommend.....I need tools to say more about......
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  11. knoblauch

    knoblauch MDL Novice

    Oct 11, 2007
    43
    0
    0
    Yes, for the uncompressed SLIC thing it has enough space(0x2B6 vs 0x176 + length of lha header). But you need also to modify acpitbl, which result an offset change. To compensate the change you need to move some small block(epa logo i.e.) before gv3 to the end, and add some smaller(than epa logo) random junk block before gv3 to keep the offset unchanged. But in this f7f bios:

    No. Item-Name Original-Size Compressed-Size Original-File-Name
    =========================================================================
    0. System BIOS 20000h(128.00K) 133CCh(76.95K) ma770ds3.BIN
    1. XGROUP CODE 0E720h(57.78K) 09FE9h(39.98K) awardext.rom
    2. ACPI table 06489h(25.13K) 02B81h(10.88K) ACPITBL.BIN
    3. GROUP ROM[18] 03550h(13.33K) 02465h(9.10K) ggroup.bin
    4. GROUP ROM[20] 00D40h(3.31K) 00A78h(2.62K) ffgroup.bin
    5. YGROUP ROM 0B350h(44.83K) 05068h(20.10K) awardeyt.rom
    6. GROUP ROM[ 0] 06F60h(27.84K) 02BC6h(10.94K) _EN_CODE.BIN
    7. PCI ROM[A] 0C800h(50.00K) 0AC37h(43.05K) sata22.bin
    8. OEM1 CODE 0AE4Fh(43.58K) 06B6Dh(26.86K) ui22.bin
    9. PCI ROM 0B000h(44.00K) 063EBh(24.98K) RTEGPXE.LOM
    10. OEM0 CODE 028ABh(10.17K) 01E1Bh(7.53K) SBF.BIN
    11. GV3 0776Ch(29.86K) 02709h(9.76K) AGESACPU.ROM
    12. MINIT 120D1h(72.20K) 120FEh(72.25K) MEMINIT.BIN
    13. HTINIT 04BC1h(18.94K) 04BF0h(18.98K) HT.DLL
    14. 2 PE32 in MB 004C9h(1.20K) 00568h(1.35K) HT32GATE.BIN

    There is no such block available to be moved to the end.

    That is why I found this f6 bios mod very tricky:

    Modded content:
    No. Item-Name Original-Size Compressed-Size Original-File-Name
    ==========================================================================
    0. System BIOS 20000h(128.00K) 133E6h(76.97K) MA770DS3.BIN
    1. XGROUP CODE 0E7A0h(57.91K) 09FFFh(40.00K) awardext.rom
    2. ACPI table 0648Dh(25.14K) 02B8Ah(10.88K) ACPITBL.BIN
    ...
    15. NoCompress ROM 00176h(0.37K) 001AAh(0.42K) LENOVO.BIN
    (SP) NCPUCODE 04000h(16.00K) 04000h(16.00K) NCPUCODE.BIN


    Original content:
    No. Item-Name Original-Size Compressed-Size Original-File-Name
    =========================================================================
    0. System BIOS 20000h(128.00K) 133EFh(76.98K) MA770DS3.BIN
    1. XGROUP CODE 0E7A0h(57.91K) 09FFFh(40.00K) awardext.rom
    2. ACPI table 06489h(25.13K) 02B81h(10.88K) ACPITBL.BIN
    ...


    The size of module 0+2 is the same in both modded and original one. I don't know how to do the trick.
     
  12. Yen

    Yen Admin
    Staff Member

    May 6, 2007
    11,373
    11,252
    340
    Yes, you're right, but the reason is different:
    Compressed size of ACPI table has increased at mod. This is a MUST since you have to extend the table with four bytes.

    The compressed Systembios size has decreased by editing some additional strings (replace with equal bytes) at mainmodule and to try till the resulting compressed size is the one you'll need to get the same sum of module 0+2.
    No problem at all......;)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  13. knoblauch

    knoblauch MDL Novice

    Oct 11, 2007
    43
    0
    0
    I thought there was a general way to do this without manually tweaking some unused bytes. :D

    I'll make a try.
    :rolleyes:
     
  14. Yen

    Yen Admin
    Staff Member

    May 6, 2007
    11,373
    11,252
    340
    #14 Yen, Oct 21, 2008
    Last edited: Oct 21, 2008
    Now I have my tools here:D
    Do you know about Awards module structure?

    Each module starts with two bytes, followed by -lh and ends with a zero byte. Additionally at older Award bioses you have to add the 8 bit checksum of the compressed module or at newer ones a FFh byte at systembiosmodule.

    Do you know that you may re-compress each module using cbrom?
    When you add a module, cbrom creates always the compressed module as bios.rom:D
    So you just need cbrom to do any actions, no modbin.

    If you apply this command:
    cbrom yourbios /other 5000:0 systembios.bin you'll get the compressed systembios as bios.rom. Just go by trial and error since you've got the right size.
    Cut out the systembios using hexeditor and save it as systembios.lha.

    Now you can simply decompress it using winrar:). Edit some strings like COPYRIGHT to 20h (space) bytes and play around till you've got the size you need.

    After that copy and paste it into a FRESH biosfile. Move xgroup module forwards and append the new compressed acpi module. You should now be at the same offset as the original bios again. Finally add the nocompress module.

    yourbios = name of the bios you want to modify.
    systembios.bin = name of 0 module.

    If you want I can make the mod for you to check what I mean.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  15. knoblauch

    knoblauch MDL Novice

    Oct 11, 2007
    43
    0
    0
    haha, I always wondered why I need this crap modbin to modify system bios.

    Now I get some questions.

    I tried your command, but cbrom biosfile /other 5000:0 romfile is the command to compress that romfile into biosfile, isn't it?

    How to extract it then? Should I simply copy the block into a empty file?

    And after modding of systembios, I need to compress it. Should I use WinRAR or CBROM? I guess I should use cbrom add it to a dummy bios file to check the size. After I get the right size I copy this content back to the start of original bios file and add those modded modules as well. Is this correct?
     
  16. Yen

    Yen Admin
    Staff Member

    May 6, 2007
    11,373
    11,252
    340
    #16 Yen, Oct 21, 2008
    Last edited: Oct 21, 2008
    Yes. Use cbrom to compress the systembios. The biosfile you've used therefore is unusable after it. You just need the created bios.rom file!!!

    It's formatted and compressed again. No need to cut it out from the 'dummy bios'. It really acts like a dummy, nothing else.

    To mod the bios you always need a FRESH ORIGINAL bios file. After you've inserted the nocompress module as final step, cbrom corrects the checksum of the biosfile in that way that you may flash it. This final step is very important ( to add a module to the modified / edited biosfile).

    I'll try it as well and post some modules here.....

    Edit: EACH module starts with 2 bytes followed by -lh, the systembios ends with a zero byte plus a FFh byte at newer Award bioses
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  17. knoblauch

    knoblauch MDL Novice

    Oct 11, 2007
    43
    0
    0
    #17 knoblauch, Oct 21, 2008
    Last edited: Oct 21, 2008
    (OP)
    Great thanks for all the tips you've given here. I just modded a GA MA770 DS3 F7F BIOS with Dell SLIC(SSV1) and XP SLP(Dell, IBM, Lenovo etc.). all first 3 modules have been modified. Sensible modules remain at the same offset.

    One problem occured in the modding process:
    I recompress the systembios module using: cbrom dummybios.bin /oem6 ma770ds3.bin.
    Although cbrom displayed the modded systembios module as 0x133A6 bytes, the size info after the -lh5- header is 1 larger as it should be, it was 0x1337E. If I copy this block back into the org. BIOS, cbrom displays only the systembios block and NCPU code. I must modify it to 0x1337D to let cbrom to correctly read the modded BIOS.

    Link:
    ...

    ;)
     
  18. Yen

    Yen Admin
    Staff Member

    May 6, 2007
    11,373
    11,252
    340
    #18 Yen, Oct 21, 2008
    Last edited: Oct 21, 2008
    No!!!
    You must use this command to re-compress the systembios:

    cbrom182 dummy /other 5000:0 ma770ds3.BIN
    Then check the resulting space. It must be one byte shorter than the calculated size you need.
    Copy and paste the created bios.rom into the fresh bios. APPEND one FFh byte. It'll count now to its size.

    If you don't use the other 5000:0 command it ends up in a disaster! The 5000:0 address is the entry point of the decompression routine at boot. It's used to decompress the systembios. Be careful!!

    Just re-compress the unmodified systembios and you'll see it is one byte shorter, cause FFh byte is missing.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  19. knoblauch

    knoblauch MDL Novice

    Oct 11, 2007
    43
    0
    0
  20. Yen

    Yen Admin
    Staff Member

    May 6, 2007
    11,373
    11,252
    340
    #20 Yen, Oct 21, 2008
    Last edited: Oct 21, 2008
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...