File:  [NetBSD Developer Wiki] / wikisrc / tutorials / how_to_install_netbsd_on_hpcarm.mdwn
Revision 1.2: download - view: text, annotated - select for diffs
Sun Feb 5 07:14:36 2012 UTC (8 years, 11 months ago) by schmonz
Branches: MAIN
CVS tags: HEAD

This how-to describes how to install NetBSD/hpcarm on a Jornada 720. We will be using a 1 GB compact flash card and will configure swap on the card.



#Disklabel the disk 

We are going to create our partitions in such a way that disklabel will do all the work of calculating the sizes for us. Hook your flash card up to the computer and check where it attaches. On my machine it shows up as sd1, so that's what I will use.

Open up a terminal and lets begin. Use the -I to create first partition on disk.

    # disklabel -i -I sd1

First we will create a DOS partition to store the kernel and the boot program. This partition is going to be at the beginning of the disk so it MUST have an offset of 63. That little gap is where the disklabel is stored, if you don't leave the offset, your disklabel will be overwritten when you try to format the disk.

    partition> e
    Filesystem type [?] [MSDOS]:
    Start offset ('x' to start after partition 'x') [0.0307617c, 63s, 0.0307617M]:
    Partition size ('$' for all remaining) : 6MB

We give it 6 MB as that is enough room for the boot program and 2 kernels.

Next we set up the swap partition, which is partition b by convention.

    partition> b
    Filesystem type [?] : swap
    Start offset ('x' to start after partition 'x') : e
    Partition size ('$' for all remaining) : 64MB
     b:    131072     12351       swap                     # (Cyl.      6*-     70*)

We have told disklabel to start the swap partition after the DOS partition so we don't have to do any calculations.

Next is the main NetBSD partition a.

    partition> a
    Filesystem type [?] : 4.2BSD
    Start offset ('x' to start after partition 'x') : b
    Partition size ('$' for all remaining) : $
     a:   1859473    143423     4.2BSD   1024  8192 45488  # (Cyl.     70*-    977*)

The last partition to set up is c. This partition represents the whole NetBSD portion of the disk, in our case that's partitions a and b.

    partition> c
    Filesystem type [?] : unused
    Start offset ('x' to start after partition 'x') : e
    Partition size ('$' for all remaining) : $
     c:   1990545     12351     unused      0     0        # (Cyl.      6*-    977*)

You should now have:

    partition> P
    5 partitions:
    #        size    offset     fstype [fsize bsize cpg/sgs]
     a:   1859473    143423     4.2BSD      0     0        # (Cyl.     70*-    977*)
     b:    131072     12351       swap                     # (Cyl.      6*-     70*)
     c:   1990545     12351     unused      0     0        # (Cyl.      6*-    977*)
     d:   2002896         0     unused      0     0        # (Cyl.      0 -    977*)
     e:     12288        63      MSDOS                     # (Cyl.      0*-      6*)

If you're happy with the partition table then write it:

    partition> W
    Label disk [n]? y
    Label written

Now you have labeled the disk, on to the next step. 

#Format the partitions

First, format the DOS partition:

    # newfs_msdos sd1e
    /dev/rsd1e: 12240 sectors in 1530 FAT12 clusters (4096 bytes/cluster)
    MBR type: 1
    bps=512 spc=8 res=1 nft=2 rde=512 sec=12288 mid=0xf8 spf=5 spt=32 hds=64 hid=63

Secondly, the NetBSD partition:

    # newfs sd1a
    /dev/rsd1a: 907.9MB (1859472 sectors) block size 8192, fragment size 1024
            using 20 cylinder groups of 45.40MB, 5811 blks, 11264 inodes.
    super-block backups (for fsck -b #) at:
          32,   93008,  185984,  278960,  371936,  464912,  557888,  650864,
      743840,  836816,  929792, 1022768, 1115744, 1208720, 1301696, 1394672,
     1487648, 1580624, 1673600, 1766576, ...

#Cross building hpcarm

Because of NetBSD's superb build framework, crosscompiling a [[Hardware/hpcarm]] release is very easy.

First we need some where to store the [[Hardware/hpcarm]] distribution and release. I use /usr/hpcarm/distribution and /usr/hpcarm/release, but anywhere will do.

Now tell where to store its build:

    # export DESTDIR=/usr/hpcarm/distribution
    # export RELEASEDIR=/usr/hpcarm/release

Start the build with:

    # cd /usr/src
    # ./ -x -m hpcarm release

If you don't want X built drop the -x option.

Wait until it's finished and there should be a nice shiny new release in your release dir.

Now to install it on your flash card... 

#Install the release

Mount your flash card:

    # mount -o softdep /dev/sd1a /mnt/jornada

Create a mount point for the DOS partition:

    # mkdir /mnt/jornada/dos

Mount the DOS partition (*IMPORTANT*: use the -l option, see BUGS in mount_msdos(8)):

    # mount -o -l /dev/sd1e /mnt/jornada/dos

Now we are ready to start installing.

Install the boot program:

    # cp /usr/hpcarm/release/hpcarm/installation/hpcboot.exe /mnt/jornada/dos

Install the kernel:

    # tar -x -p -z -f /usr/hpcarm/release/hpcarm/binary/sets/kern-JORNADA720.tgz -C /mnt/jornada/dos

Now extract the sets. This will extract all sets except the kernels.

    # for f in /usr/hpcarm/release/hpcarm/binary/sets/[^k]*.tgz; do
    >   tar -x -p -z -f $f -C /mnt/jornada
    > done

If you dont want the X sets, then just add x to the regular expression. 

#Configure the system

We are on the home straight, we just need to configure a few files and we are done.

Create the devices:

    # cd /mnt/jornada/dev
    # ./MAKEDEV all

Create a symlink to the kernel:

    # cd /mnt/jornada
    # ln -s dos/netbsd

Set up your fstab file:

    # vi /mnt/jornada/etc/fstab

    # cat /mnt/jornada/etc/fstab
    /dev/wd0a /   ffs   rw,noatime,nodevmtime 1 1
    /dev/wd0b none swap sw 0 0
    /dev/wd0e /dos msdos -l,rw                 0 0

Last but not least is to configure rc.conf.

Mine looks like:
# cat /mnt/jornada/etc/rc.conf
#       $NetBSD: how_to_install_netbsd_on_hpcarm.mdwn,v 1.2 2012/02/05 07:14:36 schmonz Exp $
# see rc.conf(5) for more information.
# Use program=YES to enable program, NO to disable it. program_flags are
# passed to the program on the command line.
# Load the defaults in from /etc/defaults/rc.conf (if it's readable).
# These can be overridden below.
if [ -r /etc/defaults/rc.conf ]; then
        . /etc/defaults/rc.conf
# If this is not set to YES, the system will drop into single-user mode.
# Add local overrides below

If you are using DHCP, add **dhclient=YES** instead of the defaultroute and hostname.

Now you're ready to boot it up. 

#Boot it up

Unmount your partitions and put the card in the Jornada. Go to **My Documents** then up one level and into **Storage Card**. Run the hpcboot program. On the boot tab select HP Jornada 720 (Japanese), select \Storage Card\ as the path and netbsd as the kernel to boot. Set the root file system to wd. Press boot and enjoy.

After you've set up hpcboot and verified the settings by successfully booting NetBSD, you may skip all the WinCE setup while booting by hitting Win+E and using only return, space and arrow keys to navigate to hpcboot and start booting NetBSD. 

CVSweb for NetBSD wikisrc <> software: FreeBSD-CVSweb