Setting Up FreeBSD on Toshiba Satellite Pro 6100

This page describes the installation of FreeBSD on a Toshiba Satellite Pro 6100 laptop.

Install FreeBSD

Install FreeBSD as told in The FreeBSD Handbook with theses consideration

Disk Partition

This notebook come with single NTFS Windows 2000 parition preinstall. You need to resize that big NTFS partion. The best tool for the task is Mandrake 9.1 install program or ntfsreize in Linux-NTFS Project. I partition the 40GB hardisk of this notebook into 4 partitions.

1. sysid 7 (NTFS) 10GB resized from original NTFS partition
2. sysid 15 (Extended DOS, LBA) 10GB DOS Entended partition for DOS/Data/Linux
3. sysid 165 (FreeBSD/NetBSD/386BSD) 10 GB FreeBSD 4.x
4. sysid 165 (FreeBSD/NetBSD/386BSD) 10 GB FreeBSD 5.x

It is the good idea to backup NTFS partition because if you use Toshiba Recovery CD to restore NTFS partition, it will repartition your hard disk to the original 40GB NTFS.

The command "dd if=/dev/ad0s1 bs=512 | gzip -c > ad0s1_backup.gz" is fine for this work. To get better compression ratio, this tip from g4u ("ghost for unix") is helpful.

Effectively, you just fill up the disk's unused blocks with zero-bytes. Open file for writing, stuff in 0-bytes until the disk is full, then close the file and remove it. The result is that all unused blocks were used by the file, and filled with data that g4u can then compress easily. Usually the operating system will just mark the blocks as unused, without changing the actual data content.

Filling unuse NTFS partition with 0 can be done with the small nullfile-1.01.exe which is written by Matthias Jordan <mjordan_at_code_hyphen_fu_dot_de>.
The restore command is "gunzip -dc ads1_backup.gz | dd of=/dev/ad0s1 bs=512".

FreeBSD Partition Organization

(same for FreeBSD 4.x/5.x)
1. / 512 MB
2. swap 512 MB
3. /var 128 MB
4. /tmp 64 MB
5. /usr 7 GB
5. /home the rest ~ 1 GB

Choosing What To Install

Select Developer install , it may reduce the bandwidth need for cvsup the source code.

Post-installation

Unselect everything in "Configure additional network services" except sshd and TCP Extensions

Upgrade to lastest patch set

Install cvsup and run

  1. Install the cvsup-without-gui-16.1f package from your CD-ROM.
  2. Create the cvsup file. You can start by copy the default one from /usr/share/examples/cvsup/cvs-supfile. and modify the file according to you environment This is my cvsup-file
    *default host=cvsup13.FreeBSD.org
    *default base=/usr
    *default prefix=/usr
    *default release=cvs
    *default delete use-rel-suffix
    #*default tag=RELENG_4_8
    *default tag=RELENG_5_2
    *default compress
    src-all
    ports-all tag=.
    doc-all
    
    Hint: If you don't know which cvsup host to use, try the port /usr/ports/sysutils/fastest_cvsup.
  3. Make the directory /usr/sup and put the refuse file there to ignore unused file. This is my refuse
    doc/es*
    doc/ja*
    doc/ru*
    doc/zh*
    doc/fr*
    doc/de*
    doc/it*
    doc/pl*
    doc/pt*
    doc/el*
    doc/sr*
    doc/nl*
    doc/no*
    ports/chinese*
    ports/german*
    ports/japanese*
    ports/korean*
    ports/russian*
    ports/vietnamese*
    ports/portuguese*
    src/share/doc/es*
    src/share/doc/ja*
    src/share/doc/ru*
    src/share/doc/zh*
    src/share/doc/fr*
    
  4. Run "cvsup -g -L2 path_to_your_cvsup-file" and wait

