Labels

Android (1) bash (2) boost (2) C (34) C++ (2) cheatsheet (2) CLion (6) css (3) Debian (33) DL (17) Docker (1) Dreamweaver (2) Eclipse (3) fail2ban (4) git (5) GitHub (4) Hacking (3) html (8) http (1) iOS (1) iPad (1) IRC (1) Java (30) javascript (3) Linux (164) Mac (19) Machine Learning (1) mySQL (47) Netbeans (4) Networking (1) Nexus (1) OpenVMS (6) Oracle (1) Pandas (3) php (16) Postgresql (8) Python (9) raid (1) RedHat (14) Samba (2) Slackware (45) SQL (14) svn (1) tar (1) ThinkPad (1) Virtualbox (3) Visual Basic (1) Visual Studio (1) Windows (2)

Wednesday 3 June 2020

SCS upgrade to support usb mouse and keyboard.

This document is/was written retrospectively and exists to document the changes made to the SCS Linux computer during the upgrade to support USB keyboard and mouse. This was successfully tested in Glasgow and at the time of writing, will can be rolled out to all other depots.


1- BACKGROUND.

1b- NOTES AND FILES.


2- PROCEDURE TO UPGRADE SCS USING CONFIGURED KERNEL (HEISENBERG).


3- STEPS TO SWITCH FROM PS2 TO USB.


4- STEPS TO SWITCH FROM USB TO PS2.


5- PROCEDURE TO REVERSE UPGRADE.


6- PROCEDURE TO CREATE HEISENBERG KERNEL.


7- LINKS.


LAST UPDATED: 29 July 2020





1- BACKGROUND.

The SCS PC exists on Criterion sorting machines and runs Slackware 8.1 with a modified 2.4.20 kernel and RTAI modules 24.1.11
The problem or one of the problems was that the pc would not work with a usb mouse or keyboard. There were also issues with only some usb memory sticks working correctly.
It was also observed that in a number of depots, the memory on this pc had been upgraded but it is worth noting that HIGH MEMORY support was not set on that kernel so such upgrades were pointless. I had in the past recompiled the kernel to ENABLE HIGH MEMORY but as I also read [source to be added], the RTAI modules don't like or work correctly large amounts of memory.

The problem; When the kernel is recompiled to have usb support for said keyboard and mouse, the existing modules no longer work.

There is no source files for the Bowe modules and compiling a kernel with a different version won't work as the previously compiled modules can not be inserted into a different kernel.

I set about recompiling the kernel to the same version number so as to allow the modules that had been previously compiled using this version to be able to be inserted as required.

I believe in the end, I skipped building the modules again with the new kernel and simply built the new kernel. I also believe I may have added support for hardware into the kernel as opposed to modules but cant confirm this at the time of writing this.


More details on the background to follow.


1b- NOTES AND FILES (FOR REFERENCE)

Transcript of notes - taken July 2019 (lacking in detail, for reference only)


##### START #####


use .config
make menuconfig
make dep
make bzimage

copy bzimage to /boot
copy System.map to /boot
update lilo.conf

Sort Network
Remove network entries in loadSCS.start
add rc.netdevice to include modprobe e1000e
edit rc.inet with IP + GW

Update Mouse
ln - ls /dev/input/mice
/dev/mouse

Update X11
edit /etc/x11/XF86Config
option "Protocol" "IMPS/2"
option "Device" "/dev/mouse"
option "XkbLayout" "uk"


##### END #####


Contents of various files, for reference only


##### START #####


Contents of the auto folder

heisenberg.bmp*  lilo.conf*  rc.keymap*  rc.netdevice*  setup.sh*  vmlinuz-2.4.20-rthal5*


Contents of /boot/README.txt

# The following kernels are installed;
#
#
# vmlinuz  - This is the original kernel and is the same as
#            vmlinuz-2.4.20-rathal5_OLD
#
#
# vmlinuz-2.4.20-rathal5  - This is the Heisenberg kernel built by H Nisbet 4th July 2019
#                           supporting usb keyboard and mouse.
#
# vmlinuz-2.4.20-rathal5_OLD  - Original kernel
#                               Note, if booting to this kernel, PS/2 mouse will not work
#                               in the GUI as the configuration had to be changed to support
#                               usb. This change would need to be manually reverted, essentially
#                               making changes to the X configuration file.
#
#
# vmlinuz-2.4.18  - Probably the original kernel distributed with Slackware 8.1




Contents of rc.keymap

# File to load UK keyboard map at boot time.
# Added by H Nisbet 05 July 2019
#!/bin/sh
echo Attempting to change keyboard map to uk layout
if [ -x /usr/bin/loadkeys ]; then
 /usr/bin/loadkeys uk.map
