BIOS – matoken's blog https://matoken.org/blog Is there no plan B? Sun, 22 Aug 2021 13:15:04 +0000 ja hourly 1 https://wordpress.org/?v=7.0.1 https://matoken.org/blog/wp-content/uploads/2025/03/cropped-1865f695c4eecc844385acef2f078255036adccd42c254580ea3844543ab56d9-32x32.jpeg BIOS – matoken's blog https://matoken.org/blog 32 32 LinuxでLENOVO T430sのBIOSアップデートUSBメモリ作成 https://matoken.org/blog/2021/08/22/lenovo-t430s-bios-update/ https://matoken.org/blog/2021/08/22/lenovo-t430s-bios-update/#respond Sun, 22 Aug 2021 13:14:54 +0000 http://matoken.org/blog/?p=3323

LENOVO T430s のBIOS更新ですが,バッテリーが弱ってアップデートできなくなっていました.中古のバッテリーを入手したので再度アップデートを試みました.光学ドライブは壊れているのでUSBメモリを使いました.環境はLinux(Debian sid amd64)です.

バッテリーの問題でアップデートが進まない

t430s bios battery error

アップデートに失敗するバッテリーの状態
$ upower -i /org/freedesktop/UPower/devices/battery_BAT0|grep energy
    energy:              638.42 Wh
    energy-empty:        0 Wh
    energy-full:         647.76 Wh
    energy-full-design:  39 Wh
    energy-rate:         0 W

現在のBIOSのバージョンを確認します. 2.75 のようです.

$ sudo lshw -sanitize | grep "*-firmware" -A 8
     *-firmware
          description: BIOS
          vendor: LENOVO
          physical id: c
          version: G7ETB5WW (2.75 )
          date: 06/10/2019
          size: 128KiB
          capacity: 16MiB
          capabilities: pci pnp upgrade shadowing cdboot bootselect edd int13floppy720 int5printscreen int9keyboard int14serial int17printer int10video acpi usb biosbootspecification uefi

以下のページによると最新は 2.76 のようなので少し古いです.

ニュースレターを見るとセキュリティ修正のようです.当てたいところ.

今回の変更内容
  バージョン 2.76

[重要な変更]
- セキュリティ上の脆弱性への対応。
- LEN-27764 ThinkPad Embedded Controller Update Vulnerability (CVE-2019-6171)
   のための対応。詳しくは、レノボ セキュリティ アドバイザリページを参照して
   ください。 (https://support.lenovo.com/us/en/solutions/len-27764)

[新機能または機能の拡張]
 ありません。

[問題の解決]
 ありません。

「BIOS アップデートユーティリティ (起動CD用)」を入手します.
CHECKSUM の部分をクリックすると3つのチェックサムが表示されるのでダウンロード後確認します.

Checksum

Checksum Tips
SHA256: 0e019465b2c6db3288004f965fa19fb37d5378bde3b6f1e1f85ce2c2cb6ee281
SHA1: b34aae723bcf14adb835d06c03f7067b23f7ef30
MD5: 23df808e42734fc6dc76031defcdcb15

$ wget https://download.lenovo.com/mobilesjp/g7uj29jp.iso (1)
$ sha256sum ./g7uj29jp.iso (2)
0e019465b2c6db3288004f965fa19fb37d5378bde3b6f1e1f85ce2c2cb6ee281  ./g7uj29jp.iso
$ sha1sum ./g7uj29jp.iso (3)
b34aae723bcf14adb835d06c03f7067b23f7ef30  ./g7uj29jp.iso
$ md5sum ./g7uj29jp.iso (4)
23df808e42734fc6dc76031defcdcb15  ./g7uj29jp.iso
  1. isoファイルダウンロード
  2. sha256形式のチェックサム確認
  3. sha1形式のチェックサム確認
  4. md5形式のチェックサム確認

昔はこのisoファイルをUSBメモリに書きオムだけで良かったのですが今はUSBメモリで起動できるよう変換が必要です. genisoimage パッケージを導入して geteltorito コマンドでイメージの変換を行います.

$ sudo apt install genisoimage (1)
$ geteltorito -o ./g7uj29jp.img ./g7uj29jp.iso (2)
Booting catalog starts at sector: 20
Manufacturer of CD: NERO BURNING ROM
Image architecture: x86
Boot media type is: harddisk
El Torito image starts at sector 27 and has 65536 sector(s) of 512 Bytes

Image has been written to file "./g7uj29jp.img".
  1. イメージ変換のために genisoimage パッケージを導入
  2. geteltorito コマンドでイメージの変換

USBメモリを接続する前に dmesg コマンドを表示しておきます.子の状態でUSBメモリを接続してデバイス名を確認します.以下の例では sdc です.Ctrl+c で終了します.

$ sudo dmesg -Hw
  :
[Aug20 17:53] usb 3-2: new high-speed USB device number 12 using xhci_hcd
[  +0.235059] usb 3-2: New USB device found, idVendor=058f, idProduct=6387, bcdDevice= 1.03
[  +0.000009] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  +0.000005] usb 3-2: Product: Mass Storage
[  +0.000003] usb 3-2: Manufacturer: Generic
[  +0.000002] usb 3-2: SerialNumber: AD279FA8
[  +0.000567] usb-storage 3-2:1.0: USB Mass Storage device detected
[  +0.000200] scsi host7: usb-storage 3-2:1.0
[  +1.017758] scsi 7:0:0:0: Direct-Access     Generic  Flash Disk       8.07 PQ: 0 ANSI: 2
[  +0.000314] scsi 7:0:0:0: Attached scsi generic sg3 type 0
[  +0.000623] sd 7:0:0:0: [sdc] 3891200 512-byte logical blocks: (1.99 GB/1.86 GiB)
[  +0.000137] sd 7:0:0:0: [sdc] Write Protect is off
[  +0.000004] sd 7:0:0:0: [sdc] Mode Sense: 03 00 00 00
[  +0.000135] sd 7:0:0:0: [sdc] No Caching mode page found
[  +0.000003] sd 7:0:0:0: [sdc] Assuming drive cache: write through
[  +0.286090]  sdc: sdc1
[  +0.019783] sd 7:0:0:0: [sdc] Attached SCSI removable disk
^C

