Date

Thanks to pip for making me do this, we love you, Pip. DO NOT BOTHER WITH CentOS 5.4 go straight to ubuntu 10.04.2 with TLS. All drivers good. Screen res not fanatastic but more than acceptable. Honestly, use CentOS on servers. ubuntu with encrypted user dir the way to go. If you really need something from Windows, use Wine.

# This goes from zero to CentOS 5.4 and Windows 7.

# With maintaining all the original Dell data partitions and Windows, adding a
# partiton for CentOS and a 190 GB ntfs Data partition that can be shared by both
# Windows 7 and CentOS 4.5

# RESULTANT PARTITIONS:
# Dell Diagnostics - 40MB - /dev/sda1 - fat
# Dell Recovery - 15GB - /dev/sda2 - nfts
# Windows 7 - 145GB - /dev/sda3 - ntfs
# CentOS 4.5 - 145GB - /dev/sda4

# It would be possible to make these sizes different but due to the number of
# partitions already on the drive it makes it more complicated.

# Open you cardboard Dell packaging box and take out the laptop.  Insert the
# the battery and plug in the power.  There is nothing in the documentation
# relating to pre-charging the battery before use so one assumes that the
# batteries are pre-charged (otherwise the manufacturers would be shipping out
# lots of replacements)

# REQUIREMENTS:
#
# 1. Knoppix Live CD - http://www.knoppix.net/
#    Any version will do, version used here, KNOPPIX_V6.2.1CD-2010-01-31-EN.iso
#
# 2. CentOS 5.4 .isos available from your nearest mirror
#    http://sunsite.rediris.es/mirror/CentOS/5.4/isos/i386/
#    It would be possible to use the netinstall iso as well I am sure, however
#    my laptop is run under version control, so I needed the actual source
#    installs, netinstall versions change over time with yum.
#
# 3. A Dell Vostro 3700 laptop with an i3 core.  I would imagine that much of
#    this build may work for the i5 and i7 cores as well.

########################
#  CORRECT SYSTEM CLOCK
########################

# On my system the sytem clock was incorrect from the first power on
# so first thing we do is ensure the system clock is correct.  Mine was set to
# CDT (Dell Austin Texas?)

# Turn on the laptop and immediately press F2 repeated to get you into the Setup
# it is quick so if you miss it power down immediately and do it again, even if
# the "Starting Windows" appears on screen, just hold to power button in and try
# again.

# Set your time if required and should you wish to access any of the Main,
# Advanced, Security or Boot menus, use Shift+cursor (cursor being left, right,
# up and down arrow keys).

# And use the Shift+cursor for navigating other options as well .. maybe F1
# should say something about that, if NumLock is on by default which it is in
# Setup.

# Open DVD tray and insert Knoppix Live CD and close.
# Save any settings changes and reset.

###################
# BOOT KNOPPIX
###################

# PLEASE NOTE THE VERSION OF KNOPPIX USED HERE CANNOT RUN the default X graphical
# interface on the Vostro so we must enter it using failsfe debug

# With the Knoppix Live CD at the ready, turn on the laptop and immediately go
# into the Boot Option by pressing the "F12" key.

# Select the DVD/CD

# At the Knoppix boot: prompt use the following boot parameters:

# boot: failsafe debug -b 3

# Using this boot command will cause Knoppix to pause at various stages in the
# boot process. Just type 'exit' at each shell or Ctrl+d as prompted to move on
# to the next stage. You will know that you are at the final stage when typing
# 'exit' does not do anything just reports "logout" and the shell prompt is:
# root@Microknoppix:/# _

# To run failsafe X type:

init 5

# Now we want to record the original disk partition information before changing
# it.  You never know...
# Select "Start Menu" > Accessories > Root Terminal

############
# INFO ONLY
# Now we are going to decrease the size of the Windows partition
# The Vostro 3700 has 3 partitions on the disk:
# Filesystem        Size       Used
# /dev/sda1          40M        9.0M
# /dev/sda2          15G        3.8G
# /dev/sda3         284G        269G
# /dev/sda4           0          0   System is labelled empty