Rebuild your system

  1. Run mergemaster -a and check the files left in /var/tmp/tmproot "find /var/tmp/tmproot -type f" may be helpful. Select the one that you want to replace your old version. You can remove unused files later ( you may need to run "chflags noschg temproot/var/empty/" to remove the system immutable flag on "empty" folder before you can delete it).
  2. Edit /etc/make.conf (4.8) or /etc/make.conf (5.2) ( copy the file from /etc/default/make.conf ). At least make sure that CPU_TYPE is set correctly. See the comment in make.conf for more detail. I will show only the option that I had changed. I don't want FORTRAN ,Objective C ,UUCP , LPR (I use LPRng) and ISDN.

    FreeBSD 4.8

    CPUTYPE=i686
    CFLAGS= -O -pipe
    CFLAGS+=-malign-loops=4 -malign-jumps=4 -malign-functions=4
    
    # To avoid building various parts of the base system:
    NO_FORTRAN=	true	# do not build g77 and related libraries
    NO_I4B=	true	# do not build isdn4bsd package
    NO_LPR=	true	# do not build lpr and related programs
    NO_OBJC=	true	# do not build Objective C support
    NOUUCP=	true	# do not build uucp related programs
    IPFW2=yes	    # Use IPFW2
    

    FreeBSD 5.2

    CPUTYPE=p4
    CFLAGS=-O -pipe
    CXXFLAGS+= -fmemoize-lookups -fsave-memoized
    PERL_VER=5.6.1
    PERL_VERSION=5.6.1
    PERL_ARCH=mach
    NOPERL=yo
    NO_PERL=yo
    NO_PERL_WRAPPER=yo
    
    #NO_FORTRAN=    true #Need by ImageMagic
    NO_I4B=        true
    NO_IPFILTER=   true
    NO_LPR=        true
    NO_OBJC=       true
    NO_KERBEROS=   true
                                                                                                                                                           
    #Port specific parameters
    A4= true
    WITHOUT_CUPS= yes
    WITH_GHOSTSCRIPT_AFPL= yes
    WITH_GTK2= yes
    WITH_LIBMAP=yes
    
  3. Reconfig your kernel (read the handbook)
    I Remove unused devices and change some options. You can see my kernel configureation 4.8 or 5.2. The following is only the outline option that I want to mention.
    cpu             I686_CPU
    ident           SATELLITE
    maxusers        0
    
    options         CPU_ENABLE_SSE
    options         CPU_FASTER_5X86_FPU
    options         NO_F00F_HACK
    options         USER_LDT    
    options         VESA
    
    pseudo-device   splash          #Need for slash screen
    options         SC_PIXEL_MODE   #Need for 100x37 text mode
    
    options         IPFIREWALL
    options         IPDIVERT
    options         IPFIREWALL_DEFAULT_TO_ACCEPT
    options         IPFIREWALL_VERBOSE
    options         IPFIREWALL_VERBOSE_LIMIT=100
    options         DUMMYNET
    #options         IPFW2   		#Don't need for FreeBSD 5.x
    
    Don't worry about the device that you comment out. FreeBSD compiles those device drivers as modules and you can later load them with kldload or put their name in /boot/loader.conf to load at boot time.
    Go to /usr/src/sys/i386/conf , make the symbolic link to your kernel configuration.
  4. Build and install your kernel and the system (read the handbook)
    For me , it is:
        make buildkernel KERNCONF="SATELLITE"
        make installkernel
        mergemaster -ar
        make -j4 buildworld
        shutdown now
        make installworld
    
  5. Remove old files left from previous version.
    If you edit make.conf to skip some programs such as uucp, the files are not deleted by make installworld. You need to find and remove them WITH CAUTION. The command "find dir \! \( -newer /kernel \) -print" where dir are /usr/bin,/usr/sbin,/bin,/sbin ,/usr/lib ,/usr/libexec and /etc may help you to locate these files.

Harden up your system