usbメモリにイメージを書き込みます.書き込みが終わったら再起動してこのUSBメモリから起動します.

$ sudo dd if=./g7uj29jp.img of=/dev/sdc bs=1M oflag=sync status=progress
33554432 bytes (34 MB, 32 MiB) copied, 11 s, 3.0 MB/s
32+0 records in
32+0 records out
33554432 bytes (34 MB, 32 MiB) copied, 11.337 s, 3.0 MB/s
$ sync
$ sync
$ sync
$ sudo shutdown -h now 'bios update'

t430s bios update01
t430s bios update02
t430s bios update03
t430s bios update04
t430s bios update05
t430s bios update06
t430s bios update07
t430s bios update08
t430s bios update09
t430s bios update10
t430s bios update11
t430s bios update12

アップデートが終わったらバージョンが上がっているのを確認します. 2.76 になりました :)

$ sudo lshw -sanitize | grep "*-firmware" -A 8
     *-firmware
          description: BIOS
          vendor: LENOVO
          physical id: c
          version: G7ETB6WW (2.76 )
          date: 09/10/2019
          size: 128KiB
          capacity: 16MiB
          capabilities: pci pnp upgrade shadowing cdboot bootselect edd int13floppy720 int5printscreen int9keyboard int14serial int17printer int10video acpi usb biosbootspecification uefi
$ sudo dmidecode | grep 'BIOS Information' -A 27
BIOS Information
        Vendor: LENOVO
        Version: G7ETB6WW (2.76 )
        Release Date: 09/10/2019
        Address: 0xE0000
        Runtime Size: 128 kB
        ROM Size: 16 MB
        Characteristics:
                PCI is supported
                PNP is supported
                BIOS is upgradeable
                BIOS shadowing is allowed
                Boot from CD is supported
                Selectable boot is supported
                EDD is supported
                3.5"/720 kB floppy services are supported (int 13h)
                Print screen service is supported (int 5h)
                8042 keyboard services are supported (int 9h)
                Serial services are supported (int 14h)
                Printer services are supported (int 17h)
                CGA/mono video services are supported (int 10h)
                ACPI is supported
                USB legacy is supported
                BIOS boot specification is supported
                Targeted content distribution is supported
                UEFI is supported
        BIOS Revision: 2.76
        Firmware Revision: 1.16
