ROM Writerを使ったBIOS改変 (NVMe driverをねじ込む)
やっぱりUSB経由のブートはかっこよくないなー、と。
toshiomi-moriki.hatenadiary.jp
ROM Writer入手
USB Programmer Module CH341A SOIC8 Clip 1.8V Adapter SOIC8 Adapter https://amzn.asia/d/4FGaSH0
CH341Aはこの界隈ではスタンダードみたいですね。 安価だし、そもそも説明書も何も入ってない。
やったこと
- UEFIToolを使って、NvmExpressDxe_Small.ffsをBIOSファイルに組み込む。
- 裏蓋を開ける。
- バッテリーとCMOS電池を外す。
- BIOSチップを探して、クリップで挟む
- 本体にケーブルを接続(USBーAで親PCにつなぐスタイル)
- 親PCと接続
- 親PCから、flashromコマンドを実行
作業中の図など。

ログとか。
$ sudo flashrom -p ch342a_spi -c MX25L6406E/MX25L6408E -w spi_backup_w_NVMe.bin
flashrom unknown on Linux 6.8.12 (x86_64)
flashrom is free software, get the source code at https://flashrom.orgUsing clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
Found Macronix flash chip "MX25L6406E/MX25L6408E" (8192 kB, SPI) on ch341a_spi.
This flash part has status UNTESTED for operations: WP
The test status of this chip may have been updated in the latest development
version of flashrom. If you are running the latest development version,
please email a report to flashrom@flashrom.org if any of the above operations
work correctly for you with this flash chip. Please include the flashrom log
file for all operations you tested (see the man page for details), and mention
which mainboard or programmer you tested in the subject line.
Thanks for your help!
Reading old flash chip contents... done.
Erasing and writing flash chip... Erase/write done.
Verifying flash... VERIFIED.
色々困ったこと。
トラブル1) UEFIToolが aptで入れるものでは間に合わなかった。git cloneして対処。
(吸い出したBIOSイメージを確認するのは最新版で。実際に NVMe driverをinsertする際には old versionと使い分け。)
古いUEFITool(0.28)をビルドする場合
$ sudo apt install git build-essential qtbase5-dev qttools5-dev qt5-qmake
$ git clone https://github.com/LongSoft/UEFITool.git
$ cd UEFITool
$ git checkout old_engine ### ここが違う!
$ qmake uefitool.pro
$ make -j$(nproc)
$ ./UEFITool新しいUEFIToolを使いたい場合
$ git clone https://github.com/LongSoft/UEFITool.git
$ cd UEFITool
$ qmake uefitool.pro
$ make -j$(nproc)
$ ./UEFITool

