OESF Portables Forum

Model Specific Forums => Sharp Zaurus => Zaurus - pdaXrom => Topic started by: ZDevil on August 15, 2007, 08:37:22 am

Title: Dualbooting Pdaxii & Openbsd
Post by: ZDevil on August 15, 2007, 08:37:22 am
After exploring for a while with dinorex, i've succeeded in setting up a dualbooting environment for pdaXii (5.4.8 Sally on NAND) and OpenBSD 4.2 beta (on my internal Extreme III 16GB CF):

Here is how it plays:    
(Sorry for the poor quality of the pics    )

1. First load the pdaXii (5.4.8) kernel. Then answer the question if i want to boot into OpenBSD or pdaX.

 

[img]http://farm2.static.flickr.com/1095/1125555877_79d24f6090.jpg\" border=\"0\" class=\"linked-image\" /]
Title: Dualbooting Pdaxii & Openbsd
Post by: HoloVector on August 15, 2007, 10:59:17 am
Whoa!  So, in theory, I could have pdaXii13 Akita with a full upgrade on my 4GB SD and OpenBSD 4.2 on the MD of my 3200?  Nice Work!

What magic is needed to be done in order to get this working?
Title: Dualbooting Pdaxii & Openbsd
Post by: mathemajikian on August 15, 2007, 07:27:40 pm
Quote
2. Booting up pdaX. Everything is fine.



