Saturday, May 7, 2011

Hard Drive Images

We use ntfsclone in our Loader project.  I tend to use it to make backups of computers, or copy NT filesystems around between partitions etc.

The command "ntfsclone" has switches "-s" and "-r" to tell ntfsclone to save and restore in a special format.  The special format leaves out all the holes in the file system -- who would want those?  And actually, why would you use ntfsclone if you weren't using those switches?  You could just use "dd" and bit copy the whole partition.  From my point of view, there seems to be little reason to use ntfsclone if you aren't using the special format switches.

Sometimes I'd like to mount an NTFS under Linux.  Ahhh, if the NTFS is in the special format and compressed with gzip, that *IS* a problem.

ntfsclone -r -O - myfs.ntfsclone.gz | gunzip -c > myfs
sudo mount -o loop myfs /mnt

The problem here is that this takes a while and in the end you better have enough free disk space available.

I've been thinking.  If you'd like to hand someone exactly what their (XP) computer had on it before and let them browse it to pull out any important files, how would you do that?  Being on Linux, I have "mount -loop" at my disposal, but Windows users are out of luck, right?

Open source to the rescue again, even on Windows: http://en.wikipedia.org/wiki/ImDisk (their homepage isn't as nice as the wikipedia page)

I tried ImDisk out, seems to work fine.  It might be a little bit hard to use for someone that only knows about their "My Documents" but who knows.  So, you could do something like this:

ntfsresize -s 50G /dev/sda1
ntfsclone -O - /dev/sda1 | \
gunzip -c | ssh bigserver "cat > myfs"
# re-image / re-install victim
rsync bigserver:myfs /mnt/windows/myoldfs
# boot windows, install ImDisk
# mount your oldfs as disk G: for retrieving stuff

 The only trick here is resizing the original ntfs down so it's pretty much full (of files).  This ensures you aren't wasting a bunch of dead space in your image file.

Monday, May 2, 2011

Aleratec Roboracer Duplex Codes

From the two sources I mentioned last week, here's the codes laid out:

CR+LF  #clear input buffer
!BNKLF8E #both LEDs off
!BNKFG89 #both LEDs flashing
!BNKLG8F #both LEDs on
!BNKSTA3 #attention/no-op

!BNKDP90 #release one disc from the top disc loader

!BNKRG95 #top handle turns a small angle
!BNKRB90 #top handle turns a big angle
!BNKRH96 #top handle turns back to origin

!BNKPG93 #bottom handle turns small angle
!BNKPB8E #bottom handle turns a big angle
!BNKPH94 #bottom handle turns back to origin

BNKR*, the "R" seems to be Reader/Writer
BNKP*, the "P" seems to be for Printer (lightscribe)

Notice that the 2 hex digits on the end of "P" commands are 2 less than the "R" commands. It makes me wonder if those 2 digits are analog.

Thursday, April 28, 2011

Straight Forward Aleratec Roboracer CD/DVD Duplex Duplicator under Linux

Rico found cool ways to talk to the Roboracer Duplex Duplicator:

http://ricochen.wordpress.com/2009/07/21/use-aleratec-roboracer-ls-duplex-under-linux-to-automate-daily-dvd-backups/

Not having the unit yet... I didn't understand the typical flow of commands, so here it seems to be.

#!/bin/bash

top=/dev/sr1
bottom=/dev/sr2
tty=/dev/ttyUSB

# clear top and load from hopper
  eject $top
  echo -n "!BNKRG95" > $tty # top_hand_small
  echo -n "!BNKRH96" > $tty # top_hand_back
  echo -n "!BNKDP90" > $tty # top_tray_load_disc
  eject -t $top

# write disc

# clear bottom and load bottom from top
  eject $bottom
  echo -n "!BNKPG93" > $tty # bottom_hand_small
  echo -n "!BNKPH94" > $tty # bottom_hand_back
  echo -n "!BNKRB90" > $tty # top_hand_big
  eject $top
  eject -t $bottom
  echo -n "!BNKRH96" > $tty # top_hand_back
  eject -t $top