fi

 


Contents of rc.netdevice


# Added by H Nisbet 04 July 2019
# Following recompile of kernel, the following
# is added to enable onboard NIC
#
# /home/nsa/Config/loadSCS.start has been modified to remove
# modprobe and ifconfig
#
# This file will now load the module at boot time
# /etc/rc.d/rc.inet1 will now set the IP address and Gateway
echo Attempting to load NIC module e1000e
/sbin/modprobe e1000e
#/sbin/modprobe e1000




A note on the above file;
Any SCS computers that were previously networked, may well have had the modprobe and ifconfig commented out previously as detailed above in rc.netdevice but at that time, it is likely that the /sbin/modprobe e1000e will have been entered into rc.modules
Obviously if this was the case, the latter can be commented out in rc.modules as the above file now does this.

Contents of lilo.conf

# LILO configuration file
# generated by 'liloconfig'
#
# Start LILO global section
lba32 # Allow booting past 1024th cylinder with a recent BIOS
boot = /dev/hda
prompt
timeout = 100
change-rules
reset
#bitmap=/boot/ULXBBH.bmp
bitmap=/boot/heisenberg.bmp
# VESA framebuffer console @ 1024x768x256
#vga = 773
image = /boot/vmlinuz-2.4.20-rthal5
root = /dev/hda1
label = "SCS Mode"

read-only
image = /boot/vmlinuz
root = /dev/hda1
label = "Safe Mode"

read-only
image = /boot/vmlinuz-2.4.20-rthal5_OLD
root = /dev/hda1
label = old

read-only



Contents of the auto folder

heisenberg.bmp*  lilo.conf*  rc.keymap*  rc.netdevice*  setup.sh*  vmlinuz-2.4.20-rthal5*



Contents of /boot folder

total 6204
drwxr-xr-x    2 root     root         4096 Nov 20  2019 ./
drwxr-xr-x   17 root     root         4096 Jul 19  2015 ../
-rw-r--r--    1 root     root          791 Nov 20  2019 README.txt
lrwxrwxrwx    1 root     root           23 May  6  2006 System.map -> /boot/System.map-2.4.20
-rw-r--r--    1 root     root       564951 May  6  2006 System.map-2.4.20
-rw-r--r--    1 root     root       515922 May 31  2002 System.map-ide-2.4.18
-rw-r--r--    1 root     root       153690 Feb 13  2003 ULXBBH.bmp
-rw-r--r--    1 root     root         7988 Mar  9  2002 boot-bmp.b
-rw-r--r--    1 root     root         7964 Mar  9  2002 boot-menu.b
-rw-r--r--    1 root     root         6204 Mar  9  2002 boot-text.b
-rw-r--r--    1 root     root          512 May  6  2006 boot.0300
lrwxrwxrwx    1 root     root           16 May  6  2006 boot.b -> /boot/boot-bmp.b
-rw-r--r--    1 root     root          728 Mar  9  2002 chain.b
lrwxrwxrwx    1 root     root           17 May  6  2006 config -> config-ide-2.4.18
-rw-r--r--    1 root     root        33409 May 31  2002 config-ide-2.4.18
-rwxr--r--    1 root     root       153690 Nov 20  2019 heisenberg.bmp*
-rw-------    1 root     root        45568 Nov 20  2019 map
-rw-r--r--    1 root     root          512 Mar  9  2002 mbr.b
-rw-r--r--    1 root     root          656 Mar  9  2002 os2_d.b
-r--------    1 root     root      1228299 May  6  2006 vmlinuz
-r--------    1 root     root      1265367 Nov 20  2019 vmlinuz-2.4.20-rthal5
-r--------    1 root     root      1228299 Nov 20  2019 vmlinuz-2.4.20-rthal5_OLD
-rw-r--r--    1 root     root      1061033 May 31  2002 vmlinuz-ide-2.4.18

 

Note on the above;
vmlinuz file size 1228299 is Safe Mode
vmlinuz-2.4.20-rthal5 file size 1265367 is the new kernel
vmlinux-2.4.20-rthal5_OLD file size 1228299 is a backup of vmlinuz

[it looks like the safe mode was the same as the default vmlinuz]


Contents of auto.sh [for reference only]

key_press ()
{
        echo
        read -n 1 -s -r -p "Press any key to continue"
        echo
        echo
}

clear
echo Starting heisenberg script...
key_press

KERNEL="vmlinuz-2.4.20-rthal5"
KERNEL_PATH="/boot/"

### BACKUP OLD KERNEL
BAC="$KERNEL.BAC"