Dual-Boot Cacko/OpenBSD (https://www.oesf.org/forums/index.php?showtopic=21249#)
Title: Dualbooting Pdaxii & Openbsd
Post by: ZDevil on August 15, 2007, 08:58:30 pm
Actually I don't make much use of the cacko/openbsd dualboot script, except the small segment about choosing booting with obsd.    But thanks, mathemajikian! Without your script i will still be getting nowhere.  
It's just a small tweak of /etc/rc.d/rc.rofilesys in pdaXii.
But for now I cannot extract the file as my 3200 is now compiling packages for OpenBSD 4.2 Beta at full tilt.
Could someone attach the original file in pdaXii so that I can post my how-to and the modified script? Thanks! [edit: got a backup; see the very next post below...]
(btw in the pictures i forgot to change the word "Cacko" in the boot script...   )
Title: Dualbooting Pdaxii & Openbsd
Post by: ZDevil on August 15, 2007, 10:00:21 pm
[UPDATED]

[span style=\'font-size:12pt;line-height:100%\']Dualbooting pdaXii & OpenBSD: a mini how-to (for C3100/3200 only; do it at your own risk)[/span]

*******************************************************************************
To set up a dualboot environment of pdaXii and OpenBSD, you have to do three things:

1. Flash pdaXii (in the usual flash "OK mode") & OpenBSD (in the emergency "D+B mode")
2. Modify /etc/rc.d/rc.rofilesys in pdaXii
3. Create a directory to hold the OpenBSD bootloader and kernel.


*******************************************************************************

1. (I suppose you know how to do this. If not, you'd better stop here for your safety.)

2. Modify /etc/rc.d/rc.rofilesys in pdaXii
This is how I change the /etc/rc.d/rc.rofilesys in pdaXii (5.4.8)
(This also seems to work for other pre-Beta4 builds which uses the older bootloader, including Beta1 and Beta3, but YMMV):

Quote
#!/bin/sh

export PATH=$PATH:/usr/bin:/bin:/sbin

get_dev_pcmcia()
{
while read SOCKET CLASS DRIVER INSTANCE DEVS MAJOR MINOR;
do
    echo $DEVS
done
}
get_dev_pcmcia_slot()
{
    grep "^$1" /var/lib/pcmcia/stab | get_dev_pcmcia
}

RW_MTD_LINE=`cat /proc/mtd | grep "home" | tail -n 1`
if [ "$RW_MTD_LINE" = "" ]; then
    RW_MTD_LINE=`cat /proc/mtd | grep "\<NAND\>.*\<2\>" | tail -n 1`
fi
if [ "$RW_MTD_LINE" = "" ]; then
    RW_MTD=""
    RW_MTDBLK=""
    RW_MTD_SIZE=0
else
    RW_MTD_NO=`echo $RW_MTD_LINE | cut -d: -f1 | cut -dd -f2`
    RW_MTD_SIZE_HEX=`echo $RW_MTD_LINE | cut -d" " -f2`

    if [ -x /sbin/devfsd ]; then
        RW_MTD=/dev/mtd/$RW_MTD_NO
        RW_MTDBLK=/dev/mtdblock/$RW_MTD_NO
    else
        RW_MTD=/dev/mtd$RW_MTD_NO
        RW_MTDBLK=/dev/mtdblock$RW_MTD_NO
    fi

    RW_MTD_SIZE=`dc 0x$RW_MTD_SIZE_HEX 1024 / p`
    initlog -s $"found $RW_MTD ${RW_MTD_SIZE}\"Kbyte\""
fi

if [ "$ZAURUS_RESET" = "HARD" ]; then

if [ ! -x /sbin/devfsd ]; then
    mount -t tmpfs -o size=12m none /dev
    cd /
    tar xf /root/.dev_default.tar 2> /dev/null > /dev/null
    mkdir /dev/shm
else
    mount -t tmpfs -o size=12m none /dev/shm
fi

STRING=$"Starting filesystem: "
msg -n $STRING

mount -o remount / 2> /dev/null > /dev/null

if [ $RW_MTD_SIZE -ne 0 ]; then
    /sbin/eraseall --j --q $RW_MTD 2> /dev/null > /dev/null
    mount -t jffs2 -o rw,noatime $RW_MTDBLK /home 2> /dev/null > /dev/null
    mkdir /home/root
    cd /
    tar --no-same-owner -xf /root/.home_default.tar 2> /dev/null > /dev/null
fi

#OpenBSD Boot
if [ /bsd ]; then
        echo "Would you like to boot OpenBSD or pdaXrom (openbsd/pdaxrom)?"
        read acceptance
        if [ "$acceptance" != "pdaxrom" ]; then
                echo "Booting OpenBSD"
                cardmgr -o >/dev/null 2>&1    #<-- This line is necessary, or the bootloader won't be able to find /bsd on the internal CF/MD.#
                cd /bsd
                /sbin/insmod /bsd/zbsdmod.o
                ./zboot
        fi
        echo "Booting pdaXrom"
fi

mkdir /dev/shm/tmp
mkdir /dev/shm/run
chmod 4777 /var/tmp
chmod 777 /tmp
touch /var/run/utmp
cd /
tar --no-same-owner -xf /root/.var_default.tar 2> /dev/null > /dev/null
touch /var/log/lastlog

rc=$?
if [ "$rc" = "0" ]; then
    success "$STRING"
else
    failure "$STRING"
fi
msg

else
### SW Reset !
......
......

Probably this is just a quick and dirty trick. I suppose there is a better way of doing that.
Anyway here is the full script.
[span style=\'font-size:12pt;line-height:100%\']USE IT AT YOUR OWN RISK!  DON'T BLAME ME IF IT BRICKS YOUR BUDDY Z. [/span]

Two small notes:
-- In case OpenBSD fails to load for some reason, in the bootloader prompt (i.e., boot>), simply type reboot and the system will boot into pdaX.
-- You don't actually have to type "openbsd" to answer the boot question. Just a [ENTER] will do.


3. Create a directory to hold the OpenBSD bootloader and kernel.
-- Create a new directory under pdaXii:
Code: [Select]
  mkdir /bsd-- Copy zboot and zbsdmod.o into this directory:
Code: [Select]
   cd /WHEREEVER/YOUR/OBSD/FILES/ARE
    cp zboot zbsdmod.o /bsd


Reboot. And then you'll see your glutton dog enjoy both penguin and puffyfish meat  ...  
Title: Dualbooting Pdaxii & Openbsd
Post by: ZDevil on August 15, 2007, 10:22:16 pm
Right, i forgot to mention that pdaXrom seems to lack the kernel module for FFS filesystem support, so for now pdaX won't be able to "see" the FFS partitions where OpenBSD lives.
Can someone provide this small piece, please?  
Title: Dualbooting Pdaxii & Openbsd
Post by: Capn_Fish on August 15, 2007, 10:44:16 pm
I can probably do it for r198, but that's not what you want, is it? Does this even work on r198?
Title: Dualbooting Pdaxii & Openbsd
Post by: ZDevil on August 15, 2007, 10:48:45 pm
I guess, technically speaking, dualbooting is also possible for the post-Beta4 builds, provided that there is a fully functional uboot which can easily let user choose which distro to boot.

I'm afraid the kernel module for r198 won't work for pdaXii/Beta1/Beta3.

It's beyond my intelligence to make one. Any help out there?  
Title: Dualbooting Pdaxii & Openbsd
Post by: ZDevil on August 21, 2007, 07:23:15 am
So has anyone tried this solution so far?  

I am also thinking of experimenting with tribooting:
cacko ==> NAND
openbsd ==> internal MD/CF
pdaXii ==> SD

But now the key is: is it possible to run pdaXii full off SD?
I will go about working out a trick if it's possible.
Title: Dualbooting Pdaxii & Openbsd
Post by: climber on August 21, 2007, 07:40:14 am
At the moment I have no time but I will try it later!

You mentioned that you have build in a 16GB CF card in you Zaurus instead of the Microdrive. That's very interesting but I'm not so familiar with the hardware of my zaurus.

Did you made pictures of the different steps of putting the microdrive out of the zaurus and putting the CF in. This would be greate and maybe more zaurus users would give them a chance. I too :-)
I saw your pictures on your side and they are really good but for doing this it should be more steps between.


I'm not sure whether I saw a configurations document of the different steps you did to get the CF work!?

Regards
Climber
Title: Dualbooting Pdaxii & Openbsd
Post by: ZDevil on August 21, 2007, 07:52:27 am
There you go: https://www.oesf.org/forums/index.php?act=S...t=0#entry129173 (https://www.oesf.org/forums/index.php?act=ST&f=149&t=19684&st=0#entry129173)  
Title: Dualbooting Pdaxii & Openbsd
Post by: climber on August 21, 2007, 08:30:32 am
Yeah, this is what I wished to see :-)

Do you have also a document how to get the CF work inside the zaurus. I would guess that I do my partitions and formatting inside the flash modus of the different roms (for example pdaXii13 or pdaXrom)!?

Regards
climber
Title: Dualbooting Pdaxii & Openbsd
Post by: ZDevil on August 21, 2007, 08:41:18 am
I don't quite get what you meant by "how to get the CF work in side the zaurus".
If you are talking about formatting and partitioning, it's all done by the OpenBSD installation process (i.e. the very first few steps).
pdaXii Sally lives entirely in NAND, and won't touch the internal MD/CF at all during installation.  
Title: Dualbooting Pdaxii & Openbsd
Post by: climber on August 21, 2007, 09:03:37 am
Yes, I'm talking about the formatting and partitioning! Sorry for the bad statement.

Ok, that looks fine! If the hardware exchange is successful the other steps should be easy going.

Could you find out anything negative since you have the CF inside the zaurus? Do any scripts which the zaurus needs for booting or configurations complain about that the microdrive is gone?

climber
Title: Dualbooting Pdaxii & Openbsd
Post by: ZDevil on August 21, 2007, 09:09:40 am
No, the CF runs very well.  I think one very nice feature of OpenBSD is that it consistently does filesystem checking after rebooting as a result of hanging/freezing (which does not happen often), which may help protecting the card itself.

And of course speedwise and powerwise, the CF beats the original MD hands down.

There is a recent thread discussing wearing of cards: https://www.oesf.org/forums/index.php?showtopic=23959 (https://www.oesf.org/forums/index.php?showtopic=23959)

Have fun!
Title: Dualbooting Pdaxii & Openbsd
Post by: portalgod on August 25, 2007, 02:52:44 pm
Quote
No, the CF runs very well.  I think one very nice feature of OpenBSD is that it consistently does filesystem checking after rebooting as a result of hanging/freezing (which does not happen often), which may help protecting the card itself.

And of course speedwise and powerwise, the CF beats the original MD hands down.

There is a recent thread discussing wearing of cards: https://www.oesf.org/forums/index.php?showtopic=23959 (https://www.oesf.org/forums/index.php?showtopic=23959)

Have fun!
[div align=\"right\"][a href=\"index.php?act=findpost&pid=166524\"][{POST_SNAPBACK}][/a][/div]

Just a quick question  : Why would I want to dual book pdaxii adn openbsd?    What value added is it?
Title: Dualbooting Pdaxii & Openbsd
Post by: Civil on August 26, 2007, 11:31:40 am
Quote
I can probably do it for r198, but that's not what you want, is it? Does this even work on r198?
OpenBSD requires that linux have some kernel modules, wich doesn't avalible in kernel 2.6
Title: Dualbooting Pdaxii & Openbsd
Post by: ZDevil on August 30, 2007, 07:18:38 am
Quote
Just a quick question  : Why would I want to dual book pdaxii adn openbsd?    What value added is it?
[div align=\"right\"][a href=\"index.php?act=findpost&pid=166682\"][{POST_SNAPBACK}][/a][/div]
Simple: just not to waste the NAND flash area.
Honestly, pdaXrom does run faster, but I feel safer and more secure with openbsd.
And I've grown so tired of running the cottage-industry-way of packaging and building (a dependency and patching hell).
Look at my feed(s) and see how >200 working packages (and it keeps growing every day...) have been built on board in a week. It's no rocket science; everyone can do that easily .
For now the only tradeoffs are: SD write support (this is important!), bluetooth RFCOMM (i use wifi only), xrandr (though I feel perfectly comfortable with landscape mode only -- just because recently I've got a 6-inch screen e-ink book reader for RSS news and books and documents    )
Title: Dualbooting Pdaxii & Openbsd
Post by: apink on August 31, 2007, 11:28:23 pm
You say that openbsd is on your cf card with pdax on nand.  Is there a reason that this can only happen on 3x00 machines and not the c1000?
Title: Dualbooting Pdaxii & Openbsd
Post by: ZDevil on August 31, 2007, 11:31:59 pm
Precisely. The whole system takes much more space than the 128MB NAND flash.
That's the main reason why I swapped the original microdrive with a fast CF (a 4gb and even 8gb card is darn cheap now  ) to make things run as smoothly as on NAND (speed, power consumption, no startup spinning, etc).  
Title: Dualbooting Pdaxii & Openbsd
Post by: ZDevil on August 31, 2007, 11:47:04 pm
Just wanna add:
The default installation of OpenBSD gives you everything:  the base system, X (xorg 7.2), a complete toolchain, and a complete man page set.

So perhaps one possibilitiy is to split up the files and put them in different partitions on different media (NAND & SD, for example). I guess this is possible, because the distribution set comes as several standalone package tarballs (you can take a look at the download locations of obsd).
The biggest trouble is up to now OpenBSD has no SD write support (a big pity, truly). But it is hoped that the final 4.2 will get SD write support, and then i am quite sure many seasoned hackers here will come up with the workarounds.
Title: Dualbooting Pdaxii & Openbsd
Post by: DaemonsGR on September 04, 2007, 04:03:00 am
I think that after some months in the dust Ill try to make this setup  looks cool!
Thnx

Tasos