$ hwinfo | grep MODALIAS=dmi:
  E: MODALIAS=dmi:bvnLENOVO:bvrG7ETB6WW(2.76):bd09/10/2019:br2.76:efr1.16:svnLENOVO:pn23533KJ:pvrThinkPadT430s:skuLENOVO_MT_2353:rvnLENOVO:rn23533KJ:rvrNotDefined:cvnLENOVO:ct10:cvrNotAvailable:
$ sudo inxi -Fxxxz | grep Machine: -A1
Machine:   Type: Laptop System: LENOVO product: 23533KJ v: ThinkPad T430s serial: <filter> Chassis: type: 10 serial: <filter>
           Mobo: LENOVO model: 23533KJ serial: <filter> UEFI: LENOVO v: G7ETB6WW (2.76 ) date: 09/10/2019

同じ方法で LENOVO Thinkpad Yoga-260 でもBIOSアップデートできました.

環境
$ dpkg-query -W genisoimage coreutils
coreutils       8.32-4+b1
genisoimage     9:1.1.11-3.2
$ lsb_release -dr
Description:    Debian GNU/Linux 11 (bullseye)
Release:        11
$ dpkg-query -W genisoimage coreutils lshw dmidecode hwinfo inxi
coreutils       8.32-4+b1
dmidecode       3.3-2
genisoimage     9:1.1.11-3.2
hwinfo  21.72-1
inxi    3.3.06-1-1
lshw    02.18.85-0.7
]]>
https://matoken.org/blog/2021/08/22/lenovo-t430s-bios-update/feed/ 0
ThinkPad T430s の BIOS を USB メモリ経由でアップデートする https://matoken.org/blog/2019/07/05/updating-the-thinkpad-t430s-bios-via-usb-memory/ https://matoken.org/blog/2019/07/05/updating-the-thinkpad-t430s-bios-via-usb-memory/#respond Fri, 05 Jul 2019 14:29:38 +0000 http://matoken.org/blog/?p=2411

以前ジャンクで入手したThinkPad T430s ですが,外部キーボードを使ったり,壊れたX220 の部品を使ったりで現在メインマシンとして利用しています.
今NVIDIA Optimus が利用できないかと試していますが,うまく行っていません.BIOS Update で治ったという事例を見つけたのでUpdate しました.Update イメージはCD に書き込んでそこから起動しないといけませんが,USBメモリでもうまく行ったのでメモを残しておきます.

※失敗するとマシンが動かなくなる可能性があります.

まずはBIOS のversion を確認します.date が2012年とかなので古そう.

現在のBIOS version 確認
$ sudo dmidecode -t bios|grep -E "Version:|Release Date:"
		Version: G7ET60WW (2.02 )
		Release Date: 09/11/2012
$ sudo lshw | grep "\-firmware" -A10|grep -E "version|date"
		  version: G7ET60WW (2.02 )
		  date: 09/11/2012

Lenovo のページでBIOSを確認すると, 26 Jun 2019 の Version 2.75 というものが最新のようです.
Windows用の実行ファイルと,起動CD用のisoファイル,それとそれぞれのリリースレターが用意されています.Linux マシンなのでisoファイルの方を入手します.

ダウンロードしたら,チェックサムを確認します.

webpage より

Checksum Tips

MD5:aa9846fb15114ef18770cc0812188418

SHA1:ace55c1a1fa87f3ca5140ef67d565ff9f863020a

SHA-256:623dc5d0442b3b0e105186901dc403c911717d4f7998223593b93e66afdbcd93

sha256sum で確認
$ sha256sum ~/Downloads/g7uj28us.iso
623dc5d0442b3b0e105186901dc403c911717d4f7998223593b93e66afdbcd93  /home/matoken/Downloads/g7uj28us.iso
isoinfo で少し中を覗く
$ isoinfo -d  -i ./g7uj28us.iso
CD-ROM is in ISO 9660 format
System id:
Volume id: G7ETB5US
Volume set id:
Publisher id:
Data preparer id:
Application id: NERO BURNING ROM
Copyright File id:
Abstract File id:
Bibliographic File id:
Volume set size is: 1
Volume set sequence number is: 1
Logical block size is: 2048
Volume size is: 16566
El Torito VD version 1 found, boot catalog is in sector 20
Joliet with UCS level 3 found
NO Rock Ridge present
Eltorito validation header:
    Hid 1
    Arch 0 (x86)
    ID 'NERO BURNING ROM'
    Key 55 AA
    Eltorito defaultboot header:
        Bootid 88 (bootable)
        Boot media 4 (Hard Disk Emulation)
        Load segment 7C0
        Sys type 6
        Nsect 1
        Bootoff 1B 27
