Annotation of wikisrc/tutorials/how_to_install_netbsd_on_hpcarm.mdwn, revision 1.2

1.2     ! schmonz     1: 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.
        !             2: 
        !             3: **Contents**
        !             4: 
        !             5: [[!toc]]
        !             6: 
        !             7: #Disklabel the disk 
        !             8: 
        !             9: 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.
        !            10: 
        !            11: Open up a terminal and lets begin. Use the -I to create first partition on disk.
        !            12: 
        !            13:     # disklabel -i -I sd1
        !            14:     partition>
        !            15: 
        !            16: 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.
        !            17: 
        !            18:     partition> e
        !            19:     Filesystem type [?] [MSDOS]:
        !            20:     Start offset ('x' to start after partition 'x') [0.0307617c, 63s, 0.0307617M]:
        !            21:     Partition size ('$' for all remaining) : 6MB
        !            22:     partition>
        !            23: 
        !            24: We give it 6 MB as that is enough room for the boot program and 2 kernels.
        !            25: 
        !            26: Next we set up the swap partition, which is partition b by convention.
        !            27: 
        !            28:     partition> b
        !            29:     Filesystem type [?] : swap
        !            30:     Start offset ('x' to start after partition 'x') : e
        !            31:     Partition size ('$' for all remaining) : 64MB
        !            32:      b:    131072     12351       swap                     # (Cyl.      6*-     70*)
        !            33:     partition>
        !            34: 
        !            35: We have told disklabel to start the swap partition after the DOS partition so we don't have to do any calculations.
        !            36: 
        !            37: Next is the main NetBSD partition a.
        !            38: 
        !            39:     partition> a
        !            40:     Filesystem type [?] : 4.2BSD
        !            41:     Start offset ('x' to start after partition 'x') : b
        !            42:     Partition size ('$' for all remaining) : $
        !            43:      a:   1859473    143423     4.2BSD   1024  8192 45488  # (Cyl.     70*-    977*)
        !            44:     partition>
        !            45: 
        !            46: 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.
        !            47: 
        !            48:     partition> c
        !            49:     Filesystem type [?] : unused
        !            50:     Start offset ('x' to start after partition 'x') : e
        !            51:     Partition size ('$' for all remaining) : $
        !            52:      c:   1990545     12351     unused      0     0        # (Cyl.      6*-    977*)
        !            53:     partition>
        !            54: 
        !            55: You should now have:
        !            56: 
        !            57:     partition> P
        !            58:     5 partitions:
        !            59:     #        size    offset     fstype [fsize bsize cpg/sgs]
        !            60:      a:   1859473    143423     4.2BSD      0     0        # (Cyl.     70*-    977*)
        !            61:      b:    131072     12351       swap                     # (Cyl.      6*-     70*)
        !            62:      c:   1990545     12351     unused      0     0        # (Cyl.      6*-    977*)
        !            63:      d:   2002896         0     unused      0     0        # (Cyl.      0 -    977*)
        !            64:      e:     12288        63      MSDOS                     # (Cyl.      0*-      6*)
        !            65:     partition>
        !            66: 
        !            67: If you're happy with the partition table then write it:
        !            68: 
        !            69:     partition> W
        !            70:     Label disk [n]? y
        !            71:     Label written
        !            72:     partition>
        !            73: 
        !            74: Now you have labeled the disk, on to the next step. 
        !            75: 
        !            76: #Format the partitions
        !            77: 
        !            78: First, format the DOS partition:
        !            79: 
        !            80:     # newfs_msdos sd1e
        !            81:     /dev/rsd1e: 12240 sectors in 1530 FAT12 clusters (4096 bytes/cluster)
        !            82:     MBR type: 1
        !            83:     bps=512 spc=8 res=1 nft=2 rde=512 sec=12288 mid=0xf8 spf=5 spt=32 hds=64 hid=63
        !            84: 
        !            85: Secondly, the NetBSD partition:
        !            86: 
        !            87:     # newfs sd1a
        !            88:     /dev/rsd1a: 907.9MB (1859472 sectors) block size 8192, fragment size 1024
        !            89:             using 20 cylinder groups of 45.40MB, 5811 blks, 11264 inodes.
        !            90:     super-block backups (for fsck -b #) at:
        !            91:           32,   93008,  185984,  278960,  371936,  464912,  557888,  650864,
        !            92:       743840,  836816,  929792, 1022768, 1115744, 1208720, 1301696, 1394672,
        !            93:      1487648, 1580624, 1673600, 1766576, ...
        !            94: 
        !            95: #Cross building hpcarm
        !            96: 
        !            97: Because of NetBSD's superb build framework, crosscompiling a [[Hardware/hpcarm]] release is very easy.
        !            98: 
        !            99: 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.
        !           100: 
        !           101: Now tell build.sh where to store its build:
        !           102: 
        !           103:     # export DESTDIR=/usr/hpcarm/distribution
        !           104:     # export RELEASEDIR=/usr/hpcarm/release
        !           105: 
        !           106: Start the build with:
        !           107: 
        !           108:     # cd /usr/src
        !           109:     # ./build.sh -x -m hpcarm release
        !           110: 
        !           111: If you don't want X built drop the -x option.
        !           112: 
        !           113: Wait until it's finished and there should be a nice shiny new release in your release dir.
        !           114: 
        !           115: Now to install it on your flash card... 
        !           116: 
        !           117: #Install the release
        !           118: 
        !           119: Mount your flash card:
        !           120: 
        !           121:     # mount -o softdep /dev/sd1a /mnt/jornada
        !           122: 
        !           123: Create a mount point for the DOS partition:
        !           124: 
        !           125:     # mkdir /mnt/jornada/dos
        !           126: 
        !           127: Mount the DOS partition (*IMPORTANT*: use the -l option, see BUGS in mount_msdos(8)):
        !           128: 
        !           129:     # mount -o -l /dev/sd1e /mnt/jornada/dos
        !           130: 
        !           131: Now we are ready to start installing.
        !           132: 
        !           133: Install the boot program:
        !           134: 
        !           135:     # cp /usr/hpcarm/release/hpcarm/installation/hpcboot.exe /mnt/jornada/dos
        !           136: 
        !           137: Install the kernel:
        !           138: 
        !           139:     # tar -x -p -z -f /usr/hpcarm/release/hpcarm/binary/sets/kern-JORNADA720.tgz -C /mnt/jornada/dos
        !           140: 
        !           141: Now extract the sets. This will extract all sets except the kernels.
        !           142: 
        !           143:     # for f in /usr/hpcarm/release/hpcarm/binary/sets/[^k]*.tgz; do
        !           144:     >   tar -x -p -z -f $f -C /mnt/jornada
        !           145:     > done
        !           146: 
        !           147: If you dont want the X sets, then just add x to the regular expression. 
        !           148: 
        !           149: #Configure the system
        !           150: 
        !           151: We are on the home straight, we just need to configure a few files and we are done.
        !           152: 
        !           153: Create the devices:
        !           154: 
        !           155:     # cd /mnt/jornada/dev
        !           156:     # ./MAKEDEV all
        !           157: 
        !           158: Create a symlink to the kernel:
        !           159: 
        !           160:     # cd /mnt/jornada
        !           161:     # ln -s dos/netbsd
        !           162: 
        !           163: Set up your fstab file:
        !           164: 
        !           165:     # vi /mnt/jornada/etc/fstab
        !           166: 
        !           167:     # cat /mnt/jornada/etc/fstab
        !           168:     /dev/wd0a /   ffs   rw,noatime,nodevmtime 1 1
        !           169:     /dev/wd0b none swap sw 0 0
        !           170:     /dev/wd0e /dos msdos -l,rw                 0 0
        !           171: 
        !           172: Last but not least is to configure rc.conf.
        !           173: 
        !           174: Mine looks like:
        !           175: <pre><code>
        !           176: # cat /mnt/jornada/etc/rc.conf
        !           177: #       $NetBSD: how_to_install_netbsd_on_hpcarm.mdwn,v 1.1 2011/11/20 20:55:21 mspo Exp $
        !           178: #
        !           179: # see rc.conf(5) for more information.
        !           180: #
        !           181: # Use program=YES to enable program, NO to disable it. program_flags are
        !           182: # passed to the program on the command line.
        !           183: #
        !           184: # Load the defaults in from /etc/defaults/rc.conf (if it's readable).
        !           185: # These can be overridden below.
        !           186: #
        !           187: if [ -r /etc/defaults/rc.conf ]; then
        !           188:         . /etc/defaults/rc.conf
        !           189: fi
        !           190: # If this is not set to YES, the system will drop into single-user mode.
        !           191: #
        !           192: rc_configured=YES
        !           193: wscons=YES
        !           194: defaultroute="1.1.1.1"
        !           195: hostname=someone.somwhere.co.uk
        !           196: sshd=YES
        !           197: rpcbind=YES
        !           198: nfs_client=YES
        !           199: lockd=YES
        !           200: statd=YES
        !           201: cron=NO
        !           202: # Add local overrides below
        !           203: #
        !           204: </code></pre>
        !           205: 
        !           206: If you are using DHCP, add **dhclient=YES** instead of the defaultroute and hostname.
        !           207: 
        !           208: Now you're ready to boot it up. 
        !           209: 
        !           210: #Boot it up
        !           211: 
        !           212: 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.
        !           213: 
1.1       mspo      214: 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 <wikimaster@NetBSD.org> software: FreeBSD-CVSweb