Flashing an HP 2140 with free software

When I flashed the Mini 2140 yesterday I used a Windows laptop to create a bootable flash drive with the BIOS utility and update on it.

I didn't really need to use a non-free operating system, as HP provide a tiny bootable ISO image with FreeDOS, but using that means wasting a CD-R. It's not that those are expensive, but they do end up in landfill.

Instead, I'd like to be able to simply use a USB key. I found some help on the FreeDOS wiki and I thought I'd document the steps I followed on Ubuntu.

0) Prequisites

You will need to install the syslinux and cabextract packages and obtain a copy of mkbootfat. The latter was not packaged, so I created source and binary packages for Intrepid and Jaunty. You will also need to download some FreeDOS files and the ROMPaq update executable from the HP website. Download the FreeDOS bootable media file, not the Windows HPQFlash one.

Finally, you will need a USB key.  It will be erased during this process, so make sure you backup any data it currently contains.

1) Preparation

Create a directory that you will work from and cd into it. Then create a directory that will eventually be the root filesystem on the USB key.

$ mkdir 2140
$ cd 2140
2140$ mkdir rootfs

Install syslinux and cabextract

2140$ sudo aptitude install syslinux cabextract

Download and install mkbootfat:

2140$ wget -c http://ubuntu.cafuego.net/pool/jaunty-cafuego/makebootfat/makebootfat_1.4-0cafuego0_i386.deb
2140$ sudo dpkg -i makebootfat_1.4-0cafuego0_i386.deb

Download the required FreeDOS files:

2140$ wget -c http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/1.0/pkgs/kernels.zip
2140$ wget -c http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/1.0/pkgs/commandx.zip
2140$ wget -c http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/1.0/pkgs/unstablx.zip

Extract command.com from commandx.zip to the rootfs directory:

2140$ unzip -d rootfs -j commandx.zip bin/command.com

Extract kernel.sys from unstablx.zip to the rootfs directory:

2140$ unzip -d rootfs -j unstablx.zip bin/kernel.sys

Extract the required files from kernels.zip to the current directory:

2140$ unzip -j kernels.zip source/ukernel/boot/fat12.bin source/ukernel/boot/fat16.bin source/ukernel/boot/fat32lba.bin

Copy mbr.bin from the syslinux package to the current directory

2140$ cp /usr/lib/syslinux/mbr.bin .

Now extract the BIOS update you downloaded from HP via cabextract and copy the update files to the rootfs directory: 

2140$ cabextract sp43583.exe
2140$ cp Rompaq/68DGU.BIN rootfs
2140$ cp Rompaq/config.sys rootfs
2140$ cp Rompaq/gpl2.txt rootfs
2140$ cp Rompaq/Rompaq.exe rootfs

Note that my download was called sp43583.exe, yours may be named differently.

2) Create the Boot Device

Insert your USB key and check the output of dmesg to see what its device name is.

2140$ dmesg
[    9.348395] usb-storage: device scan complete
[    9.349611] scsi 6:0:0:0: Direct-Access     Imation  Imation USB      PMAP PQ: 0 ANSI: 0 CCS
[    9.351075] sd 6:0:0:0: [sdb] 996864 512-byte hardware sectors: (510 MB/486 MiB)
[    9.351694] sd 6:0:0:0: [sdb] Write Protect is off
[    9.351706] sd 6:0:0:0: [sdb] Mode Sense: 23 00 00 00
[    9.351715] sd 6:0:0:0: [sdb] Assuming drive cache: write through
[    9.353699] sd 6:0:0:0: [sdb] 996864 512-byte hardware sectors: (510 MB/486 MiB)
[    9.354319] sd 6:0:0:0: [sdb] Write Protect is off
[    9.354330] sd 6:0:0:0: [sdb] Mode Sense: 23 00 00 00
[    9.354340] sd 6:0:0:0: [sdb] Assuming drive cache: write through
[    9.354354]  sdb: sdb1
[    9.355653] sd 6:0:0:0: [sdb] Attached SCSI removable disk
[    9.355767] sd 6:0:0:0: Attached scsi generic sg1 type 0