# These contain the following:
# /dev/sda1 - Dell Diagnostics
# /dev/sda2 - Dell recovery partition (fresh Win 7 copy)
# /dev/sda3 - Main working Windows 7 partition
############


# Now we get the a list of the disk partition values.
# We also save this to a new directory on the main Windows drive so that there
# are records of the original values should you ever need them by issuing the
# following commands:

mount /dev/sda3

# If you have a problem here check your /etc/fstab to ensure the partitions are
# mapped to /dev/sdaX to do that issue the following command "cat /etc/fstab"

# Now we have mounted the partitions the values...

# Making the log directory so we can always see what was what.

mkdir -p /mnt/sda3/dell_vostro_3700
sfdisk -l /dev/sda | tee /mnt/sda3/dell_vostro_3700/original.drive.partition.details.`date +%Y%m%d%H%M%S`.log
umount /dev/sda3

# The output should be similar to:
# Disk /dev/sda 38913 cylinders, 255 heads..... blah blah
# ...
#    Device  Boot  Start     End   #cyls    #blocks   Id    System
#/dev/sda1             0+      4       5-     40131   de    Dell Utility
#/dev/sda2             5+   1917-   1913-  15360000   7     HPFS/NTFS
#/dev/sda3          1917+  38913-  36996- 297169240   7     HPFS/NTFS
#/dev/sda4             0       0       0          0   0     Empty

# Now we are going to resize

# Start Menu > Preferences > GParted
# Right click on /dev/sda3 on the list > Resize/Move and set the new size value
# to what you want it to be e.g 290204 MB to 145000 MB
# Now click in the Free space following box and it will automatically refresh
# with a new value, leave this value (.e.g 145203) leave Round to cylinders
# ticked.
# Click Resize/Move

# It is now committed as a operation, in the main Gparted windows click on the
# top window menu click Edit > Apply All Operations
# "Are you sure you want to apply ..." Click Apply (or yes) not close
# At the Completed Opeartions window (check all went well) and click Close.

# Start > Menu > Logout > Shutdown.

####################
# CENTOS 5.4 INSTALL
####################

# Reboot laptop with Disk 1 of CentOS 4.5
# At the boot prompt, press <ENTER> to go into the graphical setup
# Click Next at the intro screen
# Select Language, click Next
# Select Keyboard, click Next
# Now at the partitioning screen from the dropdown list select:
# "Use free space on selected drives and create default layout" and click Next.

# This will automagically assign:
#Device        Mount_type      Type    Format    Size    Start   End
#/dev/sda4                   Extended            145204  20403   38913
#  /dev/sda5   /boot         ext3      yes       101     20403   20415
#  /dev/sda6   VolGroup00    LVM PV    yes       145102  20416   38913

# Ensure that "The GRUB boot loader will be installed on /dev/sda" is selected
# Click Add > Label: Windows7 > Device: /dev/sda3 > click OK
# Click Other > click Edit > Label: Dell_normal_boot > Device: /dev/sda2 > click OK
# [Optional] add a boot loader password
# Click next

# Network settings as desired
# Region settings
# root Password
# Desktop type
# On you go......


###############
# WINDOWS 7 BOOT
###############

# When you boot at the CentOS startup screen press any key to enter the boot
# menu and to boot the Vostro in the Dell default mode as it would without
# CentOS having been installed, select Dell_normal_boot and hit <ENTER>

# On the first boot of Windows 7 it will want to check the drive say run in
# Start Windows in Repair mode this is just due to the partition being altered
# Say yes and it just runs chkdsk all good.


##############
# CENTOS WLAN
##############

# Boot into CentOS
# Dell Wireless 1397 WLAN Mini-Card
# Open a terminal
# You will need to plugin an Ethernet connection and be connected to the Internet
# You will also need to allow traffic through the firewall (iptables) if it is
# running...

iptables -A INPUT -i eht1 -j ACCEPT