$ isoinfo -l  -i ./g7uj28us.iso

Directory listing of /
d---------   0    0    0            2048 Jun 13 2019 [     21 02]  .
d---------   0    0    0            2048 Jun 13 2019 [     21 02]  ..

この iso ファイルを CD に書き込んで起動すればいいはずですが,メディアが手元にありません.

iso ファイルによってはUSBメモリに書き込むだけで起動USBメディアになるものもあるので試してみましたが起動できませんでした.

どうにかならないかなーと探すと以下の記事を見つけました.

geteltorito というPerl Script でイメージを変換した後,USBメモリに書き込むことで ThinkPad の BIOS Update ができるようです.
この記事中ではScript 開発者のページから入手していますが,Debian では genisoimage pkg に含まれているのでこれを使いました.

geteltorito の含まれている genisoimage pkg の導入
$ apt-file search geteltorito
genisoimage: /usr/bin/geteltorito
genisoimage: /usr/share/doc/genisoimage/README.geteltorito
genisoimage: /usr/share/man/man1/geteltorito.1.gz
$ sudo apt install genisoimage
usage
$ geteltorito

/usr/bin/geteltorito [-hv] [-o outputfilename] cd-image
Script will try to extract an El Torito image from a
bootable CD (or cd-image) given by <cd-image> and write
the data extracted to STDOUT or to a file.
   -h:        This help.
   -v:        Print version of script and exit.
   -o <file>: Write extracted data to file <file> instead of STDOUT.
USBメモリを接続してデバイスをdmesg やfdisk で確認して,wipefs でパーティション情報をクリアしておく
$ sudo dmesg -He|tail
$ sudo fdisk -l /dev/sdb
$ sudo wipefs -a /dev/sdb
geteltorito でイメージ変換しながら USBメモリへの書き込み
$ geteltorito ./g7uj28us.iso | sudo dd of=/dev/sdb bs=1M oflag=dsync status=progress
Booting catalog starts at sector: 20
Manufacturer of CD: NERO BURNING ROM
Image architecture: x86
Boot media type is: harddisk
El Torito image starts at sector 27 and has 65536 sector(s) of 512 Bytes
[sudo] password for matoken:
33218560 bytes (33 MB, 32 MiB) copied, 10 s, 3.2 MB/sImage has been written to stdout ....

9+178 records in
9+178 records out
33554432 bytes (34 MB, 32 MiB) copied, 10.3254 s, 3.2 MB/s

Debian pkg に含まれているScript のversion とsite で配布されているversion は0.5 と0.6 と少し違ったので念の為両方で変換を掛けて比較してみましたが結果は同じでした.

念の為siteで配布されているものでも変換してイメージを比較してみると同じものだった
$ wget http://userpages.uni-koblenz.de/~krienke/ftp/noarch/geteltorito/geteltorito/geteltorito
$ chmod u+x ./geteltorito
$ ./geteltorito -v
Version: 0.6
$ ./geteltorito -o ./g7uj28us.img ./g7uj28us.iso
$ geteltorito -o ./g7uj28us.img-pkg ./g7uj28us.iso
$ diff -s ./g7uj28us.img ./g7uj28us.img-pkg
Files ./g7uj28us.img and ./g7uj28us.img-pkg are identical

ということで,書き込んだUSBメモリで起動してBIOS update はうまく行きました.

Version が上がっているのを確認
$ sudo dmidecode -t bios|grep -E "Version:|Release Date:"
        Version: G7ETB5WW (2.75 )
        Release Date: 06/10/2019

忘れがちだけど結構脆弱性の修正やmicrocode のアップデートも入っていたのでちゃんと当てないといけないですね…….

環境
$ dpkg-query -W genisoimage coreutils util-linux dmidecode lshw
coreutils       8.30-3
dmidecode       3.2-1
genisoimage     9:1.1.11-3+b2
lshw    02.18.85-0.2
util-linux      2.33.1-0.1
$ hostnamectl | egrep 'Operating System|Architecture'
  Operating System: Debian GNU/Linux 10 (buster)
      Architecture: x86-64

]]>
https://matoken.org/blog/2019/07/05/updating-the-thinkpad-t430s-bios-via-usb-memory/feed/ 0