mformatの-iオプションとは #osdevjp
ここ読んでいたらMakefileのmformatのオプションで-iわたしていた
30日でできる!OS自作入門(3日目)[Ubuntu16.04/NASM] - Qiita
manしても載ってないし--helpでもでないし、謎。
mtoolsのソースコードをダウンロードしてくる
Mtools - GNU Project - Free Software Foundation
mformat.cを見るとiオプション確かにある
/* get command line options */ if(helpFlag(argc, argv)) usage(0); while ((c = getopt(argc,argv, "i:148f:t:n:v:qub" "kK:R:B:r:L:I:FCc:Xh:s:T:l:N:H:M:S:2:30:Aad:m:"))!= EOF) { endptr = NULL; switch (c) { case 'i': set_cmd_line_image(optarg); break;
単に名前設定してるだけっぽい
void set_cmd_line_image(char *img) { char *ofsp; prepend(); devices[cur_dev].drive = ':'; default_drive = ':'; ofsp = strstr(img, "@@"); if (ofsp == NULL) { /* no separator => no offset */ devices[cur_dev].name = strdup(img); devices[cur_dev].offset = 0; } else { devices[cur_dev].name = strndup(img, ofsp - img); devices[cur_dev].offset = str_to_offset(ofsp+2); } devices[cur_dev].fat_bits = 0; devices[cur_dev].tracks = 0; devices[cur_dev].heads = 0; devices[cur_dev].sectors = 0; if (strchr(devices[cur_dev].name, '|')) { char *pipechar = strchr(devices[cur_dev].name, '|'); *pipechar = 0; strncpy(buffer, pipechar+1, MAX_LINE_LEN); buffer[MAX_LINE_LEN] = '\0'; fp = NULL; filename = "{command line}"; linenumber = 0; lastTokenLinenumber = 0; pos = buffer; token = 0; while (parse_one(0)); } }
あとはinit.cで読み込んでるよう。
最後の ::
はこのあたりで処理されてそう。
if (argc - optind > 1) usage(1); if(argc - optind == 1) { if(!argv[optind][0] || argv[optind][1] != ':') usage(1); drive = ch_toupper(argv[argc -1][0]); } else { drive = get_default_drive(); if(drive != ':') { /* Use default drive only if it is ":" (image file), as else it would be too dangerous... */ fprintf(stderr, "Drive letter missing\n"); exit(1); } }