# label disc

# drop disc
  echo -n "!BNKPH94" > $tty # bottom_hand_back
  eject $bottom
  echo -n "!BNKPG93" > $tty # bottom_hand_small
  echo -n "!BNKPH94" > $tty # bottom_hand_back
  eject -t $bottom

I've also found some notes on the non-Duplex version here:
http://hyperdiscs.pbworks.com/w/page/19778460/Command%20Sets%20--%20Aleratec%20RoboRacer%20LS

Saturday, November 6, 2010

Antec case fixed

Everything seems so disposable these days.  I'm trying to fight that and bought a case a few years ago...  the Antec P180.  It is quirky, it is huge, and very expensive.  But, it is the best case I've ever had and very close to silent.


I'm not really happy with it being on the floor, but it's been there for about 1/2 of it's life.  My dog walked past it a while back while a USB flash was sticking out.  I walked in a few minutes later... flash broken on the carpet... USB ports busted up.

Frustration...  I used back ports for months with an extension.

Then, I got this great idea... Antec might sell those ports.  I searched, hey people have been getting replacements under warranty.

WOW!  They actually sent me a replacement port module!

It works great.  I'm lovin' Antec even though I had 2 of their power supplies die on me in the past.

Monday, October 18, 2010

BIOS upgrades on modern hardware - with Linux

Back in the mid-90s, upgrading your BIOS meant create a boot floppy, copy your BIOS util and image to it, boot from it, run the BIOS util. 

Now days no one uses floppies.  Well almost no one.  I see no legitimate use for them on modern hardware (and OS) except for weird/scary boot and BIOS issues.

I recently tried to boot my 3 year old Gigabyte P35-S3L motherboard off of a USB flash containing Ubuntu 10.10.  Unfortunately, the BIOS is not booting from USB Flash.  This got me thinking, have I ever upgraded the BIOS?  My version is F2, the newest is F8.  So I went down that route...

First, you download some XXXX.exe file from Gigabyte's website.  Great if you no what to do with such a thing.  My Gigabyte motherboard has a Q-Flash utility built into the current BIOS, so I can flash it without booting off any media.

On my notebook:
sudo apt-get install p7zip-full
mkdir bios
cd bios
mv ../motherboard_bios_ga-p35-s3l_f8.exe .
7z x motherboard_bios_ga-p35-s3l_f8.exels -l
total 1600
-rw-r--r-- 1 scott scott      18 2009-06-21 20:13 autoexec.bat
-rw-r--r-- 1 scott scott   26351 2008-08-28 01:16 FLASHSPI.EXE
-rw-r--r-- 1 scott scott  554366 2010-10-18 13:00 motherboard_bios_ga-p35-s3l_f8.exe
-rw-r--r-- 1 scott scott 1048576 2009-06-19 04:00 P35S3L.F8

