Linux Kernel

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
nuno_silva_pt

Re:Linux Kernel

Post by nuno_silva_pt »

how can i use partcopy to make a kernel be bootable?
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Linux Kernel

Post by Pype.Clicker »

that depends from the kernel ...
in the case of Linux, a bootsector cannot start the kernel directly. You need an intermediate bootloader such as LiLo or GRUB.

and how you will install it on your disk will with partcopy will depend on the bootloader ...

But the easiest for you will probably be to download a complete floppy image (there are some on http://bochs.sf.net, afaik) and then partcopy it entirely to a clean floppy ...
distantvoices
Member
Member
Posts: 1600
Joined: Wed Oct 18, 2006 11:59 am
Location: Vienna/Austria
Contact:

Re:Linux Kernel

Post by distantvoices »

Mr. Nuno_silva shall be grateful for pypes patience.

Other possibility would be using the tool dd: dd if=boot.bin of=/dev/fd0 seek=0 for putting boot loader on first sector of floppy, then dd if=kernel.bin of=/dev/fd0 seek=1 to put the kernel image on floppy starting with sector 1.

I just wonder if he uses famous babelfish to translate the hints and tips we pass to him or if he keeps asking questions in a repetitive way.
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Linux Kernel

Post by Pype.Clicker »

I just wonder if he uses famous babelfish to translate the hints and tips we pass to him or if he keeps asking questions in a repetitive way.
that sounds a bit too much sarcastic ... can we please stop that ridiculous fight ?
distantvoices
Member
Member
Posts: 1600
Joined: Wed Oct 18, 2006 11:59 am
Location: Vienna/Austria
Contact:

Re:Linux Kernel

Post by distantvoices »

Maybe. I am getting tired of it.
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
Whatever5k

Re:Linux Kernel

Post by Whatever5k »

Pype.Clicker wrote: that sounds a bit too much sarcastic ... can we please stop that ridiculous fight ?
Agreed, that's getting on my nerves, too.
nuno_silva_pt

Re:Linux Kernel

Post by nuno_silva_pt »

I have the flowing code for the fat32 filesystem:

Code: Select all

typedef unsigned char   uint8_t;        /* or #include <stdint.h> */ 
typedef unsigned short  uint16_t;       /* Note: multi-byte values are little-endian */ 
typedef unsigned long   uint32_t; 
struct fat_bootsector                   /* Warning: this struct must be packed */ 
{ 
        uint8_t  jump[3];               /* 16-bit JMP to boot code, or 8-bit JMP + NOP */ 
        uint8_t  oem_id[8];             /* e.g. 'MSWIN4.0' */ 
        uint16_t bytes_per_sector;      /* usu. =512 */ 
        uint8_t  sectors_per_cluster; 
        uint16_t num_boot_sectors;      /* usu. =1 */ 
        uint8_t  num_fats;              /* usu. =2 */ 
        uint16_t num_root_dir_ents; 
        uint16_t total_sectors;         /* 16-bit; 0 if num sectors > 65535 */ 
        uint8_t  media_ID_byte;         /* usu. =0F0h */ 
        uint16_t sectors_per_fat; 
        uint16_t sectors_per_track; 
        uint16_t heads; 
        uint32_t hidden_sectors;        /* =LBA partition start */ 
        uint32_t total_sectors_large;   /* 32-bit; 0 if num sectors < 65536 */ 
        uint8_t  boot_code[474]; 
        uint8_t  magic[2];              /* 55h, 0AAh */ 
};                              /* 512 bytes total */ 
There are additional fields which are required by FAT32, but are optional for FAT12 and FAT16 (xxx - todo). 
FAT directory entries 
FAT directory entries are 32 bytes long: 
typedef unsigned char   uint8_t;        /* or #include <stdint.h> */ 
typedef unsigned short  uint16_t;       /* Note: multi-byte values are little-endian */ 
typedef unsigned long   uint32_t; 
struct fat_dirent                       /* Warning: this struct must be packed */ 
{ 
        uint8_t  name[8];               /* ALL-CAPS, pad right with spaces */ 
        uint8_t  ext[3];                /* ALL-CAPS, pad right with spaces */ 
        uint8_t  attrib;                /* attribute byte */ 
        uint8_t  reserved;              /* =0 */ 
        uint8_t  ctime_ms;              /* file creation time, 10ms units */ 
        uint16_t ctime;                 /* file creation time, in DOS format */ 
        uint16_t cdate;                 /* file creation date, in DOS format */ 
        uint16_t adate;                 /* DOS date of last file access */ 
        uint16_t st_clust_msw;          /* high 16 bits of starting cluster (FAT32) */ 
        uint16_t mtime;                 /* DOS time of last file modification */ 
        uint16_t mdate;                 /* DOS date of last file modification */ 
        uint16_t st_clust;              /* starting cluster */ 
        uint32_t file_size;             /* in bytes */ 
};                              /* 32 bytes total */ 
DOS times and dates are stored in these formats: 
struct dos_time                 /* Warning: this struct must be packed */ 
{ 
        unsigned two_secs : 5;  /* low 5 bits: 2-second increments */ 
        unsigned minutes : 6;   /* middle 6 bits: minutes */ 
        unsigned hours : 5;     /* high 5 bits: hours (0-23) */ 
};                              /* 2 bytes total */ 

struct dos_date                 /* Warning: this struct must be packed */ 
{ 
        unsigned date : 5;      /* low 5 bits: date (1-31) */ 
        unsigned month : 4;     /* middle 4 bits: month (1-12) */ 
        unsigned year : 7;      /* high 7 bits: year - 1980 */ 
};                              /* 2 bytes total */ 
The Attribute byte is similar to the file 'mode' under UNIX filesystems: 
struct attrib                   /* Warning: this struct must be packed */ 
{ 
        int read_only : 1;      /* b0 */ 
        int hidden : 1; 
        int system : 1; 
        int volume_label : 1; 
        int directory : 1; 
        int archive : 1; 
        int reserved : 2;       /* b6, b7 */ 
};                              /* 1 byte total */
I have 2 questions:
1- Will this work for my o.s. to have FAT32 filesystem?
2- How do i do that?
nuno_silva_pt

Re:Linux Kernel

Post by nuno_silva_pt »

About FAT32, I am more familiar, but my father does not let me have linux because I already had problems with the installation and therefore he does not let me have EXT2 or linux.
soap

Re:Linux Kernel

Post by soap »

nuno might want to have a look at UMSDOS, a filesystem which I believe allows you to use a FAT partition as the Linux root and store files with the usual owner/group/world permissions set.

http://en.tldp.org/HOWTO/UMSDOS-HOWTO.html

http://linux.voyager.hr/umsdos/
nuno_silva_pt

Re:Linux Kernel

Post by nuno_silva_pt »

I've got some source code, but where is the source for windows?
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Linux Kernel

Post by Pype.Clicker »

The source for windows ? of what ?
Be more precise: it sounds like if you were searching the sources OF windows (which of course isn't available)

BTW, what you got isn't really "sources": it's only the description of the main data structures. You're still missing algorithms like

Code: Select all

File Directory::lookup(String filename);
File::getSector(long offset);
FAT::getNext(File file,long sector_nr);
FAT::isEOF(File file, long sector_nr);
...
Once you also have the implementation of these basic operations, you'll have to mathc the interface Linux kernel expects from a filesystem type ...
nuno_silva_pt

Re:Linux Kernel

Post by nuno_silva_pt »

the source of umsdos
Post Reply