At this point, you may want to make your system harder to hack (I don't say hackproof -- after read some of hacking story -- I thought that it is impossible for me to prevent those hackers). There are a lot of documents out there in the internet. I will show you some that I think it is good to read.
  1. FreeBSD Security HOW-TO
  2. Jason Lam - Securing MySQL server on FreeBSD 4.5
  3. A FreeBSD 4.7-RELEASE Operating System Security Checklist
  4. man security
  5. man tuning
  6. BSD in O'Reilly Network OnLamb
  7. Documenting security issues in FreeBSD and the FreeBSD Ports Collection

Install ports

At this point the machine is ready to install the application software. The following list is the original list of softwares I have installed on my machine.
  1. shells/bash2 -- My favorite shell
  2. x11/XFree86-4
  3. x11/nvidia-driver
    Use version 1.0-3203 because the current (1.0.6113) has a problem with SoftEDIDs in Both 4.x and 5.x.
    To role back to older version:

    FreeBSD 4.x

    (1) Edit /usr/ports/x11/nvidia-drive/Makefile, change the lines
      
    	PORTVERSION=1.0.4365 
    	MASTER_SITES=   http://download.nvidia.com/freebsd/1.0-4365/ \ 
    	DISTNAME=NVIDIA-FreeBSD-x86-${PORTVERSION:S/0./0-/} 	
        -->
    	PORTVERSION=1.0.3203
    	MASTER_SITES=   http://download.nvidia.com/freebsd/1.0-3203/ \
    	DISTNAME=NVIDIA_FreeBSD-${PORTVERSION:S/0./0-/}
    	
    (2) Edit /usr/ports/x11/nvidia-driver/distfile, change
            MD5 (NVIDIA-FreeBSD-x86-1.0-4365.tar.gz) = e14d9f2668746ee4d8b47e1c9dbc78af
        -->
            MD5 (NVIDIA_FreeBSD-1.0-3203.tar.gz) = b982db9e898a0f3a46c2bf9d15c320d2 
    	

    FreeBSD 5.x

    You need patch files to make 3203 compilable in 5.x. The last nvidia-driver version of 3203 that I found is the version that distribute with FreeBSD 5.1.
    To got this version,you need to modify your cvs sup file for example.
    	    #ports-all tag=.
    	    ports-x11 tag=RELEASE_5_1_0
    	
    Don't forget to update your ports tree after install the nvidia-driver port to the current version.
    Anyways, If you don't have a time ,you can get this 3203_1 version from this site(nvidia-driver-3203_1)
    Put it in your port tree and install the port.

     

  4. sysutils/LPRng -- My printing system
    LPRng need ghostscript-afpl, so it is better to install LPRng before gnome2 which need any ghostscript but install ghostscript (standard) by default. If you install gnome2 first , you may end up with 2 versions of ghostscript.
  5. print/ifhp -- HP Print filter for LPRng
  6. sysutils/LPRngTool -- LPRng configuration tool
    Some tools in LPRng need printcap in /etc but some expect it in /usr/local/etc. So, choose one and make symbolic link to another
  7. x11/gnome2 -- My favorite desktop environment
    Note: I don't need gdm , so I remove the references to gdm in x11/gnome2/Makefile before install x11/gnome2 port.
  8. www/mozilla-gtk2 -- The web browser and more
  9. net/ethereal -- Package sniffer
    Note: use "make -D NOSNMP install clean" to prevent installation of SNMP module.
  10. net/tightvnc -- I need to connect to remote Win2K
  11. security/sudo -- A handy tools, if you don't want to be root all the time
  12. multimedia/mplayer -- My DVD/VCD player
    Don't forget to add yourself to "operator" group.Only root and operator are allow to access cdrom without mount command.
  13. multimedia/xmms -- My MP3 player
  14. print/acroread -- Linux acrobat reader
  15. editor/Abiword2 -- Good enought word processor,Star Office is too big for me
  16. math/gnumeric2 -- Good enought spreadsheet
  17. graphics/gqview-devel -- Image viewer
  18. www/plugger -- Handy tools for web browsing
  19. www/wget -- My downloader program
  20. security/nmap -- A handy tool for network admin
  21. www/apache+modssl -- For testing the php code
  22. database/mysql323-server -- For testing the php code
  23. database/postgresql7 -- Slower than mysql but it is the real DBMS
  24. sysutil/portupgrade -- Make you stay current
  25. www/lynx-ssl -- If you want to see the web but don't want to start X window
  26. lang/php4 -- php4 now include mod_php4 Options for 4.3.3RC1 - bcmath,bzip2,ctype,curl,gd,mcrypt,mhash,overload,pcre, posix,postgresql,session,sybase-ct,tokenizer,xml,zlib
  27. net/samba -- I need samba because not everyone in my network happy with Unix
  28. devel/gnomevfs-extras -- Use nautilus to browse samba share with smb://server/ syntax
  29. ftp/curl -- My php4 installation need curl
  30. graphics/gimp-devel -- Image editor
  31. textproc/htdig -- Full text search for my local document.
  32. sysutil/lsof -- Handy tool for administrator
  33. editor/vim
  34. security/mcryot
    The current port is marked as broken but you can workaround by
    Comment out the line BROKEN,BUILD_DEPENDS and pre-configure: (and the following cd line) in Makefile , then make install clean as usual
  35. www/flashpluginwrapper -- Linux flash plugin
  36. net/ctrace -- Allow you to traceroute with TCP or UDP in addition to ICMP
  37. math/gcalctool -- Default gnome calculator does not have base conversion. This one has.

Want to see my entire packages list as of 2004/02/14 ?. Click here.

Note:
  1. there may be a lot more packages actually install on the machine becase of the ports dependency.
  2. There is a problem with gnome2 and Ctrl+Atl+Fn keys that system console (sc) driver use for switch between virtual terminal. gnome2 intercepts those keys, there for sc will never see the keys.
    I can't find the methods to make gnome2 ignore the keys,so I write the small program vtswitch.c that can switch the virtual terminal and assign the hot key to activate the program. The program need root permission to run, you may need to set uid bit this program or use sudo to run it as root.
    See my Notebook Diary @ 2004-01-02 for more details.
  3. Some port need to recompile , if you upgrade your FreeBSD from 5.1 to 5.2 (such as some library of gnome2). For exmaple nautilus2 can not run due to some library need to be re-compile. the command portupgrade -iRf nautilus2, help you to find and recompile those ports.

Local setting

There are some small changes I make to this notebook to make my life easier.
  1. Edit /etc/motd to remove the motd message. Anyways, If you want to remove motd entirely don't forget to add update_motd=NO to your /etc/rc.conf.
  2. Edit /etc/ssh/ssh_config to use password authentication first. I know this is discouraged by security experts, but I like it. So, I add the following line to your /etc/ssh/ssh_config.
    PreferredAuthentications password,publickey,keyboard-interactive,hostbased
    
    Note: when you use scp or ssh to remote host , don't forget -C option to compress the data.
  3. Put moused.sh to /usr/local/etc/rc.d to allow my Satellite Pro 6100 to use both AccuPoint and USB mouse simultaneously. The moused will take care of AccuPoint while usbd wiil take care of USB mouse. I also put the "vidcontrol -m on" to allow me to use mouse to copy/paste in text mode
    #!/bin/sh 
    
    case "$1" in
            start)
                    /usr/sbin/moused -3 -p /dev/psm0 -I /var/run/moused_psm.pid
                    vidcontrol -m on
                    ;;
            stop)
                    kill -9 `cat /var/run/moused_psm.pid`
                    ;;
            *)
                    echo ""
                    echo "Usage: `basename $0` { start | stop }"
                    echo ""
                    exit 64
                    ;;
    esac
    
  4. Add sound.sh to /usr/local/etc/rc.d to load the sound card driver The Satellite Pro 6100 come with Intel 82801CA (ICH3) which use ich driver
    SOUND_DRV=ich
    case "$1" in
            start)
                    echo ""
                    /sbin/kldload snd_$SOUND_DRV
                    ;;
            stop)
                    /sbin/kldunload snd_$SOUND_DRV
                    ;;
            *)
                    echo ""
    				echo "Usage: `basename $0` { start | stop }"
                    echo ""
                    exit 64
                    ;;
    esac
    
  5. Also add synclock.sh to reset the clock when the machine startup The script also has the code to check the present of a network connection. It will try to syncronize to NTPD server only when there is a connection.
    #!/bin/sh
    
    # start
    if [ "x$1" = "x" -o "x$1" = "xstart" ]; then
    
    ROUTE=/sbin/route
    NTPDATE=/usr/sbin/ntpdate
    GREP=/usr/bin/grep
    AWK=/usr/bin/awk
    PING=/sbin/ping
    ntpd="192.5.41.41 132.163.4.102 129.6.15.28"
    #ntpd="132.163.4.102 129.6.15.28 128.138.140.44 137.189.6.18 165.21.110.7 63.149.208.50 216.200.93.8 205.188.185.33"
    gateway=`$ROUTE -n get default | $GREP gateway | $AWK -F":" '{print $2}' `;
    if [ "X$gateway" = "X" ]
    then
       echo "No gateway found"
       exit 1
    fi
    
    #Ping gateway
    $PING -c 1 -t 1 -q $gateway 2>&1 > /dev/null
    if [ $? -ne 0 ]
    then
      echo "Can not reach gateway [$gateway]"
      exit 2
    fi
    
    $NTPDATE -s $ntpd
    fi
    
  6. Modify /etc/rc.conf
    allscreens_flags line make the console run in 100x37 mode.
    Don't forget to compile your kernel with VESA and SC_PIXEL_MODE support
    pccard_ifconfig line is set to NO to prevent wireless network card to be loaded at start up
    allscreens_flags="-g 100x37 VESA_800x600"
    apm_enable="YES"
    apmd_enable="YES"
    check_quotas="NO"
    defaultrouter="192.168.0.254"
    hostname="satellite.net0.intranet"
    ifconfig_fxp0="inet 192.168.0.11  netmask 255.255.255.0"
    inetd_enable="NO"
    kern_securelevel_enable="NO"
    pccard_ifconfig="NO"
    sendmail_enable="NO"
    sshd_enable="YES"
    usbd_enable="YES"
    linux_enable="YES"
    syslogd_flags="-s -s"
    
  7. /etc/sysctl.conf
    kern.ipc.shmmax=67108864
    kern.ipc.shmall=32768
    hw.snd.pcm0.vchans=4
    hw.snd.maxautovchans=4
    kern.coredump=0
    #USB Floppy
    #kern.cam.da.no_6_byte=1  #Remove for FreeBSD 5.x
    #NVIDIA
    hw.nvidia.registry.SoftEDIDs=0
    hw.nvidia.registry.EnableAGPFW=1
    hw.nvidia.registry.Mobile=2
    
    The kern.cam.da.no_6_byte allow me to read from USB Floppy but not write. DO NOT mount your USB Floppy disk with rw, it can break your system.

  8. Install splash screen
    To install splash screen
  9. Add dos,ntfs partition to /etc/fstab

    FreeBSD 5.x

    # Device                Mountpoint      FStype  Options         Dump    Pass#
    /dev/ad0s3b             none            swap    sw              0       0
    /dev/ad0s4b             none            swap    sw              0       0
    proc                    /proc           procfs  rw              0       0
    /dev/ad0s4a             /               ufs     rw,noatime      1       1
    /dev/ad0s4g             /home           ufs     rw,noatime      2       2
    /dev/ad0s4e             /tmp            ufs     rw,noatime      2       2
    /dev/ad0s4f             /usr            ufs     rw,noatime      2       2
    /dev/ad0s4d             /var            ufs     rw,noatime      2       2
    /dev/acd0               /cdrom          cd9660  ro,noauto       0       0
    /dev/ad0s3a             /fbsd4          ufs     rw,noatime      3       3
    /dev/ad0s3h             /fbsd4/home     ufs     rw,noatime      4       4
    /dev/ad0s3f             /fbsd4/tmp      ufs     rw,noatime      4       4
    /dev/ad0s3g             /fbsd4/usr      ufs     rw,noatime      4       4
    /dev/ad0s3e             /fbsd4/var      ufs     rw,noatime      4       4
    linproc                 /linproc        linprocfs rw            0       0
    /dev/ad0s1		/dos_c		ntfs	ro,noauto	0	0
    #Extended DOS  partition ( 2 logical drives )
    /dev/da0s5		/dos_d		msdos	rw,noauto 	0 	0
    /dev/da0s6		/dos_e		ntfs 	ro,noauto	0	0			
    

    FreeBSD 4.x

    # Device                Mountpoint      FStype  Options         Dump    Pass#
    /dev/ad0s3b             none            swap    sw              0       0
    /dev/ad0s4b             none            swap    sw              0       0
    proc                    /proc           procfs  rw              0       0
    /dev/ad0s3a             /               ufs     rw,noatime      1       1
    /dev/ad0s3g             /home           ufs     rw,noatime      2       2
    /dev/ad0s3e             /tmp            ufs     rw,noatime      2       2
    /dev/ad0s3f             /usr            ufs     rw,noatime      2       2
    /dev/ad0s3d             /var            ufs     rw,noatime      2       2
    /dev/acd0               /cdrom          cd9660  ro,noauto       0       0
    linproc                 /linproc        linprocfs rw            0       0
    /dev/ad0s1              /dos_c          ntfs    ro,noauto       0       0
    #Extended DOS  partition ( 2 logical drives )
    /dev/da0s5              /dos_d          msdos   rw,noauto       0       0
    /dev/da0s6              /dos_e          ntfs    ro,noauto       0       0
    
  10. Change gnome desktop themes/background/splash
    This is my current desktop. The Background image was taken from NASA Astronomy Picture of the Day.

    GTK theme is standard Metal theme. meta-city theme is My own theme.

    I don't like gnome 2.2 splash screen, so I change it to the obi_chuck as in FreeBSD splash screen. To install new splash screen, just replace /usr/X11R6/share/gnome/pixmaps/splash/gnome-splash.png with a new splash image.

