Subject: Re: sh3 status
To: None <port-hpcsh@netbsd.org>
From: Valeriy E. Ushakov <uwe@ptc.spbu.ru>
List: port-hpcsh
Date: 06/18/2002 03:49:57
On Mon, Jun 17, 2002 at 16:46:21 -0400, Michael Cooper wrote:

> I just began looking for a BSD or Linux system ported to the HP Jornada 
> 690 which runs an SH3 processor.  I was looking at the www.netbsd.org 
> under the sh3 site after discovering it through a search engine.
> 
> I am having trouble however discovering some information about the 
> current status of netbsd on the sh3 system.  Could someone please direct 
> me to any site or FAQ which I can view to get this type of information. 
> I do know several programming languages so I can also get into 
> contributing, however my skills are not yet that great.  I am currently 
> looking for a system to view from a user standpoint.  Thanks.

Unfortunately, port page is quite out of date.  hpcsh port made quite
a bit of progress since then.

Here's what I did with my 680.  


If you place to build wthe world or custom kernel you will need a
NetBSD machine for cross-building.  You will need some way to write CF
cards.  I used my i386 laptop as host and cf->pcmcia adpater.

Get yourself a *big* CF card.  Ideally - 256Mb, but you can fit into
128Mb one with some trimming (I've got 128).  The problem is that gcc
2.95.3 cannot generate PIC code for sh3, so your will be using static
world - which is quite fat.

Partition the CF using fdisk on your NetBSD host machine.  Create a
small FAT partition, about 10Mb should be sufficient, and use the rest
of CF for NetBSD partition.  You will need the FAT partition b/c

. you can store your wince backup here (see below)

. you can store hpcboot and the netbsd kernel there (the kernel must
  be visible under WinCE as hpcboot is a wince program)

. WinCE won't be prompting you to reformat CF every time you insert
  it, it shuts up if it can see a FAT partition

Clean your wince temp files, IE cache etc.  Install all the updates
and patches you need, etc.  Now insert CF into Jornada and make a full
backup of WinCE to a file on CF's FAT partition.  Important!  If you
installed HP Backup 2.0, do NOT use it.  Use old HP Backup - b/c after
hard reset HP Backup 2.0 will not be available.

Now you will need an hpcsh world.  I think there were no recent
snapshots (anyone cares to build one?), so let's build the world
ourselves.  On your NetBSD host get a recent -1.6BETA or -current
source tree and familiarize yourself with /usr/src/BUILDING.

Build the world.  E.g.

    $ cd /usr/src
    $ ./build.sh -d -m hpcsh -T /usr/build/tools \
		-D /usr/build/hpcsh -O /usr/build/obj/hpcsh

Use MKFOO=no according to taste (you probably want at least MKLINT=no).

Build a kernel:

    $ PATH=$PATH:/usr/build/tools/bin	# see -T to build.sh above
    $ cd /usr/src/sys/arch/hpcsh/conf
    $ nbconfig GENERIC
    $ cd ../compile/GENERIC
    $ nbmake-hpcsh depend all

Or make youself a custom kernel based on GENERIC adding support for
pcmcia cards you own.

Uudecode /usr/src/sys/arch/hpc/stand/binary/SH3/hpcboot.exe.uu and
copy it to the FAT partition on your CF.  Copy the kernel you have
built to the CF as well.

disklabel and newfs the NetBSD partition on your CF.  When doing
disklabel, don't forget to add an entry (traditionally 'e') for the
FAT partition.  Mount the newfs'ed NetBSD fs.  Copy the world from
/usr/build/hpcsh (-D argument to build.sh) to NetBSD fs on CF.
E.g., assuming you mounted it under /mnt

    $ cd /usr/build/hpcsh
    $ pax -rw -pe . /mnt

Note that only 256Mb CF can hold the whole world.  For 128Mb or
smaller you will have to trim the world down, e.g. by dropping
compiler, includes, static libs (there are no shared libs anyway) etc,
etc.  syspkgs might help in this though I haven't tried them yet.

Edit /mnt/etc/fstab.  E.g.

    /dev/wd0a	      /		ffs	rw,noatime	1 1
    #/dev/wd0b	      none	swap	sw		0 0
    /dev/wd0e	      /cf	msdos	-l,rw		0 0
    kernfs	      /kern	kernfs	rw		0 0
    procfs	      /proc	procfs	rw		0 0

Edit /mnt/etc/rc.conf, set rc_configured=YES add local overrrides.
E.g.

    hostname="nada"
    no_swap=YES		# mine doesn't have swap
    inetd=NO
    cron=NO
    wscons=NO

    critical_filesystems_local="/cf $critical_filesystems_local"

As for the /cf filesystem in the above.  I did

     $ mkdir /mnt/cf
     $ cd /mnt
     $ ln -s cf/netbsd

This way hpcsh's /netbsd will be a symlink to the netbsd kernel in the
FAT - thus saving you precious space and making sure the kernel you
booted with hpcboot and the kernel netbsd programs like ps(1) use is
the same.  You must have created the wd0e ('e' entry) for the FAT
portion of your CF when you have created netbsd disklabel for CF.

Ok, you CF card is ready.  Insert it into Jornada navigate to
\Storage Card 2 - the FAT portion of your CF partition - and run
hpcboot.

Tell it you want to boot from \Storage Card 2 , file netbsd, and you
want root on "wd".  Chack other options according to your needs.

If everything was ok - congratulations, you booted netbsd on your
Jornada.  Login as root w/out a password and hack away.

To get back to WinCE, hlat the machine, e.g. by

    nada$ shutdown -h now

The machine will reset and start a virgin WinCE from ROM.  Calibrate
the screen, set time etc.  Now launch HP Backup and click full
restore.  Restore from the backup you have created on the FAT
partition on your CF.  Your WinCE is back.



Despite being low on memory (16Mb in my 680 w/out RAM upgrade), the
machine is quite usable.  E.g. I have support for mhzc pcmcia
ethernet/modem combo in my kernel and I can happily run ppp to dial
out and use ssh to login to my boxes.  (Internal modem in 680 is a
softmodem and is not supported, but iirc, 690 doesn't have internal
modem anyway).

The biggest nuisance is that keyboard driver has issues with scan
matrix so chords from the same row don't work.  E.g. you cannot use
C-A-F1 or C-A-F3 to switch between wscons screens, b/c F1 and Control
are in the same row and, likewise F3 and Alt are in the same row.
So if you accidentally switched e.g. to screen 1 with C-A-F2, you will
not be able to get back to screen 0 unless you tweaked wskbd map to
use something else then C-A-F1 to switch to screen 0.

I think that's about everything I can recall at the moment.  Hope that
helps.


PS: Why TGM is not building hpcsh for 1.6 branch?  Some make release
issues?  (never tried make release myself).

SY, Uwe
-- 
uwe@ptc.spbu.ru                         |       Zu Grunde kommen
http://www.ptc.spbu.ru/~uwe/            |       Ist zu Grunde gehen