很原始的CHS,看了下Sanitize_Bios_Geom() , 对 sysinstall 来说,当检测到
d->bios_cyl > 65536 || d->bios_hd > 256 || d->bios_sect >= 64
而且在出现的对话框里选择“YES", 则会调用这个函数,对硬盘的CHS进行调整
大体流程是:
1、先设最保守的参数
/* First try something that IDE can handle */
disk->bios_sect = 63;
disk->bios_hd = 16;
disk->bios_cyl = disk->chunks->size /
(disk->bios_sect * disk->bios_hd);
2、若计算得到的 bios_cyl 大于 1024, 改 bios_hd=256,再算 bios_cyl
这里对大硬盘来说存在的问题:一是调整后的bios_hd和bios_cyl会造成哪些影响,二是不使用48位的LBA,怎样寻址超出CHS能力的磁盘空间。
/* i386和amd64的 disk 结构 */
struct disk {
char *name;
u_long bios_cyl;
u_long bios_hd;
u_long bios_sect;
u_char *bootmgr;
size_t bootmgr_size;
u_char *boot1;
u_char *boot2;
struct chunk *chunks;
u_long sector_size; /* media sector size, a power of 2 */
};
/* !__ia64__ */
struct disk {
char *name;
struct chunk *chunks;
u_long media_size;
u_long sector_size;
u_long lba_start;
u_long lba_end;
u_int gpt_size; /* Number of entries */
};
struct chunk {
struct chunk *next;
struct chunk *part;
struct disk *disk;
daddr_t offset;
daddr_t size;
daddr_t end;
char *sname; /* PC98 field */
char *name;
char *oname;
/* Used during Fixup_Names() to avoid renaming more than
* absolutely needed.
*/
chunk_e type;
int subtype;
u_long flags;
void (*private_free)(void*);
void *(*private_clone)(void*);
void *private_data;
/* For data private to the application, and the management
* thereof. If the functions are not provided, no storage
* management is done, Cloning will just copy the pointer
* and freeing will just forget it.
*/
};
阅读(2300) | 评论(0) | 转发(0) |