Add Thai langage support

X11 has already support Thai language. All you need is Thai fonts and a program to switch keyboard layout. Both are already exists on the Internet.

Keyboard

There are 2 ways to handle Thai keyboard in X11, xkb extension and xmodmap. Both have there pros and cons.
xkb
xkb is a X11 standard. It already has Thai keyboard layout, just edit your XFree86 configiuration file and add the following options in Section "InputDevice"
    Option "XkbRules"   "xfree86"
    Option "XkbModel"   "pc101"
    Option "XkbLayout" "th"
    Option "XkbOptions"        "grp:ctrl_shift_toggle,grp_led:scroll"
The problem with xkb is that, you need to run the application in Thai locale (which is not exists in FreeBSD). Otherwise, X11 keyboard to string such as XLookupString will not return Thai string, so some applications such as xedit,terminal emulator will ignore Thai input.
Anyways, Mozilla seems to able to handle Thai input. If you want to use Thai input with mozilla, this your only choice.
xmodmap
xmodmap is an old X11 standard. I can not find any Thai keyboard modmap that map thai keyboard to TIS620 ascii code. Therefore, I wrote one myself. You can download xmodmap.th and Thai fonts from this site. You also need an application to switch the keyboard layout. If gnome is your Window Manager of choice, the "Keyboard Layout Switcher" applet is very good at this work. Another step to make Thai input workable is to set your LC_ALL environment to "en_US.ISO8859-1".

