the current problems (pros/cons)
the pros.
i know how to use debian/ubuntu content onto the live
cds system. xorg, etc.
i know where to trim un-need files.
the cons
i cant mount a cd using the current kernel and initial ram-disk
this main an largest problem i have to be able
to mount the cdimage and some point preferably /cdrom
once the cdrom is mounted then i can mount the squashfs images.
first thing build a kernel with the squasfs patches applied.
Saturday, August 27, 2005
Thursday, June 02, 2005
after a long hiatus
more about xorg.
xorg makes decision about what driver to load
based on doing a scan of the pci bus.
goal: write a script that calls scanpci
parses the vendor and device tags
if it find a recognized combination
it then creates an xorg.conf file if
it fails to do so the scrip should
say create vesa mode xorg.conf or even
just die and not exec xorg.
if (vendor and device)
make /etc/xorg.conf
else
make vesa based /etc/xorg.conf
exec startx
this would be under a specific user that
is not root!
this same user would have to have correct
dot files:
.xinitrc
.xserverrc
the .xinitrc is where the fun would begin!
parse the output of scanpci would be easy.
but i would need to understand the structure
of the /etc/xorg.conf file well enough to
add/replace the sections to say. what drive
to start and what modeline.
what are the sections of xorg.conf file:
1) Files
2) ServerFlags
3) InputDevices
4) Monitor
5) Modes
6) Device
7) Screen
8) ServerLayout
Files would be the fonts and drivers, i am guessing
but the locations would be fixed this is not
Server Flags i dont know what these would need to be.
Input Devices again this would be fixed and would stay
fixed this distro would run for one type of machine.
the idea would be this there wold a xorg.conf for
a type box in production lets say all the boxen
where of type foo-nvidia-psaux-2005.txt
that is a foo box with all the same kind of nvidia driver
all using psaux as the mouse device that were in production
in 2005 or some other unique identifer. but for testing
there was somethig like foo-vmware-psaxu-2005.txt this would
be a config for vmware so testing could be done on vmware
or qemu or uml. something like that. there would be little
or no shell script it would be
if vendor == someid and device == someide then
cp foo-nvidia-psaux-2005.txt /etc/xorg.conf
the distory
would have all the files
xorg makes decision about what driver to load
based on doing a scan of the pci bus.
goal: write a script that calls scanpci
parses the vendor and device tags
if it find a recognized combination
it then creates an xorg.conf file if
it fails to do so the scrip should
say create vesa mode xorg.conf or even
just die and not exec xorg.
if (vendor and device)
make /etc/xorg.conf
else
make vesa based /etc/xorg.conf
exec startx
this would be under a specific user that
is not root!
this same user would have to have correct
dot files:
.xinitrc
.xserverrc
the .xinitrc is where the fun would begin!
parse the output of scanpci would be easy.
but i would need to understand the structure
of the /etc/xorg.conf file well enough to
add/replace the sections to say. what drive
to start and what modeline.
what are the sections of xorg.conf file:
1) Files
2) ServerFlags
3) InputDevices
4) Monitor
5) Modes
6) Device
7) Screen
8) ServerLayout
Files would be the fonts and drivers, i am guessing
but the locations would be fixed this is not
Server Flags i dont know what these would need to be.
Input Devices again this would be fixed and would stay
fixed this distro would run for one type of machine.
the idea would be this there wold a xorg.conf for
a type box in production lets say all the boxen
where of type foo-nvidia-psaux-2005.txt
that is a foo box with all the same kind of nvidia driver
all using psaux as the mouse device that were in production
in 2005 or some other unique identifer. but for testing
there was somethig like foo-vmware-psaxu-2005.txt this would
be a config for vmware so testing could be done on vmware
or qemu or uml. something like that. there would be little
or no shell script it would be
if vendor == someid and device == someide then
cp foo-nvidia-psaux-2005.txt /etc/xorg.conf
the distory
would have all the files
Sunday, May 01, 2005
http://www15.big.or.jp/~yamamori/sun/tech-linux-2/index_e.html
http://www15.big.or.jp/~yamamori/sun/tech-linux-2/index_e.html
good pointers about single user mode.
good pointers about single user mode.
Wednesday, April 27, 2005
initial ramdisk howto i found
http://inferno.slug.org/lfs-hints/initrd.txt
TITLE: initrd for LFS
LFS VERSION: any
AUTHOR: Jim Gifford
SYNOPSIS:
How to setup initrd for LFS.
HINT:
$Revision: 1.8 $
Introduction to Initial RAMDisk
This hint will help you configure an LFS system for Initial RAMDisk.
Which will allow you to add modules at start-up instead of compiling them
into the kernel.
The script that is enclosed works with SCSI and USB modules only. IDE
devices are recommened to be built-in the kernel. The script will
auto-detect all SCSI and USB modules and add them to the initial ramdisk.
It will also detect the root from the fstab file
---
Assumptions Made in this document
I have made the following assumptions in this document.
Files have been downloaded.
---
Kernel Configuration
You will need to make sure the following items are configured
in your kernel. With out these, the initrd will not work.
Block Devices
Select Loopback Device Support this can be a module
or built-in.
Select RAM Disk Support this needs to be compiled as
built-in or the initrd will not show up.
Set Default RAM Disk size is 4096 which is the default
Select Initial RAM Disk (initrd) support needs be selected.
---
Needed File System Changes
You will need to create a directory for initrd to use.
The default one that is looked for is /initrd.
To Create this directory use mkdir /initrd
Another change that needs to be made is due to a bug
in busybox itself.
You will need to create a symlink to init and call it
linuxrc
cd /sbin
ln -sf init linuxrc
---
Needed Static Modules
In order for the initrd to work properly during boot up
you will need to create to static programs.
The first one being bash.
busybox
----
Busybox has a Config.h file that needs the following options
enabled to enable them remove the //
#define BB_INSMOD
#define BB_FEATURE_SH_STANDALONE_SHELL
You can configure the rest as you need, but remember have at
least the following enabled to make initrd to work properly.
#define BB_ASH
#define BB_CHROOT
#define BB_ECHO
#define BB_INSMOD
#define BB_MKDIR
#define BB_MODPROBE
#define BB_MOUNT
#define BB_PIVOT_ROOT
#define BB_UMOUNT
To create a static version of bash needed for initrd use
the following commands.
cd /usr/src
tar zxvf /usr/src/busybox-*.tar.gz
cd busy*
make LDFLAGS=-static
cp busybox /bin/busybox
Busybox must be in the /bin directory or the links created
during the initrid will fail.
---
mkinitrd
For those who do not want to type out the script. It is
available on my CVS server at
http://www.jg555.com/cvs/cvsweb.cgi/scripts/mkinitrd-lfs
This script will create the initial RAM Disk image file.
By default this script creates /boot/initrd.img
The default location for this file is /sbin
#!/bin/bash
# mkinitrd for LFS by Jim Gifford
# $Revision: 1.8 $
# Variables
TEMP="$1"
KERNEL_VERSION=""
CONFIG_FILE="/etc/modules.conf"
FSTAB="/etc/fstab"
ROOT_DEVICE=$(awk '/^[ \t]*[^#]/ { if ($2 == "/") { print $1; }}' $FSTAB)
SCSI_MODULES="`grep scsi_hostadapter $CONFIG_FILE | grep -v '^[ ]*#' | awk '{ print $3 }'`"
NEEDED_SCSI="scsi_mod sd_mod"
USB_MODULES="`grep usb-controller $CONFIG_FILE | grep -v '^[ ]*#' | awk '{ print $3 }'`"
NEEDED_USB="usbcore"
MODULES="$NEEDED_SCSI $SCSI_MODULES $NEEDED_USB $USB_MODULES"
IMAGE_SIZE=3000
MOUNT_IMAGE="/tmp/initrd.$$"
IMAGE="/tmp/initrd.img-$$"
MOUNT_POINT="/tmp/initrd.mnt-$$"
LINUXRC="$MOUNT_IMAGE/linuxrc"
# Check for initrd Directory
if ! [ -e /initrd ]
then
mkdir /initrd
fi
# Check for RAM Disk Device
if [ -e /dev/.devfsd ]
then
RAM_DEVICE="rd"
else
RAM_DEVICE="ram0"
fi
# Check for input
if [ "$TEMP" == "" ]
then
KERNEL_VERSION="`uname -r`"
else
KERNEL_VERSION="$TEMP"
fi
INITRD="/boot/initrd-$KERNEL_VERSION.img"
if [ "$TEMP" == "-h" ] || [ "$TEMP" == "--h" ] || [ "$TEMP" == "-help" ] || [ "$TEMP" == "--help" ]
then
echo "usage: mkinitrd kernel_version"
echo " : mkinitrd will automatically determin kernel version"
exit 1
fi
# Creating LoopBack Device
dd if=/dev/zero of=$IMAGE bs=1k count=$IMAGE_SIZE 2> /dev/null
for device_number in 0 1 2 3 4 5 6 7 8
do
if losetup /dev/loop$device_number $IMAGE 2>/dev/null
then
break
fi
done
if [ "$device_number" = "8" ]
then
rm -rf $MOUNT_POINT $IMAGE
echo "All of your loopback devices are in use!" >&2
exit 1
fi
LOOP_DEVICE=/dev/loop$device_number
echo y | mke2fs $LOOP_DEVICE $IMAGE_SIZE > /dev/null 2> /dev/null
echo "Using loopback device $LOOP_DEVICE"
mkdir -p $MOUNT_POINT
mount -t ext2 $LOOP_DEVICE $MOUNT_POINT || {
echo "Can't get a loopback device"
exit 1
}
# Creating Directories
mkdir -p $MOUNT_IMAGE
mkdir -p $MOUNT_IMAGE/lib
mkdir -p $MOUNT_IMAGE/bin
mkdir -p $MOUNT_IMAGE/etc
mkdir -p $MOUNT_IMAGE/dev
mkdir -p $MOUNT_IMAGE/proc
ln -s /bin $MOUNT_IMAGE/sbin
rm -rf $MOUNT_POINT/lost+found
# Copying Static Programs
cp -a /bin/busybox $MOUNT_IMAGE/bin/busybox
ln -s /bin/busybox $MOUNT_IMAGE/bin/echo
ln -s /bin/busybox $MOUNT_IMAGE/bin/mount
ln -s /bin/busybox $MOUNT_IMAGE/bin/modprobe
ln -s /bin/busybox $MOUNT_IMAGE/bin/mkdir
ln -s /bin/busybox $MOUNT_IMAGE/bin/sh
ln -s /bin/busybox $MOUNT_IMAGE/bin/umount
ln -s /bin/busybox $MOUNT_IMAGE/bin/insmod
ln -s /bin/busybox $MOUNT_IMAGE/bin/pivot_root
cp -a /etc/fstab $MOUNT_IMAGE/etc/fstab
cp -a /etc/modules.conf $MOUNT_IMAGE/etc/modules.conf
# Copying Modules
for MODULE in $MODULES
do
echo "$MODULE" | {
IFS=':' read module options
module=$module
options=$options
DIR_SEARCH1="`ls -1 /lib/modules/$KERNEL_VERSION/kernel/drivers`"
for DIR_1SEARCH in $DIR_SEARCH1
do
cp /lib/modules/$KERNEL_VERSION/kernel/drivers/$DIR_1SEARCH/$module.o $MOUNT_IMAGE/lib > /dev/null 2>&1
DIR_SEARCH2="`ls -1 /lib/modules/$KERNEL_VERSION/kernel/drivers/$DIR_1SEARCH`"
for DIR_2SEARCH in $DIR_SEARCH2
do
cp /lib/modules/$KERNEL_VERSION/kernel/drivers/$DIR_1SEARCH/$DIR_2SEARCH/$module.o $MOUNT_IMAGE/lib > /dev/null 2>&1
done
done
}
done
for i in console null $RAM_DEVICE tty[1234]
do
cp -a /dev/$i $MOUNT_IMAGE/dev
done
# Creating linuxrc File
echo "#!/bin/sh" > $LINUXRC
echo "" >> $LINUXRC
echo "echo \"Initial RAMDISK Loading Starting...\"" >> $LINUXRC
for MODULE in $MODULES
do
echo "$MODULE" | {
IFS=':' read module
module=$module
echo "Loading module $module"
echo "insmod /lib/$module.o" >> $LINUXRC
}
done
echo "echo \"Initial RAMDISK Loading Completed...\"" >> $LINUXRC
echo "mkdir /new_root" >> $LINUXRC
echo "echo \"Mounting proc...\"" >> $LINUXRC
echo "mount -n -t proc none /proc" >> $LINUXRC
echo "echo 0x0100 > /proc/sys/kernel/real-root-dev" >> $LINUXRC
echo "echo \"Mounting real root dev...\"" >> $LINUXRC
echo "mount -n -o ro $ROOT_DEVICE /new_root" >> $LINUXRC
echo "umount /proc" >> $LINUXRC
echo "cd /new_root" >> $LINUXRC
echo "echo \"Running pivot_root...\"" >> $LINUXRC
echo "pivot_root . initrd" >> $LINUXRC
echo "if [ -c initrd/dev/.devfsd ]" >> $LINUXRC
echo " then" >> $LINUXRC
echo " echo \"Mounting devfs...\"" >> $LINUXRC
echo " mount -n -t devfs none dev" >> $LINUXRC
echo "fi" >> $LINUXRC
echo "if [ \$\$ = 1 ]" >> $LINUXRC
echo " then" >> $LINUXRC
echo " echo \"Running init...\"" >> $LINUXRC
echo " exec chroot . sbin/init dev/console 2>&1" >> $LINUXRC
echo " else" >> $LINUXRC
echo " echo \"Using bug circumvention for busybox...\"" >> $LINUXRC
echo " exec chroot . linuxrc dev/console 2>&1" >> $LINUXRC
echo "fi" >> $LINUXRC
chmod +x $LINUXRC
(cd $MOUNT_IMAGE; tar cf - .) | (cd $MOUNT_POINT; tar xf -)
umount $MOUNT_POINT
losetup -d $LOOP_DEVICE
gzip -9 < $IMAGE > $INITRD
rm -rf $MOUNT_IMAGE $MOUNT_POINT $IMAGE
lilo -v
---
initrd script
The following script needs to placed in /etc/rc.d/init.d.
You will then need to link it to rcsysinit.d.
It is recommended that this script be run right after
mountfs.
To link the script change to the /etc/rc.d/rcsysinit.d
directory and issue the following command.
ln -sf ../init.d/initrd S41initrd
#!/bin/bash
# Begin $rc_base/init.d/initrd
# Based on sysklogd script from LFS-3.1 and earlier.
# Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org
source /etc/sysconfig/rc
source $rc_functions
echo "Clearing Initial RAM Disk..."
if [ -e /initrd/dev/.devfsd ]
then
umount /initrd/dev
fi
umount /initrd
/sbin/blockdev --flushbufs /dev/ram0
# End $rc_base/init.d/initrd
---
For Lilo
In order to use the initrd.img file is to add the
following entry to you lilo.conf file.
initrd=/boot/initrd.img
So your lilo.conf should look something like this.
image=/boot/vmlinuz-2.4.18
label=test
initrd=/boot/initrd-2.4.18.img
read-only
append="root=/dev/ram0 init=/linuxrc rw"
If you are just testing. You should make a separate
entry in lilo.conf. This will still allow you to boot.
---
For Grub
In order to use the initrd.img file is to add the
following entry to you menu.lst file.
initrd /boot/initrd-2.4.18.img
So your menu.lst should look something like this.
title test
root (hd0,1)
kernel /boot/vmlinuz-2.4.18
initrd /boot/initrd-2.4.18.img
---
For Syslinux
In order to use the initrd.img file is to add the
following to syslinux.cfg file.
append root=/dev/ram0 initrd=initrd-2.4.18.img
So your syslinux.cfg should look something like this.
label test
kernel vmlinuz
append root=/dev/ram0 initrd=initrd.img
---
Mail suggestions to giffordj@linkline.com
New Version of this document can be viewed from
http://www.jg555.com/cvs
this looked interesting, i am going to come back and read
a bit more closesly.
TITLE: initrd for LFS
LFS VERSION: any
AUTHOR: Jim Gifford
SYNOPSIS:
How to setup initrd for LFS.
HINT:
$Revision: 1.8 $
Introduction to Initial RAMDisk
This hint will help you configure an LFS system for Initial RAMDisk.
Which will allow you to add modules at start-up instead of compiling them
into the kernel.
The script that is enclosed works with SCSI and USB modules only. IDE
devices are recommened to be built-in the kernel. The script will
auto-detect all SCSI and USB modules and add them to the initial ramdisk.
It will also detect the root from the fstab file
---
Assumptions Made in this document
I have made the following assumptions in this document.
Files have been downloaded.
---
Kernel Configuration
You will need to make sure the following items are configured
in your kernel. With out these, the initrd will not work.
Block Devices
Select Loopback Device Support this can be a module
or built-in.
Select RAM Disk Support this needs to be compiled as
built-in or the initrd will not show up.
Set Default RAM Disk size is 4096 which is the default
Select Initial RAM Disk (initrd) support needs be selected.
---
Needed File System Changes
You will need to create a directory for initrd to use.
The default one that is looked for is /initrd.
To Create this directory use mkdir /initrd
Another change that needs to be made is due to a bug
in busybox itself.
You will need to create a symlink to init and call it
linuxrc
cd /sbin
ln -sf init linuxrc
---
Needed Static Modules
In order for the initrd to work properly during boot up
you will need to create to static programs.
The first one being bash.
busybox
----
Busybox has a Config.h file that needs the following options
enabled to enable them remove the //
#define BB_INSMOD
#define BB_FEATURE_SH_STANDALONE_SHELL
You can configure the rest as you need, but remember have at
least the following enabled to make initrd to work properly.
#define BB_ASH
#define BB_CHROOT
#define BB_ECHO
#define BB_INSMOD
#define BB_MKDIR
#define BB_MODPROBE
#define BB_MOUNT
#define BB_PIVOT_ROOT
#define BB_UMOUNT
To create a static version of bash needed for initrd use
the following commands.
cd /usr/src
tar zxvf /usr/src/busybox-*.tar.gz
cd busy*
make LDFLAGS=-static
cp busybox /bin/busybox
Busybox must be in the /bin directory or the links created
during the initrid will fail.
---
mkinitrd
For those who do not want to type out the script. It is
available on my CVS server at
http://www.jg555.com/cvs/cvsweb.cgi/scripts/mkinitrd-lfs
This script will create the initial RAM Disk image file.
By default this script creates /boot/initrd.img
The default location for this file is /sbin
#!/bin/bash
# mkinitrd for LFS by Jim Gifford
# $Revision: 1.8 $
# Variables
TEMP="$1"
KERNEL_VERSION=""
CONFIG_FILE="/etc/modules.conf"
FSTAB="/etc/fstab"
ROOT_DEVICE=$(awk '/^[ \t]*[^#]/ { if ($2 == "/") { print $1; }}' $FSTAB)
SCSI_MODULES="`grep scsi_hostadapter $CONFIG_FILE | grep -v '^[ ]*#' | awk '{ print $3 }'`"
NEEDED_SCSI="scsi_mod sd_mod"
USB_MODULES="`grep usb-controller $CONFIG_FILE | grep -v '^[ ]*#' | awk '{ print $3 }'`"
NEEDED_USB="usbcore"
MODULES="$NEEDED_SCSI $SCSI_MODULES $NEEDED_USB $USB_MODULES"
IMAGE_SIZE=3000
MOUNT_IMAGE="/tmp/initrd.$$"
IMAGE="/tmp/initrd.img-$$"
MOUNT_POINT="/tmp/initrd.mnt-$$"
LINUXRC="$MOUNT_IMAGE/linuxrc"
# Check for initrd Directory
if ! [ -e /initrd ]
then
mkdir /initrd
fi
# Check for RAM Disk Device
if [ -e /dev/.devfsd ]
then
RAM_DEVICE="rd"
else
RAM_DEVICE="ram0"
fi
# Check for input
if [ "$TEMP" == "" ]
then
KERNEL_VERSION="`uname -r`"
else
KERNEL_VERSION="$TEMP"
fi
INITRD="/boot/initrd-$KERNEL_VERSION.img"
if [ "$TEMP" == "-h" ] || [ "$TEMP" == "--h" ] || [ "$TEMP" == "-help" ] || [ "$TEMP" == "--help" ]
then
echo "usage: mkinitrd kernel_version"
echo " : mkinitrd will automatically determin kernel version"
exit 1
fi
# Creating LoopBack Device
dd if=/dev/zero of=$IMAGE bs=1k count=$IMAGE_SIZE 2> /dev/null
for device_number in 0 1 2 3 4 5 6 7 8
do
if losetup /dev/loop$device_number $IMAGE 2>/dev/null
then
break
fi
done
if [ "$device_number" = "8" ]
then
rm -rf $MOUNT_POINT $IMAGE
echo "All of your loopback devices are in use!" >&2
exit 1
fi
LOOP_DEVICE=/dev/loop$device_number
echo y | mke2fs $LOOP_DEVICE $IMAGE_SIZE > /dev/null 2> /dev/null
echo "Using loopback device $LOOP_DEVICE"
mkdir -p $MOUNT_POINT
mount -t ext2 $LOOP_DEVICE $MOUNT_POINT || {
echo "Can't get a loopback device"
exit 1
}
# Creating Directories
mkdir -p $MOUNT_IMAGE
mkdir -p $MOUNT_IMAGE/lib
mkdir -p $MOUNT_IMAGE/bin
mkdir -p $MOUNT_IMAGE/etc
mkdir -p $MOUNT_IMAGE/dev
mkdir -p $MOUNT_IMAGE/proc
ln -s /bin $MOUNT_IMAGE/sbin
rm -rf $MOUNT_POINT/lost+found
# Copying Static Programs
cp -a /bin/busybox $MOUNT_IMAGE/bin/busybox
ln -s /bin/busybox $MOUNT_IMAGE/bin/echo
ln -s /bin/busybox $MOUNT_IMAGE/bin/mount
ln -s /bin/busybox $MOUNT_IMAGE/bin/modprobe
ln -s /bin/busybox $MOUNT_IMAGE/bin/mkdir
ln -s /bin/busybox $MOUNT_IMAGE/bin/sh
ln -s /bin/busybox $MOUNT_IMAGE/bin/umount
ln -s /bin/busybox $MOUNT_IMAGE/bin/insmod
ln -s /bin/busybox $MOUNT_IMAGE/bin/pivot_root
cp -a /etc/fstab $MOUNT_IMAGE/etc/fstab
cp -a /etc/modules.conf $MOUNT_IMAGE/etc/modules.conf
# Copying Modules
for MODULE in $MODULES
do
echo "$MODULE" | {
IFS=':' read module options
module=$module
options=$options
DIR_SEARCH1="`ls -1 /lib/modules/$KERNEL_VERSION/kernel/drivers`"
for DIR_1SEARCH in $DIR_SEARCH1
do
cp /lib/modules/$KERNEL_VERSION/kernel/drivers/$DIR_1SEARCH/$module.o $MOUNT_IMAGE/lib > /dev/null 2>&1
DIR_SEARCH2="`ls -1 /lib/modules/$KERNEL_VERSION/kernel/drivers/$DIR_1SEARCH`"
for DIR_2SEARCH in $DIR_SEARCH2
do
cp /lib/modules/$KERNEL_VERSION/kernel/drivers/$DIR_1SEARCH/$DIR_2SEARCH/$module.o $MOUNT_IMAGE/lib > /dev/null 2>&1
done
done
}
done
for i in console null $RAM_DEVICE tty[1234]
do
cp -a /dev/$i $MOUNT_IMAGE/dev
done
# Creating linuxrc File
echo "#!/bin/sh" > $LINUXRC
echo "" >> $LINUXRC
echo "echo \"Initial RAMDISK Loading Starting...\"" >> $LINUXRC
for MODULE in $MODULES
do
echo "$MODULE" | {
IFS=':' read module
module=$module
echo "Loading module $module"
echo "insmod /lib/$module.o" >> $LINUXRC
}
done
echo "echo \"Initial RAMDISK Loading Completed...\"" >> $LINUXRC
echo "mkdir /new_root" >> $LINUXRC
echo "echo \"Mounting proc...\"" >> $LINUXRC
echo "mount -n -t proc none /proc" >> $LINUXRC
echo "echo 0x0100 > /proc/sys/kernel/real-root-dev" >> $LINUXRC
echo "echo \"Mounting real root dev...\"" >> $LINUXRC
echo "mount -n -o ro $ROOT_DEVICE /new_root" >> $LINUXRC
echo "umount /proc" >> $LINUXRC
echo "cd /new_root" >> $LINUXRC
echo "echo \"Running pivot_root...\"" >> $LINUXRC
echo "pivot_root . initrd" >> $LINUXRC
echo "if [ -c initrd/dev/.devfsd ]" >> $LINUXRC
echo " then" >> $LINUXRC
echo " echo \"Mounting devfs...\"" >> $LINUXRC
echo " mount -n -t devfs none dev" >> $LINUXRC
echo "fi" >> $LINUXRC
echo "if [ \$\$ = 1 ]" >> $LINUXRC
echo " then" >> $LINUXRC
echo " echo \"Running init...\"" >> $LINUXRC
echo " exec chroot . sbin/init dev/console 2>&1" >> $LINUXRC
echo " else" >> $LINUXRC
echo " echo \"Using bug circumvention for busybox...\"" >> $LINUXRC
echo " exec chroot . linuxrc dev/console 2>&1" >> $LINUXRC
echo "fi" >> $LINUXRC
chmod +x $LINUXRC
(cd $MOUNT_IMAGE; tar cf - .) | (cd $MOUNT_POINT; tar xf -)
umount $MOUNT_POINT
losetup -d $LOOP_DEVICE
gzip -9 < $IMAGE > $INITRD
rm -rf $MOUNT_IMAGE $MOUNT_POINT $IMAGE
lilo -v
---
initrd script
The following script needs to placed in /etc/rc.d/init.d.
You will then need to link it to rcsysinit.d.
It is recommended that this script be run right after
mountfs.
To link the script change to the /etc/rc.d/rcsysinit.d
directory and issue the following command.
ln -sf ../init.d/initrd S41initrd
#!/bin/bash
# Begin $rc_base/init.d/initrd
# Based on sysklogd script from LFS-3.1 and earlier.
# Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org
source /etc/sysconfig/rc
source $rc_functions
echo "Clearing Initial RAM Disk..."
if [ -e /initrd/dev/.devfsd ]
then
umount /initrd/dev
fi
umount /initrd
/sbin/blockdev --flushbufs /dev/ram0
# End $rc_base/init.d/initrd
---
For Lilo
In order to use the initrd.img file is to add the
following entry to you lilo.conf file.
initrd=/boot/initrd.img
So your lilo.conf should look something like this.
image=/boot/vmlinuz-2.4.18
label=test
initrd=/boot/initrd-2.4.18.img
read-only
append="root=/dev/ram0 init=/linuxrc rw"
If you are just testing. You should make a separate
entry in lilo.conf. This will still allow you to boot.
---
For Grub
In order to use the initrd.img file is to add the
following entry to you menu.lst file.
initrd /boot/initrd-2.4.18.img
So your menu.lst should look something like this.
title test
root (hd0,1)
kernel /boot/vmlinuz-2.4.18
initrd /boot/initrd-2.4.18.img
---
For Syslinux
In order to use the initrd.img file is to add the
following to syslinux.cfg file.
append root=/dev/ram0 initrd=initrd-2.4.18.img
So your syslinux.cfg should look something like this.
label test
kernel vmlinuz
append root=/dev/ram0 initrd=initrd.img
---
Mail suggestions to giffordj@linkline.com
New Version of this document can be viewed from
http://www.jg555.com/cvs
this looked interesting, i am going to come back and read
a bit more closesly.
initial ramdisk howto i found
http://inferno.slug.org/lfs-hints/initrd.txt
TITLE: initrd for LFS
LFS VERSION: any
AUTHOR: Jim Gifford
SYNOPSIS:
How to setup initrd for LFS.
HINT:
$Revision: 1.8 $
Introduction to Initial RAMDisk
This hint will help you configure an LFS system for Initial RAMDisk.
Which will allow you to add modules at start-up instead of compiling them
into the kernel.
The script that is enclosed works with SCSI and USB modules only. IDE
devices are recommened to be built-in the kernel. The script will
auto-detect all SCSI and USB modules and add them to the initial ramdisk.
It will also detect the root from the fstab file
---
Assumptions Made in this document
I have made the following assumptions in this document.
Files have been downloaded.
---
Kernel Configuration
You will need to make sure the following items are configured
in your kernel. With out these, the initrd will not work.
Block Devices
Select Loopback Device Support this can be a module
or built-in.
Select RAM Disk Support this needs to be compiled as
built-in or the initrd will not show up.
Set Default RAM Disk size is 4096 which is the default
Select Initial RAM Disk (initrd) support needs be selected.
---
Needed File System Changes
You will need to create a directory for initrd to use.
The default one that is looked for is /initrd.
To Create this directory use mkdir /initrd
Another change that needs to be made is due to a bug
in busybox itself.
You will need to create a symlink to init and call it
linuxrc
cd /sbin
ln -sf init linuxrc
---
Needed Static Modules
In order for the initrd to work properly during boot up
you will need to create to static programs.
The first one being bash.
busybox
----
Busybox has a Config.h file that needs the following options
enabled to enable them remove the //
#define BB_INSMOD
#define BB_FEATURE_SH_STANDALONE_SHELL
You can configure the rest as you need, but remember have at
least the following enabled to make initrd to work properly.
#define BB_ASH
#define BB_CHROOT
#define BB_ECHO
#define BB_INSMOD
#define BB_MKDIR
#define BB_MODPROBE
#define BB_MOUNT
#define BB_PIVOT_ROOT
#define BB_UMOUNT
To create a static version of bash needed for initrd use
the following commands.
cd /usr/src
tar zxvf /usr/src/busybox-*.tar.gz
cd busy*
make LDFLAGS=-static
cp busybox /bin/busybox
Busybox must be in the /bin directory or the links created
during the initrid will fail.
---
mkinitrd
For those who do not want to type out the script. It is
available on my CVS server at
http://www.jg555.com/cvs/cvsweb.cgi/scripts/mkinitrd-lfs
This script will create the initial RAM Disk image file.
By default this script creates /boot/initrd.img
The default location for this file is /sbin
#!/bin/bash
# mkinitrd for LFS by Jim Gifford
# $Revision: 1.8 $
# Variables
TEMP="$1"
KERNEL_VERSION=""
CONFIG_FILE="/etc/modules.conf"
FSTAB="/etc/fstab"
ROOT_DEVICE=$(awk '/^[ \t]*[^#]/ { if ($2 == "/") { print $1; }}' $FSTAB)
SCSI_MODULES="`grep scsi_hostadapter $CONFIG_FILE | grep -v '^[ ]*#' | awk '{ print $3 }'`"
NEEDED_SCSI="scsi_mod sd_mod"
USB_MODULES="`grep usb-controller $CONFIG_FILE | grep -v '^[ ]*#' | awk '{ print $3 }'`"
NEEDED_USB="usbcore"
MODULES="$NEEDED_SCSI $SCSI_MODULES $NEEDED_USB $USB_MODULES"
IMAGE_SIZE=3000
MOUNT_IMAGE="/tmp/initrd.$$"
IMAGE="/tmp/initrd.img-$$"
MOUNT_POINT="/tmp/initrd.mnt-$$"
LINUXRC="$MOUNT_IMAGE/linuxrc"
# Check for initrd Directory
if ! [ -e /initrd ]
then
mkdir /initrd
fi
# Check for RAM Disk Device
if [ -e /dev/.devfsd ]
then
RAM_DEVICE="rd"
else
RAM_DEVICE="ram0"
fi
# Check for input
if [ "$TEMP" == "" ]
then
KERNEL_VERSION="`uname -r`"
else
KERNEL_VERSION="$TEMP"
fi
INITRD="/boot/initrd-$KERNEL_VERSION.img"
if [ "$TEMP" == "-h" ] || [ "$TEMP" == "--h" ] || [ "$TEMP" == "-help" ] || [ "$TEMP" == "--help" ]
then
echo "usage: mkinitrd kernel_version"
echo " : mkinitrd will automatically determin kernel version"
exit 1
fi
# Creating LoopBack Device
dd if=/dev/zero of=$IMAGE bs=1k count=$IMAGE_SIZE 2> /dev/null
for device_number in 0 1 2 3 4 5 6 7 8
do
if losetup /dev/loop$device_number $IMAGE 2>/dev/null
then
break
fi
done
if [ "$device_number" = "8" ]
then
rm -rf $MOUNT_POINT $IMAGE
echo "All of your loopback devices are in use!" >&2
exit 1
fi
LOOP_DEVICE=/dev/loop$device_number
echo y | mke2fs $LOOP_DEVICE $IMAGE_SIZE > /dev/null 2> /dev/null
echo "Using loopback device $LOOP_DEVICE"
mkdir -p $MOUNT_POINT
mount -t ext2 $LOOP_DEVICE $MOUNT_POINT || {
echo "Can't get a loopback device"
exit 1
}
# Creating Directories
mkdir -p $MOUNT_IMAGE
mkdir -p $MOUNT_IMAGE/lib
mkdir -p $MOUNT_IMAGE/bin
mkdir -p $MOUNT_IMAGE/etc
mkdir -p $MOUNT_IMAGE/dev
mkdir -p $MOUNT_IMAGE/proc
ln -s /bin $MOUNT_IMAGE/sbin
rm -rf $MOUNT_POINT/lost+found
# Copying Static Programs
cp -a /bin/busybox $MOUNT_IMAGE/bin/busybox
ln -s /bin/busybox $MOUNT_IMAGE/bin/echo
ln -s /bin/busybox $MOUNT_IMAGE/bin/mount
ln -s /bin/busybox $MOUNT_IMAGE/bin/modprobe
ln -s /bin/busybox $MOUNT_IMAGE/bin/mkdir
ln -s /bin/busybox $MOUNT_IMAGE/bin/sh
ln -s /bin/busybox $MOUNT_IMAGE/bin/umount
ln -s /bin/busybox $MOUNT_IMAGE/bin/insmod
ln -s /bin/busybox $MOUNT_IMAGE/bin/pivot_root
cp -a /etc/fstab $MOUNT_IMAGE/etc/fstab
cp -a /etc/modules.conf $MOUNT_IMAGE/etc/modules.conf
# Copying Modules
for MODULE in $MODULES
do
echo "$MODULE" | {
IFS=':' read module options
module=$module
options=$options
DIR_SEARCH1="`ls -1 /lib/modules/$KERNEL_VERSION/kernel/drivers`"
for DIR_1SEARCH in $DIR_SEARCH1
do
cp /lib/modules/$KERNEL_VERSION/kernel/drivers/$DIR_1SEARCH/$module.o $MOUNT_IMAGE/lib > /dev/null 2>&1
DIR_SEARCH2="`ls -1 /lib/modules/$KERNEL_VERSION/kernel/drivers/$DIR_1SEARCH`"
for DIR_2SEARCH in $DIR_SEARCH2
do
cp /lib/modules/$KERNEL_VERSION/kernel/drivers/$DIR_1SEARCH/$DIR_2SEARCH/$module.o $MOUNT_IMAGE/lib > /dev/null 2>&1
done
done
}
done
for i in console null $RAM_DEVICE tty[1234]
do
cp -a /dev/$i $MOUNT_IMAGE/dev
done
# Creating linuxrc File
echo "#!/bin/sh" > $LINUXRC
echo "" >> $LINUXRC
echo "echo \"Initial RAMDISK Loading Starting...\"" >> $LINUXRC
for MODULE in $MODULES
do
echo "$MODULE" | {
IFS=':' read module
module=$module
echo "Loading module $module"
echo "insmod /lib/$module.o" >> $LINUXRC
}
done
echo "echo \"Initial RAMDISK Loading Completed...\"" >> $LINUXRC
echo "mkdir /new_root" >> $LINUXRC
echo "echo \"Mounting proc...\"" >> $LINUXRC
echo "mount -n -t proc none /proc" >> $LINUXRC
echo "echo 0x0100 > /proc/sys/kernel/real-root-dev" >> $LINUXRC
echo "echo \"Mounting real root dev...\"" >> $LINUXRC
echo "mount -n -o ro $ROOT_DEVICE /new_root" >> $LINUXRC
echo "umount /proc" >> $LINUXRC
echo "cd /new_root" >> $LINUXRC
echo "echo \"Running pivot_root...\"" >> $LINUXRC
echo "pivot_root . initrd" >> $LINUXRC
echo "if [ -c initrd/dev/.devfsd ]" >> $LINUXRC
echo " then" >> $LINUXRC
echo " echo \"Mounting devfs...\"" >> $LINUXRC
echo " mount -n -t devfs none dev" >> $LINUXRC
echo "fi" >> $LINUXRC
echo "if [ \$\$ = 1 ]" >> $LINUXRC
echo " then" >> $LINUXRC
echo " echo \"Running init...\"" >> $LINUXRC
echo " exec chroot . sbin/init dev/console 2>&1" >> $LINUXRC
echo " else" >> $LINUXRC
echo " echo \"Using bug circumvention for busybox...\"" >> $LINUXRC
echo " exec chroot . linuxrc dev/console 2>&1" >> $LINUXRC
echo "fi" >> $LINUXRC
chmod +x $LINUXRC
(cd $MOUNT_IMAGE; tar cf - .) | (cd $MOUNT_POINT; tar xf -)
umount $MOUNT_POINT
losetup -d $LOOP_DEVICE
gzip -9 < $IMAGE > $INITRD
rm -rf $MOUNT_IMAGE $MOUNT_POINT $IMAGE
lilo -v
---
initrd script
The following script needs to placed in /etc/rc.d/init.d.
You will then need to link it to rcsysinit.d.
It is recommended that this script be run right after
mountfs.
To link the script change to the /etc/rc.d/rcsysinit.d
directory and issue the following command.
ln -sf ../init.d/initrd S41initrd
#!/bin/bash
# Begin $rc_base/init.d/initrd
# Based on sysklogd script from LFS-3.1 and earlier.
# Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org
source /etc/sysconfig/rc
source $rc_functions
echo "Clearing Initial RAM Disk..."
if [ -e /initrd/dev/.devfsd ]
then
umount /initrd/dev
fi
umount /initrd
/sbin/blockdev --flushbufs /dev/ram0
# End $rc_base/init.d/initrd
---
For Lilo
In order to use the initrd.img file is to add the
following entry to you lilo.conf file.
initrd=/boot/initrd.img
So your lilo.conf should look something like this.
image=/boot/vmlinuz-2.4.18
label=test
initrd=/boot/initrd-2.4.18.img
read-only
append="root=/dev/ram0 init=/linuxrc rw"
If you are just testing. You should make a separate
entry in lilo.conf. This will still allow you to boot.
---
For Grub
In order to use the initrd.img file is to add the
following entry to you menu.lst file.
initrd /boot/initrd-2.4.18.img
So your menu.lst should look something like this.
title test
root (hd0,1)
kernel /boot/vmlinuz-2.4.18
initrd /boot/initrd-2.4.18.img
---
For Syslinux
In order to use the initrd.img file is to add the
following to syslinux.cfg file.
append root=/dev/ram0 initrd=initrd-2.4.18.img
So your syslinux.cfg should look something like this.
label test
kernel vmlinuz
append root=/dev/ram0 initrd=initrd.img
---
Mail suggestions to giffordj@linkline.com
New Version of this document can be viewed from
http://www.jg555.com/cvs
this looked interesting, i am going to come back and read
a bit more closesly.
TITLE: initrd for LFS
LFS VERSION: any
AUTHOR: Jim Gifford
SYNOPSIS:
How to setup initrd for LFS.
HINT:
$Revision: 1.8 $
Introduction to Initial RAMDisk
This hint will help you configure an LFS system for Initial RAMDisk.
Which will allow you to add modules at start-up instead of compiling them
into the kernel.
The script that is enclosed works with SCSI and USB modules only. IDE
devices are recommened to be built-in the kernel. The script will
auto-detect all SCSI and USB modules and add them to the initial ramdisk.
It will also detect the root from the fstab file
---
Assumptions Made in this document
I have made the following assumptions in this document.
Files have been downloaded.
---
Kernel Configuration
You will need to make sure the following items are configured
in your kernel. With out these, the initrd will not work.
Block Devices
Select Loopback Device Support this can be a module
or built-in.
Select RAM Disk Support this needs to be compiled as
built-in or the initrd will not show up.
Set Default RAM Disk size is 4096 which is the default
Select Initial RAM Disk (initrd) support needs be selected.
---
Needed File System Changes
You will need to create a directory for initrd to use.
The default one that is looked for is /initrd.
To Create this directory use mkdir /initrd
Another change that needs to be made is due to a bug
in busybox itself.
You will need to create a symlink to init and call it
linuxrc
cd /sbin
ln -sf init linuxrc
---
Needed Static Modules
In order for the initrd to work properly during boot up
you will need to create to static programs.
The first one being bash.
busybox
----
Busybox has a Config.h file that needs the following options
enabled to enable them remove the //
#define BB_INSMOD
#define BB_FEATURE_SH_STANDALONE_SHELL
You can configure the rest as you need, but remember have at
least the following enabled to make initrd to work properly.
#define BB_ASH
#define BB_CHROOT
#define BB_ECHO
#define BB_INSMOD
#define BB_MKDIR
#define BB_MODPROBE
#define BB_MOUNT
#define BB_PIVOT_ROOT
#define BB_UMOUNT
To create a static version of bash needed for initrd use
the following commands.
cd /usr/src
tar zxvf /usr/src/busybox-*.tar.gz
cd busy*
make LDFLAGS=-static
cp busybox /bin/busybox
Busybox must be in the /bin directory or the links created
during the initrid will fail.
---
mkinitrd
For those who do not want to type out the script. It is
available on my CVS server at
http://www.jg555.com/cvs/cvsweb.cgi/scripts/mkinitrd-lfs
This script will create the initial RAM Disk image file.
By default this script creates /boot/initrd.img
The default location for this file is /sbin
#!/bin/bash
# mkinitrd for LFS by Jim Gifford
# $Revision: 1.8 $
# Variables
TEMP="$1"
KERNEL_VERSION=""
CONFIG_FILE="/etc/modules.conf"
FSTAB="/etc/fstab"
ROOT_DEVICE=$(awk '/^[ \t]*[^#]/ { if ($2 == "/") { print $1; }}' $FSTAB)
SCSI_MODULES="`grep scsi_hostadapter $CONFIG_FILE | grep -v '^[ ]*#' | awk '{ print $3 }'`"
NEEDED_SCSI="scsi_mod sd_mod"
USB_MODULES="`grep usb-controller $CONFIG_FILE | grep -v '^[ ]*#' | awk '{ print $3 }'`"
NEEDED_USB="usbcore"
MODULES="$NEEDED_SCSI $SCSI_MODULES $NEEDED_USB $USB_MODULES"
IMAGE_SIZE=3000
MOUNT_IMAGE="/tmp/initrd.$$"
IMAGE="/tmp/initrd.img-$$"
MOUNT_POINT="/tmp/initrd.mnt-$$"
LINUXRC="$MOUNT_IMAGE/linuxrc"
# Check for initrd Directory
if ! [ -e /initrd ]
then
mkdir /initrd
fi
# Check for RAM Disk Device
if [ -e /dev/.devfsd ]
then
RAM_DEVICE="rd"
else
RAM_DEVICE="ram0"
fi
# Check for input
if [ "$TEMP" == "" ]
then
KERNEL_VERSION="`uname -r`"
else
KERNEL_VERSION="$TEMP"
fi
INITRD="/boot/initrd-$KERNEL_VERSION.img"
if [ "$TEMP" == "-h" ] || [ "$TEMP" == "--h" ] || [ "$TEMP" == "-help" ] || [ "$TEMP" == "--help" ]
then
echo "usage: mkinitrd kernel_version"
echo " : mkinitrd will automatically determin kernel version"
exit 1
fi
# Creating LoopBack Device
dd if=/dev/zero of=$IMAGE bs=1k count=$IMAGE_SIZE 2> /dev/null
for device_number in 0 1 2 3 4 5 6 7 8
do
if losetup /dev/loop$device_number $IMAGE 2>/dev/null
then
break
fi
done
if [ "$device_number" = "8" ]
then
rm -rf $MOUNT_POINT $IMAGE
echo "All of your loopback devices are in use!" >&2
exit 1
fi
LOOP_DEVICE=/dev/loop$device_number
echo y | mke2fs $LOOP_DEVICE $IMAGE_SIZE > /dev/null 2> /dev/null
echo "Using loopback device $LOOP_DEVICE"
mkdir -p $MOUNT_POINT
mount -t ext2 $LOOP_DEVICE $MOUNT_POINT || {
echo "Can't get a loopback device"
exit 1
}
# Creating Directories
mkdir -p $MOUNT_IMAGE
mkdir -p $MOUNT_IMAGE/lib
mkdir -p $MOUNT_IMAGE/bin
mkdir -p $MOUNT_IMAGE/etc
mkdir -p $MOUNT_IMAGE/dev
mkdir -p $MOUNT_IMAGE/proc
ln -s /bin $MOUNT_IMAGE/sbin
rm -rf $MOUNT_POINT/lost+found
# Copying Static Programs
cp -a /bin/busybox $MOUNT_IMAGE/bin/busybox
ln -s /bin/busybox $MOUNT_IMAGE/bin/echo
ln -s /bin/busybox $MOUNT_IMAGE/bin/mount
ln -s /bin/busybox $MOUNT_IMAGE/bin/modprobe
ln -s /bin/busybox $MOUNT_IMAGE/bin/mkdir
ln -s /bin/busybox $MOUNT_IMAGE/bin/sh
ln -s /bin/busybox $MOUNT_IMAGE/bin/umount
ln -s /bin/busybox $MOUNT_IMAGE/bin/insmod
ln -s /bin/busybox $MOUNT_IMAGE/bin/pivot_root
cp -a /etc/fstab $MOUNT_IMAGE/etc/fstab
cp -a /etc/modules.conf $MOUNT_IMAGE/etc/modules.conf
# Copying Modules
for MODULE in $MODULES
do
echo "$MODULE" | {
IFS=':' read module options
module=$module
options=$options
DIR_SEARCH1="`ls -1 /lib/modules/$KERNEL_VERSION/kernel/drivers`"
for DIR_1SEARCH in $DIR_SEARCH1
do
cp /lib/modules/$KERNEL_VERSION/kernel/drivers/$DIR_1SEARCH/$module.o $MOUNT_IMAGE/lib > /dev/null 2>&1
DIR_SEARCH2="`ls -1 /lib/modules/$KERNEL_VERSION/kernel/drivers/$DIR_1SEARCH`"
for DIR_2SEARCH in $DIR_SEARCH2
do
cp /lib/modules/$KERNEL_VERSION/kernel/drivers/$DIR_1SEARCH/$DIR_2SEARCH/$module.o $MOUNT_IMAGE/lib > /dev/null 2>&1
done
done
}
done
for i in console null $RAM_DEVICE tty[1234]
do
cp -a /dev/$i $MOUNT_IMAGE/dev
done
# Creating linuxrc File
echo "#!/bin/sh" > $LINUXRC
echo "" >> $LINUXRC
echo "echo \"Initial RAMDISK Loading Starting...\"" >> $LINUXRC
for MODULE in $MODULES
do
echo "$MODULE" | {
IFS=':' read module
module=$module
echo "Loading module $module"
echo "insmod /lib/$module.o" >> $LINUXRC
}
done
echo "echo \"Initial RAMDISK Loading Completed...\"" >> $LINUXRC
echo "mkdir /new_root" >> $LINUXRC
echo "echo \"Mounting proc...\"" >> $LINUXRC
echo "mount -n -t proc none /proc" >> $LINUXRC
echo "echo 0x0100 > /proc/sys/kernel/real-root-dev" >> $LINUXRC
echo "echo \"Mounting real root dev...\"" >> $LINUXRC
echo "mount -n -o ro $ROOT_DEVICE /new_root" >> $LINUXRC
echo "umount /proc" >> $LINUXRC
echo "cd /new_root" >> $LINUXRC
echo "echo \"Running pivot_root...\"" >> $LINUXRC
echo "pivot_root . initrd" >> $LINUXRC
echo "if [ -c initrd/dev/.devfsd ]" >> $LINUXRC
echo " then" >> $LINUXRC
echo " echo \"Mounting devfs...\"" >> $LINUXRC
echo " mount -n -t devfs none dev" >> $LINUXRC
echo "fi" >> $LINUXRC
echo "if [ \$\$ = 1 ]" >> $LINUXRC
echo " then" >> $LINUXRC
echo " echo \"Running init...\"" >> $LINUXRC
echo " exec chroot . sbin/init dev/console 2>&1" >> $LINUXRC
echo " else" >> $LINUXRC
echo " echo \"Using bug circumvention for busybox...\"" >> $LINUXRC
echo " exec chroot . linuxrc dev/console 2>&1" >> $LINUXRC
echo "fi" >> $LINUXRC
chmod +x $LINUXRC
(cd $MOUNT_IMAGE; tar cf - .) | (cd $MOUNT_POINT; tar xf -)
umount $MOUNT_POINT
losetup -d $LOOP_DEVICE
gzip -9 < $IMAGE > $INITRD
rm -rf $MOUNT_IMAGE $MOUNT_POINT $IMAGE
lilo -v
---
initrd script
The following script needs to placed in /etc/rc.d/init.d.
You will then need to link it to rcsysinit.d.
It is recommended that this script be run right after
mountfs.
To link the script change to the /etc/rc.d/rcsysinit.d
directory and issue the following command.
ln -sf ../init.d/initrd S41initrd
#!/bin/bash
# Begin $rc_base/init.d/initrd
# Based on sysklogd script from LFS-3.1 and earlier.
# Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org
source /etc/sysconfig/rc
source $rc_functions
echo "Clearing Initial RAM Disk..."
if [ -e /initrd/dev/.devfsd ]
then
umount /initrd/dev
fi
umount /initrd
/sbin/blockdev --flushbufs /dev/ram0
# End $rc_base/init.d/initrd
---
For Lilo
In order to use the initrd.img file is to add the
following entry to you lilo.conf file.
initrd=/boot/initrd.img
So your lilo.conf should look something like this.
image=/boot/vmlinuz-2.4.18
label=test
initrd=/boot/initrd-2.4.18.img
read-only
append="root=/dev/ram0 init=/linuxrc rw"
If you are just testing. You should make a separate
entry in lilo.conf. This will still allow you to boot.
---
For Grub
In order to use the initrd.img file is to add the
following entry to you menu.lst file.
initrd /boot/initrd-2.4.18.img
So your menu.lst should look something like this.
title test
root (hd0,1)
kernel /boot/vmlinuz-2.4.18
initrd /boot/initrd-2.4.18.img
---
For Syslinux
In order to use the initrd.img file is to add the
following to syslinux.cfg file.
append root=/dev/ram0 initrd=initrd-2.4.18.img
So your syslinux.cfg should look something like this.
label test
kernel vmlinuz
append root=/dev/ram0 initrd=initrd.img
---
Mail suggestions to giffordj@linkline.com
New Version of this document can be viewed from
http://www.jg555.com/cvs
this looked interesting, i am going to come back and read
a bit more closesly.
Monday, April 18, 2005
Xauth problems
Xauth problems
the issue is the hostname is screwed up
$> hostname
returns
(none)
sound familiar
when i removed the section of script
and just said the hostname was "uccd"
no errors
two things of import
there is a file /etc/hostname that contains
the setting for the hostname
and there is a command "hostname"
the issue is the hostname is screwed up
$> hostname
returns
(none)
sound familiar
when i removed the section of script
and just said the hostname was "uccd"
no errors
two things of import
there is a file /etc/hostname that contains
the setting for the hostname
and there is a command "hostname"
Sunday, April 17, 2005
Xauth problems
I am starting x and even getting twm to work
but when i shutdown twm/x11/xvesa
there are two sets of error messages:
xauth: (argv):1: bad display name "(none):0" in "list" command
xauth: (argv):1: bad display name "(none):0" in "add" command
waiting for X server to shut down
xauth: (argv):1 bad display name "(none):0" in "remove" command
what up?
the startx script is as follows:
#!/bin/sh
userclientrc=$HOME/.xinitrc
userserverrc=$HOME/.xserverrc
sysclientrc=/etc/X11/xinit/xinitrc
sysserverrc=/etc/X11/xinit/xserverrc
defaultclient=/usr/X11R6/bin/xterm
defaultserver=/usr/X11R6/bin/X
defaultclientargs=""
defaultserverargs="-screen 800x600x24 -2button"
clientargs=""
serverargs=""
if [ -f $userclientrc ]; then
defaultclientargs=$userclientrc
elif [ -f $sysclientrc ]; then
defaultclientargs=$sysclientrc
fi
if [ -f $userserverrc ]; then
defaultserverargs=$userserverrc
elif [ -f $sysserverrc ]; then
defaultserverargs=$sysserverrc
fi
whoseargs="client"
while [ x"$1" != x ]; do
case "$1" in
# '' required to prevent cpp from treating "/*" as a C comment.
/''*|\./''*)
if [ "$whoseargs" = "client" ]; then
if [ x"$clientargs" = x ]; then
client="$1"
else
clientargs="$clientargs $1"
fi
else
if [ x"$serverargs" = x ]; then
server="$1"
else
serverargs="$serverargs $1"
fi
fi
;;
--)
whoseargs="server"
;;
*)
if [ "$whoseargs" = "client" ]; then
clientargs="$clientargs $1"
else
# display must be the FIRST server argument
if [ x"$serverargs" = x ] && expr "$1" : ':[0-9][0-9]*$' > /dev/null 2>&1; then
display="$1"
else
serverargs="$serverargs $1"
fi
fi
;;
esac
shift
done
# process client arguments
if [ x"$client" = x ]; then
# if no client arguments either, use rc file instead
if [ x"$clientargs" = x ]; then
client="$defaultclientargs"
else
client=$defaultclient
fi
fi
# process server arguments
if [ x"$server" = x ]; then
# if no server arguments or display either, use rc file instead
if [ x"$serverargs" = x -a x"$display" = x ]; then
server="$defaultserverargs"
else
server=$defaultserver
fi
fi
if [ x"$XAUTHORITY" = x ]; then
XAUTHORITY=$HOME/.Xauthority
export XAUTHORITY
fi
removelist=
# set up default Xauth info for this machine
case `uname` in
Linux*)
if [ -z "`hostname --version 2>&1 | grep GNU`" ]; then
hostname=`hostname -f`
else
hostname=`hostname`
fi
;;
*)
hostname=`hostname`
;;
esac
authdisplay=${display:-:0}
mcookie=`mcookie`
for displayname in $authdisplay $hostname$authdisplay; do
if ! xauth list "$displayname" | grep "$displayname " >/dev/null 2>&1; then
xauth add $displayname . $mcookie
removelist="$displayname $removelist"
fi
done
xinit $client $clientargs -- $server $display $serverargs
if [ x"$removelist" != x ]; then
xauth remove $removelist
fi
if command -v deallocvt > /dev/null 2>&1; then
deallocvt
fi
but when i shutdown twm/x11/xvesa
there are two sets of error messages:
xauth: (argv):1: bad display name "(none):0" in "list" command
xauth: (argv):1: bad display name "(none):0" in "add" command
waiting for X server to shut down
xauth: (argv):1 bad display name "(none):0" in "remove" command
what up?
the startx script is as follows:
#!/bin/sh
userclientrc=$HOME/.xinitrc
userserverrc=$HOME/.xserverrc
sysclientrc=/etc/X11/xinit/xinitrc
sysserverrc=/etc/X11/xinit/xserverrc
defaultclient=/usr/X11R6/bin/xterm
defaultserver=/usr/X11R6/bin/X
defaultclientargs=""
defaultserverargs="-screen 800x600x24 -2button"
clientargs=""
serverargs=""
if [ -f $userclientrc ]; then
defaultclientargs=$userclientrc
elif [ -f $sysclientrc ]; then
defaultclientargs=$sysclientrc
fi
if [ -f $userserverrc ]; then
defaultserverargs=$userserverrc
elif [ -f $sysserverrc ]; then
defaultserverargs=$sysserverrc
fi
whoseargs="client"
while [ x"$1" != x ]; do
case "$1" in
# '' required to prevent cpp from treating "/*" as a C comment.
/''*|\./''*)
if [ "$whoseargs" = "client" ]; then
if [ x"$clientargs" = x ]; then
client="$1"
else
clientargs="$clientargs $1"
fi
else
if [ x"$serverargs" = x ]; then
server="$1"
else
serverargs="$serverargs $1"
fi
fi
;;
--)
whoseargs="server"
;;
*)
if [ "$whoseargs" = "client" ]; then
clientargs="$clientargs $1"
else
# display must be the FIRST server argument
if [ x"$serverargs" = x ] && expr "$1" : ':[0-9][0-9]*$' > /dev/null 2>&1; then
display="$1"
else
serverargs="$serverargs $1"
fi
fi
;;
esac
shift
done
# process client arguments
if [ x"$client" = x ]; then
# if no client arguments either, use rc file instead
if [ x"$clientargs" = x ]; then
client="$defaultclientargs"
else
client=$defaultclient
fi
fi
# process server arguments
if [ x"$server" = x ]; then
# if no server arguments or display either, use rc file instead
if [ x"$serverargs" = x -a x"$display" = x ]; then
server="$defaultserverargs"
else
server=$defaultserver
fi
fi
if [ x"$XAUTHORITY" = x ]; then
XAUTHORITY=$HOME/.Xauthority
export XAUTHORITY
fi
removelist=
# set up default Xauth info for this machine
case `uname` in
Linux*)
if [ -z "`hostname --version 2>&1 | grep GNU`" ]; then
hostname=`hostname -f`
else
hostname=`hostname`
fi
;;
*)
hostname=`hostname`
;;
esac
authdisplay=${display:-:0}
mcookie=`mcookie`
for displayname in $authdisplay $hostname$authdisplay; do
if ! xauth list "$displayname" | grep "$displayname " >/dev/null 2>&1; then
xauth add $displayname . $mcookie
removelist="$displayname $removelist"
fi
done
xinit $client $clientargs -- $server $display $serverargs
if [ x"$removelist" != x ]; then
xauth remove $removelist
fi
if command -v deallocvt > /dev/null 2>&1; then
deallocvt
fi
Wednesday, April 13, 2005
SAXParser (isn't)
The SAXParser class really isnt a parser classes.
Its Bridge class that gets the xml stream into
the Handler class or the class derived
from the Handler class. The Derived handler
is the parser and its recursive descent
parser.
interesting
http://www.s34.co.jp/cpptechdoc/article/xml/fsm/fsm_sax.cpp
Its Bridge class that gets the xml stream into
the Handler class or the class derived
from the Handler class. The Derived handler
is the parser and its recursive descent
parser.
interesting
http://www.s34.co.jp/cpptechdoc/article/xml/fsm/fsm_sax.cpp
Tuesday, April 12, 2005
Const wierdness found in xerces
static XMLCh* transcode (const char* const toTranscode);
ok wtf?
man i have forgotten const's and constantness
from the c++-faq section 18.5:
[18.5] What's the difference between "const Fred* p", "Fred* const p" and "const Fred* const p"?
You have to read pointer declarations right-to-left.
* const Fred* p means "p points to a Fred that is const" — that is, the Fred object can't be changed via p.
* Fred* const p means "p is a const pointer to a Fred" — that is, you can change the Fred object via p, but you can't change the pointer p itself.
* const Fred* const p means "p is a const pointer to a const Fred" — that is, you can't change the pointer p itself, nor can you change the Fred object via p.
or in my case const char* const p means "p is a const pointer to a const char" i cant change
the pointer location or what is pointed to?
ok wtf?
man i have forgotten const's and constantness
from the c++-faq section 18.5:
[18.5] What's the difference between "const Fred* p", "Fred* const p" and "const Fred* const p"?
You have to read pointer declarations right-to-left.
* const Fred* p means "p points to a Fred that is const" — that is, the Fred object can't be changed via p.
* Fred* const p means "p is a const pointer to a Fred" — that is, you can change the Fred object via p, but you can't change the pointer p itself.
* const Fred* const p means "p is a const pointer to a const Fred" — that is, you can't change the pointer p itself, nor can you change the Fred object via p.
or in my case const char* const p means "p is a const pointer to a const char" i cant change
the pointer location or what is pointed to?
Autotools update
checkout subversion and did a autogen
on the mandrake 9.2 book and got got
the following error:
configure: error: cannot find install-sh or install.sh in . ./.. ./../..
looked on google and found to things.
1) configure.in is now deprecated and the standard is now
configure.ac
2) update automake then autoconf
i updated automake to version 1.9
and autoconf to version 2.59
see this web site for a quicky example
http://freedomink.org/node/100
on the mandrake 9.2 book and got got
the following error:
configure: error: cannot find install-sh or install.sh in . ./.. ./../..
looked on google and found to things.
1) configure.in is now deprecated and the standard is now
configure.ac
2) update automake then autoconf
i updated automake to version 1.9
and autoconf to version 2.59
see this web site for a quicky example
http://freedomink.org/node/100
Sunday, April 10, 2005
Autoconf project that uses Xerces 2.6.0
I started this little project about 2 or 3 times
first looking at how to recognize if
a said library was properly installed on a system.
I found more than one answer on how that should
work. Then I pulled back from that and just
started from basics.
I followed the link "Developing software with GNU"
http://www.amath.washington.edu/~lf/tutorials/autoconf/toolsmanual_toc.html
another good reference is
http://developer.gnome.org/doc/books/WGA/creating-configuration.html
The project has these files.
reconf
Makefile.am
configure.in
src/hello.cc
src/Makefile.am
The Makefile.am has the following lines
-------------------- Makefile.am --------------------------
EXTRA_DIST = reconf configure
SUBDIRS = src
-----------------------------------------------------------
EXTRA_DIST says to "List any files that you want to include
into your source code distribution. "
A file Makfile.in will have a target called dist
The dist target can be used to generate a gzip'd tar file
some files are not covered in the automatic rules.
These files should be listed in the EXTRA_DIST variable.
since configure is normally generated it need not be part
of tar dist but you want to include it as a convience
so anyone how get the the tared dist need only
run configure.
SUBDIRS
SUBDIRS = dir1 dir2 ...
`make' will be recursively invoked in each subdirectory
stated before doing anything on the current directory.
On the same token you will need to supply a `Makefile.am'
for each of the `src' directories you have stated.
configure.in
----------------------- configure.in ---------------------
AC_INIT
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(test,0.1)
AC_PROG_CC
AC_PROG_CXX
AC_PROG_RANLIB
AC_PROG_INSTALL
AC_OUTPUT(Makefile src/Makefile)
----------------------------------------------------------
configure script must call AC_INIT
AC_INIT(package, version, [bug-report], [tar-name])
AC_INIT and AC_OUTPUT are the two only required macros by the
configure script.
AC_INIT generates the following m4 macros,
output variables and preprocessor symbols:
* [AC_]PACKAGE_NAME
* [AC_]PACKAGE_TARNAME
* [AC_]PACKAGE_VERSION
* [AC_]PACKAGE_STRING
* [AC_]PACKAGE_BUGREPORT
AM_CONFIG_HEADER:
AM_CONFIG_HEADER(config.h)
AM_CONFIG_HEADER(config.h:config.in)
Names the header file which will hold the preprocessor
macro definitions for compile time. Normally, this is
config.h. The source files will then #include "config.h".
Requires a accconfig.h file.
AC_PROG_CC first checks to see if the CC environment
variable is set on the end user's system and the other
AC_PROG_* macros work similarly.
AC_OUTPUT
Automake uses this to determine which files to create
Listed files named Makefile are treated as `Makefile's.
The next files are
src/hello.cc
------------------------------- hello.cc ---------------
#if HAVE_CONFIG_H
# include
#endif
#include
#include
using namespace XERCES_CPP_NAMESPACE
int main(int argc,char *argv[])
{
return 0;
}
the above compile and linked seemlessly.
why? because of the file:
src/Makefile.am
-------------------------- src/Makefile.am ---------------
INCLUDES = -I/usr/inlucde/xerces -I/usr/include/xercesc/sax
LDADD = -lxerces-c
bin_PROGRAMS = hello
hello_SOURCES = hello.cc
----------------------------------------------------------
INCLUDES = -I/dir1 -I/dir2 ...
Insert the -I flags that you want to pass to your compiler
when it builds object files.
LDFLAGS = -L/dir1 -L/dir2 ...
Insert the -L flags that you want to pass to your compiler.
bin_PROGRAMS = prog1 prog2 ....
Lists the executable files that will be compiled with `make'
and installed with `make install' under `/prefix/bin',
prog_SOURCES = foo1.c foo2.c ... header1.h header2.h ....
List all the files that compose the source code of the program,
including header files.
there is also specialization.
your can have the following
prog_SOURCES
prog_LDADD apply headers to a specific file
prog_LDFLAGS apply library includes to a specific file
prog_DEPENDENCIES
first looking at how to recognize if
a said library was properly installed on a system.
I found more than one answer on how that should
work. Then I pulled back from that and just
started from basics.
I followed the link "Developing software with GNU"
http://www.amath.washington.edu/~lf/tutorials/autoconf/toolsmanual_toc.html
another good reference is
http://developer.gnome.org/doc/books/WGA/creating-configuration.html
The project has these files.
reconf
Makefile.am
configure.in
src/hello.cc
src/Makefile.am
The Makefile.am has the following lines
-------------------- Makefile.am --------------------------
EXTRA_DIST = reconf configure
SUBDIRS = src
-----------------------------------------------------------
EXTRA_DIST says to "List any files that you want to include
into your source code distribution. "
A file Makfile.in will have a target called dist
The dist target can be used to generate a gzip'd tar file
some files are not covered in the automatic rules.
These files should be listed in the EXTRA_DIST variable.
since configure is normally generated it need not be part
of tar dist but you want to include it as a convience
so anyone how get the the tared dist need only
run configure.
SUBDIRS
SUBDIRS = dir1 dir2 ...
`make' will be recursively invoked in each subdirectory
stated before doing anything on the current directory.
On the same token you will need to supply a `Makefile.am'
for each of the `src' directories you have stated.
configure.in
----------------------- configure.in ---------------------
AC_INIT
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(test,0.1)
AC_PROG_CC
AC_PROG_CXX
AC_PROG_RANLIB
AC_PROG_INSTALL
AC_OUTPUT(Makefile src/Makefile)
----------------------------------------------------------
configure script must call AC_INIT
AC_INIT(package, version, [bug-report], [tar-name])
AC_INIT and AC_OUTPUT are the two only required macros by the
configure script.
AC_INIT generates the following m4 macros,
output variables and preprocessor symbols:
* [AC_]PACKAGE_NAME
* [AC_]PACKAGE_TARNAME
* [AC_]PACKAGE_VERSION
* [AC_]PACKAGE_STRING
* [AC_]PACKAGE_BUGREPORT
AM_CONFIG_HEADER:
AM_CONFIG_HEADER(config.h)
AM_CONFIG_HEADER(config.h:config.in)
Names the header file which will hold the preprocessor
macro definitions for compile time. Normally, this is
config.h. The source files will then #include "config.h".
Requires a accconfig.h file.
AC_PROG_CC first checks to see if the CC environment
variable is set on the end user's system and the other
AC_PROG_* macros work similarly.
AC_OUTPUT
Automake uses this to determine which files to create
Listed files named Makefile are treated as `Makefile's.
The next files are
src/hello.cc
------------------------------- hello.cc ---------------
#if HAVE_CONFIG_H
# include
#endif
#include
#include
using namespace XERCES_CPP_NAMESPACE
int main(int argc,char *argv[])
{
return 0;
}
the above compile and linked seemlessly.
why? because of the file:
src/Makefile.am
-------------------------- src/Makefile.am ---------------
INCLUDES = -I/usr/inlucde/xerces -I/usr/include/xercesc/sax
LDADD = -lxerces-c
bin_PROGRAMS = hello
hello_SOURCES = hello.cc
----------------------------------------------------------
INCLUDES = -I/dir1 -I/dir2 ...
Insert the -I flags that you want to pass to your compiler
when it builds object files.
LDFLAGS = -L/dir1 -L/dir2 ...
Insert the -L flags that you want to pass to your compiler.
bin_PROGRAMS = prog1 prog2 ....
Lists the executable files that will be compiled with `make'
and installed with `make install' under `/prefix/bin',
prog_SOURCES = foo1.c foo2.c ... header1.h header2.h ....
List all the files that compose the source code of the program,
including header files.
there is also specialization.
your can have the following
prog_SOURCES
prog_LDADD apply headers to a specific file
prog_LDFLAGS apply library includes to a specific file
prog_DEPENDENCIES
Friday, April 08, 2005
Autotools
http://www.nevrax.org/tiki-pagehistory.php?page=NeLCompilingLinux&diff=4
the following has a sample automake project:
http://www.openismus.com/documents/linux/automake/automake.shtml
also here is a great online book:
http://sources.redhat.com/autobook
notes: form the above online book.
configure will generate the following
files:
`config.cache' results of the system tests
`config.log` each test run and the result
`config.status` used to recreate the current configuration.
`config.h' examines variability of the C and C++ programming
languages and implementations thereof.
`Makefile' One of the common functions of `configure' is
to generate `Makefile's and other files.
so basically generate config.h and Makefile
if things break look at config.log
NOTE:
The smallest project requires the user to provide only two files.
* `Makefile.am' is an input to automake.
* `configure.in' is an input to autoconf.
----------------------Makefile.am---------------------------------
bin_PROGRAMS = foonly
foonly_SOURCES = main.c foo.c foo.h nly.c scanner.l parser.y
foonly_LDADD = @LEXLIB@
This `Makefile.am' specifies that we want a program called `foonly'
to be built and installed in the `bin' directory when make
install is run. The source files that are used to build `foonly'
are the C source files `main.c', `foo.c', `nly.c' and `foo.h', the
lex program in `scanner.l' and a yacc grammar in `parser.y'.
------------------------------------------------------------------
the following has a sample automake project:
http://www.openismus.com/documents/linux/automake/automake.shtml
also here is a great online book:
http://sources.redhat.com/autobook
notes: form the above online book.
configure will generate the following
files:
`config.cache' results of the system tests
`config.log` each test run and the result
`config.status` used to recreate the current configuration.
`config.h' examines variability of the C and C++ programming
languages and implementations thereof.
`Makefile' One of the common functions of `configure' is
to generate `Makefile's and other files.
so basically generate config.h and Makefile
if things break look at config.log
NOTE:
The smallest project requires the user to provide only two files.
* `Makefile.am' is an input to automake.
* `configure.in' is an input to autoconf.
----------------------Makefile.am---------------------------------
bin_PROGRAMS = foonly
foonly_SOURCES = main.c foo.c foo.h nly.c scanner.l parser.y
foonly_LDADD = @LEXLIB@
This `Makefile.am' specifies that we want a program called `foonly'
to be built and installed in the `bin' directory when make
install is run. The source files that are used to build `foonly'
are the C source files `main.c', `foo.c', `nly.c' and `foo.h', the
lex program in `scanner.l' and a yacc grammar in `parser.y'.
------------------------------------------------------------------
Wednesday, April 06, 2005
SDL linking woes
I have tried to compile a small sdl demo and all i get is grief of this
flavor:
checking for SDL - version >= 1.2.0... no
after some research i found that what is happening
is that a small program is trying to compiled and failing.
the analogue is this.
---------------------- sdltest.c -----------------------------------------
#include <SDL.h>
int main(int argc,char **)
{
return 0;
}
----------------------------------------------------------------------------
the configure script uses a configure script sdl-config
to determine to kick out the need library and header
path information.
all of this fails and you get the error:
checking for SDL - version >= 1.2.0... no
if found via google that details what i did above and then
hacked the sdl-config macro. and i was able to compile
the the above test and the testdrivers in the sdl
source distro.
gcc -o sdltest sdltest.c -L/usr/X11R6/lib/ `sdl-config --cflags` `sdl-config --libs` -lX11 -lXext -lgcc
what now insterests me is why i need to add -L/usr/X11/lib?
no actuall i know that i need this but what does the configure
script know this?
flavor:
checking for SDL - version >= 1.2.0... no
after some research i found that what is happening
is that a small program is trying to compiled and failing.
the analogue is this.
---------------------- sdltest.c -----------------------------------------
#include <SDL.h>
int main(int argc,char **)
{
return 0;
}
----------------------------------------------------------------------------
the configure script uses a configure script sdl-config
to determine to kick out the need library and header
path information.
all of this fails and you get the error:
checking for SDL - version >= 1.2.0... no
if found via google that details what i did above and then
hacked the sdl-config macro. and i was able to compile
the the above test and the testdrivers in the sdl
source distro.
gcc -o sdltest sdltest.c -L/usr/X11R6/lib/ `sdl-config --cflags` `sdl-config --libs` -lX11 -lXext -lgcc
what now insterests me is why i need to add -L/usr/X11/lib?
no actuall i know that i need this but what does the configure
script know this?
Tuesday, April 05, 2005
More on SSH/Pam
1. clean and server exchange (public) host keys.
If the client machine has never encountered
a given public key before, both SSH .... ask
the user whether to accept the untrusted key, ...
next the use these public keys to negotiate a session
key .... As with typical SSL connections, this
initial round of key exchanging and session-key
negotiations is completely transparent to the
end user.
[linux server security oreilly page 118-119]
SSH can secure these [X POP3 LPD] and most other
TCP based services! Forwarding X applications
back to your remote console is simple. First,
on the the remote host, edit /etc/ssh/sshd_config
and set X11Forwarding to yes (in OpenSSH Version
2x, the default is no). Second, open an ssh session using
the authentication method of your choice from your
local console to the remote host.
book [inside network perimeter security, sams second edition]
chapter 16 page 397 The Dangers of SSH
... be sure to ue the latest software versions and to keep
current with all the patchs, Also configure your SSH
servers to only permit the use of the SSH2 protocol,
instead of SSH1.
page 398. SSH Tunnels.
port forwardinging.
SSH has a powerful capability called port forwarding.
In port forwarding, an abitrary local port is chosen and
linked by an SSH connection to a particular remote host
and remote port.
After the connection is established, the SSH client listens
for traffic on the specified local port. Any traffic that
is sent to the that port is then sent through the tunnel
to the the remote SSH server. This technique is know
as SSH tunneling.
[end quote]
plans
finish building 2.6 gento book+udev
emerge ssh ... login to ssh remotely
rc-update ssh.
what risks are associated with ssh?
[more from LINUX Server Security page 125-127]
... to control the behavior of the SSH client and server [ssh],
there are only two files to edit: ssh_config and sshd_config, respectively.
ssh_config is a global configuration file for ssh sessions
intitiated from the local host.
ssh_config consists of a list of parameters, one line per parameter,
in the format:
parameter-name parameter-value1(,parameter-value2,etc.)
If the client machine has never encountered
a given public key before, both SSH .... ask
the user whether to accept the untrusted key, ...
next the use these public keys to negotiate a session
key .... As with typical SSL connections, this
initial round of key exchanging and session-key
negotiations is completely transparent to the
end user.
[linux server security oreilly page 118-119]
SSH can secure these [X POP3 LPD] and most other
TCP based services! Forwarding X applications
back to your remote console is simple. First,
on the the remote host, edit /etc/ssh/sshd_config
and set X11Forwarding to yes (in OpenSSH Version
2x, the default is no). Second, open an ssh session using
the authentication method of your choice from your
local console to the remote host.
book [inside network perimeter security, sams second edition]
chapter 16 page 397 The Dangers of SSH
... be sure to ue the latest software versions and to keep
current with all the patchs, Also configure your SSH
servers to only permit the use of the SSH2 protocol,
instead of SSH1.
page 398. SSH Tunnels.
port forwardinging.
SSH has a powerful capability called port forwarding.
In port forwarding, an abitrary local port is chosen and
linked by an SSH connection to a particular remote host
and remote port.
After the connection is established, the SSH client listens
for traffic on the specified local port. Any traffic that
is sent to the that port is then sent through the tunnel
to the the remote SSH server. This technique is know
as SSH tunneling.
[end quote]
plans
finish building 2.6 gento book+udev
emerge ssh ... login to ssh remotely
rc-update ssh.
what risks are associated with ssh?
[more from LINUX Server Security page 125-127]
... to control the behavior of the SSH client and server [ssh],
there are only two files to edit: ssh_config and sshd_config, respectively.
ssh_config is a global configuration file for ssh sessions
intitiated from the local host.
ssh_config consists of a list of parameters, one line per parameter,
in the format:
parameter-name parameter-value1(,parameter-value2,etc.)
Sunday, April 03, 2005
Created rootfs files: /etc
I want to create premade user accounts
From "Running Linux page 141"
ever account on the system has an entry in the file /etc/passwd.
this file contains entries, one line per user ...
username:password:uid:gid:gecos:homedir:shell
username (obvious)
password and encrypted representation of the users password.
uid
the user id is a unique integer the system uses to identify the account.
... the uid is more important to the system
gid the group id ... refering to the users default group
found in the file /etc/gorup
gecos miscellaneous inforation about the user
homedir: the users home directory
shell: the name of the progr run when the user logs in.
From "Running Linux page 141"
ever account on the system has an entry in the file /etc/passwd.
this file contains entries, one line per user ...
username:password:uid:gid:gecos:homedir:shell
username (obvious)
password and encrypted representation of the users password.
uid
the user id is a unique integer the system uses to identify the account.
... the uid is more important to the system
gid the group id ... refering to the users default group
found in the file /etc/gorup
gecos miscellaneous inforation about the user
homedir: the users home directory
shell: the name of the progr run when the user logs in.
Tossed 2.4.2x and moved 2.6 + udev
In the next interation of the machine build I will start with
the kernel 2.6 and use udev.
I had all the parts working apache+mysql+bugzill and
ssh as a stand alone (no integration with apache)
see the following
http://www.gentoo.org/doc/en/udev-guide.xml
and it eliminated the errors i was getting about
about modprobe
the kernel 2.6 and use udev.
I had all the parts working apache+mysql+bugzill and
ssh as a stand alone (no integration with apache)
see the following
http://www.gentoo.org/doc/en/udev-guide.xml
and it eliminated the errors i was getting about
about modprobe
Friday, April 01, 2005
MySql Bugzilla
ok mysql has a two part process of install
you need to have a root or sa user
then have a bugzilla user and
all the grant tables working.
$> /etc/init.d/mysql start
$> mysqladmin -u root flush-privileges password "password"
$> mysql -u root -p
Enter password: password
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.0.22
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> exit
Bye
the above worked see the page:
http://www.ladse.de/index.php/Installation:Gentoo:MySQL
now i have tried to run the bugzilla checksetup.pl script
and here is what i get.
Creating database bugs ...
The 'bugs' database could not be created. The error returned was:
Access denied for user: '@localhost' to database 'bugs'
but this makes sense because really all i have done is setup
the basic mysql exe and the system tables
but is there a complete bugzilla db with tables and a user?
i dont know is the answer to this. so what do i need to do?
i need to have command line tools to query the db status.
yes there are fine graphical tools but i need things
i can script. (i dont want to fart with web shots
on this blog)
ok
i ran mysql command
$> mysql -u root -p
and then ran the following query:
mysql> select Host,User from mysql.user;
+-----------+------+
| Host | User |
+-----------+------+
| localhost | |
| localhost | root |
+-----------+------+
2 rows in set (0.00 sec)
there is currently one user.
so i pretty much know i need
to add a user called bugs.
i looked up the mysql documentation online
and adding a user seems to be
be more about 'grant' than 'create user'
anyway the link is:
http://dev.mysql.com/doc/mysql/en/adding-users.html
GRANT ALL PRIVILEGES on *.* to 'bugs'@'localhost'
-> IDENTIFIED BY 'password' with GRANT OPTION;
GRANT ALL PRIVILEGES on *.* to 'bugs'@'%'
->IDENTIFIED BY 'password' WITH GRANT OPTION;
so i have created user 'bugs' on the bugs database
with the password 'password'
i have deliberately made this simple i may change
the passwords later but for now i want something
simple easy to remember as move along.
i then reran ./checksetup.pl from the bugzilla
source dirctory same problem again
but the inuited that i would need to check
the password entry :
$db_pass = ''
ah!
i changed this to
$db_pass = 'password'
and re-ran ./checksetup.pl
tada it start creating a bunch
of tables and user accounts.
i went back and put the link in my
browser;
http://localhost/bugzilla/
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, root@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Apache/2.0.52 (Gentoo/Linux) Server at xxxx Port 80
so what next?
i could debug the index.cgi script?
or is it something in the localconfig script?
i found the following line in the error logs
[Fri Apr 01 13:43:00 2005] [alert] [client 192.168.x.x] /var/www/localhost/htdocs/bugzilla/.htaccess: AllowOverride not allowed
i did some digging in the bugzilla docs and found this.
4.2.6. .htaccess files and security
....
The default .htaccess file may not provide adequate access restrictions, depending on your web server configuration. Be sure to check the entries for your Bugzilla directory so that the .htaccess file is allowed to override web server defaults. For instance, let's assume your installation of Bugzilla is installed to /usr/local/bugzilla . You should have this entry in your httpd.conf file:
I DID NOT HAVE THIS.
I added the following and went back and tried the site.
tada! the bugzilla site came up.
you need to have a root or sa user
then have a bugzilla user and
all the grant tables working.
$> /etc/init.d/mysql start
$> mysqladmin -u root flush-privileges password "password"
$> mysql -u root -p
Enter password: password
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.0.22
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> exit
Bye
the above worked see the page:
http://www.ladse.de/index.php/Installation:Gentoo:MySQL
now i have tried to run the bugzilla checksetup.pl script
and here is what i get.
Creating database bugs ...
The 'bugs' database could not be created. The error returned was:
Access denied for user: '@localhost' to database 'bugs'
but this makes sense because really all i have done is setup
the basic mysql exe and the system tables
but is there a complete bugzilla db with tables and a user?
i dont know is the answer to this. so what do i need to do?
i need to have command line tools to query the db status.
yes there are fine graphical tools but i need things
i can script. (i dont want to fart with web shots
on this blog)
ok
i ran mysql command
$> mysql -u root -p
and then ran the following query:
mysql> select Host,User from mysql.user;
+-----------+------+
| Host | User |
+-----------+------+
| localhost | |
| localhost | root |
+-----------+------+
2 rows in set (0.00 sec)
there is currently one user.
so i pretty much know i need
to add a user called bugs.
i looked up the mysql documentation online
and adding a user seems to be
be more about 'grant' than 'create user'
anyway the link is:
http://dev.mysql.com/doc/mysql/en/adding-users.html
GRANT ALL PRIVILEGES on *.* to 'bugs'@'localhost'
-> IDENTIFIED BY 'password' with GRANT OPTION;
GRANT ALL PRIVILEGES on *.* to 'bugs'@'%'
->IDENTIFIED BY 'password' WITH GRANT OPTION;
so i have created user 'bugs' on the bugs database
with the password 'password'
i have deliberately made this simple i may change
the passwords later but for now i want something
simple easy to remember as move along.
i then reran ./checksetup.pl from the bugzilla
source dirctory same problem again
but the inuited that i would need to check
the password entry :
$db_pass = ''
ah!
i changed this to
$db_pass = 'password'
and re-ran ./checksetup.pl
tada it start creating a bunch
of tables and user accounts.
i went back and put the link in my
browser;
http://localhost/bugzilla/
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, root@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Apache/2.0.52 (Gentoo/Linux) Server at xxxx Port 80
so what next?
i could debug the index.cgi script?
or is it something in the localconfig script?
[Fri Apr 01 13:43:00 2005] [alert] [client 192.168.x.x] /var/www/localhost/htdocs/bugzilla/.htaccess: AllowOverride not allowed
i did some digging in the bugzilla docs and found this.
4.2.6. .htaccess files and security
....
The default .htaccess file may not provide adequate access restrictions, depending on your web server configuration. Be sure to check the
<Directory /usr/local/bugzilla/>
Options +FollowSymLinks +Indexes +Includes +ExecCGI
AllowOverride All
</Directory>
I added the following and went back and tried the site.
tada! the bugzilla site came up.
Thursday, March 31, 2005
Pro Apache 3rd Edition Peter Wainwright
This is an awesome book.
Better than the oreilly books and they
are usually pretty good.
notes from the book
<Limit> restricts scope of the directives.
<Directory >
Directives inside a <Directory > container apply
only to that directory and its subdirectories.
<Directory> containers can't be nested
<VirtualHost>
<VirtualHost> allows additional hosts and web sites to be
defined alongside the main server host site. Each
virtual host can have its own name, IP address, and
error and accesss logs
ok i had to wipe the gentoo box i was working on.
i had tried everything with this box. when ever
i built/ran apache in a chroot it worked great.
served pages like a charm when i tried to unmerge
emerge back apache the same problems.
during the rebuild process i disabled pam
i have stopped and restarted apache it seems
to serve up the index page
fine. another item is i disabled ssl.
I need to do more research about what ssl does
(i know what it does) but rather i need it caused
the problem before where pages just would
not be served up. personally i think it was pam.
Better than the oreilly books and they
are usually pretty good.
notes from the book
<Limit> restricts scope of the directives.
<Directory >
Directives inside a <Directory > container apply
only to that directory and its subdirectories.
<Directory> containers can't be nested
<VirtualHost>
<VirtualHost> allows additional hosts and web sites to be
defined alongside the main server host site. Each
virtual host can have its own name, IP address, and
error and accesss logs
ok i had to wipe the gentoo box i was working on.
i had tried everything with this box. when ever
i built/ran apache in a chroot it worked great.
served pages like a charm when i tried to unmerge
emerge back apache the same problems.
during the rebuild process i disabled pam
i have stopped and restarted apache it seems
to serve up the index page
fine. another item is i disabled ssl.
I need to do more research about what ssl does
(i know what it does) but rather i need it caused
the problem before where pages just would
not be served up. personally i think it was pam.
Wednesday, March 30, 2005
MC (midnight commander on uclibc gentoo)
finally got this to build.
this probably works because the tarball has
been tainted with the x11 4.3.0 i have been
working with also the libtermcap.
but here are the steps i took.
build the following
1) libiconv-1.9.1.tar.gz
2) gettext-0.14.tar.gz
3) glib-2.4.0.tar.gz
the built mc (mc-4.6.1-pre1.tar.gz)
i will trash this tarball and rebuild
the project from scratch.
this probably works because the tarball has
been tainted with the x11 4.3.0 i have been
working with also the libtermcap.
but here are the steps i took.
build the following
1) libiconv-1.9.1.tar.gz
2) gettext-0.14.tar.gz
3) glib-2.4.0.tar.gz
the built mc (mc-4.6.1-pre1.tar.gz)
i will trash this tarball and rebuild
the project from scratch.
more stupid tar tricks
( cd "$SRC"; tar -cf- --exclude=.svn --exclude=CVS . ) | ( cd $DST; tar -xf- )
Tuesday, March 29, 2005
Startx
1. startx is a script.
2. startx looks for .xinitrc in the user's home directory, and if it is not found then proceeds to use the contents of /usr/lib/X11/xinit/xinitrc, which is a a symbolic link to /etc/X11/xinit/xinitrc.
2. startx looks for .xinitrc in the user's home directory, and if it is not found then proceeds to use the contents of /usr/lib/X11/xinit/xinitrc, which is a a symbolic link to /etc/X11/xinit/xinitrc.
Monday, March 28, 2005
Finite statemachine class
nice state machine implementation.
simple no gpl.
the other statemachine implementations i have found
are predicated on table generation. i would
create a table would be a pain because it
would not be human (this human) readable
once it was created. and because the
grammer that i dealing with is ll(k)
flex will not be of use. and flex script
is relative readable.
http://www.isd.mel.nist.gov/projects/omacapi/Software/FiniteStateMachine/FSMIntroPage.html
simple no gpl.
the other statemachine implementations i have found
are predicated on table generation. i would
create a table would be a pain because it
would not be human (this human) readable
once it was created. and because the
grammer that i dealing with is ll(k)
flex will not be of use. and flex script
is relative readable.
http://www.isd.mel.nist.gov/projects/omacapi/Software/FiniteStateMachine/FSMIntroPage.html
Friday, March 25, 2005
remote debugging with gdbserver
i may actually be able to use gdbserver
i tried this a couple of weeks ago with no success no
after more expermentation i think
i have something that works.
first on the host machine i downloaded and compiled
gdb version 6.0.
then i created a do nothing project that would
illustrate what i was looking for.
there is a main the opens a file and writes to it.
initall i wanted to write something to console
but it seems gdb server was eating the stderr
output. but opening a file and writting data
to it would show that program was be controlled
remotely.
------------------------------ main.c ---------------------
#ifdef HAVE_CONFIG_H
#include
#endif
#include
#include "foo.h"
int main(int argc, char * argv[])
{
int i = 0;
FILE *pFile;
pFile = fopen("/tmp/out.txt","w");
for(;;)
{
i++;
fprintf(pFile,"%d\n",foo(i));
fflush(pFile);
}
return 0;
}
----------------------------------------------
i wanted to see of the insight debugger
could automatically load source that
was being remotely debugged.
----------------------- foo.c ----------------
#ifdef HAVE_CONFIG_H
#include
#endif
#include
#include "foo.h"
int foo(int i)
{
return i-1;
}
-----------------------------------------------
procedure.
1) compile and link the program then tar
all of it and ftp it to the remote machine.
untar this and run gdbserver as follows:
./gdbserver 192.168.0.10:1234 ./stubs
the name of program executeable is stubs
the ip of this remote machine 192.168.0.10
i selected a port address of 1234.
2) on the host side start the insight debugger
and open the console window and type
file /path/to/stubs
then
target extended-remote 192.168.0.10:1234
the following should echo back
0x40000c90 in ?? ()
3) start debugging or should start debugging.
b main should put a breakpoint at main.
then
c or continute will run till main and stop
execute here
after that i started type s and as came to line
fprintf(pFile,"%d\n",foo(i));
the source file for foo.c was load automatically.
i telneted over to the remote machine and examined
the file /tmp/out.txt and the output was
0
1
2
3
as it should be.
i tried this a couple of weeks ago with no success no
after more expermentation i think
i have something that works.
first on the host machine i downloaded and compiled
gdb version 6.0.
then i created a do nothing project that would
illustrate what i was looking for.
there is a main the opens a file and writes to it.
initall i wanted to write something to console
but it seems gdb server was eating the stderr
output. but opening a file and writting data
to it would show that program was be controlled
remotely.
------------------------------ main.c ---------------------
#ifdef HAVE_CONFIG_H
#include
#endif
#include
#include "foo.h"
int main(int argc, char * argv[])
{
int i = 0;
FILE *pFile;
pFile = fopen("/tmp/out.txt","w");
for(;;)
{
i++;
fprintf(pFile,"%d\n",foo(i));
fflush(pFile);
}
return 0;
}
----------------------------------------------
i wanted to see of the insight debugger
could automatically load source that
was being remotely debugged.
----------------------- foo.c ----------------
#ifdef HAVE_CONFIG_H
#include
#endif
#include
#include "foo.h"
int foo(int i)
{
return i-1;
}
-----------------------------------------------
procedure.
1) compile and link the program then tar
all of it and ftp it to the remote machine.
untar this and run gdbserver as follows:
./gdbserver 192.168.0.10:1234 ./stubs
the name of program executeable is stubs
the ip of this remote machine 192.168.0.10
i selected a port address of 1234.
2) on the host side start the insight debugger
and open the console window and type
file /path/to/stubs
then
target extended-remote 192.168.0.10:1234
the following should echo back
0x40000c90 in ?? ()
3) start debugging or should start debugging.
b main should put a breakpoint at main.
then
c or continute will run till main and stop
execute here
after that i started type s and as came to line
fprintf(pFile,"%d\n",foo(i));
the source file for foo.c was load automatically.
i telneted over to the remote machine and examined
the file /tmp/out.txt and the output was
0
1
2
3
as it should be.
Sunday, March 20, 2005
MySQL revisited
Notes: From O'reilly book.
As with the binary install, the first step is to create a uer
who will run the MySql server:
$> su - root
$> groupadd mysql
$> useradd -g mysql mysql
......
The software is now installed. We have few set-up
taskes left do. Run mysql_install_deb to create
the MySql grant tables
$> cd /usr/local/mysql
$> cd scripts/mysql_install_db
Setup the ownership of the binaries so they are
owned by root and in the MySQL administrator
group
As with the binary install, the first step is to create a uer
who will run the MySql server:
$> su - root
$> groupadd mysql
$> useradd -g mysql mysql
......
The software is now installed. We have few set-up
taskes left do. Run mysql_install_deb to create
the MySql grant tables
$> cd /usr/local/mysql
$> cd scripts/mysql_install_db
Setup the ownership of the binaries so they are
owned by root and in the MySQL administrator
group
Wednesday, March 16, 2005
building kdrive on uclibc
i did finaly figure out how to build kdrive aka tinyx.
dont use uclibc build root system.
instead i used gentoo uclibc stage.
first of all uclibc stage can be
downloaded from one of the mirrors.
then i made a chroot. using the
stage and portage mirror.
tada i build system that works.
1) emerged kdrive this produced
/usr/X11R6/bin/Xvesa
/usr/X11R6/startxkd
I stopped x11
and re-ran he chroot sans x11
and tada xvesa ran the mouse work
correctly and ctrl-alt-backspace termed
the whole thing correctly.
how to place the thing on a bootable
cdrom?
------------------------------------------
xvesa i need to get
x/xvesa when the cd boots.
also what about an
ideas startx/xinit?
and a window manager (blackbox/fluxbox)
startx is a script
xinit is prog from c source xinitr.c
how does xinit start
here is what the man page says:
http://www.xfree86.org/current/xinit.1.html
The xinit program is used to start the X Window System server and a first client program on systems that cannot start X directly from /etc/init or in environments that use multiple window systems. When this first client exits, xinit will kill the X server and then terminate.
If no specific client program is given on the command line, xinit will look for a file in the user's home directory called .xinitrc to run as a shell script to start up client programs. If no such file exists, xinit will use the following as a default:
xterm -geometry +1+1 -n login -display :0
If no specific server program is given on the command line, xinit will look for a file in the user's home directory called .xserverrc to run as a shell script to start up the server. If no such file exists, xinit will use the following as a default:
X :0
Note that this assumes that there is a program named X in the current search path. However, servers are usually named Xdisplaytype where displaytype is the type of graphics display which is driven by this server. The site administrator should, therefore, make a link to the appropriate type of server on the machine, or create a shell script that runs xinit with the appropriate server.
Note, when using a .xserverrc script be sure to ``exec'' the real X server. Failing to do this can make the X server slow to start and exit. For example:
exec Xdisplaytype
An important point is that programs which are run by .xinitrc should be run in the background if they do not exit right away, so that they don't prevent other programs from starting up. However, the last long-lived program started (usually a window manager or terminal emulator) should be left in the foreground so that the script won't exit (which indicates that the user is done and that xinit should exit).
An alternate client and/or server may be specified on the command line. The desired client program and its arguments should be given as the first command line arguments to xinit. To specify a particular server command line, append a double dash (--) to the xinit command line (after any client and arguments) followed by the desired server command.
Both the client program name and the server program name must begin with a slash (/) or a period (.). Otherwise, they are treated as an arguments to be appended to their respective startup lines. This makes it possible to add arguments (for example, foreground and background colors) without having to retype the whole command line.
If an explicit server name is not given and the first argument following the double dash (--) is a colon followed by a digit, xinit will use that number as the display number instead of zero. All remaining arguments are appended to the server command line.
dont use uclibc build root system.
instead i used gentoo uclibc stage.
first of all uclibc stage can be
downloaded from one of the mirrors.
then i made a chroot. using the
stage and portage mirror.
tada i build system that works.
1) emerged kdrive this produced
/usr/X11R6/bin/Xvesa
/usr/X11R6/startxkd
I stopped x11
and re-ran he chroot sans x11
and tada xvesa ran the mouse work
correctly and ctrl-alt-backspace termed
the whole thing correctly.
how to place the thing on a bootable
cdrom?
------------------------------------------
xvesa i need to get
x/xvesa when the cd boots.
also what about an
ideas startx/xinit?
and a window manager (blackbox/fluxbox)
startx is a script
xinit is prog from c source xinitr.c
how does xinit start
here is what the man page says:
http://www.xfree86.org/current/xinit.1.html
The xinit program is used to start the X Window System server and a first client program on systems that cannot start X directly from /etc/init or in environments that use multiple window systems. When this first client exits, xinit will kill the X server and then terminate.
If no specific client program is given on the command line, xinit will look for a file in the user's home directory called .xinitrc to run as a shell script to start up client programs. If no such file exists, xinit will use the following as a default:
xterm -geometry +1+1 -n login -display :0
If no specific server program is given on the command line, xinit will look for a file in the user's home directory called .xserverrc to run as a shell script to start up the server. If no such file exists, xinit will use the following as a default:
X :0
Note that this assumes that there is a program named X in the current search path. However, servers are usually named Xdisplaytype where displaytype is the type of graphics display which is driven by this server. The site administrator should, therefore, make a link to the appropriate type of server on the machine, or create a shell script that runs xinit with the appropriate server.
Note, when using a .xserverrc script be sure to ``exec'' the real X server. Failing to do this can make the X server slow to start and exit. For example:
exec Xdisplaytype
An important point is that programs which are run by .xinitrc should be run in the background if they do not exit right away, so that they don't prevent other programs from starting up. However, the last long-lived program started (usually a window manager or terminal emulator) should be left in the foreground so that the script won't exit (which indicates that the user is done and that xinit should exit).
An alternate client and/or server may be specified on the command line. The desired client program and its arguments should be given as the first command line arguments to xinit. To specify a particular server command line, append a double dash (--) to the xinit command line (after any client and arguments) followed by the desired server command.
Both the client program name and the server program name must begin with a slash (/) or a period (.). Otherwise, they are treated as an arguments to be appended to their respective startup lines. This makes it possible to add arguments (for example, foreground and background colors) without having to retype the whole command line.
If an explicit server name is not given and the first argument following the double dash (--) is a colon followed by a digit, xinit will use that number as the display number instead of zero. All remaining arguments are appended to the server command line.
Checking MySql
ok my first attempt at starting mysql /etc/init.d/mysql start:
ERROR 2002: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
ok check the conf file.
----------------------------- here is the conf file -------------------------
# /etc/mysql/my.cnf: The global mysql configuration file.
# $Header: /var/cvsroot/gentoo-x86/dev-db/mysql/files/my.cnf-4.0.14-r1,v 1.2 2004/07/18 02:47:43 dragonheart Exp $
#
# This file can be simultaneously placed in three places:
# 1. /etc/mysql/my.cnf to set global options.
# 2. /var/lib/mysql/my.cnf to set server-specific options.
# 3. ~/.my.cnf to set user-specific options.
#
# One can use all long options that the program supports.
# Run the program with --help to get a list of them.
#
# The following values assume you have at least 32M RAM!
[client]
#password = my_password
port = 3306
socket = /var/run/mysqld/mysqld.sock
[safe_mysqld]
err-log = /var/log/mysql/mysql.err
[mysqld]
skip-innodb
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
log-error = /var/log/mysql/mysqld.err
# If set, mysql logs all queries(general query log). This will be deprecated in
# 5.0. This logs all queries, even error queries and is slow.
# log = /var/log/mysql/mysql.log
#
# If you really need logging, use rather binary logging. Especially when doing
# replication. Read
# file:/usr/share/doc/mysql-*/manual.html.gz#Replication
# You can use PURGE MASTER LOGS TO '$hostname-bin.010' to get rid of old logs
# from $hostname-bin.01 up to $hostname-bin.09 while the slave server is
# running.
# Before doing that, check which logfile slave curently uses by running
# mysql> SHOW SLAVE STATUS
# To list logfiles on master do:
# mysql> SHOW MASTER LOGS
# Then use PURGE for those not needed anymore only! Never remove the files
# manually!
#
# Also consult RESET MASTER and RESET SLAVE commands before doing any changes
# mysql> RESET MASTER - Deletes all binary logs listed in the index
# file, resetting the binlog index file to be empty.
# mysql> RESET SLAVE - Makes the slave forget its replication position in
# the master logs.
# mysql> SET SQL_LOG_BIN=0 - this turns off logging (execute on MASTER only)
# mysql> SET SQL_LOG_BIN=1 - this turns on logging (execute on MASTER only)
#
# log-bin
# set-variable = binlog-do-db=non_existant
# set-variable = binlog-ignore-db=database_name
#
# server-id has to unique for each master or slave in your network,
# lets use last number from IP address
# server-id = 207
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
language = /usr/share/mysql/english
skip-locking
set-variable = key_buffer=16M
set-variable = max_allowed_packet=1M
set-variable = thread_stack=128K
# keep secure by default!
bind-address = 127.0.0.1
port = 3306
# this can make it even more secure:
#skip-networking
[mysqldump]
quick
set-variable = max_allowed_packet=1M
[mysql]
#no-auto-rehash # faster start of mysql but no tab completition
[isamchk]
set-variable = key_buffer=16M
------------------------------------------------------------------------------
i chanched the entry for the pasword
and re-ran the start script
/etc/init.d/mysql start
no more error but new message to run the script /usr/bin/mysql_install_db
i ran the script and here is the following.
Preparing db table
Preparing host table
Preparing user table
Preparing func table
Preparing tables_priv table
Preparing columns_priv table
Installing all prepared tables
To start mysqld at boot time you have to copy support-files/mysql.server
to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, issue the following commands to start the server
and change the applicable passwords:
/etc/init.d/mysql start
/usr/bin/mysqladmin -u root -h gentoo password 'new-password'
/usr/bin/mysqladmin -u root password 'new-password'
Depending on your configuration, a -p option may be needed
in the last command. See the manual for more details.
You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &
You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory:
cd sql-bench ; perl run-all-tests
Please report any problems with the /usr/bin/mysqlbug script!
The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at https://order.mysql.com
so here is the up-shot.
$> emerge mysql
$> edit the /etc/mysql/mycnf file
$> /usr/bin/mysql_install_db
edit /etc/my.cnf
change the passworld entry
/etc/init.d/mysql start
run /usr/bin/mysql_install_db
add the mysql to the default startup.
ERROR 2002: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
ok check the conf file.
----------------------------- here is the conf file -------------------------
# /etc/mysql/my.cnf: The global mysql configuration file.
# $Header: /var/cvsroot/gentoo-x86/dev-db/mysql/files/my.cnf-4.0.14-r1,v 1.2 2004/07/18 02:47:43 dragonheart Exp $
#
# This file can be simultaneously placed in three places:
# 1. /etc/mysql/my.cnf to set global options.
# 2. /var/lib/mysql/my.cnf to set server-specific options.
# 3. ~/.my.cnf to set user-specific options.
#
# One can use all long options that the program supports.
# Run the program with --help to get a list of them.
#
# The following values assume you have at least 32M RAM!
[client]
#password = my_password
port = 3306
socket = /var/run/mysqld/mysqld.sock
[safe_mysqld]
err-log = /var/log/mysql/mysql.err
[mysqld]
skip-innodb
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
log-error = /var/log/mysql/mysqld.err
# If set, mysql logs all queries(general query log). This will be deprecated in
# 5.0. This logs all queries, even error queries and is slow.
# log = /var/log/mysql/mysql.log
#
# If you really need logging, use rather binary logging. Especially when doing
# replication. Read
# file:/usr/share/doc/mysql-*/manual.html.gz#Replication
# You can use PURGE MASTER LOGS TO '$hostname-bin.010' to get rid of old logs
# from $hostname-bin.01 up to $hostname-bin.09 while the slave server is
# running.
# Before doing that, check which logfile slave curently uses by running
# mysql> SHOW SLAVE STATUS
# To list logfiles on master do:
# mysql> SHOW MASTER LOGS
# Then use PURGE for those not needed anymore only! Never remove the files
# manually!
#
# Also consult RESET MASTER and RESET SLAVE commands before doing any changes
# mysql> RESET MASTER - Deletes all binary logs listed in the index
# file, resetting the binlog index file to be empty.
# mysql> RESET SLAVE - Makes the slave forget its replication position in
# the master logs.
# mysql> SET SQL_LOG_BIN=0 - this turns off logging (execute on MASTER only)
# mysql> SET SQL_LOG_BIN=1 - this turns on logging (execute on MASTER only)
#
# log-bin
# set-variable = binlog-do-db=non_existant
# set-variable = binlog-ignore-db=database_name
#
# server-id has to unique for each master or slave in your network,
# lets use last number from IP address
# server-id = 207
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
language = /usr/share/mysql/english
skip-locking
set-variable = key_buffer=16M
set-variable = max_allowed_packet=1M
set-variable = thread_stack=128K
# keep secure by default!
bind-address = 127.0.0.1
port = 3306
# this can make it even more secure:
#skip-networking
[mysqldump]
quick
set-variable = max_allowed_packet=1M
[mysql]
#no-auto-rehash # faster start of mysql but no tab completition
[isamchk]
set-variable = key_buffer=16M
------------------------------------------------------------------------------
i chanched the entry for the pasword
and re-ran the start script
/etc/init.d/mysql start
no more error but new message to run the script /usr/bin/mysql_install_db
i ran the script and here is the following.
Preparing db table
Preparing host table
Preparing user table
Preparing func table
Preparing tables_priv table
Preparing columns_priv table
Installing all prepared tables
To start mysqld at boot time you have to copy support-files/mysql.server
to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, issue the following commands to start the server
and change the applicable passwords:
/etc/init.d/mysql start
/usr/bin/mysqladmin -u root -h gentoo password 'new-password'
/usr/bin/mysqladmin -u root password 'new-password'
Depending on your configuration, a -p option may be needed
in the last command. See the manual for more details.
You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &
You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory:
cd sql-bench ; perl run-all-tests
Please report any problems with the /usr/bin/mysqlbug script!
The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at https://order.mysql.com
so here is the up-shot.
$> emerge mysql
$> edit the /etc/mysql/mycnf file
$> /usr/bin/mysql_install_db
edit /etc/my.cnf
change the passworld entry
/etc/init.d/mysql start
run /usr/bin/mysql_install_db
add the mysql to the default startup.
Slowly Fixing Bugzilla
The issue was that the index.cgi directory would never be show index.cgi
I hemmed and hawed around and then tried to use the check script
that comes with bugzilla and I check the user groups.
Finally I just tried trial and error.
I unmerged the buzilla and remerged apache
first things first. you have to resart apache for
options in the conf directory to take affect.
So remember to make a change and then to run/etc/init.d/apache2 restart repeat
I then figured out that I got and index.cgi to work
in a subdirectory of the main installed then I
could get bugzilla to install.
I created index.cgi script:
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "Hello, World.";
and placed it in the directory
/var/www/localhost/htdocs/zilla
then attempted to run the script
http://192.168.0.10/zilla
users@httpd.apache.org### /etc/apache2/conf/apache2.conf
### $Id: apache2.conf,v 1.1 2004/03/22 21:17:57 stuart Exp $
###
### Main Configuration Section
### You really shouldn't change these settings unless you're a guru
###
ServerRoot /usr/lib/apache2
ServerName 192.168.0.10
#LockFile /etc/apache2/apache2.lock
PidFile /var/run/apache2.pid
ErrorLog logs/error_log
LogLevel warn
DocumentRoot /var/www/localhost/htdocs
#the following had now affect on getting
#index.cgi to work
#DirectoryIndex index.html index.shtml index.cgi
### Dynamic Shared Object (DSO) Support
###
### You should always leave these three, as they are needed for normal use.
### mod_access (Order, Allow, etc..)
### mod_log_config (Transferlog, etc..)
### mod_mime (AddType, etc...)
###
LoadModule access_module modules/mod_access.so
LoadModule auth_module modules/mod_auth.so
LoadModule auth_anon_module modules/mod_auth_anon.so
LoadModule auth_dbm_module modules/mod_auth_dbm.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule include_module modules/mod_include.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule env_module modules/mod_env.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
LoadModule usertrack_module modules/mod_usertrack.so
LoadModule unique_id_module modules/mod_unique_id.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule mime_module modules/mod_mime.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule asis_module modules/mod_asis.so
LoadModule info_module modules/mod_info.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule cgid_module modules/mod_cgid.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
LoadModule imap_module modules/mod_imap.so
LoadModule actions_module modules/mod_actions.so
LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
###
### New Modules for 2.0 (some are experimental)
###
LoadModule file_cache_module modules/mod_file_cache.so
LoadModule echo_module modules/mod_echo.so
LoadModule charset_lite_module modules/mod_charset_lite.so
LoadModule cache_module modules/mod_cache.so
LoadModule disk_cache_module modules/mod_disk_cache.so
LoadModule mem_cache_module modules/mod_mem_cache.so
LoadModule ext_filter_module modules/mod_ext_filter.so
LoadModule case_filter_module modules/mod_case_filter.so
LoadModule case_filter_in_module modules/mod_case_filter_in.so
LoadModule deflate_module modules/mod_deflate.so
#LoadModule optional_hook_export_module modules/mod_optional_hook_export.so
#LoadModule optional_hook_import_module modules/mod_optional_hook_import.so
#LoadModule optional_fn_import_module modules/mod_optional_fn_import.so
#LoadModule optional_fn_export_module modules/mod_optional_fn_export.so
#LoadModule bucketeer_module modules/mod_bucketeer.so
LoadModule logio_module modules/mod_logio.so
###
### Global Configuration
###
# Splitting up apache2.conf into two files makes it easier to support
# multiple configurations on the same serer. In commonapache2.conf
# you keep directives that apply to all implementations and in this
# file you keep server-specific directives. While we don't yet have
# multiple configurations out-of-the-box, this allows us to do that
# in the future easily. (PERLPROXIED *ahem*)
#
# For Apache2 we load all conf files in conf/modules.d
Include conf/modules.d/*.conf
Include conf/commonapache2.conf
###
### IP Address/Port
###
#BindAddress *
Listen 80
###
### Log configuration Section
###
#Single logfile with access, agent and referer information
#This is the default, if vlogs are not defined for the main server
CustomLog logs/access_log combined env=!VLOG
#If VLOG is defined in conf/vhosts/vhosts.conf, we use this entry
#CustomLog "|/usr/sbin/apache2splitlogfile" vhost env=VLOG
###
### Virtual Hosts
###
# We include different templates for Virtual Hosting. Have a look in the
# vhosts directory and modify to suit your needs.
#Include conf/vhosts/vhosts.conf
#Include conf/vhosts/dynamic-vhosts.conf
#Include conf/vhosts/virtual-homepages.conf
###
### Performance settings Section
###
#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 300
#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On
#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100
#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 15
# prefork MPM [THIS IS THE DEFAULT]
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 150
MaxRequestsPerChild 0
# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
StartServers 2
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
# perchild MPM
# NumServers: constant number of server processes
# StartThreads: initial number of worker threads in each server process
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# MaxThreadsPerChild: maximum number of worker threads in each server process
# MaxRequestsPerChild: maximum number of connections per server process
NumServers 5
StartThreads 5
MinSpareThreads 5
MaxSpareThreads 10
MaxThreadsPerChild 20
MaxRequestsPerChild 0
#the follow doesnt fix or disable the issue
#AddHandler cgi-script .cgi
#The following kills the working index.cgi why?
#ScriptAlias /zilla/ /var/www/localhost/htdocs/zilla/
#the follow doesnt fix or disable the issue
#DirectoryIndex index.cgi
#the following lets me
AddHandler cgi-script .cgi
Options +Indexes +ExecCGI +FollowSymLinks
DirectoryIndex index.cgi
AllowOverride None
------------------------------------------------------------------------------------
the next thing to try is the actually install bugzilla
the machine i am working against will be remote
i may try the following once i get bugzilla and
subversion to work.
i came back and now emerge bugzilla.
this seemed to work a bit better this time.
i saw a post stating that it was better
to have a working mysql install or maybe
i just answered better questions to the
start up script.
anyway i added the following:
<Directory /var/www/localhost/htdocs/bugzilla/>
AddHandler cgi-script .cgi
Options +Indexes +ExecCGI +FollowSymLinks
DirectoryIndex index.cgi
AllowOverride None
</Directory>
to the conf file and restarted.
and tried to run http://192.168.0.10/bugzilla
in the browser ... no good i get a 500 error
this is different.
i then chmod +x index.cgi and then reload the url
and this is what i get.
Software error:
-------------------------------------------------------------------------------
No value for param loginmethod (try running checksetup.pl again) at Bugzilla/Config.pm line 161.
BEGIN failed--compilation aborted at Bugzilla/Auth.pm line 42.
Compilation failed in require at Bugzilla.pm line 27.
BEGIN failed--compilation aborted at Bugzilla.pm line 27.
Compilation failed in require at CGI.pl line 411.
BEGIN failed--compilation aborted at CGI.pl line 411.
For help, please send mail to the webmaster (root@localhost), giving this error message and the time and date of the error.
Software error:
[Wed Mar 16 12:50:13 2005] index.cgi: No value for param loginmethod (try running checksetup.pl again) at Bugzilla/Config.pm line 161.
[Wed Mar 16 12:50:13 2005] index.cgi: BEGIN failed--compilation aborted at Bugzilla/Auth.pm line 42.
[Wed Mar 16 12:50:13 2005] index.cgi: Compilation failed in require at Bugzilla.pm line 27.
[Wed Mar 16 12:50:13 2005] index.cgi: BEGIN failed--compilation aborted at Bugzilla.pm line 27.
[Wed Mar 16 12:50:13 2005] index.cgi: Compilation failed in require at CGI.pl line 411.
[Wed Mar 16 12:50:13 2005] index.cgi: BEGIN failed--compilation aborted at CGI.pl line 411.
Compilation failed in require at /var/www/localhost/htdocs/bugzilla/index.cgi line 33.
For help, please send mail to the webmaster
------------------------------------------------------------------------------------
couple of things to try:
1) is msql running? i dont know i havent check.
all i did was emerge the exes
2) are the permissions all the files correct?
I hemmed and hawed around and then tried to use the check script
that comes with bugzilla and I check the user groups.
Finally I just tried trial and error.
I unmerged the buzilla and remerged apache
first things first. you have to resart apache for
options in the conf directory to take affect.
So remember to make a change and then to run/etc/init.d/apache2 restart repeat
I then figured out that I got and index.cgi to work
in a subdirectory of the main installed then I
could get bugzilla to install.
I created index.cgi script:
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "Hello, World.";
and placed it in the directory
/var/www/localhost/htdocs/zilla
then attempted to run the script
http://192.168.0.10/zilla
users@httpd.apache.org### /etc/apache2/conf/apache2.conf
### $Id: apache2.conf,v 1.1 2004/03/22 21:17:57 stuart Exp $
###
### Main Configuration Section
### You really shouldn't change these settings unless you're a guru
###
ServerRoot /usr/lib/apache2
ServerName 192.168.0.10
#LockFile /etc/apache2/apache2.lock
PidFile /var/run/apache2.pid
ErrorLog logs/error_log
LogLevel warn
DocumentRoot /var/www/localhost/htdocs
#the following had now affect on getting
#index.cgi to work
#DirectoryIndex index.html index.shtml index.cgi
### Dynamic Shared Object (DSO) Support
###
### You should always leave these three, as they are needed for normal use.
### mod_access (Order, Allow, etc..)
### mod_log_config (Transferlog, etc..)
### mod_mime (AddType, etc...)
###
LoadModule access_module modules/mod_access.so
LoadModule auth_module modules/mod_auth.so
LoadModule auth_anon_module modules/mod_auth_anon.so
LoadModule auth_dbm_module modules/mod_auth_dbm.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule include_module modules/mod_include.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule env_module modules/mod_env.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
LoadModule usertrack_module modules/mod_usertrack.so
LoadModule unique_id_module modules/mod_unique_id.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule mime_module modules/mod_mime.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule asis_module modules/mod_asis.so
LoadModule info_module modules/mod_info.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule cgid_module modules/mod_cgid.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
LoadModule imap_module modules/mod_imap.so
LoadModule actions_module modules/mod_actions.so
LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
###
### New Modules for 2.0 (some are experimental)
###
LoadModule file_cache_module modules/mod_file_cache.so
LoadModule echo_module modules/mod_echo.so
LoadModule charset_lite_module modules/mod_charset_lite.so
LoadModule cache_module modules/mod_cache.so
LoadModule disk_cache_module modules/mod_disk_cache.so
LoadModule mem_cache_module modules/mod_mem_cache.so
LoadModule ext_filter_module modules/mod_ext_filter.so
LoadModule case_filter_module modules/mod_case_filter.so
LoadModule case_filter_in_module modules/mod_case_filter_in.so
LoadModule deflate_module modules/mod_deflate.so
#LoadModule optional_hook_export_module modules/mod_optional_hook_export.so
#LoadModule optional_hook_import_module modules/mod_optional_hook_import.so
#LoadModule optional_fn_import_module modules/mod_optional_fn_import.so
#LoadModule optional_fn_export_module modules/mod_optional_fn_export.so
#LoadModule bucketeer_module modules/mod_bucketeer.so
LoadModule logio_module modules/mod_logio.so
###
### Global Configuration
###
# Splitting up apache2.conf into two files makes it easier to support
# multiple configurations on the same serer. In commonapache2.conf
# you keep directives that apply to all implementations and in this
# file you keep server-specific directives. While we don't yet have
# multiple configurations out-of-the-box, this allows us to do that
# in the future easily. (PERLPROXIED *ahem*)
#
# For Apache2 we load all conf files in conf/modules.d
Include conf/modules.d/*.conf
Include conf/commonapache2.conf
###
### IP Address/Port
###
#BindAddress *
Listen 80
###
### Log configuration Section
###
#Single logfile with access, agent and referer information
#This is the default, if vlogs are not defined for the main server
CustomLog logs/access_log combined env=!VLOG
#If VLOG is defined in conf/vhosts/vhosts.conf, we use this entry
#CustomLog "|/usr/sbin/apache2splitlogfile" vhost env=VLOG
###
### Virtual Hosts
###
# We include different templates for Virtual Hosting. Have a look in the
# vhosts directory and modify to suit your needs.
#Include conf/vhosts/vhosts.conf
#Include conf/vhosts/dynamic-vhosts.conf
#Include conf/vhosts/virtual-homepages.conf
###
### Performance settings Section
###
#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 300
#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On
#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100
#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 15
# prefork MPM [THIS IS THE DEFAULT]
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 150
MaxRequestsPerChild 0
# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
StartServers 2
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
# perchild MPM
# NumServers: constant number of server processes
# StartThreads: initial number of worker threads in each server process
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# MaxThreadsPerChild: maximum number of worker threads in each server process
# MaxRequestsPerChild: maximum number of connections per server process
NumServers 5
StartThreads 5
MinSpareThreads 5
MaxSpareThreads 10
MaxThreadsPerChild 20
MaxRequestsPerChild 0
#the follow doesnt fix or disable the issue
#AddHandler cgi-script .cgi
#The following kills the working index.cgi why?
#ScriptAlias /zilla/ /var/www/localhost/htdocs/zilla/
#the follow doesnt fix or disable the issue
#DirectoryIndex index.cgi
#the following lets me
AddHandler cgi-script .cgi
Options +Indexes +ExecCGI +FollowSymLinks
DirectoryIndex index.cgi
AllowOverride None
------------------------------------------------------------------------------------
the next thing to try is the actually install bugzilla
the machine i am working against will be remote
i may try the following once i get bugzilla and
subversion to work.
i came back and now emerge bugzilla.
this seemed to work a bit better this time.
i saw a post stating that it was better
to have a working mysql install or maybe
i just answered better questions to the
start up script.
anyway i added the following:
<Directory /var/www/localhost/htdocs/bugzilla/>
AddHandler cgi-script .cgi
Options +Indexes +ExecCGI +FollowSymLinks
DirectoryIndex index.cgi
AllowOverride None
</Directory>
to the conf file and restarted.
and tried to run http://192.168.0.10/bugzilla
in the browser ... no good i get a 500 error
this is different.
i then chmod +x index.cgi and then reload the url
and this is what i get.
Software error:
-------------------------------------------------------------------------------
No value for param loginmethod (try running checksetup.pl again) at Bugzilla/Config.pm line 161.
BEGIN failed--compilation aborted at Bugzilla/Auth.pm line 42.
Compilation failed in require at Bugzilla.pm line 27.
BEGIN failed--compilation aborted at Bugzilla.pm line 27.
Compilation failed in require at CGI.pl line 411.
BEGIN failed--compilation aborted at CGI.pl line 411.
For help, please send mail to the webmaster (root@localhost), giving this error message and the time and date of the error.
Software error:
[Wed Mar 16 12:50:13 2005] index.cgi: No value for param loginmethod (try running checksetup.pl again) at Bugzilla/Config.pm line 161.
[Wed Mar 16 12:50:13 2005] index.cgi: BEGIN failed--compilation aborted at Bugzilla/Auth.pm line 42.
[Wed Mar 16 12:50:13 2005] index.cgi: Compilation failed in require at Bugzilla.pm line 27.
[Wed Mar 16 12:50:13 2005] index.cgi: BEGIN failed--compilation aborted at Bugzilla.pm line 27.
[Wed Mar 16 12:50:13 2005] index.cgi: Compilation failed in require at CGI.pl line 411.
[Wed Mar 16 12:50:13 2005] index.cgi: BEGIN failed--compilation aborted at CGI.pl line 411.
Compilation failed in require at /var/www/localhost/htdocs/bugzilla/index.cgi line 33.
For help, please send mail to the webmaster
------------------------------------------------------------------------------------
couple of things to try:
1) is msql running? i dont know i havent check.
all i did was emerge the exes
2) are the permissions all the files correct?
Sunday, March 13, 2005
SSH
OpenSSH wasinstalled when i installed everything else
subversion and bugzilla.
attempted logining into the gentoo box via
ssh -l user_name 192.168.0.x
a nogo.
ok is the sever started most likely not.
nope its not.
rc-update add /etc/init.d/sshd default
then i edited the /etc/ssh/sshd_config file
eventually i want to be able to ssh into this machine
and work remotely
i need to edit this file again.
/etc/ssh/sshd_config
skip will not skip it i found the gentoo wiki.
most excellent.
http://gentoo-wiki.com/HOWTO_setup_a_home-server#Configuring_ssh
i did the following
# ssh-keygen -t rsa1 -b 1024 -f /etc/ssh/ssh_host_key -N ""
# ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N ""
# ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ""
and the following actually worked.
# /etc/init.d/sshd start
and it ran!
then i tried loging infrom another machine on the local network
ssh -l user_name 192.168.0.x
this was a no go ... it kept asking
for a password
ill come back to it later
subversion and bugzilla.
attempted logining into the gentoo box via
ssh -l user_name 192.168.0.x
a nogo.
ok is the sever started most likely not.
nope its not.
rc-update add /etc/init.d/sshd default
then i edited the /etc/ssh/sshd_config file
eventually i want to be able to ssh into this machine
and work remotely
i need to edit this file again.
/etc/ssh/sshd_config
skip will not skip it i found the gentoo wiki.
most excellent.
http://gentoo-wiki.com/HOWTO_setup_a_home-server#Configuring_ssh
i did the following
# ssh-keygen -t rsa1 -b 1024 -f /etc/ssh/ssh_host_key -N ""
# ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N ""
# ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ""
and the following actually worked.
# /etc/init.d/sshd start
and it ran!
then i tried loging infrom another machine on the local network
ssh -l user_name 192.168.0.x
this was a no go ... it kept asking
for a password
ill come back to it later
The importance of taking notes
About 2 years ago i did a ton of mysql/java programming
All of the cuff i didnt take notes man i wish i had
written down how i got things to work. i wont do
that again (not take notes) because now id dont
have the time to fuck around with small details.
All of the cuff i didnt take notes man i wish i had
written down how i got things to work. i wont do
that again (not take notes) because now id dont
have the time to fuck around with small details.
Friday, March 11, 2005
MYSQL For Bugzilla
I have apache serving up simple web pages.
But what do i need to do for bugzilla?
the manual states that
need to place the following entry
in the apache.conf file.
<Directory /var/www/html/bugzilla>
AddHandler cgi-script .cgi
Options +Indexes +ExecCGI
DirectoryIndex index.cgi
AllowOverride Limit
</Directory>
but on the the gentoo distro the correct
location is at:
at /var/www/localhost/htdocs/bugzilla
But what do i need to do for bugzilla?
the manual states that
need to place the following entry
in the apache.conf file.
<Directory /var/www/html/bugzilla>
AddHandler cgi-script .cgi
Options +Indexes +ExecCGI
DirectoryIndex index.cgi
AllowOverride Limit
</Directory>
but on the the gentoo distro the correct
location is at:
at /var/www/localhost/htdocs/bugzilla
The labours of hercules
the build up to bugzilla.
I) Built a gentoo box.
The box has a 3com 3c59x class card.
modified the file /etc/modules.autoload.d/kernel-2.4
with the single line
3c59x
II) next set up the net work to have a static ip address.
change file /etc/conf.d/net to have the entry.
iface_eth0="192.168.0.x broadcast 192.168.0.255 netmask 255.255.255.0"
gateway="eth0/192.168.0.1"
III) emerge xorg and check that this works.
I was lucky xorg worked without a hitch.
Then installed mc tightvnc blackbox.
IV) emerge subversion and bugzilla with in turn emerges subversion.
ACCEPT_KEYWORDS="~x86" emerge bugzilla subversion
why accept keywords bugzilla is a masked ebuild
this can be found in the bugzilla ebuild file.
next steps will be to test the mysql database.
1) what has been place in the etc directories.
2) mysqldmin to test or mysqlcc?
after that will be to setup the ssh tunnel layer.
after that will be to setup rsync to do regular backups.
* Subversion Server Notes
* -----------------------
*
* If you intend to run a server, a repository needs to be created using
* svnadmin (see man svnadmin) or the following command to create it in
* /var/svn:
*
* ebuild /path/to/ebuild/subversion-1.1.3-r1.ebuild config
*
* If you upgraded from an older version of berkely db and experience
* problems with your repository then run the following commands as root:
* db4_recover -h /var/svn/repos
* chown -Rf apache:apache /var/svn/repos
*
* Subversion has multiple server types, take your pick:
*
* - svnserve daemon:
* 1. edit /etc/conf.d/svnserve
* 2. start daemon: /etc/init.d/svnserve start
* 3. make persistent: rc-update add svnserve default
*
* - svnserve via xinetd:
* 1. edit /etc/xinetd.d/svnserve (remove disable line)
* 2. restart xinetd.d: /etc/init.d/xinetd restart
*
* - svn over ssh:
* 1. create an svnserve wrapper in /usr/local/bin to set the umask you
* want, for example:
* #!/bin/bash
* umask 002
* exec /usr/bin/svnserve "$@"
*
>>> Regenerating /etc/ld.so.cache...
* Caching service dependencies...
>>> dev-util/subversion-1.1.3-r1 merged.
>>> Recording dev-util/subversion in "world" favorites file...
>>> clean: No packages selected for removal.
>>> Auto-cleaning packages ...
>>> No outdated packages were found on your system.
* Regenerating GNU info directory index...
* Processed 115 info files.
I) Built a gentoo box.
The box has a 3com 3c59x class card.
modified the file /etc/modules.autoload.d/kernel-2.4
with the single line
3c59x
II) next set up the net work to have a static ip address.
change file /etc/conf.d/net to have the entry.
iface_eth0="192.168.0.x broadcast 192.168.0.255 netmask 255.255.255.0"
gateway="eth0/192.168.0.1"
III) emerge xorg and check that this works.
I was lucky xorg worked without a hitch.
Then installed mc tightvnc blackbox.
IV) emerge subversion and bugzilla with in turn emerges subversion.
ACCEPT_KEYWORDS="~x86" emerge bugzilla subversion
why accept keywords bugzilla is a masked ebuild
this can be found in the bugzilla ebuild file.
next steps will be to test the mysql database.
1) what has been place in the etc directories.
2) mysqldmin to test or mysqlcc?
after that will be to setup the ssh tunnel layer.
after that will be to setup rsync to do regular backups.
* Subversion Server Notes
* -----------------------
*
* If you intend to run a server, a repository needs to be created using
* svnadmin (see man svnadmin) or the following command to create it in
* /var/svn:
*
* ebuild /path/to/ebuild/subversion-1.1.3-r1.ebuild config
*
* If you upgraded from an older version of berkely db and experience
* problems with your repository then run the following commands as root:
* db4_recover -h /var/svn/repos
* chown -Rf apache:apache /var/svn/repos
*
* Subversion has multiple server types, take your pick:
*
* - svnserve daemon:
* 1. edit /etc/conf.d/svnserve
* 2. start daemon: /etc/init.d/svnserve start
* 3. make persistent: rc-update add svnserve default
*
* - svnserve via xinetd:
* 1. edit /etc/xinetd.d/svnserve (remove disable line)
* 2. restart xinetd.d: /etc/init.d/xinetd restart
*
* - svn over ssh:
* 1. create an svnserve wrapper in /usr/local/bin to set the umask you
* want, for example:
* #!/bin/bash
* umask 002
* exec /usr/bin/svnserve "$@"
*
>>> Regenerating /etc/ld.so.cache...
* Caching service dependencies...
>>> dev-util/subversion-1.1.3-r1 merged.
>>> Recording dev-util/subversion in "world" favorites file...
>>> clean: No packages selected for removal.
>>> Auto-cleaning packages ...
>>> No outdated packages were found on your system.
* Regenerating GNU info directory index...
* Processed 115 info files.
Wednesday, March 09, 2005
Debootstrap and uwoody
building debootstrap
the ebuilds in gentoo are damned helpful.
followed instructions on debootrap ebuild
goto link:
http://packages.qa.debian.org/dpkg
and get source:
dpkg_1.10.26.tar.gz
untar it and make and install.
then
http://packages.qa.debian.org/d/debootstrap.html
and get source:
http://http.us.debian.org/debian/pool/main/d/debootstrap/debootstrap_0.2.45-0.2.tar.gz
un-tared this into tmp
then copied devices.tar.gz into the
this came from the directory
/tmp/debootstrap-0.2.45
then make all install
http://www.underhanded.org/papers/debian-conversion/remotedeb.html
the ebuilds in gentoo are damned helpful.
followed instructions on debootrap ebuild
goto link:
http://packages.qa.debian.org/dpkg
and get source:
dpkg_1.10.26.tar.gz
untar it and make and install.
then
http://packages.qa.debian.org/d/debootstrap.html
and get source:
http://http.us.debian.org/debian/pool/main/d/debootstrap/debootstrap_0.2.45-0.2.tar.gz
un-tared this into tmp
then copied devices.tar.gz into the
this came from the directory
/tmp/debootstrap-0.2.45
then make all install
http://www.underhanded.org/papers/debian-conversion/remotedeb.html
Tuesday, March 08, 2005
uwoody
I finlay started to understand uwoody provided by
eric anderson. not that i have it working.
I have to download the package debootstrap
given:
devel for this is on a redhat 7.3 machine
yes 7.3 so it would probably work on mandrake
9.x or 10.x or gentoo
tricks to creating a uwoody chroot.
1. find the source pack for debootstrap:
i my case i used:
debootstrap_0.2.45-0.2.tar.gz
un-tar the file in an appropriate area
and inside the directory created
run make and make install.
make install will create a directory called.
/usr/lib/debootstrap/scripts
to this directory you will add the file
uwoody which you have downloaded from:
http://people.debian.org/~andersee/debootstrap/
you will then run the following:
debootstrap --arch i386 uwoody /target http://people.debian.org/~andersee
this will create a directory called target that
should have the basic uclibc debian binaries
i chrooted into the /target directory:
$> chroot /target /bin/bash
and updated the apt system as follows.
1. added the file sources.list directory /etc/apt
and
2. added the line
deb http://people.debian.org/~andersee uwoody main
i wanted to check if the compiler was working correctly
did the following
echo "int main() { return 0; } " > dummy.c
gcc dummy.c
this produced a.out
i ray a.out as
$> a.out
no problems
the did the following
ldd a.out
libc.so.0 => /lib/libc.so.0 (0x40007000)
libintl.so.1 => /usr/lib/libintl.so.1 (0x40053000)
libiconv.so.2 => /usr/lib/libiconv.so.2 (0x40059000)
ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0x40000000)
eric anderson. not that i have it working.
I have to download the package debootstrap
given:
devel for this is on a redhat 7.3 machine
yes 7.3 so it would probably work on mandrake
9.x or 10.x or gentoo
tricks to creating a uwoody chroot.
1. find the source pack for debootstrap:
i my case i used:
debootstrap_0.2.45-0.2.tar.gz
un-tar the file in an appropriate area
and inside the directory created
run make and make install.
make install will create a directory called.
/usr/lib/debootstrap/scripts
to this directory you will add the file
uwoody which you have downloaded from:
http://people.debian.org/~andersee/debootstrap/
you will then run the following:
debootstrap --arch i386 uwoody /target http://people.debian.org/~andersee
this will create a directory called target that
should have the basic uclibc debian binaries
i chrooted into the /target directory:
$> chroot /target /bin/bash
and updated the apt system as follows.
1. added the file sources.list directory /etc/apt
and
2. added the line
deb http://people.debian.org/~andersee uwoody main
i wanted to check if the compiler was working correctly
did the following
echo "int main() { return 0; } " > dummy.c
gcc dummy.c
this produced a.out
i ray a.out as
$> a.out
no problems
the did the following
ldd a.out
libc.so.0 => /lib/libc.so.0 (0x40007000)
libintl.so.1 => /usr/lib/libintl.so.1 (0x40053000)
libiconv.so.2 => /usr/lib/libiconv.so.2 (0x40059000)
ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0x40000000)
Adding busybox To an existing boot cd
Why would you want todo this?
(long story here is how to do it).
The bootable cd was/is essentially all
binary. I am able to add new things to
it but chaning how the system boot
scripts work would be a long process
I dont wish to undertake.
In a script I added the followning:
#This kernel level module was present and
#did match the hardware I could obtain.
modprobe 3c59x
#Manually configure the network
ifconfig eth0 inet 192.168.0.x netmask 255.255.255.0 broadcast 192.168.0.255 u
#Also manually set up the loopback device
ifconfig lo 127.0.0.1 broadcast 255.0.0.0 up
#These are the busybox based telnet daemon
mkdir /dev/pts
mknod /dev/ptmx c 5 2
mount -t devpts none /dev/pts
#I had to copy the pam directories off of redhat cd
#as the bootable cdrom is redhat based.
#also I had to remove the securytty entry from the
#file login.
ln -s /cdrom/etc/pam.d /etc/pam.d
#next I created a derivated of the busybox
#passwd program that would just change
#passwd to predefined value. this util was called passwd1
/cdrom/busybox/adduser foobar
/cdrom/busybox/passwd1 foobar
/cdrom/busybox/telnetd
#note busybox was compiled static
#a nice feature not dependence on the binaries
#found on the cd.
#copy my entry into passwd file
/cdrom/bin/mini_httpd -u root -d /
(long story here is how to do it).
The bootable cd was/is essentially all
binary. I am able to add new things to
it but chaning how the system boot
scripts work would be a long process
I dont wish to undertake.
In a script I added the followning:
#This kernel level module was present and
#did match the hardware I could obtain.
modprobe 3c59x
#Manually configure the network
ifconfig eth0 inet 192.168.0.x netmask 255.255.255.0 broadcast 192.168.0.255 u
#Also manually set up the loopback device
ifconfig lo 127.0.0.1 broadcast 255.0.0.0 up
#These are the busybox based telnet daemon
mkdir /dev/pts
mknod /dev/ptmx c 5 2
mount -t devpts none /dev/pts
#I had to copy the pam directories off of redhat cd
#as the bootable cdrom is redhat based.
#also I had to remove the securytty entry from the
#file login.
ln -s /cdrom/etc/pam.d /etc/pam.d
#next I created a derivated of the busybox
#passwd program that would just change
#passwd to predefined value. this util was called passwd1
/cdrom/busybox/adduser foobar
/cdrom/busybox/passwd1 foobar
/cdrom/busybox/telnetd
#note busybox was compiled static
#a nice feature not dependence on the binaries
#found on the cd.
#copy my entry into passwd file
/cdrom/bin/mini_httpd -u root -d /
Saturday, March 05, 2005
The conundrum.
The conundrum is I simple can't
build something as thorough and
complete as buildroot, and really
don't want to just wanted to build
a bootable cd that had x11 and sdl.
But have said that I like my build
system so i have opted for a trade
off. Use the buildroot system to
make a uclibc chroot and my build
system lives inside that chroot.
I wouldn't have to loose all
settings and file moves and init files
that i had created and after soem
investigation i realized
what i wanted base coreutils less
and so forth could be build
and laid down on what would
become my own rootfile system.
build something as thorough and
complete as buildroot, and really
don't want to just wanted to build
a bootable cd that had x11 and sdl.
But have said that I like my build
system so i have opted for a trade
off. Use the buildroot system to
make a uclibc chroot and my build
system lives inside that chroot.
I wouldn't have to loose all
settings and file moves and init files
that i had created and after soem
investigation i realized
what i wanted base coreutils less
and so forth could be build
and laid down on what would
become my own rootfile system.
Friday, March 04, 2005
Built XF4.2.0 but ...
Build XFree 4.2.0 but dont jump and down yet.
Actually this isnt XFree 4.2.0 but closer to XFree
4.1.0 or something in between it is the
derivative that comes from uclibc buildroot.
I have modified the host.def file to build
the Xvesa server and is build.
Then I tried running the thing inside of
uclibc root/chroot ... the X11 cross comes
up and so does the herringbone pattern but
the mouse is froze and ctrl+alt+backspace
is frozen, so, i have to hit the power/reset.
Ok how did I get the thing to build? Its more
of question of what I wasnt doing? I wasnt
paying attention to the sed command in the
Makefile script. The
cross.def file contains the locations of the
cross compiler and cross linker
if these are fubar-ed then nothing
will work.
look at cross.def:
/* $XFree86: xc/config/cf/cross.def,v 1.2 2001/03/30 02:15:17 keithp Exp $ */
/*
* This file contains redefinitions of some symbols to enable
* cross compilation: e.g. paths for include files and paths to
* compiler images. It will have to be edited to reflect these
* given your local configuration.
*/
#undef i386Architecture
#define Arm32Architecture
#undef OptimizedCDebugFlags
#define OptimizedCDebugFlags -O2
#define ServerCDebugFlags -O2
#undef StandardDefines
#define StandardDefines -Dlinux -D__arm__ -D_POSIX_SOURCE -D_BSD_SOURCE -D_GNU_SOURCE -DX_LOCALE
#undef CcCmd
#define StdIncDir REPLACE_STAGING_DIR/include
#define PreIncDir
#undef PostIncDir
#define PostIncDir REPLACE_STAGING_DIR/lib/gcc-lib/arm-linux/3.2/include
#define CcCmd REPLACE_STAGING_DIR/bin/arm-uclibc-gcc
#undef CplusplusCmd
#define HasCplusplus NO
#define CplusplusCmd NO
#define DoRanlibCmd YES
#define RanlibCmd REPLACE_STAGING_DIR/bin/arm-uclibc-ranlib
#undef ExtraLoadFlags
#define ExtraLoadFlags
#define FbNoPixelAddrCode
#undef TermcapLibrary
#define TermcapLibrary NO
#undef LdPostLib
#define LdPostLib
#undef LdCmd
#define LdCmd REPLACE_STAGING_DIR/bin/arm-uclibc-ld
#undef ExtensionOSDefines
#define ExtensionOSDefines
#define ServerXdmcpDefines /**/
#include
REPLACE_STAGING_DIR needs to be sed-ed
with the staging directory
and arm-uclibc- needs to be
replaced with i386-uclibc-linux-gcc
then tada it compiles and builds.
getting it to work is another thing.
my best guess is that i am missing
and entry in the dev filesystem
Actually this isnt XFree 4.2.0 but closer to XFree
4.1.0 or something in between it is the
derivative that comes from uclibc buildroot.
I have modified the host.def file to build
the Xvesa server and is build.
Then I tried running the thing inside of
uclibc root/chroot ... the X11 cross comes
up and so does the herringbone pattern but
the mouse is froze and ctrl+alt+backspace
is frozen, so, i have to hit the power/reset.
Ok how did I get the thing to build? Its more
of question of what I wasnt doing? I wasnt
paying attention to the sed command in the
Makefile script. The
cross.def file contains the locations of the
cross compiler and cross linker
if these are fubar-ed then nothing
will work.
look at cross.def:
/* $XFree86: xc/config/cf/cross.def,v 1.2 2001/03/30 02:15:17 keithp Exp $ */
/*
* This file contains redefinitions of some symbols to enable
* cross compilation: e.g. paths for include files and paths to
* compiler images. It will have to be edited to reflect these
* given your local configuration.
*/
#undef i386Architecture
#define Arm32Architecture
#undef OptimizedCDebugFlags
#define OptimizedCDebugFlags -O2
#define ServerCDebugFlags -O2
#undef StandardDefines
#define StandardDefines -Dlinux -D__arm__ -D_POSIX_SOURCE -D_BSD_SOURCE -D_GNU_SOURCE -DX_LOCALE
#undef CcCmd
#define StdIncDir REPLACE_STAGING_DIR/include
#define PreIncDir
#undef PostIncDir
#define PostIncDir REPLACE_STAGING_DIR/lib/gcc-lib/arm-linux/3.2/include
#define CcCmd REPLACE_STAGING_DIR/bin/arm-uclibc-gcc
#undef CplusplusCmd
#define HasCplusplus NO
#define CplusplusCmd NO
#define DoRanlibCmd YES
#define RanlibCmd REPLACE_STAGING_DIR/bin/arm-uclibc-ranlib
#undef ExtraLoadFlags
#define ExtraLoadFlags
#define FbNoPixelAddrCode
#undef TermcapLibrary
#define TermcapLibrary NO
#undef LdPostLib
#define LdPostLib
#undef LdCmd
#define LdCmd REPLACE_STAGING_DIR/bin/arm-uclibc-ld
#undef ExtensionOSDefines
#define ExtensionOSDefines
#define ServerXdmcpDefines /**/
#include
REPLACE_STAGING_DIR needs to be sed-ed
with the staging directory
and arm-uclibc- needs to be
replaced with i386-uclibc-linux-gcc
then tada it compiles and builds.
getting it to work is another thing.
my best guess is that i am missing
and entry in the dev filesystem
Monday, February 28, 2005
remote debuggings using a gdbserver
god i hope this works.
this would mean i could really honestly start
stepping into the game code (a first)
1. i build a static and installed version gdb-6.3 to the game cd.
2. i build and installed gdb-.63 to my devel box.
but before i do that i want to see if this works so
i took one of my linux boxes and compiled and installed
gdb-6.3 on this box. the i plan to see if i can remotely
run gdb, if this works then i will get everything running
on the cd (the plan is).
well this didnt on the first cut
this would mean i could really honestly start
stepping into the game code (a first)
1. i build a static and installed version gdb-6.3 to the game cd.
2. i build and installed gdb-.63 to my devel box.
but before i do that i want to see if this works so
i took one of my linux boxes and compiled and installed
gdb-6.3 on this box. the i plan to see if i can remotely
run gdb, if this works then i will get everything running
on the cd (the plan is).
well this didnt on the first cut
building a autoconf based project
The following excerpt came from the following html page:
http://inti.sourceforge.net/tutorial/libinti/autotoolsproject.html
Building a GNU Autotools Project
1. The Essential Files
2. The Directory Structure
3. Makefile.am
4. configure.in
5. Generating the Output Files
6. Building and Installing the Project
7. Maintaining the Input Files
8. Some Helpful Links
If you're unfamiliar with the GNU Autotools and want to know how to build and maintain an Autotools project you should read this section. It will take you step-by-step through the process of creating and building a small project, and at the end provide you with some helpful links to more documentation and examples. You should also work through the next section on Internationalization and Localization. It will show you how to add international support to the project.
Autoconf and Automake provide an effective build system to maintain your software, usually on someone else's system. Automake examines source files, determines how they depend on each other, and generates a Makefile so the files can be compiled in the correct order. Autoconf permits automatic configuration of software installation, handling a large number of system quirks to increase portability. Libtool (not discussed here) is a command-line interface to the compiler and linker that makes it easy to generate static and shared libraries.
The Essential Files
The smallest project requires you provide only two files:
* Makefile.am - an input file to automake that specifies a projects build requirements: what needs to be built, and where it goes when installed.
* configure.in - an input file to autoconf that provides the macro invocations and shell code fragments autoconf uses to build a configure script.
The GNU Autotools will generate the rest of the files needed to build the project.
The Directory Structure
Before writing any code for a new project you need to decide on the directory structure the project will use.
* The top-level directory is used for configuration files, such as configure.in, and other sundry files like ChangeLog, COPY (a copy of the project license) and README.
* Any unique library should have its own subdirectory containing all headers and sources, a Makefile.am, and any other library specific files.
* The headers and sources for the main application should be in another subdirectory, typically called src.
* Other directories can include: config for intermediate files, doc for the project documentation and test for the project self-test suite.
The following steps will take you through creating and building the HelloWorld project. The top-level directory for HelloWorld is. You will find the project's headers and sources in the src subdirectory. There are three files: helloworld.cc, helloworld.h and main.cc.
Makfile.am
You must provide a Makefile.am file for each directory in your source tree. Makefile.am for the top-level directory is simple. Create a new text file called Makefile.am in the directory. Add the following line to the file and save it:
SUBDIRS = src
The SUBDIRS variable is used to list the subdirectories that must be built.
Next, in the subdirectory create another text file called Makefile.am. Add the following lines to the file and save it:
bin_PROGRAMS = helloworld
AM_CXXFLAGS = $(INTI_CFLAGS)
helloworld_SOURCES = main.cc helloworld.cc helloworld.h
helloworld_LDADD = $(INTI_LIBS)
The bin_PROGRAMS variable specifies that we want a program called helloworld to be built and installed in the bin directory when make install is run.
The AM_CXXFLAGS macro sets the compiler flags. You should not use CXXFLAGS in Makefile.am because it's unsafe. CXXFLAGS is a user variable that users expect to be able to override.
The helloworld_SOURCES variable specifies the source files used to build the helloworld target. Note that the SOURCES variable for a target is prefixed by the name of the target, in this case helloworld.
The last variable, helloworld_LDADD, specifies the libraries that must be passed to the linker to build the target. This variable is only used by programs and libraries. Note that LDADD uses the same naming rule as the SOURCES variable.
configure.in
The configure.in file must in the project's top-level directory. Change to the directory and create a text file called configure.in. Add the following lines to the file and save it:
AC_INIT(src/main.cc)
PACKAGE=helloworld
VERSION=0.1.0
AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
INTI_REQUIRED_VERSION=1.0.7
PKG_CHECK_MODULES(INTI, inti-1.0 >= $INTI_REQUIRED_VERSION)
AC_SUBST(INTI_CFLAGS)
AC_SUBST(INTI_LIBS)
AC_PROG_CXX
AC_OUTPUT(Makefile src/Makefile)
The AC_INIT macro performs essential initialization for the generated configure script. It takes as an argument a filename from the source directory, to ensure that the source directory has been specified correctly.
The PACKAGE and VERSION variables declare the name and version of the package respectively.
The AM_INIT_AUTOMAKE macro does all the standard initialization required by Automake and takes two arguments, the package name and version number.
The INTI_REQUIRED_VERSION variable specifies the minimum required Inti version, in this case 1.0.7.
The PKG_CHECK_MODULES macro checks for the specified version of the Inti library and if found places the necessary include flags in $(INTI_CFLAGS) and the libraries to link with $(INTI_LIBS). If the correct version is not found configure will report an error.
The AC_PROG_CXX checks for the C++ compiler and sets the variables CXX, GXX and CXXFLAGS.
The last macro AC_OUTPUT must be called at the end of configure.in to create the Makefiles.
Generating the Output Files
Now we need to generate the required output files from the two input files configure.in and Makefile.am. First we need to collect all the macro invocations in configure.in that Autoconf will need to build the configure script. This is done with the following command:
$ aclocal
This generates the file aclocal.m4 and adds it to the current directory.
Next, run autoconf:
$ autoconf
After running autoconf you will find the configure script in the current directory. It's important to run aclocal first because automake relies on the contents on configure.in and aclocal.m4.
There are a few files that the GNU standard says must be present in the top-level directory, and if not found Automake will report an error. Enter the following command to create these files:
$ touch AUTHORS NEWS README ChangeLog
Now we can run automake to create Makefile.in. The --add-missing argument copies some boilerplate files from your Automake installation into the current directory.
$ automake --add-missing
By now, the contents of the directory should be looking a lot like the top-level directory of a GNU package you may have installed before:
aclocal.m4 autom4te.cache config.h.in configure.in depcomp install-sh Makefile.in mkinstalldirs README
AUTHORS ChangeLog configure COPYING INSTALL Makefile.am missing NEWS src
Building and Installing the Project
At this point you should be able to package up your source tree in a tarball and give it to other users to install on their own systems. A user just has to unpack the tarball and run the following commands:
$ ./configure --prefix=some_directory
$ make
$ make install
If you run the above commands and look in your bin directory you will find helloworld. Have a look at the size of the executable. Wow! Its 588 kbytes. That's because it contains all the debugging and compiler symbols needed to debug the program.
Now run the following command:
$ make install-strip
If you look at the size of helloworld now it's a lot smaller, only 35.7 kbytes. The command make install-strip strips out all the debugging symbols. The resulting executable is much smaller and faster but you won't be able to debug the program. As a rule, you should only strip a program when its stable.
Maintaining the Input Files
Everytime you edit any of the GNU Autotools input files in your package, you must regenerate the output files. If you add a new source file to the helloworld_SOURCES variable in Makefile.am you must regenerate Makefile.in. If you are building your package you will need to rerun configure to regenerate the Makefile's. Many project maintainers put the necessary commands to do this into a script called autogen.sh and run this script whenever the output files need to be regenerated.
Create a text file called autogen.sh in the top-level directory and make sure you change its file mode to make it executable. Add the following commands to the file and save it:
#! /bin/sh
aclocal && automake --add-missing && autoconf
Now you can easily run the following commands to update your project's output files, and rebuild the project:
$./autogen.sh
$ ./configure --prefix=/some_directory
$ make
$ make install
I created a project called donothing-0.0.1
containing the following files:
Makefile.am
configure.in
AUTHORS
INTALL
COPYING
INSTALL
THANKS
src/getopt1.c
src/getopt.h
src/Makefile.in
src/getopt.c
src/main.c
src/Makefile.am
src/options.h
i ran the following instructions the root
source directory:
aclocal
autoconf
touch AUTHORS NEWS README Changlog
automake --add-missing
./configure
make
Tada, a GNU project
then I rebuild donothing debug
by:
make clean
make CFLAGS=-g
loaded gdb donothing and stepped through each
line of the prog (main.c)
http://inti.sourceforge.net/tutorial/libinti/autotoolsproject.html
Building a GNU Autotools Project
1. The Essential Files
2. The Directory Structure
3. Makefile.am
4. configure.in
5. Generating the Output Files
6. Building and Installing the Project
7. Maintaining the Input Files
8. Some Helpful Links
If you're unfamiliar with the GNU Autotools and want to know how to build and maintain an Autotools project you should read this section. It will take you step-by-step through the process of creating and building a small project, and at the end provide you with some helpful links to more documentation and examples. You should also work through the next section on Internationalization and Localization. It will show you how to add international support to the project.
Autoconf and Automake provide an effective build system to maintain your software, usually on someone else's system. Automake examines source files, determines how they depend on each other, and generates a Makefile so the files can be compiled in the correct order. Autoconf permits automatic configuration of software installation, handling a large number of system quirks to increase portability. Libtool (not discussed here) is a command-line interface to the compiler and linker that makes it easy to generate static and shared libraries.
The Essential Files
The smallest project requires you provide only two files:
* Makefile.am - an input file to automake that specifies a projects build requirements: what needs to be built, and where it goes when installed.
* configure.in - an input file to autoconf that provides the macro invocations and shell code fragments autoconf uses to build a configure script.
The GNU Autotools will generate the rest of the files needed to build the project.
The Directory Structure
Before writing any code for a new project you need to decide on the directory structure the project will use.
* The top-level directory is used for configuration files, such as configure.in, and other sundry files like ChangeLog, COPY (a copy of the project license) and README.
* Any unique library should have its own subdirectory containing all headers and sources, a Makefile.am, and any other library specific files.
* The headers and sources for the main application should be in another subdirectory, typically called src.
* Other directories can include: config for intermediate files, doc for the project documentation and test for the project self-test suite.
The following steps will take you through creating and building the HelloWorld project. The top-level directory for HelloWorld is
Makfile.am
You must provide a Makefile.am file for each directory in your source tree. Makefile.am for the top-level directory is simple. Create a new text file called Makefile.am in the
SUBDIRS = src
The SUBDIRS variable is used to list the subdirectories that must be built.
Next, in the
bin_PROGRAMS = helloworld
AM_CXXFLAGS = $(INTI_CFLAGS)
helloworld_SOURCES = main.cc helloworld.cc helloworld.h
helloworld_LDADD = $(INTI_LIBS)
The bin_PROGRAMS variable specifies that we want a program called helloworld to be built and installed in the bin directory when make install is run.
The AM_CXXFLAGS macro sets the compiler flags. You should not use CXXFLAGS in Makefile.am because it's unsafe. CXXFLAGS is a user variable that users expect to be able to override.
The helloworld_SOURCES variable specifies the source files used to build the helloworld target. Note that the SOURCES variable for a target is prefixed by the name of the target, in this case helloworld.
The last variable, helloworld_LDADD, specifies the libraries that must be passed to the linker to build the target. This variable is only used by programs and libraries. Note that LDADD uses the same naming rule as the SOURCES variable.
configure.in
The configure.in file must in the project's top-level directory. Change to the
AC_INIT(src/main.cc)
PACKAGE=helloworld
VERSION=0.1.0
AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
INTI_REQUIRED_VERSION=1.0.7
PKG_CHECK_MODULES(INTI, inti-1.0 >= $INTI_REQUIRED_VERSION)
AC_SUBST(INTI_CFLAGS)
AC_SUBST(INTI_LIBS)
AC_PROG_CXX
AC_OUTPUT(Makefile src/Makefile)
The AC_INIT macro performs essential initialization for the generated configure script. It takes as an argument a filename from the source directory, to ensure that the source directory has been specified correctly.
The PACKAGE and VERSION variables declare the name and version of the package respectively.
The AM_INIT_AUTOMAKE macro does all the standard initialization required by Automake and takes two arguments, the package name and version number.
The INTI_REQUIRED_VERSION variable specifies the minimum required Inti version, in this case 1.0.7.
The PKG_CHECK_MODULES macro checks for the specified version of the Inti library and if found places the necessary include flags in $(INTI_CFLAGS) and the libraries to link with $(INTI_LIBS). If the correct version is not found configure will report an error.
The AC_PROG_CXX checks for the C++ compiler and sets the variables CXX, GXX and CXXFLAGS.
The last macro AC_OUTPUT must be called at the end of configure.in to create the Makefiles.
Generating the Output Files
Now we need to generate the required output files from the two input files configure.in and Makefile.am. First we need to collect all the macro invocations in configure.in that Autoconf will need to build the configure script. This is done with the following command:
$ aclocal
This generates the file aclocal.m4 and adds it to the current directory.
Next, run autoconf:
$ autoconf
After running autoconf you will find the configure script in the current directory. It's important to run aclocal first because automake relies on the contents on configure.in and aclocal.m4.
There are a few files that the GNU standard says must be present in the top-level directory, and if not found Automake will report an error. Enter the following command to create these files:
$ touch AUTHORS NEWS README ChangeLog
Now we can run automake to create Makefile.in. The --add-missing argument copies some boilerplate files from your Automake installation into the current directory.
$ automake --add-missing
By now, the contents of the
aclocal.m4 autom4te.cache config.h.in configure.in depcomp install-sh Makefile.in mkinstalldirs README
AUTHORS ChangeLog configure COPYING INSTALL Makefile.am missing NEWS src
Building and Installing the Project
At this point you should be able to package up your source tree in a tarball and give it to other users to install on their own systems. A user just has to unpack the tarball and run the following commands:
$ ./configure --prefix=some_directory
$ make
$ make install
If you run the above commands and look in your bin directory you will find helloworld. Have a look at the size of the executable. Wow! Its 588 kbytes. That's because it contains all the debugging and compiler symbols needed to debug the program.
Now run the following command:
$ make install-strip
If you look at the size of helloworld now it's a lot smaller, only 35.7 kbytes. The command make install-strip strips out all the debugging symbols. The resulting executable is much smaller and faster but you won't be able to debug the program. As a rule, you should only strip a program when its stable.
Maintaining the Input Files
Everytime you edit any of the GNU Autotools input files in your package, you must regenerate the output files. If you add a new source file to the helloworld_SOURCES variable in Makefile.am you must regenerate Makefile.in. If you are building your package you will need to rerun configure to regenerate the Makefile's. Many project maintainers put the necessary commands to do this into a script called autogen.sh and run this script whenever the output files need to be regenerated.
Create a text file called autogen.sh in the top-level directory and make sure you change its file mode to make it executable. Add the following commands to the file and save it:
#! /bin/sh
aclocal && automake --add-missing && autoconf
Now you can easily run the following commands to update your project's output files, and rebuild the project:
$./autogen.sh
$ ./configure --prefix=/some_directory
$ make
$ make install
I created a project called donothing-0.0.1
containing the following files:
Makefile.am
configure.in
AUTHORS
INTALL
COPYING
INSTALL
THANKS
src/getopt1.c
src/getopt.h
src/Makefile.in
src/getopt.c
src/main.c
src/Makefile.am
src/options.h
i ran the following instructions the root
source directory:
aclocal
autoconf
touch AUTHORS NEWS README Changlog
automake --add-missing
./configure
make
Tada, a GNU project
then I rebuild donothing debug
by:
make clean
make CFLAGS=-g
loaded gdb donothing and stepped through each
line of the prog (main.c)
Subscribe to:
Comments (Atom)