Bootblock desc

From 흡혈양파의 인터넷工房
Revision as of 05:10, 2 April 2013 by Onionmixer (talk | contribs) (내용갱신)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
boot label 세팅에 관한 bootblock.h 파일의 참고정보

아래 내용은 bootblock.h 파일의 일부분을 발췌한 내용이다.

한글로 달려있는 주석부분을 잘 참고하도록 한다.


#define NEXT68K_LABEL_MAXPARTITIONS     8       /* number of partitions in next68k_disklabel */
#define NEXT68K_LABEL_CPULBLLEN         24
#define NEXT68K_LABEL_MAXDNMLEN         24
#define NEXT68K_LABEL_MAXTYPLEN         24
#define NEXT68K_LABEL_MAXBFLEN          24
#define NEXT68K_LABEL_MAXHNLEN          32
#define NEXT68K_LABEL_MAXMPTLEN         16
#define NEXT68K_LABEL_MAXFSTLEN         8
#define NEXT68K_LABEL_NBAD              1670    /* sized to make label ~= 8KB */

struct next68k_partition {
        int32_t cp_offset;              /* starting sector */
        int32_t cp_size;                /* number of sectors in partition */
        int16_t cp_bsize;               /* block size in bytes */
        int16_t cp_fsize;               /* filesystem basic fragment size */
        char    cp_opt;                 /* optimization type: 's'pace/'t'ime */
        char    cp_pad1;
        int16_t cp_cpg;                 /* filesystem cylinders per group */
        int16_t cp_density;             /* bytes per inode density */
        int8_t  cp_minfree;             /* minfree (%) */
        int8_t  cp_newfs;               /* run newfs during init */
        char    cp_mountpt[NEXT68K_LABEL_MAXMPTLEN];
                                        /* default/standard mount point */
        int8_t  cp_automnt;             /* auto-mount when inserted */
        char    cp_type[NEXT68K_LABEL_MAXFSTLEN]; /* file system type name */
        char    cp_pad2;
} __packed;

/* The disklabel the way it is on the disk */
struct next68k_disklabel {
        int32_t cd_version;             /* label version */
        int32_t cd_label_blkno;         /* block # of this label */ <- 첫번째 변경할 바이트 offset 0x5 ~ 0x08 ( 실제로는 4 바이트의 끝자리니까 0x8  변경해야함)
        int32_t cd_size;                /* size of media area (sectors) */
        char    cd_label[NEXT68K_LABEL_CPULBLLEN]; /* disk name (label) */
        uint32_t cd_flags;              /* flags */
        uint32_t cd_tag;                /* volume tag */
        char    cd_name[NEXT68K_LABEL_MAXDNMLEN]; /* drive (hardware) name */
        char    cd_type[NEXT68K_LABEL_MAXTYPLEN]; /* drive type */
        int32_t cd_secsize;             /* # of bytes per sector */
        int32_t cd_ntracks;             /* # of tracks per cylinder */
        int32_t cd_nsectors;            /* # of data sectors per track */
        int32_t cd_ncylinders;          /* # of data cylinders per unit */
        int32_t cd_rpm;                 /* rotational speed */
        int16_t cd_front;               /* # of sectors in "front porch" */ <- offset 0x70
        int16_t cd_back;                /* # of sectors in "back porch" */ <- offset 0x72
        int16_t cd_ngroups;             /* # of alt groups */
        int16_t cd_ag_size;             /* alt group size (sectors) */
        int16_t cd_ag_alts;             /* alternate sectors / alt group */
        int16_t cd_ag_off;              /* sector offset to first alternate */
        int32_t cd_boot_blkno[2];       /* boot program locations */ <- 두번째변경할바이트 offset 0x7c
        char    cd_kernel[NEXT68K_LABEL_MAXBFLEN]; /* default kernel name */ <- 세번째변경할바이트 offset 0x84
        char    cd_hostname[NEXT68K_LABEL_MAXHNLEN];
                                /* host name (usu. where disk was labeled) */
        char    cd_rootpartition;       /* root partition letter e.g. 'a' */
        char    cd_rwpartition;         /* r/w partition letter e.g. 'b' */
        struct next68k_partition cd_partitions[NEXT68K_LABEL_MAXPARTITIONS];

        union {
                uint16_t CD_v3_checksum; /* label version 3 checksum */ <- 네번째 변경바이트 offset 0x22e(위의 cd_version  따라 dlV3 인경우)
                int32_t CD_bad[NEXT68K_LABEL_NBAD];
                                        /* block number that is bad */
        } cd_un;
        uint16_t cd_checksum;           /* label version 1 or 2 checksum */ <- 네번째 변경바이트 offset 0x1c46 (위의 cd_version  따라 NeXT 또는 dlV2 인경우)
} __packed;

#define NEXT68K_LABEL_cd_checksum       cd_checksum
#define NEXT68K_LABEL_cd_v3_checksum    cd_un.CD_v3_checksum
#define NEXT68K_LABEL_cd_bad            cd_un.CD_bad

#define NEXT68K_LABEL_SECTOR            0       /* sector containing label */
#define NEXT68K_LABEL_OFFSET            0       /* offset of label in sector */
#define NEXT68K_LABEL_SIZE              8192    /* size of label */
#define NEXT68K_LABEL_CD_V1             0x4e655854 /* version #1: "NeXT" */
#define NEXT68K_LABEL_CD_V2             0x646c5632 /* version #2: "dlV2" */
#define NEXT68K_LABEL_CD_V3             0x646c5633 /* version #3: "dlV3" */
#define NEXT68K_LABEL_DEFAULTFRONTPORCH (160 * 2)
#define NEXT68K_LABEL_DEFAULTBOOT0_1    (32 * 2)
#define NEXT68K_LABEL_DEFAULTBOOT0_2    (96 * 2)