Fonts

Just download and install them as another X11 font and make your XFree86 point to that directory. such as
Section "Files"
    ...
    FontPath   "/usr/local/thai/fonts/iso8859-11/"
    FontPath   "/usr/local/thai/fonts/x11-fonts/"
    FontPath   "/usr/local/thai/fonts/TTF/"
EndSection

You may need fonts.dir (for raster fonts) or fonts.scale (for True Type fonts),fonts.alias . Read X11 manual about these files or just copy one from standard X11 font directory and edit it. If you need mine , get them from above link. I got all Thai fonts from Linux TLE.
Note: Font encoding for Thai is iso8859-11 but most applications may need the older encodings of tis620-0,tis620-2 or tis620.2533-1.

Gnome

To add TTF Thai font to gnome system. I need to do the following steps There is also gnome thai menu,text, ... ,etc from NECTC Linux TLE, but I found no use of them.

Thai Word Break

This is a hardest part no application out there except Star/Open office and NECTEC OfficeTLE that support Thai word break. If you need Thai office suit try to get them from Open TLE Project. Beware, don't try to download them in Thai office hour (8:00am to 16:00pm GMT+7).
If you want to write your own application, download libinthai. I don't write it and never use it. Go to this page if you need help.

The document theme copy from FreeBSD Handbook
For questions about this documentation, e-mail <cws@miraclenet.co.th>
Last update : $Id: setup.html,v 1.24 2004/12/02 00:32:17 cws Exp $
Chatchawan Wongsiriprasert