Date: Fri, 6 Aug 1999 07:24:18 -0700 (PDT) From: papowell@astart.com To: freebsd-small@FreeBSD.ORG, jay@oneway.com Subject: Re: HowTo: Making bootable FlashRom Images. Message-ID: <199908061424.HAA01942@h4.private>
next in thread | raw e-mail | index | archive | help
> From owner-freebsd-small@FreeBSD.ORG Fri Jul 30 15:05:49 1999 > Date: Fri, 30 Jul 1999 18:03:30 -0400 (EDT) > From: Jay Kuri <jay@oneway.com> > To: freebsd-small@FreeBSD.ORG > Subject: HowTo: Making bootable FlashRom Images. > > > Late but not forgotten... Skip to the very bottom for the ultra-short > version. > > These are the instructions for making bootable FlashRom images using > PicoBSD 0.44. The devices I use are have an IDE-controller chip which > makes them look to the system like IDE drives. But there is no reason > that these instructions can't be applied to another type of flash rom > with only minor modifications. > > The process is suprisingly easy. > > First you need to know the layout of your device. IE: it's disklabel. > The roms I use masquerade as IDE drives, so I just created a standard > disklabel using the geometry of the drive as taken from the bios. > The easiest way to do this if you have the device hooked up to a running > FreeBSD system, is to go into sysinstall and set it up in the > partition/label section. > > Basically what you have to do is create an entry in the /etc/disktab file. > For our 8M flash, this is the disktab entry we used: > > flash8:\ > :dt=ESDI:ty=winchester:se#512:nt#4:ns#16:nc#250:\ > :pa#16000:oa#0:ta=4.2BSD:ba#8192:fa#1024:\ > :pc#16000:oc#0: > > The first line is the key (name) of the disktab entry, the second line > sets the geometry of the drive, 4 heads, 16 sectors/track and 250 > cylinders (nt#4, ns#16, and nc#250). The third line sets the 'a' slice, > occupying the whole disk (pa#16000 or 16000 sectors, oa#0 (offset 0)), and > containing a ffs (4.2BSD) filesystem. Then the 'c' slice is defined, again > with the pc#16000 and oc#0 values. (see the top of the disktab file for > a better explanation of disktab entries) > > Now comes the modifications. Remember that this is based on the 0.44 > PicoBSD distribution, not the new Makefile-based one. I don't know how > different it is... 1. You do what you have done above. I like the layout - very nice. 2. In the CONFIG file you put: #SIZE= 2400 #FLOPPY_SIZE= 1440 #FLOPPY_FS= fd1440 # size of the MFS file system - You can put more files on this # or you can increase the space. Note: each 1 Meg increase takes # about 1K of image space. You lose a corresponding amount of memory # for processes. Lets make it 4.8 Megabytes SIZE= 4800 # You have 4 * 16 * 250 / 2 = 8000 K bytes of flash, so you can use them FLOPPY_SIZE= 8000 FLOPPY_FS= flash8 > > In the stage3 file, find the line that contains the dd to picobsd.bin > command (about line 20). The count parameter will be set to 1440. This > is the size in K. For my rom, I use 8000 (since that is the actual size > of our rom). This value will be half the pc# value we entered above. > > Then we go down to the disklabel line (~ line 36). Find the fd1440 and > replace it with the key you entered in the disktab file. For this > example, 'flash8' is the correct value. > > Depending on the size of your MFS filesystem, you may want to increase the > INODES in stage1. > > That covers the changes you need to make in the scripts. > > There are some other changes that need to be made in order for your new > PicoBSD-Flash to work. Your best bet is to create a custom picobsd type > (just copy the one that most closely matches the features you want). I > used net. > > The first thing you have to do is make sure that your PicoBSD kernel > supports whatever type of device your flash drive is detected as. Since > ours is an IDE device, we need to enable the ide devices (wdc0, wd0, wd1, > etc). You do this by editing the PICOBSD config file in the conf/ > directory. > > You also have to add the devices to your MFS filesystem. You do this by > editing the Makefile in the mfs.tree directory. On approximately line > 37, add the devices for your IDE drive (wd0h is a good way to get all of > the slices you need), along with any other devices you want (I added ttyd0 > for my console port). Done already... > > Now that you have support for your IDE device configured into your PicoBSD > kernel, and the devices set up, you have to change the way the system > boots. > > Normally after PicoBSD boots, it mounts the floppy drive and copys files > off of it onto the MFS filesystem it created. Obviously, we need to make > it mount the flash instead. There are two files you need to change to do > this. These files are in the lang directory. Edit the mfs.rc.(language) > file (in my case mfs.rc.en) and find the line that mounts the floppy ( ~ > line 24) and change the fd0 device to your flash device. I used wd0c. > Now edit the update.(language) script and do the same thing, make sure you > get the umount command as well). > > WARNING: If you enter the wrong device or do not create the > device nodes, your flash will NOT work, it will enter a horrible infinite > loop running /etc/rc again and again until you reboot. Ummm... there is a simple change that will fix this behaviour. Change the line in lang/mfs.tree/etc/rc.{en,pl} which reads: . rc to : . rc.local Rename lang/floppy.tree/etc/rc.{en,pl} to lang/floppy.tree/etc/rc.local.{en,pl}. Now if it does not find rc.local it will continue on and exit. > > Thats it. > > When you run the build script, and select your custom configuration, it > will create a picobsd.bin file that is the correct size for your flash > device. You should be able to dd the file directly onto your flash and > then boot from it. > > > Oh.. and one last thing. Be VERY careful when dumping the image to your > flash (esp. if it is an IDE-type) because it is very easy to mistype and > overwrite your REAL drive with your picobsd distribution. Let me tell > you, until I did that, I'd never seen a FreeBSD machine die so hideously. > =) > > Good luck, and please send me feedback and/or better ways to do these > things. > > Take it easy, > Jay > > PS: Short version: > > 1: create a disktab entry for your flash device > > 2: edit stage3 so that it creates the right size picobsd.bin image and > uses the disktab entry you created (instead of fd1440) to disklabel the > file. > > 2a: If you are going to have a larger MFS filesystem, edit INODES in > stage1. > > 3: Add your flashrom device to the PICOBSD kernel config file (wd0 in our > case) > > 4: Add your flashrom device to the Makefile in mfs.tree > > 5: Edit lang/mfs.rc.(lang) so that it mounts the flash device instead of > the floppy device. > 5a: Edit lang/update.(lang) to do the same. > > 6: build it, dd it and watch it work. =) > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-small" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-small" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199908061424.HAA01942>