sudo cat > inst_6_driver.sh << "ARSE" cd /sources/xorg/driver for package in $(grep -v '^#' ../driver-7.5-2.wget) do packagedir=${package%.tar.bz2} tar -xf $package cd $packagedir case $packagedir in xf86-input-evdev-[0-9]* | xf86-video-ati-[0-9]* | xf86-video-fbdev-[0-9]* | xf86-video-glint-[0-9]* | xf86-video-newport-[0-9]* ) sed -i -e "s/\xc3\xb8/\\\\[\/o]/" -e "s/\xc3\xa4/\\\\[:a]/" -e "s/\xc3\x9c/\\\\[:U]/" man/*.man ;; esac # #All we have just done is to say, if the filename matches any of the five examples, then wave some [sed] fairy dust over the documentation files to make sure they will be readable. # ./configure $XORG_CONFIG --with-xorg-module-dir=$XORG_PREFIX/lib/X11/modules # #The [module-dir] was set in the configuration variables of Xserver last time. # make $CORES_TO_USE make install cd .. rm -rvf $packagedir done 2>&1 | tee -a ../driver-7.5-2-compile.log echo "Next: ~/conf_xorg.sh" ARSE chmod +x ./inst_6_driver.sh sudo mv ./inst_6_driver.sh /media/lfs/root
We also need to run a couple of configuration commands, which I am going to script - you'll see why when you read them. They are both to do with filesystem compatibility. First we have to make a symbolic link to allow older software to still find X, and secondly we need to move soft programs to where FHS says they should be. When BLFS says:
(ensure you modify <$XORG_PREFIX> appropriately)
What it means, for us, is that the '<' and '>' characters need to be removed.
sudo cat > conf_xorg.sh << "ARSE" ln -vsf $XORG_PREFIX /usr/X11R6 mkdir -p /etc/X11 && for file in $XORG_PREFIX/{lib/X11/xinit,share/X11/{app-defaults,twm}} do mv -v $file /etc/X11/ 2> /dev/null && ln -v -s /etc/X11/$(basename $file) $file done echo "Move to home [cd ~]" echo "Xorg -configure" echo "X -retro -config ~/xorg.conf.new" echo "to test the settings. Assuming they work, setup the X environment by running ~/conf_xorg_files.sh" ARSE chmod +x ./conf_xorg.sh sudo mv ./conf_xorg.sh /media/lfs/root
Now all we should have to do is move to home:
cd ~
and run the configuration script:
Xorg -configure
This should create a new file in ~, called xorg.conf.new. We should now be able to test the installation by running Xorg based on that file:
X -retro -config ~/xorg.conf.new
This did not go well on my first try. The machine I was testing it on uses an nVidia graphics card. Xorg detected this in the configure stage and the [conf] file refered to the 'nv' driver (I had chosen to build it during my first installation by not commenting it out of the .wget file). However, it just crashed with a segmentation fault. I then tried changing the driver manually using 'nano' to vesa. This worked – it created a 1280x1024 display. I also tried fbdev, and this worked with a 1024x768 screen. I could only quit from the displays by holding [CTRL + ALT + F1] to switch back to the first terminal, and then [CTRL + C] to quit the running program.
I suspect what has happened here is the xorg 'nv' driver is shite. I could probably resolve this by installing the closed source nvidia drivers at this point. I think, however, that I will test on the laptop first.
(Sound of laptop testing)
The laptop test went great. The system detected the intel card and it worked first time. On a subsequent build I chose not to install the 'nv' driver, and the step above just used the fbdev driver, which worked fine.
I went back to the desktop machine and downloaded the latest 32bit nvidia drivers for linux. They came in a [.run] file. I downloaded this to my /sources/xorg folder by running these commands from the USB Key:
umount -v /media/amiga sudo mkdir /media/lfs sudo mount -v -t ext3 /dev/disk/by-label/amiga /media/lfs cd /media/lfs/sources/xorg/driver wget http://uk.download.nvidia.com/XFree86/Linux-x86/256.35/NVIDIA-Linux-x86-256.35.run cat > ./inst_nv.sh << EOF ./NVIDIA-Linux-x86-256.35.run --x-prefix=/usr --kernel-source-path=/sources/linux-2.6.32.8 --no-precompiled-interface -a EOF chmod +x ./inst_nv.sh
The eagle eye'd amongst you will have noticed that I have snuck in a script there. That's the command to install the driver, and it is a bit of a monster, so it's best to script it in. I'll mention when we should run this. I then booted the amiga key. Now the nvidia driver require access to the kernel source code, so we have to decompress it:
cd /sources cat linux.tar.lzma | lzma -d | tar x rm -rf linux.tar.lzma
Now we need to make the file we downloaded executable:
cd xorg/driver/ chmod +x NVIDIA-Linux-x86-256.35.run
Finally we need to run it ...
./NVIDIA-Linux-x86-256.35.run --x-prefix=/usr --kernel-source-path=/sources/linux-2.6.32.8 --no-precompiled-interface -a or ./inst_nv.sh
... if we saved the script I mentioned. You should be asked if you want to write a xorg.conf. Agree to this.
What I was left with was two xorg.conf files. One in /etc/X11/ and one in ~ with a [.new] extension. One worked with my nvidia powered desktop and the other worked with my intel powered compaq netbook. So, I did this:
cp /etc/X11/xorg.conf /etc/X11/xorg.conf.nvidia mv ~/xorg.conf.new /etc/X11/xorg.conf.intel
If you refused to allow the nvidia installer to create the xorg.conf, or for some reason you need to rebuild an nvidia xorg.conf in the future you would run this command from a machine with nvidia hardware:
nvidia-xconfig --output-xconfig=/etc/X11/xorg.conf.nvidia
And if you want to rebuild the intel xorg.conf, you would run this from a machine with intel hardware:
Xorg -configure mv ./xorg.conf.new /etc/X11/xorg.conf.intel
I am now able to switch between them, depending on the machine I am using, as follows:
cp --force /etc/X11/xorg.conf.nvidia /etc/X11/xorg.conf cp --force /etc/X11/xorg.conf.intel /etc/X11/xorg.conf
To make the switching easier, I made the following scripts (run the command to make then using the LiveCD).
sudo cat > ./startx_nvidia.sh << EOF cp -f /etc/X11/xorg.conf.nvidia /etc/X11/xorg.conf startx EOF sudo chmod +x ./startx_nvidia.sh sudo mv ./startx_nvidia.sh /media/lfs/root sudo cat > ./startx_intel.sh << EOF cp -f /etc/X11/xorg.conf.intel /etc/X11/xorg.conf startx EOF sudo chmod +x ./startx_intel.sh sudo mv ./startx_intel.sh /media/lfs/root
Predictably this did not properly work. The nvidia driver installation changes around some important files. You still get the correct screen resolution but you do not get hardware acceleration. May not strictly be necessary for an Amiga emulator, but I like to be thorough. After much testing (including attempting to archive and restore the [/usr/lib/X11] folder, I have come to the conclusion that there is no easy way to switch between the nvidia and intel driver without uninstalling and rebuilding the nvidia driver completely each time. This is a pain in the arse, because it is slow, very slow if you compress the kernel source folder. I am putting the commands to handle a compressed kernel source folder in the scripts, but I am going to comment them out. If you are swapping the Amiga Key between intel and nvidia machines, you will want to just leave the sources folder uncompressed for the duration. Remember the compress command can take up to an hour to run.
sudo cat > ./startx_nvidia.sh << EOF #cd /sources #cat linux.tar.lzma | lzma -d | tar x #rm -rf linux.tar.lzma /sources/xorg/driver/NVIDIA-Linux-x86-256.35.run --x-prefix=/usr --kernel-source-path=/sources/linux-2.6.32.8 --no-precompiled-interface -a --silent #cd /sources #tar -c linux-2.6.32.8 | lzma --best > linux.tar.lzma #rm -rf linux-2.6.32.8 cp -f /etc/X11/xorg.conf.nvidia /etc/X11/xorg.conf startx EOF sudo chmod +x ./startx_nvidia.sh sudo mv ./startx_nvidia.sh /media/lfs/root sudo cat > ./startx_intel.sh << EOF /sources/xorg/driver/NVIDIA-Linux-x86-256.35.run --uninstall --silent cp -f /etc/X11/xorg.conf.intel /etc/X11/xorg.conf startx EOF sudo chmod +x ./startx_intel.sh sudo mv ./startx_intel.sh /media/lfs/root
Whatever xorg.conf I use, I need to make sure it realises I am using a UK Keyboard. I need to change this section of the file:
Section "InputDevice" Identifier "Keyboard0" Driver "kbd" EndSection
To make it look like this:
Section "InputDevice" Identifier "Keyboard0" Driver "kbd" Option "CoreKeyboard" Option "XkbRules" "xorg" Option "XkbModel" "pc105" Option "XkbLayout" "gb" EndSection
The X display looks pretty bleak when we run it now, just a grey background and a cross for the mouse pointer. We can sort that out by telling X to auto-start software when it runs. To do so we make a file in the ~ directory called [.xinitrc]:
cat > ~/.xinitrc << "EOF" # Begin .xinitrc file xterm -g 80x20+0+0 & xclock -g 100x100-0+0 & twm EOF
This runs the [xterm] program that we installed earlier, and also the [xclock] program that we installed with the applications theme'd package. I am not entirely sure what the numbering means. The [80x20] I am sure is the number of columns and rows that the [xterm] window has when it runs. Finally it runs [t]oms [w]indow [m]anager - a very basic program for drawing windows on the screen.
We want the xterm, graphical BASH, to use the same prompt as the text mode. I think the best way to do that is to create the following file, which just re-runs the normal profile when logging in.
cat > ~/.bashrc << "EOF" source /etc/profile EOF
We will also take this opportunity to add a small performance boost by telling the system to create a temporary file for X each time the machine starts. This stops X having to do this itself, and saves some time. The [createfiles] is picked up by one of the LFS boot scripts that we have already installed. It's name is self explanatory, even if the permissions based binary bullshit in the command is not.
cat >> /etc/sysconfig/createfiles << "EOF" /tmp/.ICE-unix dir 1777 root root EOF
Because these commands are a bit tricky, lets script them:
sudo cat > conf_xorg_files.sh << "ARSE" cat > ~/.xinitrc << "EOF" # Begin .xinitrc file xterm -g 80x20+0+0 & xclock -g 100x100-0+0 & twm EOF cat > ~/.bashrc << "EOF" source /etc/profile EOF cat >> /etc/sysconfig/createfiles << "EOF" /tmp/.ICE-unix dir 1777 root root EOF ARSE chmod +x ./conf_xorg_files.sh sudo mv ./conf_xorg_files.sh /media/lfs/root
You should now be able to run
startx
and you will see a terminal window and a clock - OOOOOh, exciting!
Don't forget to recompress the Kernel Source:
cd /sources tar -c linux-2.6.32.8 | lzma --best > linux.tar.lzma rm -rf linux-2.6.32.8
No comments:
Post a Comment