if [ -e $KERNEL_PATH$BAC ]
then
        echo Backup already exists, aborting kernel backup...
        echo Please investigate and run the script again.
        echo Hint: $KERNEL_PATH$BAC
        echo
        key_press
        exit 1
else
        echo $KERNEL_PATH$BAC doesnt exist, we are good to go...

        if [ -e $KERNEL_PATH$KERNEL ]
        then
                echo Backing up old kernel
                cp $KERNEL_PATH$KERNEL $KERNEL_PATH$BAC
        else
                echo $KERNEL_PATH$KERNEL doesnt seem to exist
                echo Please investigate and run the script again
                echo Hint: $KERNEL+PATH$KERNEL
                echo
                key_press
                exit
        fi

fi

key_press


### COPY NEW KERNEL
echo Copying new kernel
cp $KERNEL $KERNEL_PATH/
key_press

### COPY NIC stuff
echo copying rc.netdevice
cp rc.netdevice /etc/rc.d/rc.netdevice
chmod +x /etc/rc.d/rc.netdevice
key_press

### COPY loadSCS.Start
echo Modifying the loadSCS.start script
cp /home/nsa/Config/loadSCS.start /home/nsa/Config/loadSCS.start.OLD
echo sed doesnt seem to be working correctly
echo loadSCS.start will need to be modified manually.
echo Please do this now...
#cp loadSCS.start /home/nsa/Config/loadSCS.start
#chmod +x /home/nsa/Config/loadSCS.start
key_press

### PREPARE lilo
echo Preparing lilo
cp heisenberg.bmp /boot/
cp /etc/lilo.conf /etc/lilo.conf.OLD
cp lilo.conf /etc/lilo.conf
lilo
key_press

### PREPARE mouse and keyboard
#echo Preparing usb mouse and keyboard
#key_press

### PREPARE Keyboard map
echo Preparing keyboard map
cp rc.keymap /etc/rc.d/
chmod +x /etc/rc.d/rc.keymap
key_press


##### END #####



2- PROCEDURE TO UPGRADE SCS USING CONFIGURED KERNEL (HEISENBERG).


Download heisenberg.tar from:

http://172.16.144.252/stuff/SCS/heisenberg.tar

into a new directory and extract using;

tar -xf heisenberg.tar

This will produce the following files (note permissions and owner/groups which should be modified if necessary when they are copied to their destinations);

filename - permissions - owner - group

heisenberg.bmp  744 root root
lilo.conf  644 root root
rc.keymap  755 root root
rc.netdevice  755 root root
setup.sh
vmlinuz-2.4.20-rthal5*  r root root
 
Make the auto.sh executable if it is not so already with;

chmod+x auto.sh

Then run auto.sh as follows;

./auto.sh

##### STOP ##### STOP ##### STOP #####


The purpose of the setup.sh file was to install the new kernel and make the necessary changes but from memory and from reading through the file today (17 June 2020), it wasn't quite complete, I'm not 100% sure why not, time, interest, motivation, illness, who knows... but the good news is that the upgrade can be done manually as follows;

Note: root is probably needed for most of the following steps.

2.1) BACKUP OLD KERNEL;


cp /boot/vmlinuz /boot/vmlinuz-2.4.20-rthal5_OLD

or alternatively as per the auto.sh script;

cp /boot/vmlinuz /boot/vmlinuz-2.4.20-rthal5_BAC


Ensure that the backup filename matches that which is in the lilo.conf file obviously.


 2.1.1) System.map (For reference)

I'm not 100% sure if this has been an oversight but when I normally or previously compiled kernels, on copying the kernel to /boot/ I also copied the System.map to /boot/ having different System.map files for different kernel versions. Perhaps here I have only one as I've compiled the kernel with the same version number for reasons discussed in Section 1 above.

See here and more importantly here (both my blog posts from some time ago regarding kernel compilation). also see here for more information about the System.map file.

I'll revise this at some point in the future if I can clarify whether or not it was needed in this case.

2.2) COPY NEW KERNEL;

cp vmlinuz-2.4.20-rthal5 /boot/


2.3) COPY NETWORK;

cp rc.netdevice /etc/rc.d/rc.netdevice
chmod +x /etc/rc.d/rc.netdevice


Modify /etc/rc.d/rc.inet1 as network IP will no longer be set by loadSCS.start

2.4)  BACKUP AND MODIFY loadSCS.Start

Note: If machine was previously networked correctly, this step likely isn't required.

cp /home/nsa/Config/loadSCS.start /home/nsa/Config/loadSCS.start.OLD

Note, the above simply creates a backup of the loadSCS.start file, it still needs to be modified and this can be done by commenting out the following two lines;

