Sunday, September 30, 2007

FreeBSD - Installation of NanaBSD

Prepare:
1. Transcend industrial 1GB CF
2. CF to IDE card
3. A HDD

Installation:
1. install a new Freebsd 6.2 on the HDD
2. install needed software from ports
3. cd /usr/src/tools/tools/nanobsd
4. mkdir Pkg
5. build packages from installed software
pkg_create -Rb package_name.tgz
6. vi localfile
add following codes
==========================================================
#!/bin/sh -e


# save pointer to packages, there should be $src/Pkg directory
# with packages ready to install
src=$(dirname `realpath $0`)
pkgs="$src/Pkg"

# go to Nano world
cd "$NANO_WORLDDIR"

# start from the beginning
dirs="usr/local tmp/Pkg var/db/pkg"
rm -rf $dirs
mkdir $dirs

trap "umount $pkgs" SIGHUP SIGINT SIGTERM
mount_nullfs -o ro "$pkgs" tmp/Pkg
chroot "$NANO_WORLDDIR" sh -c "cd /tmp/Pkg && pkg_add -vF *"
umount "$pkgs"
rmdir tmp/Pkg
===========================================================
7. edit nanobsd.sh
add customized function
cust_JwW(){
sh /usr/src/tools/tools/nanobsd/localfile
}

8. add config file
vi mynano.conf
transcend 1g
customize_cmd cust_JwW
customize_cmd cust_nobeastie

9. edit FlashDevice.sub
# fdisk da0
******* Working on device /dev/da0 *******
parameters extracted from in-core disklabel are:
cylinders=1985 heads=16 sectors/track=63 (1008 blks/cyl)

ps: 1985x16x63x512 = 1024450560

add above codes in the end of transcend section


transcend 1g|1024m|1024mb)
case $a2 in
122|122mb)
NANO_MEDIASIZE=`expr 1024450560 / 512`
NANO_HEADS=16
NANO_SECTS=63
;;

10. build nanobsd
sh nanobsd.sh -c mynano.conf

11. install nanobsd to CF card
cd /usr/obj/nanobsd.full
dd if=_.disk.full of=/dev/ad0 bs=64k

12. finish. insert the CF to IDE card to the 1st IDE slot and set the CF to master

PS. be careful the device name, da0 or ad0 ad2....