Elks Distribution
It sounds like your distribution is in advance of that which I have produced thus far Richard.
My first "stable" version is ready now. I am not sure what the procedure is here but I have attached a zip file EDE.zip to this email which contains two floppy image files for install disk one and disk two.
I would be interested to here how it runs elsewhere.
Here are some notes on what to expect.
- I have tested it on 80286 and 80386 machines.
- I recommend creating a dos partition before starting (at least 20Mb)
- The install will create a 20Mb ELks /dev/bda1
- This first version will only install to /dev/bda1
DON'T TRY IT UNLESS YOU HAVE A BLANK SYSTEM TO PLAY WITH
- There are 2 install floppys. The first is a 0.0.82 kernel root/boot disk that I am using as an interim measure ot create the filesystem until 0.1.0 is ok.
- Boot system with floppy 1
- You then have to login as root (as indicated) to start the install
- The install kicks off fdisk
- Set partition type to 81
- Ensure partition is bootable.
- The script, at the moment, then drops to the hash prompt requesting disk change and reboot.
- As instructed reboot the system with disk 2
- Again login as root to continue the install
- Everything is automated now.
- The end is a little scruffy at the moment. (You have to wait for reboot to start before taking the floppy out).
- The system should then reboot into your new ELKS system.
I will be doing a lot more to make this more attractive but I thought it was a starting point.
I hope you like it.
Feedback appreciated.
Thanks
Neil
Does this all includes a bootloader?
Quoted 1 line
- The system should then reboot into your new ELKS system.
Hi Neil.
Quoted 10 lines
It sounds like your distribution is in advance of that which I have produced thus far Richard.
My first "stable" version is ready now. I am not sure what the procedure is here but I have attached a zip file EDE.zip to this email which contains two floppy image files for install disk one and disk two.
I would be interested to hear how it runs elsewhere.
Quoted 8 lines
Here are some notes on what to expect.
- I have tested it on 80286 and 80386 machines.
- I recommend creating a dos partition before starting (at least 20Mb)
- The install will create a 20Mb ELks/dev/bda1
- This first version will only install to/dev/bda1DON'T TRY IT UNLESS YOU HAVE A BLANK SYSTEM TO PLAY WITH
Some thoughts regarding the above which you may wish to consider:
1. If the target partition has to be fixed, then it would make more sense to select /dev/bda4 as the ELKS partition to use, as MSDOS (and most other operating systems) allocate starting at the low end of the numbers.
2. The ideal would be to have it parse the partition table looking for a suitable partition, where "suitable" is defined as being
a. Smaller than 31M (the claimed limit of the file system
format used for ELKS, and
b. Of partition type 80 hex (the "Old Minix" partition that ELKS
uses for its filesystem).
I've added a command to the elkscmd CVS tree that deals with point 2b above (look for partype.c in the disk_utils directory) and the source is enclosed for reference. It takes the desired partition code as a command-line parameter, so is generic in that sense. It also checks both /dev/hda and /dev/sda if it can't find /dev/bda so in that sense is not ELKS-specific either.
Best wishes from Riley.
/* partype v1.0.0 Partition type locator
* Copyright (C) 2002, Riley H Williams G7GOD,
* Released under the GNU General Public Licence, version 2 only. *
* This program searches the partition table of the primary hard drive for
* a partition with a particular hex code for the partition type. It only
* searches the four primary partitions, not logical partitions. *
* If it finds any partitions of the specified type, it displays the name
* of the lowest numbered partition on stdout.
*
* On completion, it returns one of the following error codes:
*
* 0 No partition with the specified type was found.
*
* 1 Partition /dev/bda1 has the specified type. * 2 Partition /dev/bda2 has the specified type. * 3 Partition /dev/bda3 has the specified type. * 4 Partition /dev/bda4 has the specified type.
*
* 65 Partition /dev/hda1 has the specified type.
* 66 Partition /dev/hda2 has the specified type.
* 67 Partition /dev/hda3 has the specified type.
* 68 Partition /dev/hda4 has the specified type.
*
* 129 Partition /dev/sda1 has the specified type.
* 130 Partition /dev/sda2 has the specified type.
* 131 Partition /dev/sda3 has the specified type.
* 132 Partition /dev/sda4 has the specified type.
*
* 252 The raw drive is not seekable.
* 253 Neither /dev/hda nor /dev/bda is available.
* 254 An invalid partition type was specified.
* 255 Usage message displayed.
*
* Note that the error code only indicates the FIRST partition in the
* sequence listed above that is of the relevant type.
*/
#include <stdio.h>
unsigned char digit(char ch)
{
if (ch >= '0' && ch <= '9')
return ch - '0';
else if (ch >= 'A' && ch <= 'F')
return ch + 10 - 'A';
else if (ch >= 'a' && ch <= 'f')
return ch + 10 - 'a';
else
return 0;
}int main(int argc,char **argv)
{
unsigned char table[64];
FILE *fp;
char *ptr = argv[1], *drive = "/dev/bda";
unsigned char n, partition = 0, result = 0;
if (argc != 2) {
fprintf(stderr, "Usage: %s <type>\n\n", *argv);
fprintf(stderr, "Where <type> is the hexadecimal partition type required\n");
exit(255);
}
while (*ptr) {
partition *= 16;
partition += digit(*ptr++);
}
if (!partition) {
fprintf(stderr, "ERROR 1: Invalid partition type: %02X (%s)\n",
partition, argv[1]);
exit(254);
}
if ((fp = fopen(drive,"rb")) == NULL) {
drive[5] = 'h';
if ((fp = fopen(drive,"rb")) == NULL) {
drive[5] = 's';
if ((fp = fopen(drive,"rb")) == NULL) {
fprintf(stderr, "ERROR 2: Can't open raw drive.\n");
fprintf(stderr, " Searched /dev/hda - /dev/sda - /dev/bda only.\n");
exit(253);
}
}
}
if (fseek(fp,0x1c0,SEEK_SET)) {
fprintf(stderr, "ERROR 3: Can't seek to partition table in /dev/bda\n");
exit(252);
}
for (n=0; n<64; n++)
table[n] = fgetc(fp);
for (n=4; n; n--)
if (table[16*n-14] == partition)
result = n;
if (result) {
printf("%s%d\n",drive,result);
switch (drive[5]) {
case 's':
result += 64;
case 'h':
result += 64;
case 'b':
break;
}
}
exit(result);
}I will, indeed, look very closely at your remarks as I move forward. I am particularly interested by the partition.c.
I'll keep everyone posted.
Many Thanks
Neil
Quoted 156 lines · Riley Williams
Hi Neil.
Quoted 10 lines
It sounds like your distribution is in advance of that which I have produced thus far Richard.
My first "stable" version is ready now. I am not sure what the procedure is here but I have attached a zip file EDE.zip to this email which contains two floppy image files for install disk one and disk two.
I would be interested to hear how it runs elsewhere.
Quoted 8 lines
Here are some notes on what to expect.
- I have tested it on 80286 and 80386 machines.
- I recommend creating a dos partition before starting (at least 20Mb)
- The install will create a 20Mb ELks/dev/bda1
- This first version will only install to/dev/bda1DON'T TRY IT UNLESS YOU HAVE A BLANK SYSTEM TO PLAY WITH
Some thoughts regarding the above which you may wish to consider:
1. If the target partition has to be fixed, then it would make more sense to select
/dev/bda4as the ELKS partition to use, as MSDOS (and most other operating systems) allocate starting at the low end of the numbers.2. The ideal would be to have it parse the partition table looking for a suitable partition, where "suitable" is defined as being
a. Smaller than 31M (the claimed limit of the file system
format used for ELKS, andb. Of partition type 80 hex (the "Old Minix" partition that ELKS
uses for its filesystem).I've added a command to the elkscmd CVS tree that deals with point 2b above (look for
partype.cin thedisk_utilsdirectory) and the source is enclosed for reference. It takes the desired partition code as a command-line parameter, so is generic in that sense. It also checks both/dev/hdaand/dev/sdaif it can't find/dev/bdaso in that sense is not ELKS-specific either.Best wishes from Riley.
----/* partype v1.0.0 Partition type locator
* Copyright (C) 2002, Riley H Williams G7GOD,
* Released under the GNU General Public Licence, version 2 only. *
* This program searches the partition table of the primary hard drive for
* a partition with a particular hex code for the partition type. It only
* searches the four primary partitions, not logical partitions. *
* If it finds any partitions of the specified type, it displays the name
* of the lowest numbered partition on stdout.
*
* On completion, it returns one of the following error codes:
*
* 0 No partition with the specified type was found.
** 1 Partition /dev/bda1 has the specified type. * 2 Partition /dev/bda2 has the specified type. * 3 Partition /dev/bda3 has the specified type. * 4 Partition /dev/bda4 has the specified type.*
* 65 Partition/dev/hda1has the specified type.
* 66 Partition/dev/hda2has the specified type.
* 67 Partition/dev/hda3has the specified type.
* 68 Partition/dev/hda4has the specified type.
*
* 129 Partition/dev/sda1has the specified type.
* 130 Partition/dev/sda2has the specified type.
* 131 Partition/dev/sda3has the specified type.
* 132 Partition/dev/sda4has the specified type.
*
* 252 The raw drive is not seekable.
* 253 Neither/dev/hdanor/dev/bdais available.
* 254 An invalid partition type was specified.
* 255 Usage message displayed.
*
* Note that the error code only indicates the FIRST partition in the
* sequence listed above that is of the relevant type.
*/#include <
stdio.h>unsigned char digit(char ch)
{ if (ch >= '0' && ch <= '9') return ch - '0'; else if (ch >= 'A' && ch <= 'F') return ch + 10 - 'A'; else if (ch >= 'a' && ch <= 'f') return ch + 10 - 'a'; else return 0; }int
main(int argc,char **argv){ unsigned char table[64]; FILE *fp; char *ptr = argv[1], *drive = "/dev/bda"; unsigned char n, partition = 0, result = 0; if (argc != 2) { fprintf(stderr, "Usage: %s <type>\n\n", *argv); fprintf(stderr, "Where <type> is the hexadecimal partition type required\n"); exit(255); } while (*ptr) { partition *= 16; partition += digit(*ptr++); } if (!partition) { fprintf(stderr, "ERROR 1: Invalid partition type: %02X (%s)\n", partition, argv[1]); exit(254); } if ((fp = fopen(drive,"rb")) == NULL) { drive[5] = 'h'; if ((fp = fopen(drive,"rb")) == NULL) { drive[5] = 's'; if ((fp = fopen(drive,"rb")) == NULL) { fprintf(stderr, "ERROR 2: Can't open raw drive.\n"); fprintf(stderr, " Searched /dev/hda - /dev/sda - /dev/bda only.\n"); exit(253); } } } if (fseek(fp,0x1c0,SEEK_SET)) { fprintf(stderr, "ERROR 3: Can't seek to partition table in /dev/bda\n"); exit(252); } for (n=0; n<64; n++) table[n] = fgetc(fp); for (n=4; n; n--) if (table[16*n-14] == partition) result = n; if (result) { printf("%s%d\n",drive,result); switch (drive[5]) { case 's': result += 64; case 'h': result += 64; case 'b': break; } } exit(result); }
Hi Neil.
Quoted 2 lines
I will, indeed, look very closely at your remarks as I move forward. I am particularly interested by the
partition.c.
If you're using ash as your install shell, you should be able to use the following script...
#!/bin/ash : fdisk /dev/bda TGT=$(partype 80)
...and, from this point, you just use ${TGT} as the target partition. I can't test this at the moment as I'm not near a suitable system, so the above is pure theory at this point. However, memory says that sash does not support the necessary facilities.
Also note that if we move to /dev/hda instead of /dev/bda then only the fdisk line needs changing, and the rest of the code will work as is.
Best wishes from Riley.
Many Thanks.
This is valuable information.
Neil
Quoted 26 lines · Riley Williams
Hi Neil.
Quoted 2 lines
I will, indeed, look very closely at your remarks as I move forward. I am particularly interested by the
partition.c.If you're using ash as your install shell, you should be able to use the following script...
#!/bin/ash : fdisk /dev/bda TGT=$(partype 80)...and, from this point, you just use ${TGT} as the target partition. I can't test this at the moment as I'm not near a suitable system, so the above is pure theory at this point. However, memory says that sash does not support the necessary facilities.
Also note that if we move to
/dev/hdainstead of/dev/bdathen only the fdisk line needs changing, and the rest of the code will work as is.Best wishes from Riley.
Hi Neil.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
I will, indeed, look very closely at your remarks as I move forward. I am particularly interested by the
partition.c.
Note that it's called partype (for "partition type) and not partition.
Quoted 15 lines
Quoted 15 lines
If you're using ash as your install shell, you should be able to use the following script...
#!/bin/ash : fdisk /dev/bda TGT=$(partype 80)...and, from this point, you just use ${TGT} as the target partition. I can't test this at the moment as I'm not near a suitable system, so the above is pure theory at this point. However, memory says that sash does not support the necessary facilities.
Quoted 5 lines
Quoted 3 lines
Also note that if we move to
/dev/hdainstead of/dev/bdathen only the fdisk line needs changing, and the rest of the code will work as is.Many Thanks. This is valuable information.
You'll also be pleased to hear that the code for partype.c was developed using gcc -Wall -pedantic and, as a result, compiles and runs on Linux as well as ELKS. It needs bcc -ansi to compile for ELKS, but we're using that anyway, so it's not a problem.
I tested it on my Linux system by running partype 83 ; echo $? to check it gave the right results, and it does.
Best wishes from Riley.
Quoted 6 lines · Neil Holmes
It sounds like your distribution is in advance of that which I have produced thus far Richard.
My first "stable" version is ready now. I am not sure what the procedure is here but I have attached a zip file EDE.zip to this email which contains two floppy image files for install disk one and disk two.
May just be me but can't see attachment here or in the archives
http://rainbow.cs.unipi.gr/linux-8086-list/2002/05/attachment.html
Can you put up a link to a site or resend it.
Paul
Hi Neil.
Update to the following...
Quoted 6 lines
Quoted 2 lines
I will, indeed, look very closely at your remarks as I move forward. I am particularly interested by the
partition.c.If you're using ash as your install shell, you should be able to use the following script...
Quoted 6 lines
#!/bin/ash : fdisk /dev/bda TGT=$(partype 80)
if test -n "${TGT}" ; then
# Use ${TGT} as partition.
else
# No partition of type 80 found, so error.
fiQuoted 7 lines
...and, from this point, you just use ${TGT} as the target partition. I can't test this at the moment as I'm not near a suitable system, so the above is pure theory at this point. However, memory says that sash does not support the necessary facilities.
Also note that if we move to
/dev/hdainstead of/dev/bdathen only the fdisk line needs changing, and the rest of the code will work as is.
As shown by the additional code above, a test immediately following the partype line determines whether installation is possible as indicated above. Alternatively, code similar to the following could be used...
export TGT=''
while test -z "${TGT}" ; do
fdisk /dev/bda
TGT=$(partype 80)
if test -z "${TGT}" ; then
echo Need at least one partition of type 80.
sleep 5
fi
done...as this guarantees that a suitable partition will exist once the while loop finishes.
Best wishes from Riley.