i need to turn of optimization
discusses the following
http://wiki.inkscape.org/wiki/index.php/CompilingInkscape
Plain vanilla compilation is done as documented in INSTALL; ./autogen.sh (optionally); ./configure; make; su && make test; make install (optional). See INSTALL for more on that.
But if you're going to be doing a lot of development, there's some tricks and techniques you should know, to get best results.
1. Turn off optimization
2. Use ccache for faster compilation
3. Set up a separate build directory (nice for testing both gcc and g++, or cross compiling)
4. Use the -j N flag to optimize for the number of processors in your machine, with N = 1 + no. proc's
Example: Setting up both gcc and g++ build environments (in separate tree), and using ccache for faster compilations on a dual-processor machine, with no optimization, assuming /bin/bash:
mkdir build-gcc build-g++
cvs checkout inkscape
cd inkscape
libtoolize --copy --force
./autogen.sh
cd ../build-gcc
CFLAGS='-g -O0 -Wall' CC='ccache gcc' ../inkscape/configure
cd ../build-g++
CXXFLAGS='-g -O0 -Wall' CXX='ccache g++' ../inkscape/configure
cd ../build-gcc && make -j 3
cd ../build-g++ && make -j 3
Turning off just optimization (which can produce strange results in debuggers):
export CXXFLAGS='-g -O0 -Wall'
export CFLAGS='-g -O0 -Wall'
./configure
Retrieved from "http://wiki.inkscape.org/wiki/index.php/CompilingInkscape"
This page has been accessed 7,113 times. This page was last modified 21:45, 20 June 2006.
add to the file Makefile.am
bin_PROGRAMS = testxml
testxml_SOURCES = main.cpp
AM_CXXFLAGS = -g -O0 -Wall
CXXFLAGS=
SUBDIRS = tinyxml
LDADD = tinyxml/libtinyxml.a
Monday, October 30, 2006
getopts example
http://www.siit.tu.ac.th/mdailey/class/2003_s2/its225/assignments/testopts.c:
/*
* testopts.c: example usage for getopt command line parsing
* library.
*
* Matt Dailey, Feb 2004
*
* Compile with "gcc testopt.c" to get executable a.out.
*
* This example program takes arguments of the following form:
*
* a.out [-ac] [-b] arg1 arg2 ...
*
* That is, a.out has three optional options -a, -b, and -c.
* -a and -c are standalone options, and -b is an option that
* takes a string argument.
*
* Valid invocations include:
*
* a.out
* a.out -a
* a.out -c
* a.out -b arg1
* a.out -ac
* a.out -b arg1 -ca
* a.out f1 f2 f3
* a.out -a f1 f2 f3
* a.out -ca f1 f2 f3
* a.out -ca f1 f2 -b arg1 f3
*
* and so on. What's nice is that the options and arguments
* can occur in any order.
*
* Also refer to "man 3 getopt"
*
*/
#include
#include
#include
#include
#define TRUE 1
#define FALSE 0
char *g_pCharProgramName = NULL;
int main( int argc, char *argv[] ) {
extern char *optarg;
extern int optind;
int this_opt;
int bOptA = FALSE;
int bOptB = FALSE;
int bOptC = FALSE;
char *pCharOptB = NULL;
g_pCharProgramName = argv[0];
/* Loop until all arguments are processed. On each pass, we
* call getopt() for the next option */
while ( 1 ) {
/* Get the next option. It is placed in this_opt. We pass
* the user-entered argc/argv and our option string. The
* option string "ab:c" says our program has options -a, -b,
* and -c. The -b option requires an argument (this is
* specified by the colon in 'b:'. */
this_opt = getopt( argc, argv, "ab:c" );
/* If there are no options left, getopt() returns -1. */
if ( this_opt == -1 ) break;
/* Now we have either a valid option or an invalid option.
* Check all possible cases. */
switch ( this_opt ) {
case 'a':
/* The user selected the -a option. Set a bool for later use. */
bOptA = TRUE;
break;
case 'b':
/* This is the -b option. Since we put b: in the getopt
* options string, option b has an argument. Let's save it */
bOptB = TRUE;
pCharOptB = strdup( optarg );
break;
case 'c':
/* -c is another simple option like -a. Just set a flag to
* not that the user selected it. */
bOptC = TRUE;
break;
default:
/* Error case.
*
* getopt() prints an invalid option message for you.
* Usually we now print a usage message. */
printf( "Usage: %s [-ac] [-b] [arg1] [arg2] ...\n",
g_pCharProgramName );
exit( -1 );
break;
}
}
/* Print out the options selected and not selected */
if ( bOptA ) {
printf( "Option A selected\n" );
} else {
printf( "Option A not selected\n" );
}
if ( bOptB ) {
printf( "Option B selected with argument %s\n", pCharOptB );
} else {
printf( "Option B not selected\n" );
}
if ( bOptC ) {
printf( "Option C selected\n" );
} else {
printf( "Option C not selected\n" );
}
/* Print out the non-option arguments. optind now indexes
* the first non-option argument in argv[]. */
while( optind < argc ) {
printf( "Got non-option argument %s\n", argv[optind] );
optind++;
}
/* Clean up */
if ( pCharOptB != NULL ) free( pCharOptB );
}
/*
* testopts.c: example usage for getopt command line parsing
* library.
*
* Matt Dailey, Feb 2004
*
* Compile with "gcc testopt.c" to get executable a.out.
*
* This example program takes arguments of the following form:
*
* a.out [-ac] [-b
*
* That is, a.out has three optional options -a, -b, and -c.
* -a and -c are standalone options, and -b is an option that
* takes a string argument.
*
* Valid invocations include:
*
* a.out
* a.out -a
* a.out -c
* a.out -b arg1
* a.out -ac
* a.out -b arg1 -ca
* a.out f1 f2 f3
* a.out -a f1 f2 f3
* a.out -ca f1 f2 f3
* a.out -ca f1 f2 -b arg1 f3
*
* and so on. What's nice is that the options and arguments
* can occur in any order.
*
* Also refer to "man 3 getopt"
*
*/
#include
#include
#include
#include
#define TRUE 1
#define FALSE 0
char *g_pCharProgramName = NULL;
int main( int argc, char *argv[] ) {
extern char *optarg;
extern int optind;
int this_opt;
int bOptA = FALSE;
int bOptB = FALSE;
int bOptC = FALSE;
char *pCharOptB = NULL;
g_pCharProgramName = argv[0];
/* Loop until all arguments are processed. On each pass, we
* call getopt() for the next option */
while ( 1 ) {
/* Get the next option. It is placed in this_opt. We pass
* the user-entered argc/argv and our option string. The
* option string "ab:c" says our program has options -a, -b,
* and -c. The -b option requires an argument (this is
* specified by the colon in 'b:'. */
this_opt = getopt( argc, argv, "ab:c" );
/* If there are no options left, getopt() returns -1. */
if ( this_opt == -1 ) break;
/* Now we have either a valid option or an invalid option.
* Check all possible cases. */
switch ( this_opt ) {
case 'a':
/* The user selected the -a option. Set a bool for later use. */
bOptA = TRUE;
break;
case 'b':
/* This is the -b option. Since we put b: in the getopt
* options string, option b has an argument. Let's save it */
bOptB = TRUE;
pCharOptB = strdup( optarg );
break;
case 'c':
/* -c is another simple option like -a. Just set a flag to
* not that the user selected it. */
bOptC = TRUE;
break;
default:
/* Error case.
*
* getopt() prints an invalid option message for you.
* Usually we now print a usage message. */
printf( "Usage: %s [-ac] [-b
g_pCharProgramName );
exit( -1 );
break;
}
}
/* Print out the options selected and not selected */
if ( bOptA ) {
printf( "Option A selected\n" );
} else {
printf( "Option A not selected\n" );
}
if ( bOptB ) {
printf( "Option B selected with argument %s\n", pCharOptB );
} else {
printf( "Option B not selected\n" );
}
if ( bOptC ) {
printf( "Option C selected\n" );
} else {
printf( "Option C not selected\n" );
}
/* Print out the non-option arguments. optind now indexes
* the first non-option argument in argv[]. */
while( optind < argc ) {
printf( "Got non-option argument %s\n", argv[optind] );
optind++;
}
/* Clean up */
if ( pCharOptB != NULL ) free( pCharOptB );
}
Friday, October 27, 2006
Better XConfiguration script that uses the ouput of xvidtune
Section "ServerLayout"
Identifier "XFree86 Configured"
Screen 0 "Screen0" 0 0
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
EndSection
Section "Files"
RgbPath "/usr/X11R6/lib/X11/rgb"
ModulePath "/usr/X11R6/lib/modules"
FontPath "/usr/X11R6/lib/X11/fonts/misc/"
FontPath "/usr/X11R6/lib/X11/fonts/Speedo/"
FontPath "/usr/X11R6/lib/X11/fonts/Type1/"
FontPath "/usr/X11R6/lib/X11/fonts/CID/"
FontPath "/usr/X11R6/lib/X11/fonts/75dpi/"
FontPath "/usr/X11R6/lib/X11/fonts/100dpi/"
EndSection
Section "Module"
Load "dbe"
Load "dri"
Load "extmod"
Load "glx"
Load "record"
Load "xtrap"
Load "speedo"
Load "type1"
EndSection
Section "InputDevice"
Identifier "Keyboard0"
Driver "keyboard"
EndSection
Section "InputDevice"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/psaux"
EndSection
Section "Monitor"
#DisplaySize 370 270 # mm
Identifier "Monitor0"
VendorName "VSC"
ModelName "A90-2"
Option "DPMS"
EndSection
#the following was derived from xvidtune
Section "Modes"
Identifier "Mode1"
Modeline "1280x1024" 157.50 1280 1344 1504 1728 1024 1025 1028 1072
Modeline "1280x960" 148.50 1280 1344 1504 1728 960 961 964 1011
Modeline "1024x768" 94.50 1024 1072 1168 1376 768 769 772 808
EndSection
Section "Device"
### Available Driver options are:-
### Values: : integer,: float, : "True"/"False",
###: "String", : " Hz/kHz/MHz"
### [arg]: arg optional
#Option "NoAccel" # []
#Option "SWcursor" # []
#Option "Dac6Bit" # []
#Option "Dac8Bit" # []
#Option "ForcePCIMode" # []
#Option "BusType" # []
#Option "CPPIOMode" # []
#Option "CPusecTimeout" #
#Option "AGPMode" #
#Option "AGPFastWrite" # []
#Option "AGPSize" #
#Option "GARTSize" #
#Option "RingSize" #
#Option "BufferSize" #
#Option "EnableDepthMoves" # []
#Option "EnablePageFlip" # []
#Option "NoBackBuffer" # []
#Option "PanelOff" # []
#Option "DDCMode" # []
#Option "MonitorLayout" # []
#Option "IgnoreEDID" # []
#Option "OverlayOnCRTC2" # []
#Option "CloneMode" # []
#Option "CloneHSync" # []
#Option "CloneVRefresh" # []
#Option "UseFBDev" # []
#Option "VideoKey" #
#Option "DisplayPriority" # []
#Option "PanelSize" # []
#Option "ForceMinDotClock" #
Identifier "Card0"
Driver "ati"
VendorName "ATI Technologies Inc"
BoardName "Radeon R250 Lf [Radeon Mobility 9000 M9]"
BusID "PCI:1:0:0"
EndSection
Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"
DefaultColorDepth 16
# i added this section
SubSection "Display"
Depth 8
Modes "1280x1024" "1024x768" "800x600" "640x480" "640x400"
EndSubSection
SubSection "Display"
Depth 15
Modes "1280x1024" "1152x864" "1024x768" "800x600" "640x480" "640x400" "512x384" "480x300" "400x300" "320x240" "320x200"
EndSubSection
SubSection "Display"
Depth 16
Modes "1280x1024" "1024x768" "800x600" "640x480" "640x400"
EndSubSection
SubSection "Display"
Depth 24
Modes "1280x1024" "1152x864" "1024x768" "800x600" "640x480" "640x400" "512x384" "480x300" "400x300" "320x240" "320x200"
EndSubSection
SubSection "Display"
Depth 32
Modes "1280x1024" "1152x864" "1024x768" "800x600" "640x480" "640x400" "512x384" "480x300" "400x300" "320x240" "320x200"
EndSubSection
EndSection
Identifier "XFree86 Configured"
Screen 0 "Screen0" 0 0
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
EndSection
Section "Files"
RgbPath "/usr/X11R6/lib/X11/rgb"
ModulePath "/usr/X11R6/lib/modules"
FontPath "/usr/X11R6/lib/X11/fonts/misc/"
FontPath "/usr/X11R6/lib/X11/fonts/Speedo/"
FontPath "/usr/X11R6/lib/X11/fonts/Type1/"
FontPath "/usr/X11R6/lib/X11/fonts/CID/"
FontPath "/usr/X11R6/lib/X11/fonts/75dpi/"
FontPath "/usr/X11R6/lib/X11/fonts/100dpi/"
EndSection
Section "Module"
Load "dbe"
Load "dri"
Load "extmod"
Load "glx"
Load "record"
Load "xtrap"
Load "speedo"
Load "type1"
EndSection
Section "InputDevice"
Identifier "Keyboard0"
Driver "keyboard"
EndSection
Section "InputDevice"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/psaux"
EndSection
Section "Monitor"
#DisplaySize 370 270 # mm
Identifier "Monitor0"
VendorName "VSC"
ModelName "A90-2"
Option "DPMS"
EndSection
#the following was derived from xvidtune
Section "Modes"
Identifier "Mode1"
Modeline "1280x1024" 157.50 1280 1344 1504 1728 1024 1025 1028 1072
Modeline "1280x960" 148.50 1280 1344 1504 1728 960 961 964 1011
Modeline "1024x768" 94.50 1024 1072 1168 1376 768 769 772 808
EndSection
Section "Device"
### Available Driver options are:-
### Values: : integer,
###
### [arg]: arg optional
#Option "NoAccel" # [
#Option "SWcursor" # [
#Option "Dac6Bit" # [
#Option "Dac8Bit" # [
#Option "ForcePCIMode" # [
#Option "BusType" # [
#Option "CPPIOMode" # [
#Option "CPusecTimeout" #
#Option "AGPMode" #
#Option "AGPFastWrite" # [
#Option "AGPSize" #
#Option "GARTSize" #
#Option "RingSize" #
#Option "BufferSize" #
#Option "EnableDepthMoves" # [
#Option "EnablePageFlip" # [
#Option "NoBackBuffer" # [
#Option "PanelOff" # [
#Option "DDCMode" # [
#Option "MonitorLayout" # [
#Option "IgnoreEDID" # [
#Option "OverlayOnCRTC2" # [
#Option "CloneMode" # [
#Option "CloneHSync" # [
#Option "CloneVRefresh" # [
#Option "UseFBDev" # [
#Option "VideoKey" #
#Option "DisplayPriority" # [
#Option "PanelSize" # [
#Option "ForceMinDotClock" #
Identifier "Card0"
Driver "ati"
VendorName "ATI Technologies Inc"
BoardName "Radeon R250 Lf [Radeon Mobility 9000 M9]"
BusID "PCI:1:0:0"
EndSection
Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"
DefaultColorDepth 16
# i added this section
SubSection "Display"
Depth 8
Modes "1280x1024" "1024x768" "800x600" "640x480" "640x400"
EndSubSection
SubSection "Display"
Depth 15
Modes "1280x1024" "1152x864" "1024x768" "800x600" "640x480" "640x400" "512x384" "480x300" "400x300" "320x240" "320x200"
EndSubSection
SubSection "Display"
Depth 16
Modes "1280x1024" "1024x768" "800x600" "640x480" "640x400"
EndSubSection
SubSection "Display"
Depth 24
Modes "1280x1024" "1152x864" "1024x768" "800x600" "640x480" "640x400" "512x384" "480x300" "400x300" "320x240" "320x200"
EndSubSection
SubSection "Display"
Depth 32
Modes "1280x1024" "1152x864" "1024x768" "800x600" "640x480" "640x400" "512x384" "480x300" "400x300" "320x240" "320x200"
EndSubSection
EndSection
Thursday, October 26, 2006
setting up the kernel and the modules.
the kernel goes here
/boot/xxxkernel
you need to modify the /boot/grub/menu.lst
to have the following entry.
i just place this at the top of the previous
entries.
title sasKernel from xxxx
root (hd0,0)
kernel /boot/xxxkernel root=/dev/hdc1 ro single
savedefault
boot
notice that this is a 2.6 kernel and has kernel modules
the modules start-up is dependent on the file
/etc/modules:
------------------------------------------------------------------
# /etc/modules: kernel modules to load at boot time.
#
# This file should contain the names of kernel modules that are
# to be loaded at boot time, one per line. Comments begin with
# a "#", and everything on the line after them are ignored.
ide-cd
ide-detect
ide-disk
psmouse
sd_mod
sr_mod
## i added these.
radeon
sis
8250
serial_core
-----------------------------------------------------------------
these files are in /lib/modules/2.6.10-xxx/kernel
./drivers
./drivers/char
./drivers/char/drm
./drivers/char/drm/radeon.ko
./drivers/char/drm/sis.ko
./drivers/serial
./drivers/serial/8250.ko
./drivers/serial/serial_core.ko
/boot/xxxkernel
you need to modify the /boot/grub/menu.lst
to have the following entry.
i just place this at the top of the previous
entries.
title sasKernel from xxxx
root (hd0,0)
kernel /boot/xxxkernel root=/dev/hdc1 ro single
savedefault
boot
notice that this is a 2.6 kernel and has kernel modules
the modules start-up is dependent on the file
/etc/modules:
------------------------------------------------------------------
# /etc/modules: kernel modules to load at boot time.
#
# This file should contain the names of kernel modules that are
# to be loaded at boot time, one per line. Comments begin with
# a "#", and everything on the line after them are ignored.
ide-cd
ide-detect
ide-disk
psmouse
sd_mod
sr_mod
## i added these.
radeon
sis
8250
serial_core
-----------------------------------------------------------------
these files are in /lib/modules/2.6.10-xxx/kernel
./drivers
./drivers/char
./drivers/char/drm
./drivers/char/drm/radeon.ko
./drivers/char/drm/sis.ko
./drivers/serial
./drivers/serial/8250.ko
./drivers/serial/serial_core.ko
bootlogd
i have added bootlogd start to my rc0 start up script
debian:/etc/rc0.d# ls -l S*boot*
lrwxr-xr-x 1 root root 18 2006-10-26 10:41 S00bootlogd -> ../init.d/bootlogd
lets see if this can log everything.
here is so more information i found out about bootlogd
the init script i set up in /etc/rcS.d no in the above /etc/rc0.d
and this guy at http://www.timhardy.net/wordpress/2005/12/11/enabling-bootlogd-on-debian-31/
had the following to say:
Enabling Bootlogd on Debian 3.1
Bootlogd does not work out of the box on Debian 3.1 with a 2.6.8 kernel. If you enable it by setting the option to yes in /etc/default/bootlogd you’ll see the error message bootlogd: ioctl (/dev/ttyzf, TIOCCONS): Bad file descriptor scroll by on boot and the log is not created.
The problem lies with the version of udev used in Debian stable.
One solution is to upgrade the udev package to one from testing or unstable but that is not acceptable to someone who wants a pure system.
The alternative is to move the order the scripts are executed in /etc/rcS.d/. Remember, execution order is determined by the number in the filename so by renaming the bootlogd launching script you can get it to run before the udev script S04udev
mv /etc/rcS.d/S05bootlogd /etc/rcS.d/S03bootlogd-was-S05
The next time you boot, the log will be enabled for reading in /var/log/boot.
(Solution by Frans Pop on the debian-laptop mailing list)
then you need to change the /etc/default/bootlogd file look like
-----------------------------------------------------------------
# Run bootlogd at startup ?
BOOTLOGD_ENABLE=YES
debian:/etc/rc0.d# ls -l S*boot*
lrwxr-xr-x 1 root root 18 2006-10-26 10:41 S00bootlogd -> ../init.d/bootlogd
lets see if this can log everything.
here is so more information i found out about bootlogd
the init script i set up in /etc/rcS.d no in the above /etc/rc0.d
and this guy at http://www.timhardy.net/wordpress/2005/12/11/enabling-bootlogd-on-debian-31/
had the following to say:
Enabling Bootlogd on Debian 3.1
Bootlogd does not work out of the box on Debian 3.1 with a 2.6.8 kernel. If you enable it by setting the option to yes in /etc/default/bootlogd you’ll see the error message bootlogd: ioctl (/dev/ttyzf, TIOCCONS): Bad file descriptor scroll by on boot and the log is not created.
The problem lies with the version of udev used in Debian stable.
One solution is to upgrade the udev package to one from testing or unstable but that is not acceptable to someone who wants a pure system.
The alternative is to move the order the scripts are executed in /etc/rcS.d/. Remember, execution order is determined by the number in the filename so by renaming the bootlogd launching script you can get it to run before the udev script S04udev
mv /etc/rcS.d/S05bootlogd /etc/rcS.d/S03bootlogd-was-S05
The next time you boot, the log will be enabled for reading in /var/log/boot.
(Solution by Frans Pop on the debian-laptop mailing list)
then you need to change the /etc/default/bootlogd file look like
-----------------------------------------------------------------
# Run bootlogd at startup ?
BOOTLOGD_ENABLE=YES
Friday, October 20, 2006
Tuesday, October 17, 2006
autoconf
http://www.openismus.com/documents/linux/automake/automake.shtml
great little tutorial.
here is what tools i needed to install.
ii autoconf 2.59a-3 automatic configure script builder
ii autogen 5.6.6-2 an automated text file generator
ii automake1.4 1.4-p6-9 A tool for generating GNU Standards-complian
ii autoproject 0.17-1 create a skeleton source package for a new p
ii autotools-dev 20050422.1 Update infrastructure for config.{guess,sub}
ii libtool 1.5.6-6 Generic library support script
great little tutorial.
here is what tools i needed to install.
ii autoconf 2.59a-3 automatic configure script builder
ii autogen 5.6.6-2 an automated text file generator
ii automake1.4 1.4-p6-9 A tool for generating GNU Standards-complian
ii autoproject 0.17-1 create a skeleton source package for a new p
ii autotools-dev 20050422.1 Update infrastructure for config.{guess,sub}
ii libtool 1.5.6-6 Generic library support script
Friday, October 13, 2006
yo dude im back!
working on a debian system whoopte fucking do!
here is a working XF86Config-4:
------------------------------------------------------------------------------
# XF86Config-4 (XFree86 X Window System server configuration file)
#
# This file was generated by dexconf, the Debian X Configuration tool, using
# values from the debconf database.
#
# Edit this file with caution, and see the XF86Config-4 manual page.
# (Type "man XF86Config-4" at the shell prompt.)
#
# This file is automatically updated on xserver-xfree86 package upgrades *only*
# if it has not been modified since the last upgrade of the xserver-xfree86
# package.
#
# If you have edited this file but would like it to be automatically updated
# again, run the following commands as root:
#
# cp /etc/X11/XF86Config-4 /etc/X11/XF86Config-4.custom
# md5sum /etc/X11/XF86Config-4 >/var/lib/xfree86/XF86Config-4.md5sum
# dpkg-reconfigure xserver-xfree86
Section "ServerLayout"
Identifier "Default Layout"
Screen "Default Screen" 0 0
InputDevice "Generic Keyboard"
InputDevice "Configured Mouse"
EndSection
Section "Files"
# local font server
# if the local font server has problems, we can fall back on these
FontPath "unix/:7100"
FontPath "/usr/lib/X11/fonts/misc"
FontPath "/usr/lib/X11/fonts/cyrillic"
FontPath "/usr/lib/X11/fonts/100dpi/:unscaled"
FontPath "/usr/lib/X11/fonts/75dpi/:unscaled"
FontPath "/usr/lib/X11/fonts/Type1"
FontPath "/usr/lib/X11/fonts/CID"
FontPath "/usr/lib/X11/fonts/Speedo"
FontPath "/usr/lib/X11/fonts/100dpi"
FontPath "/usr/lib/X11/fonts/75dpi"
EndSection
Section "Module"
Load "GLcore"
Load "bitmap"
Load "dbe"
Load "ddc"
Load "dri"
Load "extmod"
Load "freetype"
Load "glx"
Load "int10"
Load "record"
Load "speedo"
Load "type1"
Load "vbe"
EndSection
Section "InputDevice"
Identifier "Generic Keyboard"
Driver "keyboard"
Option "CoreKeyboard"
Option "XkbRules" "xfree86"
Option "XkbModel" "pc104"
Option "XkbLayout" "us"
EndSection
Section "InputDevice"
Identifier "Configured Mouse"
Driver "mouse"
Option "CorePointer"
Option "Device" "/dev/input/mice"
Option "Protocol" "ImPS/2"
Option "Emulate3Buttons" "true"
Option "ZAxisMapping" "4 5"
EndSection
Section "Monitor"
Identifier "Generic Monitor"
HorizSync 31.5 - 64.3
VertRefresh 50.0 - 70.0
Option "DPMS"
EndSection
Section "Device"
Identifier "Generic Video Card"
Driver "ati"
EndSection
Section "Screen"
Identifier "Default Screen"
Device "Generic Video Card"
Monitor "Generic Monitor"
DefaultDepth 15
SubSection "Display"
Depth 1
Modes "1280x960" "1152x864" "1024x768"
EndSubSection
SubSection "Display"
Depth 4
Modes "1280x960" "1152x864" "1024x768"
EndSubSection
SubSection "Display"
Depth 8
Modes "1280x960"
EndSubSection
SubSection "Display"
Depth 15
Modes "1280x960"
EndSubSection
SubSection "Display"
Depth 16
Modes "1280x960" "1152x864" "1024x768"
EndSubSection
SubSection "Display"
Depth 24
Modes "1280x960"
EndSubSection
EndSection
Section "Screen"
Identifier "Screen1"
Device "Generic Video Card"
Monitor "Generic Monitor"
DefaultDepth 8
SubSection "Display"
Depth 8
Modes "1280x1024"
EndSubSection
EndSection
Section "DRI"
Mode 0666
EndSection
-----------------------------------------------------------------------------
i am going to provide a list of the basic packages
emacs21_21.4a-1_i386.deb
kde_5%3a44_all.deb
less_382-1_i386.deb
links2_2.1pre16-1_i386.deb
mc_1%3a4.6.0-4.6.1-pre3-3sarge1_i386.deb
mozilla_2%3a1.7.8-1sarge7.1_i386.deb
resolvconf_1.28_all.deb
xbase-clients_4.3.0.dfsg.1-14sarge1_i386.deb
xchat_2.4.1-0.1_i386.deb
x-window-system_4.3.0.dfsg.1-14sarge1_all.deb
x-window-system-core_4.3.0.dfsg.1-14sarge1_i386.deb
----------------------------------------------------------------------------
i had to change some things to get nameserver in the conf file
/etc/resolv.conf to work correctly.
----------------------------------------------------------------------------
to install the kernel:
apt-get install kernel-package build-essential libncurses5-dev
and follow the instructions in /usr/share/doc/kernel-package/README.gz;
You should also ask me about 'make-kpkg' and 'kp mantra'
dpkg The kernel compilation mantra is make-kpkg clean && make-kpkg --revision=$(date +'%Y%m%d') --append-to-version=-$(hostname) --rootcmd fakeroot clean && make-kpkg --revision=$(date +'%Y%m%d') --append-to-version=-$(hostname) --rootcmd fakeroot kernel_image modules_image . Add --initrd before kernel_image if you need an initrd.
i took the quixant kernel sources and unpacked them in /usr/src/
the unpacke to the directory linux-2.6.10, i then mv-ed this to linux-2.6.10-qxt
and symbolicly linked this to /usr/src/linux
then i began the above process.
here is a working XF86Config-4:
------------------------------------------------------------------------------
# XF86Config-4 (XFree86 X Window System server configuration file)
#
# This file was generated by dexconf, the Debian X Configuration tool, using
# values from the debconf database.
#
# Edit this file with caution, and see the XF86Config-4 manual page.
# (Type "man XF86Config-4" at the shell prompt.)
#
# This file is automatically updated on xserver-xfree86 package upgrades *only*
# if it has not been modified since the last upgrade of the xserver-xfree86
# package.
#
# If you have edited this file but would like it to be automatically updated
# again, run the following commands as root:
#
# cp /etc/X11/XF86Config-4 /etc/X11/XF86Config-4.custom
# md5sum /etc/X11/XF86Config-4 >/var/lib/xfree86/XF86Config-4.md5sum
# dpkg-reconfigure xserver-xfree86
Section "ServerLayout"
Identifier "Default Layout"
Screen "Default Screen" 0 0
InputDevice "Generic Keyboard"
InputDevice "Configured Mouse"
EndSection
Section "Files"
# local font server
# if the local font server has problems, we can fall back on these
FontPath "unix/:7100"
FontPath "/usr/lib/X11/fonts/misc"
FontPath "/usr/lib/X11/fonts/cyrillic"
FontPath "/usr/lib/X11/fonts/100dpi/:unscaled"
FontPath "/usr/lib/X11/fonts/75dpi/:unscaled"
FontPath "/usr/lib/X11/fonts/Type1"
FontPath "/usr/lib/X11/fonts/CID"
FontPath "/usr/lib/X11/fonts/Speedo"
FontPath "/usr/lib/X11/fonts/100dpi"
FontPath "/usr/lib/X11/fonts/75dpi"
EndSection
Section "Module"
Load "GLcore"
Load "bitmap"
Load "dbe"
Load "ddc"
Load "dri"
Load "extmod"
Load "freetype"
Load "glx"
Load "int10"
Load "record"
Load "speedo"
Load "type1"
Load "vbe"
EndSection
Section "InputDevice"
Identifier "Generic Keyboard"
Driver "keyboard"
Option "CoreKeyboard"
Option "XkbRules" "xfree86"
Option "XkbModel" "pc104"
Option "XkbLayout" "us"
EndSection
Section "InputDevice"
Identifier "Configured Mouse"
Driver "mouse"
Option "CorePointer"
Option "Device" "/dev/input/mice"
Option "Protocol" "ImPS/2"
Option "Emulate3Buttons" "true"
Option "ZAxisMapping" "4 5"
EndSection
Section "Monitor"
Identifier "Generic Monitor"
HorizSync 31.5 - 64.3
VertRefresh 50.0 - 70.0
Option "DPMS"
EndSection
Section "Device"
Identifier "Generic Video Card"
Driver "ati"
EndSection
Section "Screen"
Identifier "Default Screen"
Device "Generic Video Card"
Monitor "Generic Monitor"
DefaultDepth 15
SubSection "Display"
Depth 1
Modes "1280x960" "1152x864" "1024x768"
EndSubSection
SubSection "Display"
Depth 4
Modes "1280x960" "1152x864" "1024x768"
EndSubSection
SubSection "Display"
Depth 8
Modes "1280x960"
EndSubSection
SubSection "Display"
Depth 15
Modes "1280x960"
EndSubSection
SubSection "Display"
Depth 16
Modes "1280x960" "1152x864" "1024x768"
EndSubSection
SubSection "Display"
Depth 24
Modes "1280x960"
EndSubSection
EndSection
Section "Screen"
Identifier "Screen1"
Device "Generic Video Card"
Monitor "Generic Monitor"
DefaultDepth 8
SubSection "Display"
Depth 8
Modes "1280x1024"
EndSubSection
EndSection
Section "DRI"
Mode 0666
EndSection
-----------------------------------------------------------------------------
i am going to provide a list of the basic packages
emacs21_21.4a-1_i386.deb
kde_5%3a44_all.deb
less_382-1_i386.deb
links2_2.1pre16-1_i386.deb
mc_1%3a4.6.0-4.6.1-pre3-3sarge1_i386.deb
mozilla_2%3a1.7.8-1sarge7.1_i386.deb
resolvconf_1.28_all.deb
xbase-clients_4.3.0.dfsg.1-14sarge1_i386.deb
xchat_2.4.1-0.1_i386.deb
x-window-system_4.3.0.dfsg.1-14sarge1_all.deb
x-window-system-core_4.3.0.dfsg.1-14sarge1_i386.deb
----------------------------------------------------------------------------
i had to change some things to get nameserver in the conf file
/etc/resolv.conf to work correctly.
----------------------------------------------------------------------------
to install the kernel:
apt-get install kernel-package build-essential libncurses5-dev
and follow the instructions in /usr/share/doc/kernel-package/README.gz;
You should also ask me about 'make-kpkg' and 'kp mantra'
dpkg The kernel compilation mantra is make-kpkg clean && make-kpkg --revision=$(date +'%Y%m%d') --append-to-version=-$(hostname) --rootcmd fakeroot clean && make-kpkg --revision=$(date +'%Y%m%d') --append-to-version=-$(hostname) --rootcmd fakeroot kernel_image modules_image . Add --initrd before kernel_image if you need an initrd.
i took the quixant kernel sources and unpacked them in /usr/src/
the unpacke to the directory linux-2.6.10, i then mv-ed this to linux-2.6.10-qxt
and symbolicly linked this to /usr/src/linux
then i began the above process.
Wednesday, May 10, 2006
cvs notes
Cvs notes:
Sandbox: A sandbox is a local copy of a project’s files.
Repository:
When you create a sandbox, you need to specify the repository to which to which it is connected. You do this by setting the repository path, either by putting it in the CVSROOT environment variable on you client computer, or by declaring it in the –d command option when you check out the sandbox. CVS stores the repository path in the sandbox.
The cvs checkout command is used to create a sandbox. Once the sandbox is created, checkout no longer needs to be used sandox; update is the preferred command from that point..
Files are edited in the sandbox, but changes to the sandbox have no effect on the repository until the are commited. The cvs commit uploads changes from the sandbox to the repository.
The cvs commit command uploads changes to from the sandbox to the repository, cvs update downloads changes from the repository to the sandbox.
Creating a repository:
To create a repository, create the repository root directory on the computer that will act as the CVS server and ensure that the root directory is owned by the user who will ultimately own the repository. Execute the command:
$> cvs –d repository_root_directory init
Where repository_root_directory is the name of your directory, to setup that directory as a CVS repository. The root must be given an absolute path, not a relative path.
Note: ensure there is enough room for three times the expected final size of the project
If you intend to store binary files then five times the size.
Securing the project.
Sandboxes are checked out of the repository with the username of the user who creates them or does the checking out.
Repository Root Directory:
Secure the repository root directory so that only users who are allowed to create new projects have write access. Users who will be using existing repository projects, even though they may creating and writng to projects files should only have read access to this directory.
Project Directories:
Group ownership of project files and directories controls project security. Ensure that each project is group-owned by a group with appropriate membership, and set the group permissions for the project files to the project’s group.
In UNIX or linux set each directory’s SGID bit to ensure that any new files or directories created in the directory are created with the same group ID as the directory the are created in. Use the command chmod g+s directory to set the SGID bit.
Repository Structure:
A CVS repository is composed of the special CVSROOT administrative directory and any project directories you create. All the CVS administrative files and configuration files are kept in CVSROOT.
CVS Subdirectory:
The only file stored in the CVS subdirectories in a repository is fileattr. Which lists the file attributes of the files in the parent directory.
Locks:
CVS uses read and write locks to prevent processes from simultaneously writing to or reading from the same repository files. These locks are signaled by the presence of a file or directory with a specific name patter in project directories.
CVSROOT Files:
The CVSROOT directory contains administrative files that contain information about the project stored in CVS.
It is good practice to have a specific username to own the CVSROOT directory and the repository root directory, and to be the initial owner of the CVSROOT files.
Create a group to have the group ownership of the CVSROOT directory and files, and include only trusted people in that group.
Configuration Files:
Config:
LockDir=directory
CVS puts lock files in the nominated directory rather than in the repository. This allows you to set the repository directories read-only for people who should not be commiting changes.
LogHistory=value
The text in value controls which actions are logged to the history file in the repository’s CVSROOT directory. The valid values are any combination of the following letters:
A Log when a file is added to the repository.
C Long when a file would have been updated in a sandbox, but needed to be merged and there where conflicts in the merge.
E Log when a file or files are exported.
F Log when a file or files are released.
G Log when a file is updated in a sandbox with a successful merge.
M Log when a file si modified (a sandbox revision is added to the repository).
O Log when a file or files are checked out.
R Log when a file is removed from the repository.
T Log when a file or files are tagged or rtagged.
U Log when a file is updated in a sandbox with no merge required
W Log when a file is deleted from a sandbox during an update because it is no longer active in the repository.
RCSBIN=directory
SystemAuth=value
This option is useful only if the client connects to CVS in pserver mode. It applies to CVS Versions 1.9.14 and later. If value is yes, the server authenticates the connecting user with the passwd file in the repository’s CVSROOT directory. If the user fails to authenticate there, the server authenticates the user against the main user database for the operating system.
If the value is no, the server authenticates the user only against the passwd file.
The default is yes.
Modules:
The modules file contains information about projects in the repository and can group arbitrary files or directories into a single module.Information in this file must be created by the repository or project administrator; CVS does not update this file when a new project is imported. Once a module is defined, the project and directories it defines can be checked out into a sandbox using either the module name or the name of the repository directory it represents.
Backing Up A Repository:
A CVS repository can be backed up using the same backup tools and schedule that you use for ordinary text and binary files.
Quick start guide I have used successfully:
1. Create a CVS user (for example 'cvsuser') using useradd. This will also create a group called 'cvsuser' which will be used to grant CVS access to other users.
For example:
[jdavis]$ su root
Password: {enter password}
[root]# /usr/sbin/useradd -c 'CVS root user' cvsuser
[root]# passwd cvsuser
New password: {enter password}
Retype new password: {enter password}
2. Create a folder for the initial repository using the 'cvsuser' account, or chown / chgrp it to 'cvsuser'.
[root]# mkdir /cvsrepo
[root]# chown cvsuser /cvsrepo
3. Set the 'group sticky bit' on all directories used by CVS (See "CVS File Permissions").
[root]# chmod g+s /cvsrepo
4. Initialize the repository using cvs init
[jdavis]$ su cvsuser
Password: {enter password}
[cvsuser]$ cvs -d :local:/cvsrepo init
5. Set up the lock directory
This is an important step. If lock directory is not set, the CVS daemon will try to create lock files in the repository directory, which will result in 'failed to create lock directory' error message when users perform any operations on the repository.
Create the lock directory first. For example:
[root]# mkdir /var/lock/cvs
[root]# chgrp -R cvsuser /var/lock/cvs
[root]# chmod -R g+w /var/lock/cvs
Then, configure CVS to use the lock directory. Change to a temporary directory, for example /home/cvsuser (which was created by the useradd command above), and check out the CVSROOT module from the repository using the local filesystem mode (not pserver mode). Edit the CVSROOT/config file and either uncomment or add a line 'LockDir=/var/lock/cvs'.
[root]# cd /home/cvsuser
[root]# cvs -d :local:/cvsrepo co CVSROOT
[root]# vi CVSROOT/config
... uncomment or change the line that defines LockDir...
for example: LockDir=/var/lock/cvs
[root]# cvs -d :local:/cvsrepo commit CVSROOT
6. Set up the cvs daemon:
for systems that use inetd - Add a line to the /etc/inetd.conf file
cvspserver stream tcp nowait root /usr/bin/cvs cvs --allow-root=/cvs pserver
Make sure /etc/services contains the line
cvspserver 2401/tcp
for systems that use xinetd - Create a 'cvspserver' file:
Sample /etc/xinet.d/cvspserver file
service cvspserver
{
socket_type = stream
wait = no
user = root
group = cvsgroup
env = HOME=/cvsrepo # Fixes RHL 7.0 problem!
server = /usr/bin/cvs
server_args = -f --allow-root=/cvsrepo pserver
disable = no
}
7. Restart inetd (or xinetd).
[root]# /etc/init.d/xinetd restart
Sandbox: A sandbox is a local copy of a project’s files.
Repository:
When you create a sandbox, you need to specify the repository to which to which it is connected. You do this by setting the repository path, either by putting it in the CVSROOT environment variable on you client computer, or by declaring it in the –d command option when you check out the sandbox. CVS stores the repository path in the sandbox.
The cvs checkout command is used to create a sandbox. Once the sandbox is created, checkout no longer needs to be used sandox; update is the preferred command from that point..
Files are edited in the sandbox, but changes to the sandbox have no effect on the repository until the are commited. The cvs commit uploads changes from the sandbox to the repository.
The cvs commit command uploads changes to from the sandbox to the repository, cvs update downloads changes from the repository to the sandbox.
Creating a repository:
To create a repository, create the repository root directory on the computer that will act as the CVS server and ensure that the root directory is owned by the user who will ultimately own the repository. Execute the command:
$> cvs –d repository_root_directory init
Where repository_root_directory is the name of your directory, to setup that directory as a CVS repository. The root must be given an absolute path, not a relative path.
Note: ensure there is enough room for three times the expected final size of the project
If you intend to store binary files then five times the size.
Securing the project.
Sandboxes are checked out of the repository with the username of the user who creates them or does the checking out.
Repository Root Directory:
Secure the repository root directory so that only users who are allowed to create new projects have write access. Users who will be using existing repository projects, even though they may creating and writng to projects files should only have read access to this directory.
Project Directories:
Group ownership of project files and directories controls project security. Ensure that each project is group-owned by a group with appropriate membership, and set the group permissions for the project files to the project’s group.
In UNIX or linux set each directory’s SGID bit to ensure that any new files or directories created in the directory are created with the same group ID as the directory the are created in. Use the command chmod g+s directory to set the SGID bit.
Repository Structure:
A CVS repository is composed of the special CVSROOT administrative directory and any project directories you create. All the CVS administrative files and configuration files are kept in CVSROOT.
CVS Subdirectory:
The only file stored in the CVS subdirectories in a repository is fileattr. Which lists the file attributes of the files in the parent directory.
Locks:
CVS uses read and write locks to prevent processes from simultaneously writing to or reading from the same repository files. These locks are signaled by the presence of a file or directory with a specific name patter in project directories.
CVSROOT Files:
The CVSROOT directory contains administrative files that contain information about the project stored in CVS.
It is good practice to have a specific username to own the CVSROOT directory and the repository root directory, and to be the initial owner of the CVSROOT files.
Create a group to have the group ownership of the CVSROOT directory and files, and include only trusted people in that group.
Configuration Files:
Config:
LockDir=directory
CVS puts lock files in the nominated directory rather than in the repository. This allows you to set the repository directories read-only for people who should not be commiting changes.
LogHistory=value
The text in value controls which actions are logged to the history file in the repository’s CVSROOT directory. The valid values are any combination of the following letters:
A Log when a file is added to the repository.
C Long when a file would have been updated in a sandbox, but needed to be merged and there where conflicts in the merge.
E Log when a file or files are exported.
F Log when a file or files are released.
G Log when a file is updated in a sandbox with a successful merge.
M Log when a file si modified (a sandbox revision is added to the repository).
O Log when a file or files are checked out.
R Log when a file is removed from the repository.
T Log when a file or files are tagged or rtagged.
U Log when a file is updated in a sandbox with no merge required
W Log when a file is deleted from a sandbox during an update because it is no longer active in the repository.
RCSBIN=directory
SystemAuth=value
This option is useful only if the client connects to CVS in pserver mode. It applies to CVS Versions 1.9.14 and later. If value is yes, the server authenticates the connecting user with the passwd file in the repository’s CVSROOT directory. If the user fails to authenticate there, the server authenticates the user against the main user database for the operating system.
If the value is no, the server authenticates the user only against the passwd file.
The default is yes.
Modules:
The modules file contains information about projects in the repository and can group arbitrary files or directories into a single module.Information in this file must be created by the repository or project administrator; CVS does not update this file when a new project is imported. Once a module is defined, the project and directories it defines can be checked out into a sandbox using either the module name or the name of the repository directory it represents.
Backing Up A Repository:
A CVS repository can be backed up using the same backup tools and schedule that you use for ordinary text and binary files.
Quick start guide I have used successfully:
1. Create a CVS user (for example 'cvsuser') using useradd. This will also create a group called 'cvsuser' which will be used to grant CVS access to other users.
For example:
[jdavis]$ su root
Password: {enter password}
[root]# /usr/sbin/useradd -c 'CVS root user' cvsuser
[root]# passwd cvsuser
New password: {enter password}
Retype new password: {enter password}
2. Create a folder for the initial repository using the 'cvsuser' account, or chown / chgrp it to 'cvsuser'.
[root]# mkdir /cvsrepo
[root]# chown cvsuser /cvsrepo
3. Set the 'group sticky bit' on all directories used by CVS (See "CVS File Permissions").
[root]# chmod g+s /cvsrepo
4. Initialize the repository using cvs init
[jdavis]$ su cvsuser
Password: {enter password}
[cvsuser]$ cvs -d :local:/cvsrepo init
5. Set up the lock directory
This is an important step. If lock directory is not set, the CVS daemon will try to create lock files in the repository directory, which will result in 'failed to create lock directory' error message when users perform any operations on the repository.
Create the lock directory first. For example:
[root]# mkdir /var/lock/cvs
[root]# chgrp -R cvsuser /var/lock/cvs
[root]# chmod -R g+w /var/lock/cvs
Then, configure CVS to use the lock directory. Change to a temporary directory, for example /home/cvsuser (which was created by the useradd command above), and check out the CVSROOT module from the repository using the local filesystem mode (not pserver mode). Edit the CVSROOT/config file and either uncomment or add a line 'LockDir=/var/lock/cvs'.
[root]# cd /home/cvsuser
[root]# cvs -d :local:/cvsrepo co CVSROOT
[root]# vi CVSROOT/config
... uncomment or change the line that defines LockDir...
for example: LockDir=/var/lock/cvs
[root]# cvs -d :local:/cvsrepo commit CVSROOT
6. Set up the cvs daemon:
for systems that use inetd - Add a line to the /etc/inetd.conf file
cvspserver stream tcp nowait root /usr/bin/cvs cvs --allow-root=/cvs pserver
Make sure /etc/services contains the line
cvspserver 2401/tcp
for systems that use xinetd - Create a 'cvspserver' file:
Sample /etc/xinet.d/cvspserver file
service cvspserver
{
socket_type = stream
wait = no
user = root
group = cvsgroup
env = HOME=/cvsrepo # Fixes RHL 7.0 problem!
server = /usr/bin/cvs
server_args = -f --allow-root=/cvsrepo pserver
disable = no
}
7. Restart inetd (or xinetd).
[root]# /etc/init.d/xinetd restart
Sunday, March 26, 2006
building qemu on fedora core 4(5)
the real pain the butt is getting the kernel sources
installed on the system and getting the
older version of gcc.
take a look at this link
http://www.brandonhutchinson.com/Installing_QEMU_with_Accelerator_Module_on_Fedora_Core.html
./configure --prefix=/usr/local/qemu --cc=gcc32
installed on the system and getting the
older version of gcc.
take a look at this link
http://www.brandonhutchinson.com/Installing_QEMU_with_Accelerator_Module_on_Fedora_Core.html
./configure --prefix=/usr/local/qemu --cc=gcc32
Saturday, August 27, 2005
moving to a linux 2.6 live cd system
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.
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.
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?
Subscribe to:
Posts (Atom)