# PLEASE NOTE THIS IN NOT A RECOMMENDED MANNER OF RUNNING YOUR FIREWALL for the
# WLAN and you should implement a proper ruleset.

# Make a logfile
LOGFILE=/var/log/`date +%Y%m%d%H%M%S`.dell_1397_wlan_mini_card.log

# Make a dir for the necessary software
mkdir -p /usr/local/src/dell_1397_wlan_minicard

# Get your WLAN details
echo "WLAN Details:" | tee $LOGFILE
for BUSID in $(/sbin/lspci | awk '{ IGNORECASE=1 } /net/ { print $1 }'); do /sbin/lspci -s $BUSID -m; /sbin/lspci -s $BUSID -n; done | tee -a $LOGFILE

# Install required compiling dependencies
yum -y install kernel-headers kernel-devel gcc

# Get the broadcom driver software
cd /usr/local/src/dell_1397_wlan_minicard
wget http://www.broadcom.com/docs/linux_sta/hybrid-portsrc-x86_32-v5.60.48.36.tar.gz

# Install
mkdir -p /usr/local/src/hybrid-wl
cd /usr/local/src/hybrid-wl
tar xvfz /usr/local/src/dell_1397_wlan_minicard/hybrid-portsrc-x86_32-v5.60.48.36.tar.gz
chown -R nobody.users /usr/local/src/hybrid-wl

# Rectify bug in the link, depending on your kernel
# /lib/modules/2.6.18-164.el5/build > ../../../usr/src/kernels/2.6.18-164.el5-i686
rm -f /lib/modules/2.6.18-164.el5/build
ln -s /usr/src/kernels/2.6.18-164.15.1.el5-i686 /lib/modules/2.6.18-164.el5/build

# Compile driver module
BUILD_DIR=/usr/local/src/hybrid-wl
cd $BUILD_DIR
cp src/include/typedefs.h src/include/typedefs.h.original

# EDIT THE typedefs.h file MANUALLY as per http://wiki.centos.org/HowTos/Laptops/Wireless/Broadcom

vi +80 src/include/typedefs.h
## comment out block of code beginning at line 80, so it would look like this:
#/*
##ifndef TYPEDEF_BOOL
#typedef  unsigned char  bool;
##endif
#*/

# Save the file :wq

make -C /lib/modules/`uname -r`/build/ M=`pwd`
# Strip it down if you wish
# strip --strip-debug wl.ko

rmmod bcm43xx
rmmod b43
rmmod b43legacy
rmmod ndiswrapper

modprobe ieee80211_crypt_tkip
insmod $BUILD_DIR/wl.ko
service NetworkManager restart
cp -v $BUILD_DIR/wl.ko /lib/modules/`uname -r`/extra/

depmod $(uname -r)
modprobe wl
service NetworkManager restart

echo "# Broadcom WLAN - see http://wiki.centos.org/HowTos/Laptops/Wireless/Broadcom?action=show
blacklist bcm43xx
blacklist ndiswrapper
blacklist b43
blacklist b43legacy" >> /etc/modprobe.d/blacklist

echo "# Broadcom WLAN - see http://wiki.centos.org/HowTos/Laptops/Wireless/Broadcom?action=show
alias eth1 wl" >> /etc/modprobe.conf

echo "# Broadcom WLAN - see http://wiki.centos.org/HowTos/Laptops/Wireless/Broadcom?action=show
alias ieee80211_crypt_tkip ieee80211_crypt_tkip
alias eth1 wl" >> /etc/modprobe.d/modprobe.conf.dist

# Now you can configure and use the Dell 1397 wlan mini-card
# REMEMBER iptables as that rul added will not persist at reboot

# ATTENTION: This driver module is NOT persistent across kernel upgrades
# (i.e. when you update the kernel, and boot the newly installed one, you'll
# have to do this over again). And again, this is why you placed the archive
# contents in /usr/local/src/hybrid-wl and changed the ownership of the
# directory and it's contents.