トラブル2) 実際にイメージ焼き込みの際にエラー出まくる。(以下、エラーログ)
→ よくあるらしい。クリップを上から軽く押さえつけて対処。
$ sudo flashrom -p ch341a_spi -c MX25L6406E/MX25L6408E -w spi_backup_w_NVMe.bin
[sudo] toshiomi のパスワード:
flashrom unknown on Linux 6.8.12 (x86_64)
flashrom is free software, get the source code at https://flashrom.orgUsing clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
Found Macronix flash chip "MX25L6406E/MX25L6408E" (8192 kB, SPI) on ch341a_spi.
This flash part has status UNTESTED for operations: WP
The test status of this chip may have been updated in the latest development
version of flashrom. If you are running the latest development version,
please email a report to flashrom@flashrom.org if any of the above operations
work correctly for you with this flash chip. Please include the flashrom log
file for all operations you tested (see the man page for details), and mention
which mainboard or programmer you tested in the subject line.
Thanks for your help!
Reading old flash chip contents... done.
Erasing and writing flash chip... FAILED at 0x002600c0! Expected=0xff, Found=0x4d, failed byte count from 0x00260000-0x00260fff: 0xf30
ERASE FAILED!
Reading current flash chip contents... done. Looking for another erase function.
FAILED at 0x002600c0! Expected=0xff, Found=0x4d, failed byte count from 0x00260000-0x0026ffff: 0xfe48
ERASE FAILED!
Reading current flash chip contents... done. Looking for another erase function.
FAILED at 0x002600c0! Expected=0xff, Found=0x4d, failed byte count from 0x00260000-0x0026ffff: 0xfe48
ERASE FAILED!
Reading current flash chip contents... done. Looking for another erase function.
FAILED at 0x00000010! Expected=0xff, Found=0x5a, failed byte count from 0x00000000-0x007fffff: 0x3c4d7c
ERASE FAILED!
Reading current flash chip contents... done. Looking for another erase function.
FAILED at 0x00000010! Expected=0xff, Found=0x5a, failed byte count from 0x00000000-0x007fffff: 0x3c4d7c
ERASE FAILED!
Reading current flash chip contents... done. Looking for another erase function.
Looking for another erase function.
Looking for another erase function.
No usable erase functions left.
FAILED!
Uh oh. Erase/write failed. Checking if anything has changed.
Reading current flash chip contents... done.
Good, writing to the flash chip apparently didn't do anything.
Please check the connections (especially those to write protection pins) between
the programmer and the flash chip. If you think the error is caused by flashrom
please report this to the mailing list at flashrom@flashrom.org or on IRC (see
https://www.flashrom.org/Contact for details), thanks!
toshiomi@toshiomi-u38n:~/Downloads/VERSAPRO_BIOS$ sudo flashrom -p ch341a_spi -c MX25L6406E/MX25L6408E -v spi_backup_w_NVMe.bin
flashrom unknown on Linux 6.8.12 (x86_64)
flashrom is free software, get the source code at https://flashrom.orgUsing clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
Found Macronix flash chip "MX25L6406E/MX25L6408E" (8192 kB, SPI) on ch341a_spi.
This flash part has status UNTESTED for operations: WP
The test status of this chip may have been updated in the latest development
version of flashrom. If you are running the latest development version,
please email a report to flashrom@flashrom.org if any of the above operations
work correctly for you with this flash chip. Please include the flashrom log
file for all operations you tested (see the man page for details), and mention
which mainboard or programmer you tested in the subject line.
Thanks for your help!
Verifying flash... FAILED at 0x002600e0! Expected=0xaa, Found=0x2f, failed byte count from 0x00000000-0x007fffff: 0x1abdd2とはいえ、読み直してみたら書き換え前のデータと同じのようなので文鎮化は避けられそうだった。
$ sudo flashrom -p ch341a_spi -c MX25L6406E/MX25L6408E -r read-after-verifyfailed.bin
flashrom unknown on Linux 6.8.12 (x86_64)
flashrom is free software, get the source code at https://flashrom.orgUsing clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
Found Macronix flash chip "MX25L6406E/MX25L6408E" (8192 kB, SPI) on ch341a_spi.
This flash part has status UNTESTED for operations: WP
The test status of this chip may have been updated in the latest development
version of flashrom. If you are running the latest development version,
please email a report to flashrom@flashrom.org if any of the above operations
work correctly for you with this flash chip. Please include the flashrom log
file for all operations you tested (see the man page for details), and mention
which mainboard or programmer you tested in the subject line.
Thanks for your help!
Reading flash... done.$ sha256sum *.bin
620b0d1dbd8db389660f8bcfdf1fe2db35b9ebadcabc99b6cd32c8a1a22e7432 read-after-verifyfailed.bin
620b0d1dbd8db389660f8bcfdf1fe2db35b9ebadcabc99b6cd32c8a1a22e7432 spi_backup.bin
b8b4ede9235610e4827a3553bfbdc07c3c2ffd77037b6d6b9700cc91f3a5e569 spi_backup_w_NVMe.bin
すんなり行ったような書き方してますが。。。
実際はまぁ、ありとあらゆるところで引っかかりました。
- そもそもIntel FPTでソフトウェア的に書き換えたかったのだが、このNEC機はBIOS改変を念入りに潰されていた模様。
- ROM Writerを使うのが初めてなため、届いた部品のどれ使っていいのかわからず。
- それでもChatGPTに聞きながら進める。
- 最初の1回目は違うチップ(EEPROM, 64kB)につないで読み出してしまう。(が、これのおかげでROM Writer自体は動いていることを確信)
- 本命のBIOS Flashにつなぐも、全くつながってくれない。
- どうもクリップの接触が怪しいらしい。目を皿のようにしてクリップ接続を何度も試行。
- たまたまうまく読めるようになる。
- 念の為、2回読み込んでハッシュが違っていないことを確認。
- が、書き込みの際に eraseができない現象に遭遇。(上述の書き換えエラー)
- さらに念の為、SPI経由で読み出したBIOSイメージをUEFIToolで書き換える。
- ダメ元で、クリップを押し付けながらの書き込みを再試。
→ うまく行った!