$Id: mobilepro880_netbsd.txt,v 1.17 2007/03/28 14:04:48 acruhl Exp $ Installing NetBSD 2.0 on the NEC Mobilepro 880 by Andy Ruhl, with help from Todd Vierling and people at port-hpcmips@netbsd.org, thanks! (Note: This document is not word wrapped for the time being. Please download it and view it in your favorite text editor to alleviate this. Thanks.) Sections: 1. What you need 2. Warning 3. Install method 4. Booting just a kernel for test purposes 5. Formatting a CF card 6. Boot install kernel, run sysinst to install on the CF card 7. Setting up the distribution to boot (booting without using sysinstall) 8. Making a new kernel to boot specifically from an external method (netboot or USB attached storage) 9. Running X 10. Installing and using packages 11. Hardware suggestions 12. Other setup suggestions 13. Thanks and any change requests ------------- - Section 1 - ------------- What you need: 1. NEC Mobilepro 880 2. CF card of some size, preferably 128 meg or larger if you plan to use it for primary storage. At least 256 megs to run X, but that might not be enough. 3. Either: a. Network adapter (to install via sysinst over the network or netboot, not covered here) or b. Some storage device to store the install filesets (to install via sysinst, not covered here) or c. CF card reader to connect to another machine so you can set up the CF disk from another machine (preferably a NetBSD machine) The included serial cable may be useful to use as a console, but I didn't get one with mine so I won't comment on it. I picked up a USB 2.0 IDE drive enclosure for about $10. This is probably not necessarily desireable or feasible because it adds a lot of extra bulk, and obviously an external power supply will be necessary to power the drive. However, it is entirely possible to install onto a CF card once it is partitioned correctly. I chose to use a USB hard drive because it was cheap and available. You can run NetBSD entirely from a USB connected storage device if you want to. But you still need a CF card to boot from. It's also possible to use USB attached pen drives. I have a 256 meg USB pen drive that works well. ------------- - Section 2 - ------------- Warning: Use this information at your own risk. If you lose any data, it's not my fault! It's not my intention for you to lose data with this document, and I try to warn you if it's possible. NetBSD will write over whatever data is stored in the WinCE area of memory every time it is booted. Don't plan on storing any WinCE data on the Mobilepro if you do happen to use WinCE. Also, WinCE will "re-install" itself every time you boot the Mobilepro after running NetBSD, which can get annoying. If someone knows of a way to skip all of the configuration that WinCE wants you to do at boot time, that would be great. But I believe we have no other choice unless someone knows how to automatically boot something other than WinCE. We are using WinCE as a glorified boot loader at this point. ------------- - Section 3 - ------------- Install Method: Choose your install method. Here are some options you have: 1. Manually unpack the distribution sets onto a storage device (recommended) 2. Use sysinst (install kernel) on the CF card a. Use a network card to install over the network b. Install the distribution sets from local storage, a USB drive for instance. I highly recommend unpacking the distribution sets onto a NetBSD partition on the CF card from another machine. Sysinst seems to work fine, but it is slow. I tried it by installing via the network, but it would also probably work from some USB or PCMCIA attached storage containing the distribution sets. I will cover unpacking the distribution sets onto some storage device. ------------- - Section 4 - ------------- Booting just a kernel for test purposes: This is useful because you can see what hardware is attached and use this later on if you need to. For instance, if you are going to install onto a CF card or an external USB device, you want to know what device it shows up as. You only need 2 files for this: 1. pbsdboot.exe 2. A kernel Back up any data on your CF card. It's probably going to be lost as soon as you let the Mobilepro format the card. Put these both onto a CF card with an MSDOS partition that can be used by the Mobilepro's WinCE operating system. You should be able to let WinCE format the card, then connect the card to any other machine using the CF card reader. Then copy the kernel and pbsdboot.exe onto the card, then put it back into the Mobilepro 880. You can get them here: ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-2.0/hpcmips/installation/ The netbsd.gz file is an install kernel. I'm not sure if it will boot while it's gzipped or not, I decided to un-gzip mine and it worked. You could also use just a generic kernel from the distribution sets as well. To use pbsdboot.exe: Boot the Mobilepro 880. Go through whatever you have to do in order to have a clean desktop with no bothersome pop up windows. Double click on the "My Handheld PC" icon. There should be a folder that represents your CF card with a different looking icon that has something on the folder, not sure what it is. Note the name of this folder, this is needed to use pbsdboot.exe. Double click the folder, and you should see 2 files in there at the minimum, pbsdboot.exe and netbsd, the netbsd kernel. Double click on pbsdboot.exe. pbsdboot.exe is a very cool program, whoever wrote it, thanks! It has a few options in here. The only ones that are absolutely necessary are to set your path to the netbsd kernel in "Kernel name:", and set the frame buffer type in "Frame Buffer:". My particular machine names the CF card Storage Card2, so my path looks like this: \Storage Card2\netbsd Scroll down to choose "Mobile Pro 880" in the next list. You can also use options, however I don't use any at this time. Properties has some other things you can do. I don't use any of those. Click the "Boot" button. There is a warning that pops up. Take heed of it if you have anything stored in WinCE. It will be gone after you click the "Yes" button. pbsdboot.exe creates a .ini file and it remembers your settings after you boot. This is nice. So now you have booted NetBSD. Feels good doesn't it? Take note of the hardware you see as it gets detected by the kernel. Of particular importance will be your network card device name, if you have one (mine is ep0), and your disk names. The CF card should be called wd0, and any usb storage should be sd0. You'll probably have to use the "hard reset" button, the one above the power button on the keyboard, to reboot the Mobilepro 880. This will force it into re-initializing WinCE from scratch, and you have to go through all the setup. You don't actually have to set up WinCE if you don't plan on using it, but you still have to click through all the boxes. Annoying. Unless someone has a better way. ------------- - Section 5 - ------------- Formatting the CF card: Courtesy of Todd Vierling, with notes by me. Todd assumes you don't have another machine to use to write to the CF card, he's doing this with the INSTALL kernel. (Note: There are other published methods to format CF cards, but I found that they didn't work. The Mobilepro 880 seems to be peculiar. This method worked for me.) From Todd: -- WinCE uses fdisked drives. You might want to try the following: * boot NetBSD INSTALL kernel * exit sysinst and run fdisk from the command line: $ fdisk -u wd0 * make partition 0 type 6 (16-bit FAT), and make it big enough to hold hpcboot.exe, a gzipped INSTALL kernel, a real kernel, and perhaps some work area for other kernels and/or storing WinCE data * make partition 1 type 169 (NetBSD), sized for the rest of the disk Write down the absolute start sector number and raw sector count of the 16-bit FAT partition. Then: $ dd if=/dev/zero of=/dev/wd0d bs=512 seek=START count=20 where START is the starting sector of the FAT partition -- this will prompt WinCE to reformat it. Then reboot into WinCE and tell it Yes to format the now-shrunken FAT partition. (WinCE 2.1/2.11 has some kind of oddness in its FAT implementation; it's best to let it format a repartitioned card.) (Note by Andy: After you boot into WinCE to let it format your card, your next step is to use disklabel to format the NetBSD partition if you choose to extract the sets manaully. If you want to use sysinst [aka the install kernel], I believe it will format the rest of the CF card for you and you don't have to bother with disklabel until you use sysinst.) When you boot back into NetBSD, you'll have the ability to use the NetBSD-fdisk'ed partition completely isolated from the FAT side. You can use the absolute sector start and count of the FAT partition in a customized disklabel to get access to that partition from the NetBSD side. -- If you choose to install via sysinstall (slow!), you can continue to the next section. If not, continue on. Disklabel is covered very well elsewhere, so I won't go over it here. You can use disklabel from the install kernel, or from some other machine running NetBSD. At this point, you want to use disklabel to make an "a" partition for your root disk, and any other ones you plan to use. Your MSDOS partition that we will use to boot the NetBSD kernel using pbsdboot.exe will be called "e". I only use "a" and "b" for swap. Swap is optional, but recommended if you have space. I'm currently using a 64 meg swap partition on an externally attached USB drive, but I plan to still use one when I get a large CF drive. ------------- - Section 6 - ------------- Boot the install kernel, run sysinst: (You can skip this section if you decide not to use sysinstall. I recommend skipping sysinstall because it's very slow. But it's more friendly. I've only used sysinstall once, and I didn't let it complete so I don't know how to use it too well on this device.) Boot the install kernel using pbsdboot.exe, and this should work very similarly to sysinstall on any other platform. It's recommended to practice this on another box, such as an i386, so that you don't have to go through it more than once on the Mobilepro 880. The main thing here is when sysinstall sets up your disk, don't touch the MSDOS partition, which will be "e" when setting up NetBSD partitions. You need that to boot! NetBSD wants to boot from the CF card by default, which should show up as wd0. It wants to use /dev/wd0a as root, and /dev/wd0b as swap. If you want to use something else, read down to the section where you can tell your kernel what to boot from. This requires a kernel build on another machine. But if not, you're done. You should have a working NetBSD machine. Follow the NetBSD guide to set it up and use it from here. ------------- - Section 7 - ------------- Setting up the distribution to boot (booting without using sysinstall): If you chose to skip step 6, then you need to unpack the distribution sets onto some disk that you want to boot from. At this point, you want to connect the CF card to a machine running NetBSD so we can work on it. Use disklabel to create partitions in the NetBSD part of the disk (which you set up using fdisk earlier in step 5). Disklabel is covered elsewhere. For simplicity's sake, making one large root partition on "a" and a swap partition on "b" makes sense. Mount the "a" disk somewhere. On my machine, the CF card shows up as sd2, but it's almost surely different on your machine. If you don't have any other scsi disks, it's probably sd0. I'll use sd0 as an example: mount /dev/sd0a /mnt Get the distribution sets for hpcmips. 2.0-release is here: ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-2.0/hpcmips/binary/sets/ At the BARE minimum, you need the kern-GENERIC.tgz, base.tgz and etc.tgz sets. If you don't have enough space on your CF card for these, you need to trim them down. I started to do this but I gave up and decided to install on a 256 meg pen drive. It had plenty of space. cd /mnt tar xvzpf /path/to/sets.tgz Once that is done, you want to do a little setup. cd /mnt/etc Then set up rc.conf to do what you want it to do. You want to set rc_configured=YES for sure. If you use dhcp, also set dhclient=YES. Set up whatever else in /etc you think you need. I made an ifconfig.ep0 file to set up my particular network card. Setting up a resolv.conf file would be a good idea if you're not using dhcp. Also set your default route either in rc.conf or the defaultroute file. Having experience in NetBSD helps at this point. Also, be sure to read the man page for afterboot(8). cd /mnt/dev sh MAKEDEV all This will set up your device nodes. You have to do this. You also want to copy the kernel called /mnt/netbsd to your MSDOS partition on the CF card so pbsdboot.exe can boot it. You also want to ensure that whatever kernel you boot with pbsdboot.exe from the MSDOS partition is the same one in your NetBSD root disk or some things won't work. I believe there's a way to get pbsdboot.exe to boot the kernel that lives on the NetBSD root disk but I haven't figured it out yet. Put the CF card into the Mobilepro 880 and boot it. Boot using pbsdboot.exe and you should have a working NetBSD system. If you chose to set up your disk on anoter disk, such as a USB disk, the kernel won't know where root is and you'll have to type in sd0a or whatever your disk is called. This is where it's nice to rebuild the kernel and tell it where the root device is. ------------- - Section 8 - ------------- Making a new kernel to boot specifically from an external method (netboot or USB attached storage): If you decide you want to netboot or boot from a disk other than the CF card (ie other than wd0a), it's nice to set up the kernel to know how to boot from this device. Edit the config file in /usr/src/sys/arch/hpcmips/conf/ For instance, my USB disk shows up to the kernel as sd0, so I want to boot sd0a. You should change the default config line in your kernel conf file (notice that I just commented out the default line): #config netbsd root on ? type ? config netbsd root on sd0a type ? Or if you want to netboot: #config netbsd root on ? type ? config netbsd root on ? type nfs If you have more than one network adapter, you need to specify it after "on". Mine would be ep0. This sounds silly, but since there are PCMCIA, CF and USB network adapters that should all work with the Mobilepro 880, you could have more than 1! To netboot, you also need this option: options NFS_BOOT_BOOTP Follow the directions on netbooting in the diskless man page, all you need to do is set up a dhcp server which will handle bootp, and have a filesystem set up somewhere that is hosted by nfs. This is beyond the scope of this document. You can either build the kernel on the Mobilepro 880 (Slow! Took me about 4 hours to build a kernel which was quite trimmed down.), or cross build it from another machine running NetBSD. Both of these subjects are beyond the scope of this document. But if you have the entire source tree, this should work to cross build a kernel: cd /usr/src ./build.sh -m hpcmips -T -O tools ./build.sh -u -m hpcmips -T -O kernel=MP880 (or whatever you called your new config file) Note that once you build the tools, you can use the -u option so it doesn't build them again. The kernel will be in the obj directory, it will tell you where when the build is done. Also note that I've had some problems trimming down the kernel. Some hardware that I don't have causes the kernel to not boot if I remove it. I don't know why. You can safely remove all the normal stuff, ie scsi hardware you don't have, network cards you don't have, usb devices you don't have, options you don't want, etc. ------------- - Section 9 - ------------- Running X: The hpcmips distribution sets include an X server built specifically for these devices. You need to install the X distribution sets to get it though. No configuration is necessary. Just run "startx". This should start up a twm window manager. Using the stylus is a little tricky. You can't just drag the mouse around because as soon as you touch the screen, this simulates the first mouse button. You can simulate the middle and right buttons as well: Middle: hold down the windows key and the number 2 key, then touch the screen Right: hold down the windows key and the number 3 key, then touch the screen See the man page for Xhpc for more details. -------------- - Section 10 - -------------- Installing and using packages: You can build packages using pkgsrc on the Mobilepro 880, but they will build slowly. Currently, there aren't any packages built for us for NetBSD 2.0 on mipsel at the ftp.netbsd.org site, so we have to go it alone. I have a NetBSD/Cobalt box that I've been building stuff on. It's slow, but not as slow as the Mobilepro 880. We only have 32 megs of memory and a slow processor, so we're going to be limited in what we do. I'm currently using the standard twm window manager and dillo as my web browser. It doesn't render things very good, and doesn't seem to do php at all. I tried to build firefox, but it didn't build and honestly I'm not even sure if it would be feasible to run. mMosaic will render some stuff that dillo won't. Lynx works just fine. -------------- - Section 11 - -------------- Hardware suggestions: Most of this document should apply to the Mobilepro 800 as well, it appears to be largely similar to the 880 in most respects. But only about 130 mhz compared to about 170 mhz. Before you buy a Mobilepro 880, note what it does and doesn't have! It doesn't have a full keyboard with F keys. It's monitor is very good by PDA standards, but not by regular laptop standards. It has no built in stereo audio, and I haven't got the built in mono audio working yet. If someone knows how to do this, this would be great. But normal headphones won't work in the audio jack anyway. The keyboard is rather small, but should be useable after some practice. Anything you plug into the Mobilepro 880 is going to have a fairly drastic affect on battery life. My regular PCMCIA ethernet adapter seems to really drag it down. Network adapters: You can't use CardBus adapters. They must be the older 16 bit PCMCIA ones. The newer CardBus ones tend to identify themselves as CardBus on the retail box somewhere since this is a feature. Some cards that used to be 16 bit PCMCIA are sometimes now CardBus. These may even have the same model number, but probably a different revision number. Linksys and Belkin are guilty of this. According to Todd vierling, there is a low power CF based ethernet card, often referred to as LP-E that only draws about 10ma of power. Unfortunately it's only 10baseT, but I think you probably can't get full 100baseT bandwidth on one of these Mobilepros anyway. You can use a PCMCIA to CF adapter for the card, but I haven't done it yet. I plan on it though. For reference, standard PCMCIA ethernet adapters seem to draw 100ma or so. If someone knows one that draws less, I'd like to know about it. Wireless adapters seem to all draw around 250ma, even the CF based ones. Obviously, this is going to put a damper on your battery life. Again, if there is one that's lower, I'd like to know about it! I'm using a 3Com 3C589B-TP 10baseT card for the wired network. I have not had any problems with it. I have a Linksys WPC11 v3 802.11b card that is working fine. Note that v4 or higher will NOT work. This is how I have configured it: ifconfig wi0 inet 192.168.0.10 netmask 255.255.255.0 ssid mynetwork chan 6 nwkey 1:0x Other cards that are known to work, thanks to Andrew L. Gould: Belkin F5D6020 (802.11b) (Note by Andy: F5D6020 v3 is Cardbus, this won't work. v2 is 16 bit PCMCIA, however it uses an unsupported chipset. v1 might be the only one that will work.) Linksys NP100 Fast Ethernet 10/100 I tried using a Xircom combo 56k modem and 10/100 card, which is the xi device (xi0). This one didn't work, it kept giving me "device timeout" errors. USB devices: USB devices should work. Like I said, I have a USB 2.0 enclosure for an IDE drive that has been working flawlessly. It's a 200 gig drive, but I only formatted out 4 gigs to simulate the CF card I want. The USB port is only capable of delivering around 500 ma, so you should use a powered hub if you want to draw more (found that info in the NetBSD/hpcmips area). USB pen drives are very useful for either using as a root disk or for removeable storage. I have a 256 meg Lexar JumpDrive whicn works great. I bought a cheapie USB 1.1 hub from a large retailer which shall remain namless for $10, which works fine. I connected a USB floppy, but it claimed to draw 500ma, which is the limit of the USB port on the Mobilepro 880. Also, I don't think hpcmips comes with fdformat! I've found a USB sound card that works! It's the Turtle Beach Audio Advantage Micro. Be sure you have USB audio enabled in the kernel. Also, you want to use a player based on libmad which does not use floating point. Thanks to Katsuomi Hamajima from the port-hpcimps@netbsd.org mailing list for the suggestion to use madplay (based on libmad) which doesn't use floating point to listen to music. Thanks again! More audio notes: I haven't found a graphical audio player that works yet, but I've only tried xmms so far, with the libmad plugin. I'd like to know if a USB attached cd/dvd drive works. It should. Even better, a burner. CF devices: There are other CF devices, such as ethernet cards (also wireless oens). I haven't found too many other CF devices to speak of. Since you need to boot from the CF card, this might be of limited use. Still, if I boot from the network or my pen drive, I can eject the CF card and put some other device in there. PCMCIA to CF adapters should also work with CF devices. For example, the low power CF ethernet card I mentioned above. -------------- - Section 12 - -------------- Other setup suggestions: cgd: I plan on using the Mobilepro for actual work at some point, so I would want to encrypt the work I do. I have been trying to set up a cgd via the NetBSD guide, but I think that the Mobilepro doesn't want to generate the randomness that I need. I need to figure out a way around this. Minimizing disk usage: I want to find out everything that actually writes to the "disk" because I plan on using a microdrive, which apparently uses quite a bit more power than a solid state CF card. I think the first thing I want to do is have the syslog write to a file on a memory disk (a rather small one, only a few hundred kilobytes should be fine), then copy the syslog to disk at shutdown (if I find this unnecessary, I can stop doing this in the future). I am working on this. If anyone knows a quick way to minimize disk usage, I would appreciate some documentation on this. -------------- - Section 13 - -------------- Thanks again to Todd Vierling and everyone at port-hpcmips@netbsd.org that helped. I wrote this document and then read one from another Mobilepro enthusiast and realized that they are very similar. This other one is written by C.M. Hobbs. It's specific to the 770 model. Check it out: http://hobbsc.sdf-us.org/770.html This is my first real NetBSD document, and I know it's probably not formatted the correct way. I will work on this as time permits. There is probably way too much ramble as well. If any changes are needed, please post to port-hpcmips "that at word" netbsd.org, or email me at acruhl "that at word" sdf.lonestar.org. Thanks! Copyright Andy Ruhl, other than the parts clearly marked as being written by someone else. You can use this as long as you don't claim that you wrote it.