ThinkPad X201 - replacing Intel PXE Option ROM with ASMedia SATA module

Hi Guys,

for my X201 I got a SuperTalent CoreStore Plus 128 GB (mPCIe) with an ASMedia 1061 SATA controller. As expected the BIOS won’t let me select that drive as a boot device.

So what did I do so far?

1. Got original Lenovo BIOS file (Phoenix), extracted it from Lenovos proprietary file format and then decompressed the modules.
2. Located the Intel PXE Option ROM in file OPTROM02.rom
3. Used fp.exe/fi.exe and rom2mod.exe to compress OPTROM02.rom to OPTROM02.rom.lz
4. Got the ASMedia Option ROM v0.954 from here: AHCI & RAID ROM Modules
5. Renamed the ASMedia .bin file to OPTROM02-NEW.rom, opened it in a hex editor and filled it up with zeroes to match the file size of the original Intel Option ROM.
6. Compressed the OPTROM02-NEW.rom to OPTROM02-NEW.rom.lz
7. Opened the original (extracted) BIOS.rom file in a hex editor, located the part with the original Intel Option ROM by comparing with OPTROM02.rom.lz (leaving the 27-byte LZINT header aside).
8. Replaced the whole Intel Option ROM part with the new ASMedia Option ROM.
9. To make sure the procedure was successful, decompressed the modules from the BIOS.rom and got the ASMedia ROM as OPTROM02.rom just as expected.
10. Loaded the modified BIOS.rom into the Phoenix SLIC Mod utility v2.14, under advanced options selected “No SLIC” and let it run. Finished without errors. I hoped this step would adjust the checksum.
11. Tried to flash the resulting ROM file with PHLASH16 and WinPhlash:

"Corrupted interface descriptors in new BIOS file.
Device descriptor signature not found in the interface.
Error Code: -160"


And now I am really stuck.
Can anyone help me with this?
I can upload all relevant files if that helps.

@ Gex:
Welcome at Win-RAID Forum!

Unfortunately I cannot help you myself, because I am not an expert regarding your problem.
Maybe someone else can give you a hint about what to do.

Good luck!
Fernando

Are you sure, that you cannot select any HDD/SSD, which is connected with any ASMedia 106x SATA port, as boot device?
What lets you think, that a replacement of the Intel LAN ROM module by an ASMedia 106x AHCI ROM will solve this problem?

Hi Fernando,

thanks for your replies!

Yes, I am 100% sure that I can’t select the ASMedia controller as a boot device. Some other people have tried it before and came up with the same result.
When PXE boot is disabled in the main BIOS, there’s no sign of the controller during startup at all. I tried different boot managers (Windows, Grub, Plop, etc.) and none of them was able to detect the SSD as a bootable device.
When I enable PXE boot, the following error message shows up during boot:

1
2
3
4
 
ERROR
Expansion ROM not initialized - PCI Mass Storage Controller in slot 02
Bus: 03, Device:00, Function:00
Press <ESC> to continue
 


So I thought: If it doesn't not work this way, why not try to implement the Option ROM directy via the main BIOS? Not sure if that's the correct approach as I haven't done any BIOS modding before, but I thought it could be worth a try.

