Die Idee hinter diesem Diff ist es CVS tauglich zu machen. Man kann praktisch sein Image --enable-ide bauen und die Treiber werden aber nur geladen wenn die Hardware da ist bzw. das Filesystem
Ideen/Anregungn/Kommentare sind Wilkommnen:
Speedy2206 und Nitr8:
I didnt like the idea of having to "touch" files just to determine what tasks should be performed. So I came up with the idea to replace the entire coding in rCs with just one single line:
/bin/loadsupport
Loadsupport is a standalone file which is run independently from Neutrino. The code for it is as follows...
loadsupport.cpp:
Code: Alles auswählen
/* Quick standalone tool to determine whether or not the IDE support should be loaded
- Speedy2206 */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
int main()
{
int idestatus = 0;
int activesoftcam = 0;
FILE* fdconf = fopen("/var/tuxbox/config/neutrino.conf", "r");
if(fdconf)
{
char buffer[120];
while(fgets(buffer, 120, fdconf)!=NULL)
{
sscanf(buffer, "allinwonder_idestatus=%i", idestatus);
}
fclose(fdconf);
}
if (idestatus == 0) // IDE Functionality is Disabled (dont load kernel stuff)
{
printf("[LOAD-SUPPORT] IDE Support Disabled\n");
}
else
{ // IDE Functionality is Enabled (load everything)
printf("[LOAD-SUPPORT] IDE Support Enabled\n");
system("insmod ide-core.o");
system("insmod dboxide.o");
system("insmod ide-detect.o");
system("insmod ide-disk.o");
if (idestatus == 1) // XFS FileSystem
system("insmod xfs.o");
if (idestatus == 2) // EXT2 FileSystem
system("insmod ext2.o");
if (idestatus == 3) // EXT3 FileSystem
system("insmod jbd.o");
system("insmod ext3.o");
}
Right, here goes:Basically, loadsupport reads the neutrino.conf file, where the All-in-Wonder menu has already saved its values.
It looks at the value for "allinwonder_idestatus", and determines what to do next.
If the value = 0, then this means that the user wants to disable IDE support. In this case, no files are loaded for IDE.
However, if the value is > 1, then this means that the user has enabled the IDE support, and we load the correct files.
Using this command clears up both rCs andstart_neutrino. It must be added before processing fstab.
The mounting itself is all by fstab, so we dont require any coding for it whatsoever
Firstly I must say a massive thanks to Speedy2206 for all his hard work and efforts. Secondly I would like to explain what we have in the IDE section.
scruff1963 pointed out a valid point that all IDE images load the modules on boot, I checked a couple of images and all the rcS files include the IDE modules. This wastes memory for users without IDE support and also slows down boot up my a few milliseconds or maybe a second. To Eliminate this problem Speedy2206 had suggested the loadsupport so we decided to load the modules as necessary. Not only now do none IDE users benefit but so do IDE users because it also only loads the modules you require into the kernel.
We had the mounting of the disk here but speedy seems to have to have removed it. I think putting the mounting back here eliminates the need to add the relevent info into /ect/fstab wich will also help squshfs images. We can also add that if swap is selected mount that. That also removes the need for a /var/etc/.swap file I guss to look like this:if (idestatus == disabled)
{
printf("[LOAD-SUPPORT] IDE Support Disabled\n");
}
else
{ printf("[LOAD-SUPPORT] IDE Support Enabled\n");
system("insmod ide-core.o");
system("insmod dboxide.o");
system("insmod ide-detect.o");
system("insmod ide-disk.o");
if (idestatus == XFS) system("insmod xfs.o");
if (idestatus == EXT2) system("insmod ext2.o");
if (idestatus == EXT3) system("insmod jbd.o");
system("insmod ext3.o");
}
Then we wloud need nothing IDE related in fstab nore anything in rcS IDE or swap related sscanf(buffer, "allinwonder_ideswap=%i",ideswap);
if (idestatus == disabled)
{
printf("[LOAD-SUPPORT] IDE Support Disabled\n");
}
else
{ printf("[LOAD-SUPPORT] IDE Support Enabled\n");
system("insmod ide-core.o");
system("insmod dboxide.o");
system("insmod ide-detect.o");
system("insmod ide-disk.o");
if (idestatus == XFS) system("insmod xfs.o");
system("/bin/mount -t xfs /dev/ide/host0/bus0/target0/lun0/part2 /hdd");
if (idestatus == EXT2) system("insmod ext2.o");
system("/bin/mount -t ext2 /dev/ide/host0/bus0/target0/lun0/part2 /hdd");
if (idestatus == EXT3) system("insmod jbd.o");
system("insmod ext3.o");
system("/bin/mount -t ext2 /dev/ide/host0/bus0/target0/lun0/part2 /hdd");
if (ideswap == ON)
system("/sbin/swapon /dev/ide/host0/bus0/target0/lun0/part1");
}
For the inisilatation part what we have is copy the scripts simular to the ones JTG to use. What theis does in a nutshell is:
I will think on what else we could add and update you guys once speedy and I have spoken again.### Clean up and Unmount
rm /var/etc/.ext2 /var/etc/.ext3 /var/etc/.xfs
umount /hdd
swapoff /dev/ide/host0/bus0/target0/lun0/part1
sleep 3
sfdisk /dev/ide/host0/bus0/target0/lun0/disc << EOF
,128,S
,,L
EOF
### HDD Initialis
## Only if Swap is enabled
mkswap /dev/ide/host0/bus0/target0/lun0/part1
## XFS Selected the
/sbin/mkfs.xfs -l version=2 -f /dev/ide/host0/bus0/target0/lun0/part2
insmod xfs
/bin/mount -t xfs /dev/ide/host0/bus0/target0/lun0/part2 /hdd
## EXT2
/sbin/mkfs.ext2 -T largefile -m0 /dev/ide/host0/bus0/target0/lun0/part2
insmod ext2
/bin/mount -t ext2 /dev/ide/host0/bus0/target0/lun0/part2 /hdd
## EXT3 Selected then
/sbin/mkfs.ext3 -T largefile -m0 /dev/ide/host0/bus0/target0/lun0/part2
insmod jbd
insmod ext3
/bin/mount -t ext3 /dev/ide/host0/bus0/target0/lun0/part2 /hdd
## If swap enabled mount that too
/sbin/swapon /dev/ide/host0/bus0/target0/lun0/part1
What do you guys think of the above thou?
--me