Mine is /dev/sdb. It has one partition on it currently. I will delete this and blank the MBR on the USB key via dd:

2140$ sudo dd if=/dev/zero of=/dev/sdb bs=512 count=1

This will write zeroes to the first sector of the USB key, which is where both its master boot record and partition map live.

Warning: This process essentially wipes the USB key. Make sure the data on it is backed up and that you are using the correct device name.

Unplug and replug the USB key to ensure the kernel is no longer using the old partition map. After plugging it back in, recheck the device file name. It should not have changed, but it may have.

Finally, use makebootfat to make this device bootable and copy the rootfs to it:

2140$ sudo makebootfat -o /dev/sdb -E 255 -1 fat12.bin -2 fat16.bin -3 fat32lba.bin -m mbr.bin rootfs

You should now have a bootable USB key with the BIOS update tools on it.

3) Profit

Boot your Mini 2140 using the key you just created. After a short moment, the Rompaq utility should start and you can upgrade your BIOS.

Caveats

makebootfat appears to be somewhat temperamental with regards to USB keys and BIOSes. This HOWTO works fine if I run all commands on the Mini 2140, but if I create the boot device on my workstation, the result is not bootable. I've only tried it with a single old USB key though.

I strongly suggest crossing your fingers when executing each step.

Comments

Hi Cafuego!

I followed step by step yours instructions on my hp 2140. I created a bootable USB pen. But when I try to boot from my USB pen, my PC hangs before running rompaq.exe. I think that is a Kernel problem, my HP hangs with this writings on the screen:

FreeDOS Kernel version 1.1.37w (Build 2037w_UNSTABLE, Aug 19 2006)

Copyright 1995-2005 Pasquale Villani and the FreeDOS Project.
NO WARRANTY. Licensed under the GNU General Public Licence

WARNING : partition Pri:1 FS 0B has CHS = 0-0-63 not 0-1-1
WARNING : partition Pri:1 FS 0B has CHS = 1023-7-14 not 1022-80-52
C: HD1, Pri[1], CHS = 0-0-63, start = 0MB, size=3807MB

Did you have any idea how to debug this?

Thanks Valde

I have no idea how to debug it, but it's exactly what happened when I created the USB key on my workstation, so if you have a different USB key, give that a try.

The one that eventually worked for me was a few years old and only 512MB.

Thanks for your reply!

I'll try with an older USB pen and I'll let you know if it's work!

bye bye Valde

Hi, I'm replying to this old post because I'm experiencing very slow transfer rate with wireless network (I use archlinux with 3.2.2-1-ARCH).
So i tried to upgrade my bios (F.00) and I discovered that the geometry issue is due to a LBA flag missing. You can fix it using gparted after the makebootfat step.
Sadly my wireless transfer rate is still slow...
Are you experiencing same problems with wireless rate?

You are absolutely right, it is better to use an usb for bootable disk to made. I am doing like this for that time when I have found that it is actually possible. What about payable operating system, why don't you want to use that? For me personally Linux is something strange and something very difficult and uncomfortable.. Of course maybe it is because I am using windows for about 7 years. For those people who uses Linux, Ubuntu or Unix they are better than Windows so it is natural. Thanks for the interesting post, I am always reading your blog.

Sincerely,

Drew Johansson

Thanks for the great tutorial man. You are absolutely right about those bootable cd's. I mean usb is a much better option, just because after few years you will realize that your desk is full of cd's even if you are not using some of them at all. So thanks one more time for this detailed tutorial and I will be looking forward to other great posts from you in the nearest future.

Sincerely,

Mark Dollson

These are really basic instructions but still important. Really it’s very useful and informative. Its good tips and easy steps. So thanks for nice post.

Add new comment