[Idee] UK IDE Menu

PT-1
Moderator english
Beiträge: 2458
Registriert: Donnerstag 20. Dezember 2001, 00:00

[Idee] UK IDE Menu

Beitrag von PT-1 »

Danke an die Jungs aus England fuers teilen !

Bild

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");
}
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 done by fstab, so we dont require any coding for it whatsoever
Right, here goes:

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 done 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.
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");
}
We had the mounting of the disk done 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:
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");
}
Then we wloud need nothing IDE related in fstab nore anything in rcS IDE or swap related 

For the inisilatation part what we have done is copy the scripts simular to the ones JTG to use. What theis does in a nutshell is:
### 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
I will think on what else we could add and update you guys once speedy and I have spoken again.

What do you guys think of the above thou?
--me
new.life
Erleuchteter
Erleuchteter
Beiträge: 797
Registriert: Sonntag 19. Februar 2006, 01:17

Re: [Idee] UK IDE Menu

Beitrag von new.life »

wenn das wirklich so ist:
...This wastes memory for users without IDE support and also slows down boot up my a few milliseconds or maybe a second...
..würde ich mich sehr freuen wenn das Einzug ins CVS findet...'All-in-Wonder Menue' finde ich als Name allerdings etwas übertrieben ;-)