#modprobe e1000e
#ifconfig eth0 up 192.168.1.100 netmask 255.255.255.0


This will now be taken care of by the rc.netdevice from the previous step.

2.5) PREPARE LILO

We copy the new bitmap file, make a backup or current configuration file and then copy the new configuration file;

cp heisenberg.bmp /boot/
cp /etc/lilo.conf /etc/lilo.conf.OLD
cp lilo.conf /etc/lilo.conf


We then need to run lilo to effect the change;

lilo

2.6) COPY README.TXT (IF IT EXISTS);

cp README.TXT /boot/

Note, the following two steps are only required if we are actually going to use a usb keyboard and mouse. Otherwise, these can be done at a later date.

2.7) PREPARE MOUSE AND KEYBOARD;

cp rc.keymap /etc/rc.d/
chmod +x /etc/rc.d/rc.keymap


ln -is /dev/input/mice /dev/mouse

2.8) UPDATE X11;

Edit /etc/X11/XF86Config section "InputDevice" as below;

Section "InputDevice"

# Identifier and driver

    Identifier  "Mouse1"
    Driver      "mouse"
#    Option "Protocol"    "PS/2"
#    Option "Device"      "/dev/psaux"

Option "Protocol" "imps/2"
Option "Device" "/dev/mouse"

 

Also under "InputDevice" under Identifier "Keyboard1", comment out and add as below;

#    Option "XkbLayout" "us"
Option "XkbLayout"      "uk"
 


 2.9) REBOOT;

shutdown -r now 


3- STEPS TO SWITCH FROM PS2 TO USB.


Generally, follow STEPS 2.7 & 2.8



4- STEPS TO SWITCH FROM USB TO PS2.


Generally, follow STEP 2.8 but in reverse, uncomment the red entries and comment out the green entries.

Finally, we need to create the linking required, similar to STEP 2.7 but we may need to firstly unlink the file from STEP 2.7 I'm unsure if this needs to be done, but if so, can be done by;

unlink /dev/mouse

Finally, link the file similar to STEP 2.7 only this time using the /dev/psaux file as per STEP 2.8;

ln -si /dev/psaux /dev/mouse


5- PROCEDURE TO REVERSE UPGRADE.


There should be no reason to do this, however it can be almost achieved, possibly by modifying lilo.conf to boot into vmlinuz-2.4.20-rthal5_OLD by default or alternatively, by renaming vmlinuz-2.4.20-rthal5 to something like vmlinuz-2.4.20-rthal5_Heisenberg and then renaming vmlinuz-2.4.20-rthal5_OLD to vmlinuz-2.4.20-rthal5 this should then allow the old kernel to boot by default.

Reversing the network side of things need not be discussed here as most SCS computers were networked (properly) by me previously anyway.

the README.txt file as per 2.6 should be deleted as this would only serve to confuse and the original boot image ULXBBH.bmp should be restored, removing Heisenberg.bmp, this can of course and should be done in lilo.conf

The steps in section 4 above  should then be carried out to remove the usb device configuration and revert back to ps2, which would need to be done if the old kernel was to be used for whatever reason.


6- PROCEDURE TO CREATE HEISENBERG KERNEL.

At the time of writing, I no longer have a copy of the .config file used to create the kernel, so it is unlikely that this section will ever be completed.
UPDATE:  The Heisenberg .config file and also what is assumed to be the original .config file can be found here and here respectively.

TODO - Add details of how the kernel was compiled, whilst allowing the modules to be inserted without error.


7- LINKS.

In no particular order...

https://www.linuxquestions.org/questions/slackware-14/build-and-insert-modules-into-running-kernel-slackware-8-1-2-4-20-kernel-with-rtai-patch-4175656586/

https://www.kernel.org/doc/ols/2001/rtai.pdf

https://mirrors.edge.kernel.org/pub/linux/kernel/v2.4/

https://mirrors.slackware.com/slackware/slackware-8.1/

https://www.slackbook.org/html/index.html

https://www.rtai.org

https://www.tldp.org/HOWTO/Module-HOWTO/x197.html

https://www.rtai.org/userfiles/downloads/RTAI/rtai-24.1.11.tgz

https://blog.david14.com/2019/06/linux-mouse-gpm.html

https://www.linuxquestions.org/questions/slackware-14/setting-up-a-usb-mouse-in-slackware-401496/

https://rlworkman.net/system.map/

https://gist.github.com/plisken1/b4e425ffbc9a4d80c814944ce741998e

https://gist.github.com/plisken1/e2e16041198e74f457d9ead66a71c322

No comments:

Post a Comment

Note: only a member of this blog may post a comment.