By now I have been able to create a flashable image using just the Phoenix SLIC Mod Tool (v2.56). Still doesn't load the ASMedia Option ROM though.
Enabling both "Allow user to modify other modules" and "No SLIC" would let me swap the OPROM01.rom and OPROM02.rom in the DUMP directory. So I left OPROM01.rom in place, swapped OPROM02.rom with the ASMedia ROM (filled with zeroes to match the old OPROM02's size) and finally got an image that I was able to flash. As said before, the ASMedia Option ROM wasn't loaded at boot (with "PXE" boot option enabled).

I think it could work if I could swap OPROM01.rom (instead of 02) with the ASMedia ROM, but I can't swap it in because the file is too big (Intel PXE ROM is just 30.208 Bytes, ASMedia ROM is 32.256 Bytes). I don't know how to reduce the size of the ASMedia ROM, just deleting some zeroes with a hex editor doesn't seem a good idea as it would probably screw the whole thing up...

@ Gex:

If I understood you correctly, the ASMedia SATA Controller is not an on-board Controller of your Thinkpad X201.
In this case it doesn’t make much sense for me to integrate an ASMedia AHCI ROM module into the mainboard BIOS of your Thinkpad. The Option ROM modules of the mainboard BIOS will only work with Controllers, which are natively part of the mainboard itself.
I suspect, that your Thinkpad X201 isn’t able to boot off any PCIe card Controller.

Fernando, that’s correct, the ASMedia controller resides on a mPCIe card. Therefore my understanding is that the Option ROM should be loaded directly from this add-in card at boot time. Which obviously doesn’t work.

But if it was embedded on the mainboard, it would internally be connected via the PCIe-bus as well. The internal gigabit LAN controller (that supports PXE boot) is also connected via the PCIe bus. So I thought it should be possible to enable the BIOS to boot from the ASM controller instead of the Intel LAN controller since both are basically connected to the PCIe bus?

No, you cannot compare both Controllers.
The Intel Ethernet Controller of your system is part of the mainboard, whereas the ASMedia AHCI Controller is part of an inserted PCIe card.

Actually, @Gex is right, there is literally no difference for a PCI (or PCIe) devices that are soldered on the MB or plugged into a slot (except device number, of course), unless BIOS vendor specially made such difference.
The problem here is that there were no storage OPROM on that system, so the whole storage OPROM support may be disabled in that BIOS build, but I can’t say for sure.

@Gex , you should try to apply the same mod on a BIOS dump made by SPI programmer and flash the result with it, so you don’t need to overcome any flash protections possible.

Unfortunately I don’t have an SPI programmer, test clip etc. etc. at hand… so this is not really an option right now

edit: I’ve seen people using Arduinos to flash BIOS chips… will do some research on that as I do have an Arduino Uno R3…

Hello!

In a search regarding this BIOS flash/recovery trouble I recently discovered the ‘Bus Pirate’ - a rather cheap device, specialized in reading and writing about eveything, including SPI flash. I think I’m gonna buy one soon.

@Gex :

For what reason do you think oprom1 might work better than replacing oprom2?
In my T60’s BIOS there are two oproms related to PXE: OPROM7.ROM and OPROM8.ROM.
OPROM7.ROM identifies as "Intel(R) Boot Agent PXE Base Code (PXE-2.1 build 086)"
OPROM8.ROM identifies as "Initializing Intel(R) Boot Agent GE v1.3.24.IBA GE Slot 0000 v1324.PXE 2.1 Build 086 (WfM 2.0)"
Interestingly OPROM8.ROM got exactly the same file size like the asmedia 0.954 rom has (32256 Byte).
I’m not sure why there are two OPROMS for PXE. Maybe the one is for boot integration and the other for providing any PXE setup options while booting? Which one of both would be suited better for replacement, besides the file size factor?

I don’t understand what you did in your steps 1 through 9.
Indeed I just started Phoenix Tool, enabled the “Allow user to modify other modules” and “No SLIC” options, opened my BIOS file. When prompted to replace files now, I replaced the OPROM8.ROM file in the DUMP directory by the ASMedia ROM and approved the PT dialogue. So there’s was no need for fiddling around with any command line tools.

In recent Phoenix Tools there’s an specific option for allowing to swap between files with different sizes. that would allow you replacing any file. Of course we don’t know if this just skips size checks by Phoenix Tools, or if the tool actually does something useful by enabling that… but let’s find out :wink:


BTW:
If you just want to get this baby runinng, you maybe are interested in the coreboot project (Doesn’t the name greatly fit our corestore hardware?). It’s an OpenSource BIOS alternative for many notebooks. It’s able for booting from anything able for storing data. I don’t know about the usability status for X201, but it’s worth a look probably. Also I’m not sure about any conflicts, compatiblity problems or further problems that might result from having such an exotic BIOS configuration. And of course I’d prefer having your help here with our genuine BIOS modding issues :slight_smile:


@CodeRush
Doesn’t the integrated AHCI controller utilize a kind of storage ROM like the corestore controller does?

@ElMariachi :

First of all, just ignore the steps 1-9 in my first post. That was my first attempt before I found out about the capabilites of AndyP’s Phoenix Tool. I didn’t manage to produce a flashable image that way. I suppose it’s a checksum issue (don’t know how to recalculate the checksum) but I am not sure about that.

My option ROM files look quite similar to yours:

OPROM01.rom:
Copyright © 1997-2010, Intel Corporation
Intel Corporation
Intel® Boot Agent PXE Base Code (PXE-2.1 build 089)


OPROM02.rom:
Copyright © 1997-2010, Intel Corporation
Initializing Intel ® Boot Agent
GE v1.3.51 IBA
GE Slot 0000 v1351
PXE 2.1 Build 089 (WfM 2.0)


So why do I suppose it could work replacing OPROM01 instead of OPROM02? To me it looks like some sort of “chainloading”. Enabling the PXE boot option in the BIOS will probably first run the OPROM01 code which then continues to load OPROM02. That’s my (very limited) understanding at this point.

My original OPROM01.rom is 30.208 bytes in size, the ASMedia file is 32.256 bytes. The original OPROM02.rom, on the other hand, is 35.328 bytes. So when I swapped the latter with the new ASMedia ROM, I had to add 3.072 bytes to the new one to make it the same size as the original one. To accomplish this, I simply filled the file up with zeroes. The resulting BIOS image was perfectly flashable, did not brick my board, but did not load the ASMedia ROM either.

Next thing I tried was to replace the OPROM01.rom with a file of 30.208 bytes (just like the original one) made up entirely of zeroes. The OPROM02 was replaced with the modified ASMedia ROM. Gave me a flashable image as well, but this time it bricked the board. The idea was that OPROM01 would be loaded and then just skipped because it’s all zeros. Didn’t work.

I have also noticed the checkbox to swap an option ROM file ignoring the file size, I will try that next. I see two different approaches here:
1. Just swap the (smaller) original OPROM01 with the new (bigger) ASMedia ROM, not touching anything else. This will inevitably lead to a different overall file size and probably mess up address pointers and stuff that comes behind the option ROMs in the final image.
2. The combined file size of both original ROMs is 65.536 bytes. The ASMedia ROM is 32.256 bytes. So I will try to use the ASMedia instead of OPROM01 and then create a “dummy” OPROM02 filled with zeros and a file size of 33.280 bytes. Given that in the final BIOS image both option ROMs are located next to each other (are they? I will have a look…), the combined size of that “code block” would not change, thus leaving pointers and stuff intact.

I hope you haven’t lost me at this point… I will let you know when I have given it a try.

Regarding coreboot: I have noticed that project before, seems to be working quite well on the X201. As far as I have read, the SeaBIOS payload should work with any option ROM, so the chances are probably good to get the ASMedia controller working. But I’d like it better if I could continue using the genuine Lenovo BIOS…

A friend of mine just borrowed me his SPI flasher, but I still have to modify it for 3.3V and get a SOIC8-clip so I don’t have to solder wires to my board… as soon as I have everything ready I will extract the current BIOS and try to inject the ASMedia ROM directy. And maybe give coreboot a chance…

That’s good news, so hope isn’t lost completely at least.

I haven’t lost you so far.
Did you notice that the two older asmedis roms are 32768bytes in size?
So you could just replace both roms by v0.951 in example, while maintaining combined 65k size, without the need for creating an empty rom file.

I thought and searched about what you said regarding the controller’s firmware residing on the controller’s flash itself anyway. It sounds just logical that we would need something else, for telling the bios it should have a look at PCIE at all.
I found that there indeedis something called “PCIe slot option ROM” in intel BIOSes. (Like here: http://downloadmirror.intel.com/22568/en…R01.07.0001.TXT)
So wouldn’t that be the right thing to integrate?
We shouldn’t forget, that PCIe booting is some rather new feature, that started existence just when SSDs got so fast, that vendors wanted to skip SATA controllers for increasing performance. (M.2 form factor)
So we would have to find such an option rom in the bios for some recent chipset - and make sure there’s a chance for making this run on older chipsets. My buest guess would be, searching and extracting this PCIe slot option ROM from the oldest PCIe-boot supporting intel chipset - not to forget that current ROMs are mostly UEFI in case this matters for option ROMs. Probably it’d also need to match PCIe address space and that’s a major problem I assume.

btw:
All additional controller cards i placed in my PCs required INT 13h support form BIOS - how could we check or change if our BIOS got this enabled?

The author of Plop announced PCIe support for version 6 though…

I have just had a look into the original BIOS ROM file. The OPROM01 and OPROM02 sections do not reside next to each other, in fact the OPROM02 even comes before the OPROM01. I suppose that makes my idea regarding the combined size of the Option ROMs somewhat pointless.


Well, PCIe itself has been around for more than ten years now and so have PCIe SATA add-on cards. Attaching SSDs directly to the PCIe bus as you described is a pretty new feature indeed, but that’s AFAIK not how the Corestore Plus works. The older Corestore MV does not feature the ASMedia SATA controller, so your assumptions probably do apply to that model.
The Intel BIOS in the document you linked seems to be an EFI BIOS, so the PCIe slot option ROM will probably not be something to use on our old Phoenix BIOSes? But we should do a bit more research on that. Sounds promising nevertheless.


Uh, I haven’t thought about that yet…


Yeah, so I sent the guy an email even before I attempted to do any BIOS mods, regarding the release date of v6 and he replied that it will NOT be released any time in the near future… :frowning:


Yeah, so I sent the guy an email even before I attempted to do any BIOS mods, regarding the release date of v6 and he replied that it will NOT be released any time in the near future… :([/quote]

Maybe we should bribe him abit? :slight_smile:

@Gex @ElMariachi

The main problem here is the BIOS, as it doesn’t search for boot devices in PCIe. It probably just searches for classcode 0200 in PCIe and that is it. No wonder, since only now this feature is added to newer boards.

If it where to find the SSD, it will be displayed in the boot menu. The SSD can’t expect that every BIOS will include the ASMedia OROM, so it must come prepared with its own boot files - or so we hope for, because the SSD isn’t been advertised as bootable. Trying to include it in your BIOS feels just pointless. Can you boot into Linux and try to dump the ROM for the SSD?

If it where to have space issues, it would print “Not enough space to copy PCI option ROM …” and you could just disable PXE boot or remove Intel OPROM from BIOS. Again, not much hopes with this step.

If the SSD doesn’t appear in the Boot menu, it simply isn’t loaded or seen as a boot device. Your best bet is to contact Lenovo and ask for a special beta BIOS with PCIe boot, especially for this SSD. But given the time passed from the laptop manufacturing, you will be extremely lucky, even if it is as simple as adding a few lines of code in the original BIOS. To do this on your own, I don’t think if it is worth the risk.

Last chance is to remove both Intel PXE ROMs and add ASMedia 3.70 instead. This is the ROM you need for your card, not 0.954, as seen in this example. Phoenix BIOS Editor should be the tool for the job.

Hello!

The SSD actually is displayed during post. It’s just some prompt with a meaning roughly like ‘SATA3 controller found one physical device’.
So yes, it’s recognized but just not utillized for boot device list.

Wouldn’t dumping the SSD’s ROM give the same file like one of those ASMEDIA Rom Files?
And how could i create this dump from linux? Could this work ‘dd if=/dev/xxx of=~/ssd.rom’?

And what is the difference between 0.954 and AMEDIA 3.70?
Ain’t these just two different versions of the same ROM?

Thank you!

ElMariachi

I take it that your laptop is SATA2 capable only? If so, the SATA3 message will be related to the SSD.

The idea of romdumping is to check if the SSD is bootable and what firmware it has. Try to follow that link I posted.

Like I already posted, a Super Talent PCIe DX1 M.2 SSD is using 3.02 for booting, so it would seem you need 3.xx for your SSD.

Yes. This message is from the corestore. I know the Version in my Corestore is 3.07, as it’s being shown while booting. I just thought that probably the other ROM-Versions are doing the same, just a bit newer or older…

Besided this I recently found an interesting fact:
I tried booting a linux live system (Mint 17) from USB and DVD and it didn’t wokr, but got stuck with a flashing cursor after executing syslinux/isolinux.
It started working, after I had removed the SSD. So I think there might be a chance for making the SSD boot through syslinux, because otherwise I wouldn’t expect the ssd to disturb the boot process like this…

Have you tried different bootloaders, like GRUB2, Clover, Chameleon… ? I know it has a little chance of working and a lot of hassle, but every idea counts.

Your only options are a bootloader or inserting 3.70 firmware instead of PXE and hoping it works.