At this point, I had the image file P35S3L.F8.  It needs to get to my workstation and have Q-Flash work on it.  Looking at Q-Flash (hit the End key during boot), it will read floppies and hard drives. (I'm sure only formated FAT)  I have no Floppy drive in my workstation, so I found my USB Floppy drive.  You are probably thinking, but... it's USB, will the HW do the proper rerouting?  I had confidence from prior recovery of BIOS using a USB Floppy.

A little wierd but:
sudo ln -s /dev/sdb /dev/fd0
mformat a:
mcopy P35S3L.F8 a:
(I checked to make sure I could read it and did a diff of the original)

Booted into Q-Flash, and now it showed a Floppy B where it only showed Floppy A before. Selected it, chose my image file..  and Click click click...  away we go.

I still can't boot off USB Flash, but I do have a new BIOS.

Thursday, June 17, 2010

screen sharing on Linux

Seems like not many choices...  But who needs many choices if it works well?  In the Windows world the choices seem to never end.

VNC is the old tried and true.  It is great over LAN, ok over fast WAN connections, but seems to leave something to be desired over typical internet connections.  The speed just isn't stellar.  Worse, if you want to share YOUR existing desktop on Linux, it affects your video performance.  It is universal though, I can connect to my mum (secure over ssh tunneling of course) and fix things on her XP machine.

NX... what great promise it has and has had and had and had.  It does what people thought was impossible - it speeds up remote X sessions to almost local speed.  The commercial server starts at $800.  But no fear, there are open source servers that use the NX libraries.

The problem is the free NX client (nxclient) is pretty much the only offering out there to view a remote session.  It comes in Windows, Mac, Linux, and other flavors.  It works quite well in many cases except this one:  attach to a shared local desktop (or shadow session) with the client on a modern Linux distribution.  If you do this - the keyboard is all messed up.  An up-arrow causes a PrintScreen button to be pushed and so on.

So... if you are ok with mouse / keyboard input turned off - I guess it will work ok.  Our options are slim, so that's the way we will be using it.  Sure would be nice though if a Linux user could see my Linux desktop and interact with it as well as a Windows or Mac user could!

If we were "real men", we'd take the open source NX libraries and put our own working NX Client together ourselves.  Which, if we have slow times, I'm sure that will be discussed.

Saturday, June 12, 2010

big week

A very busy week that has so far turned out very good.
In addition to the normal life stuff, I did a ton of zipping around trying to grow our little business. I'm trying to get more use of our Loader product, save XP machines from landfills, and get another software developer.

Demo "Loader" to local computer shop.
This went really well despite more poor preparedness. I managed to lose my flash drive (boot media) in the last 10 minutes before I went out the door. I searched frantically, then built up a new usb flash drive. When I got to the computer (repair) store, they had DHCP so I demoed an XP install on my Dell Mini 9. They were interested in trying it on a computer on the bench. When it worked flawlessly except for missing one driver they were impressed; basically, "we've got to have it!" Not alot of money involved, but we have to start somewhere and they are willing to work through bugs.

Hiring a third.
We've been wanting to do this far a long time. I've had my eyes set on an unnamed person and we finally have enough stability that I feel comfortable asking this person to join us. Crossing fingers.

XBMC Demo.

I went to the ISLUG meeting this week. It got off to a slow start. I was 10 minutes late and there was one other person. I expected them to already be ooowing and aaahing over XBMC, but it took at least another 1/2 hour for that to happen. Joshua Clark has posted a bit on the ISLUG site. It will likely replace my Freevo setup that I have had for 7 years.

Demo "Loader" to ERGS.
My family and I went to Salt Lake City today (Saturday). Our plan was to go to the Zoo, then Electroregeneration Society, then the Discovery Museum, then somewhere fun for dinner - The Maya . It ended up very different. We arrived at the Zoo quite late with wind and rain following us there - so we skipped that. We took care of some family wardrobe malfunctions at Walmart. Then what... We decided to go to the Gateway mall, ate at Applebee's, and my mom and I walked to ERGS while my wife and kids checked out build-a-bear etc and went to the Discovery Museum without us.
ERGS, was great! I had a good time talking with Jerry. Learning about their operation. I really hope we can get something like it fired up in Pocatello and Idaho Falls. I'll post more on this later.
Showing off the Loader was fun and worked great on a random box we grabbed. I'm very close to all the details with it so I enjoy explaining and answering questions. Jerry liked it, we will talk more about how they can implement it there. We will donate use of it to them -- to get things rolling.

Thursday, April 29, 2010

when to commit your source code to "the" repository

A friend of mine, Jeff, has been working for a defense contractor for a while. About a year ago, he was in town and we went to lunch, where he told me the awful news. People don't know how to use a version control system. (Or is it a revision control system?) The software developers there DO NOT commit there code to the repository until after they load it to production. He was bewildered by this. (I was too) They said... No, it's just too hard. Sometimes we move things around, thats a pain. Also, we are sure we have the same thing in the repository and production this way.

OK, I have some obvious problems with this that are hopefully obvious to you too. If not, you are not a geek and shouldn't be reading this post. What kind of repository is this? Apparently they are not keeping track of any of their development or bug fixes. So all they have in their repository are releases that hopefully match was was installed in production.

Fast Forward to yesterday....

Part-time, I subcontract to a Department of Energy contractor. They use PVCS. I stored a few scripts in a project directory in their PVCS. Great, I think to myself this is much less painful than all the paperwork. Minutes later, I notice and fix a few typos in the ReadMe.txt. I commit that change to PVCS. (If you've worked for a bureaucracy for many years, you may have just caught my mistake.)

So I have:

Script1 Version 1.0
Lib1 Version 1.0
ReadMe.txt Version 1.1

A fellow system engineer is tasked with "loading it to plant." In normal speak this is "release to production." He's trying to push this through and get all the authorizations signed off. He gets a call, "Why is ReadMe.txt at version 1.1? What SCR (Software Change Request) was done to authorize those changes? You can't just go changing files willy-nilly."

Oh no! We've been TRAPPED! Really? Since the end of development ReadMe.txt been at Version 1.1 and all the testing was done on Version 1.1 - for some reason that should read Version 1.0. Why? Because at least one person doesn't know what a version control system is. Now if they were a "sophisticated" user, they would use TAGS and people that don't understand versions could just look at release tags. But they are not sophisticated users. How they document a release is inside their SCR (Software Change Request) document. You PASTE the versions of all the files you are releasing into this document. This is your poor man's tag. Well, apparently it's a poor man's tag only when convenient for the people in control. At the stage we got the (you've been caught) call, it was not a poor man's tag. The version on the file is some how the release version.

How did we make them happy? We removed the ReadMe.txt from the SCR document as it was not a file we were installing anyway.

A couple questions:
  • Has anyone ever seen this sort of use/abuse of a version control system? Was it at a government contractor?
  • What would have happened if all the files were 1.1? Would it pass detection?
  • Should I ask if there is another repository that I can use for source code version control?
Doesn't look like I'm the only person that believes in "commit early, commit often."

Monday, April 19, 2010

Tucows/Comodo code signing certificate for Java

I might as well document this process out here for others.

Comodo through Tucows is the known cheapest way to sign Java code. So that's what we went for. In addition to parting with $75, plan on a day of finding verification documents and keeping the ball in their court.

The process is supposed to go like this:
  1. Signup with Tucows to be an author. (free)
  2. Use their "author resources" to order a Comodo certificate.
  3. Verify you are who you say you are with Comodo.
  4. Download certificate and start signing your Java jars.
The problem is, the flow between Tucows and Comodo is very loose. It takes 2-3 days to get handed off to Comodo after you start your order with Tucows. Then it takes a day for Comodo to start asking you questions. After that, from our experience, count on bouncing information to Comodo atleast 6 times over the course of 3 days. In our case, our $75 code signing probably cost us $500 if you include our time. On the other hand, it's probably a hastle with everyone.

Problem #1:
It seems for their Corporate verification, it's fairly indepth. I think we were able to be verified with: Articles of Incorporation, Acceptance of S-Corp, company bank statement, and phone bill.

Problem #2:
We were just about to move HQ to a new corporate address. I gave them our new corporate address, none of our documents support that address. So I had to tell them to change my order's address to our existing/current corporate address.

Problem #3:
We don't have a land line in our business name. We have a Google Voice number that forwards to our cell phones. This sounds all smart and modern, but caused us problems in this case. We had to jump through additional hoops to get them to accept our cell phone bill.

Once you get all the OKs, they finally send you a link to "collect your code signing certificate." BTW, you are supposed to use the same computer and browser from start to finish. It's doing some certifying magic. So you go to the collection link, and your browser (or javascript) has a popup that a certificate is installed. Now you just stare at the page that doesn't have any forward navigation.

So, you'll probably do what I did and search for how to USE your Comodo certificate. Google tells me some good things that aren't obvious from the Comodo page.
  • https://support.comodo.com/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=419
  • https://support.comodo.com/uploaded/UsingComodoAuthenticodeCertificateforJava.pdf
Those docs are pretty Windows centric. You just gotta love screen captures of a DOS box. (We do things a little different in the Linux/Unix world where we can actually copy TEXT out of a command line easily.)

After following how to export the certificate out of Firefox, I had a P12 file. My experience was something like this:

wget  http://wiki.austriangrid.at/files/PKCS12Import.java
javac PKCS12Import.java
java PKCS12Import srcbin-code-signing-certificate.p12 keystore.ks
jarsigner -keystore keystore.ks classes.jar "srcbin, inc's the usertrust network id"
jarsigner -verify -certs classes.jar

(Or maybe I should show you that in 4 or 5 screen shots, put in a document and covert it to PDF)

Thursday, November 12, 2009

notebook <= 1.6 aspect ratio

The consumers have taken over!

It turns out that nobody actually uses their computers for computing anymore, they all just watch videos. In 2004 it was special to have a notebook with a widescreen. It wasn't my desire, but I purchased a Compaq R3000Z with a 1680x1050 15.4" screen -- 1.6 aspect ratio. It's a tad bit too dense. I'm a fanatic about running LCDs in native resolution so I'm eager for new desktops (on Linux) to do all the scaling for you.

Back to the current situation. You can no longer get a 1.33 (4:3) aspect ration notebook screen. Worse... the old 1.6 aspect ratio isn't wide enough for those watch movies on their computers... so a new 16:9 or 1.78 is a must. This is now driving the market. 50% of the screens are 1366x768 -- the same as my refurb 32" TV. It's out of control.

Recap:
1.33 (4:3) is gone, dead...
1.6 (16:10) is very rare now
1.78 (16:9) is "all that"

I'd actually prefer something that I could see more than 5 lines of source code on at a time. A good start is more than 1000 pixels high. To do that in the current market I'd have to buy something as wide as a truck. Gone are the days of my old work laptop's 1400x1050 (D610).

You can still get 1.6 aspect ratio in high end notebooks, but it takes lots of looking in addition to the money:

Lenovo T400 (14" 1440x900)
Lenovo R400 (14" 1440x900)
Dell E6400 (14" 1440x900)
Apple Macbook Pro (15" 1440x900)

Their are some with 1680x1050, but you'd have to get a pretty big notebook to make the pixels big enough for my eyes.

The 1.6 aspect ratio thins the herd... To maybe 5% of the notebooks out their.

My Desire:
14 or 14.1" screen at 1440x900
2.4+GHz Core 2 Duo
DDR3 Memory (would go to 4GB)
7200RPM HD 320GB
Lightweight (no CD/DVD would be a plus)
Good battery life

The cheap route -- Dell Vostro 1520.
no DDR3, big 15", and not light... but does have 1440x900 (WXGA+)
(BTW, I really appreciate Dell not telling you the resolutions and instead giving you these acronyms)

The Dell E5400 starts cheap, but you pay $99 to get away from Vista. :( I probably should be getting Win7 for testing -- not to actually use mind you.

I think what I really want... A Macbook Pro 15" shrunk down to 14" and the cost shrunk would be nice too.

Friday, October 2, 2009

scanners in Ubuntu 9.04 Jaunty

It turns out that progress is painful sometimes. Ubuntu is not shy about changing how things work. I've used 2 scanners in the last few weeks and both required a work-around. For xsane or gscan2pdf to find my scanners I had to sudo them.

sudo gscan2pdf

Well of course that's not the right way to do it, so I started searching. I spent way to long searching and finding junk --lots of UDEV rules that you have to get "just right". When really what you want to do is tell HAL.

This great post tells all.

Wednesday, September 30, 2009

A little bit of everything - Sep 30 2009

My main consulting contract has been very busy. We've been working on a capital project that needed to be in place on Sep 30. Anything that could go wrong, went wrong. Wrong computers, wrong hard drive controller cards, wrong cables for those controller cards, incomplete test beds of existing infrastructure, on and on.

I ordered a Fujitsu S1500 scanner. I almost went with the cheaper S300, but decided that I really needed the Fujitsu driver/engine that is thoroughly tested in Linux. I plan to use it with gscan2pdf. I'll probably post something later about trying to go paperless in business and personal paperwork.

We just got jared spruced up. The page at sourceforge needs spruced up now. Jared now supports "db" records which according to Tim at Sentinal Chicken was introduced in the registry hive format with XP. I've seen one "db" record in the "software" hive. It's just not that common to have strings that are larger than 16K. But it sure confuses Windows if you screw up any record.

I relearned everything I forgot since I last used Cinelerra. I'm trying to make videos for the srcbin Loader. I'm making progress and will probably have a 20 minute full demo, 3 minute infomercial, and 1 minute commercial.

I highly recommend Cabot's Deck Stain which is available at Lowe's. (Behr has given me nothing but trouble, check DIY forums for details) We tried Cabot's a few days ago and it's wonderful. I recommend a mix of atleast 1:1 clear to color. 2:1 would really show off your wood. One gallon will do 500 sqft.

Friday, September 11, 2009

record your desktop with ffmpeg

Long ago (2006?) at a previous job, I used ffmpeg to do some screen recordings or "screencasts". We wanted to integrate video help into our custom in-house EDA tool. At that point, most screen capture on Linux was buggy. I tried gtk-recordMyDesktop and xvidcap, compiling new packages from source didn't really make good quality video. I found a hack for ffmpeg to capture X as an input, it worked great. Long term it had a problem, the patch used code from an incompatible license. So ffmpeg and the patch could not come together as a product.

But... GOOD NEWS. As of Ubuntu 9.04, ffmpeg has stable capture support. Apparently the feature was re-implemented so that the license problem was resolved!

Here is how you do it:

ffmpeg -an -s 1200x900 -r 25 -f x11grab -i :0.0 \
-s 1200x900 -r 25 -vcodec libxvid \
-aspect 1.3333 -sameq video-nosound.avi


I found this posted on ubuntu forums from igorzwx.

Oh, this is handy too. I forgot this command name, but knew it existed from years past. Gives you the geometry setting of a window:

xwininfo

Even better! A great little script that runs xwininfo for you and builds you an ffmpeg line.

Wednesday, September 9, 2009

air hose the email server

Today I switched memory on the email server, Dell SC440. It went from 2GB to 4GB, the email server is actually inside a Xen DomU (guest). No head is on this machine. I knew it would not boot strait away with different memory size. On a Dell it tells you the memory size changed, do you want to continue or enter setup. I blindly hit F1 (continue). I did not known F1 was bypassing the warning that SATA2 was not found.

After fiddling around I found it had dropped /dev/sdb out of the RAIDs. Eeek. My dusting job with the air hose, was too invasive!

Not good:

# cat /proc/mdstat
Personalities : [raid6] [raid5] [raid4] [raid0] [raid1]
md2 : active raid5 sda4[0] sdd4[3] sdc4[2]
444309504 blocks level 5, 256k chunk, algorithm 2 [4/3] [U_UU]

md0 : active raid1 sda1[0] sdc1[2]
803236 blocks super 1.0 [3/2] [U_U]
bitmap: 2/7 pages [8KB], 64KB chunk

md1 : active raid5 sda2[0] sdd2[3] sdc2[2]
15710976 blocks level 5, 256k chunk, algorithm 2 [4/3] [U_UU]

So I needed to re-add it, but I can never remember the syntax. After some looking, this is what I did:

mdadm --misc --detail /dev/md0
mdadm --manage /dev/md0 --add /dev/sdb1
mdadm --misc --detail /dev/md1
mdadm --manage /dev/md1 --add /dev/sdb2
mdadm --misc --detail /dev/md2
mdadm --manage /dev/md2 --add /dev/sdb4

Monday, September 7, 2009

new email server and spam

About 2 weeks ago we switched to Zimbra Collaboration Suite. I finally had time to do this, after working on it on and off for about 7 months. It replaced a homegrown Postfix, Courier IMAP, Spamassassin setup running on Gentoo. I've been running my own email server for a very long time... first RedHat 4-5 on a DEC Alpha, then on SuSE 7, then Gentoo. Back in the old days a misconfigured server didn't really matter much. Yes, there was a time I even (unknowingly) ran an open relay. Seems like in about 2000-2001 things needed to be much tighter. And now it's to the point I'd rather not configure each daemon individually.

Zimbra is treating us great so far -- our little company and all the friends and family that have been on my mail server for so so long.

One thing that concerns me -- more spam seems to get through. Well, it turns out that my old Postfix setup was probably a bit overboard. It was particularly nasty to incoming connections that:
  1. Lacked a reverse DNS lookup
  2. Came from a Dynamic IP
  3. Reverse DNS didn't match their HELO
So, I'm trying to be nicer now. Not everyone's mail can come through "proper" channels I guess. Much of the time it's out of a person's control, their ISP might not know what they are doing.

I'm trying to teach the Bayesian filter about spam and ham. Zimbra is supposed to do this when someone drags the email to the Junk folder or if they click on the Junk button in their web interface. I'm not totally sure. And since they've abstracted me from sa-learn, I can't run it directly without passing it a bunch of switches so it can find itself in the /opt/zimbra tree.

I've decided to try to attract some spam. How better than to post an email address here? How about scrapeme1@srcbin.com that sounds good. Yes, scrape me would like some unsolicited email. For those wondering about "Scrape," it is what people used to do computer screens to get information off of them -- usually in a terminal application. After the web got interesting data, web scraping took off. Spammers build "robots" or "bots" to traverse the web looking for text that looks like email addresses. Mostlikely, scrapeme1@srcbin.com will look fresh and desirable to spammers and will hopefully spread around a bit on some lists.

Sunday, September 6, 2009

how to build a DOS boot USB mem stick on Linux

You might find yourself needing to boot DOS on an x86 computer. A popular reason would be to update the BIOS. What if the computer doesn't have a floppy drive? Or you need more room than a floppy? What if the new SATA DVD writer doesn't seem to be recognized by the CDROM drivers on the DOS boot CD you built?

We use sysresccd all the time, but that is Linux and I needed to copy an arbitrary .exe to removable media, boot DOS and run the .exe. I've customized the FreeDOS CD, but CDs wouldn't work so I found this page. Which option to try? Well, I chose a few short options at first, then went with the long option (#1). A lot of procedural language, seems better to just write a script.

Make an empty directory and run this script (on Linux):
Download it here
#!/bin/sh

wget 'http://prdownloads.sourceforge.net/advancemame/makebootfat-1.4.tar.gz?download'
tar -xzf makebootfat-1.4.tar.gz
cd makebootfat-1.4
./configure
make
ls makebootfat

cd ..

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

unzip kernels.zip
unzip commandx.zip
unzip unstablx.zip

mkdir fs-root

cp bin/command.com bin/kernel.sys fs-root/
cp source/ukernel/boot/fat*.bin fs-root/
cp /usr/lib/syslinux/mbr.bin fs-root/

#cd fs-root
#sudo ../makebootfat-1.4/makebootfat -o /dev/sdd -E 255 -1 fat12.bin -2 fat16.bin -3 fat32lba.bin -m mbr.bin .
#sudo dd if=/dev/sdd of=~/fdos-usb.dd


Tested on Ubuntu 9.04 with nothing special installed. Apparently some distributions will have /usr/lib/syslinux/mbr.bin in another spot or not at all. The last 3 lines (comments) are there as an example of what to do next. Use "sudo dd" at your own risk.

The end result is a USB mem stick that will boot FreeDOS and allow you to run your BIOS update utility. Now you are free to collect lots of little tools like that on one stick.

intended use and who we are

I had a blog of technical stuff setup on JRoller, but it was just sorta clunky, wasn't used much, and got very little traffic. I (we) hope to post good technical stuff here for other's reference, not just our own.

srcbin, Inc is a small company in south east Idaho. We think we have talent and hope to grow and gain talent. The more I think of it we ought to expose some of our little adventure. We hope to work towards the principles in Monty's hacking business model.

Our name might be a little confusing for those outside the software realm. "src" and "bin" are the typical abbreviations for source and binary respectively. It's a little geeky, but so are we.