亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? grub-mkimage.c

?? 最新的grub2源代碼
?? C
字號:
/* *  GRUB  --  GRand Unified Bootloader *  Copyright (C) 2004, 2005  Free Software Foundation, Inc. * *  This program is free software; you can redistribute it and/or modify *  it under the terms of the GNU General Public License as published by *  the Free Software Foundation; either version 2 of the License, or *  (at your option) any later version. * *  This program is distributed in the hope that it will be useful, *  but WITHOUT ANY WARRANTY; without even the implied warranty of *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the *  GNU General Public License for more details. * *  You should have received a copy of the GNU General Public License *  along with this program; if not, write to the Free Software *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */#include <stdio.h>#include <stdint.h>#include <unistd.h>#include <fcntl.h>#include <getopt.h>#include <stdlib.h>#include <string.h>#include <grub/elf.h>#include <grub/util/misc.h>#include <grub/util/resolve.h>#include <grub/kernel.h>#include <grub/machine/kernel.h>#define ALIGN_UP(addr, align) ((long)((char *)addr + align - 1) & ~(align - 1))#define GRUB_IEEE1275_NOTE_NAME "PowerPC"#define GRUB_IEEE1275_NOTE_TYPE 0x1275/* These structures are defined according to the CHRP binding to IEEE1275,   "Client Program Format" section.  */struct grub_ieee1275_note_hdr{  grub_uint32_t namesz;  grub_uint32_t descsz;  grub_uint32_t type;  char name[sizeof (GRUB_IEEE1275_NOTE_NAME)];};struct grub_ieee1275_note_desc{  grub_uint32_t real_mode;  grub_uint32_t real_base;  grub_uint32_t real_size;  grub_uint32_t virt_base;  grub_uint32_t virt_size;  grub_uint32_t load_base;};struct grub_ieee1275_note{  struct grub_ieee1275_note_hdr header;  struct grub_ieee1275_note_desc descriptor;};voidload_note (Elf32_Phdr *phdr, FILE *out){  struct grub_ieee1275_note note;  int note_size = sizeof (struct grub_ieee1275_note);  grub_util_info ("adding CHRP NOTE segment");  note.header.namesz = grub_cpu_to_be32 (sizeof (GRUB_IEEE1275_NOTE_NAME));  note.header.descsz = grub_cpu_to_be32 (note_size);  note.header.type = grub_cpu_to_be32 (GRUB_IEEE1275_NOTE_TYPE);  strcpy (note.header.name, GRUB_IEEE1275_NOTE_NAME);  note.descriptor.real_mode = grub_cpu_to_be32 (0xffffffff);  note.descriptor.real_base = grub_cpu_to_be32 (0x00c00000);  note.descriptor.real_size = grub_cpu_to_be32 (0xffffffff);  note.descriptor.virt_base = grub_cpu_to_be32 (0xffffffff);  note.descriptor.virt_size = grub_cpu_to_be32 (0xffffffff);  note.descriptor.load_base = grub_cpu_to_be32 (0x00004000);  /* Write the note data to the new segment.  */  grub_util_write_image_at (&note, note_size,			    grub_be_to_cpu32 (phdr->p_offset), out);  /* Fill in the rest of the segment header.  */  phdr->p_type = grub_cpu_to_be32 (PT_NOTE);  phdr->p_flags = grub_cpu_to_be32 (PF_R);  phdr->p_align = grub_cpu_to_be32 (sizeof (long));  phdr->p_vaddr = 0;  phdr->p_paddr = 0;  phdr->p_filesz = grub_cpu_to_be32 (note_size);  phdr->p_memsz = 0;}voidload_modules (Elf32_Phdr *phdr, const char *dir, char *mods[], FILE *out){  char *module_img;  struct grub_util_path_list *path_list;  struct grub_util_path_list *p;  struct grub_module_info *modinfo;  size_t offset;  size_t total_module_size;  path_list = grub_util_resolve_dependencies (dir, "moddep.lst", mods);  offset = sizeof (struct grub_module_info);  total_module_size = sizeof (struct grub_module_info);  for (p = path_list; p; p = p->next)    {      total_module_size += (grub_util_get_image_size (p->name)	  + sizeof (struct grub_module_header));    }  grub_util_info ("the total module size is 0x%x", total_module_size);  module_img = xmalloc (total_module_size);  modinfo = (struct grub_module_info *) module_img;  modinfo->magic = grub_cpu_to_be32 (GRUB_MODULE_MAGIC);  modinfo->offset = grub_cpu_to_be32 (sizeof (struct grub_module_info));  modinfo->size = grub_cpu_to_be32 (total_module_size);  /* Load all the modules, with headers, into module_img.  */  for (p = path_list; p; p = p->next)    {      struct grub_module_header *header;      size_t mod_size;      grub_util_info ("adding module %s", p->name);      mod_size = grub_util_get_image_size (p->name);      header = (struct grub_module_header *) (module_img + offset);      header->offset = grub_cpu_to_be32 (sizeof (*header));      header->size = grub_cpu_to_be32 (mod_size + sizeof (*header));      grub_util_load_image (p->name, module_img + offset + sizeof (*header));      offset += sizeof (*header) + mod_size;    }  /* Write the module data to the new segment.  */  grub_util_write_image_at (module_img, total_module_size,			    grub_cpu_to_be32 (phdr->p_offset), out);  /* Fill in the rest of the segment header.  */  phdr->p_type = grub_cpu_to_be32 (PT_LOAD);  phdr->p_flags = grub_cpu_to_be32 (PF_R | PF_W | PF_X);  phdr->p_align = grub_cpu_to_be32 (sizeof (long));  phdr->p_vaddr = grub_cpu_to_be32 (GRUB_IEEE1275_MODULE_BASE);  phdr->p_paddr = grub_cpu_to_be32 (GRUB_IEEE1275_MODULE_BASE);  phdr->p_filesz = grub_cpu_to_be32 (total_module_size);  phdr->p_memsz = grub_cpu_to_be32 (total_module_size);}voidadd_segments (char *dir, FILE *out, int chrp, char *mods[]){  Elf32_Ehdr ehdr;  Elf32_Phdr *phdrs = NULL;  Elf32_Phdr *phdr;  FILE *in;  char *kernel_path;  off_t phdroff;  int i;  /* Read ELF header.  */  kernel_path = grub_util_get_path (dir, "grubof");  in = fopen (kernel_path, "rb");  if (! in)    grub_util_error ("cannot open %s", kernel_path);  grub_util_read_at (&ehdr, sizeof (ehdr), 0, in);    phdrs = xmalloc (grub_be_to_cpu16 (ehdr.e_phentsize)		   * (grub_be_to_cpu16 (ehdr.e_phnum) + 2));  /* Copy all existing segments.  */  for (i = 0; i < grub_be_to_cpu16 (ehdr.e_phnum); i++)    {      char *segment_img;      phdr = phdrs + i;      /* Read segment header.  */      grub_util_read_at (phdr, sizeof (Elf32_Phdr),			 (grub_be_to_cpu32 (ehdr.e_phoff)			  + (i * grub_be_to_cpu16 (ehdr.e_phentsize))),			 in);      grub_util_info ("copying segment %d, type %d", i,		      grub_be_to_cpu32 (phdr->p_type));      /* Read segment data and write it to new file.  */      segment_img = xmalloc (grub_be_to_cpu32 (phdr->p_filesz));        grub_util_read_at (segment_img, grub_be_to_cpu32 (phdr->p_filesz),			 grub_be_to_cpu32 (phdr->p_offset), in);      grub_util_write_image_at (segment_img, grub_be_to_cpu32 (phdr->p_filesz),				grub_be_to_cpu32 (phdr->p_offset), out);      free (segment_img);    }  if (mods[0] != NULL)    {      /* Construct new segment header for modules.  */      phdr = phdrs + grub_be_to_cpu16 (ehdr.e_phnum);      ehdr.e_phnum = grub_cpu_to_be16 (grub_be_to_cpu16 (ehdr.e_phnum) + 1);      /* Fill in p_offset so the callees know where to write.  */      phdr->p_offset = grub_cpu_to_be32 (ALIGN_UP (grub_util_get_fp_size (out),						   sizeof (long)));      load_modules (phdr, dir, mods, out);    }  if (chrp)    {      /* Construct new segment header for the CHRP note.  */      phdr = phdrs + grub_be_to_cpu16 (ehdr.e_phnum);      ehdr.e_phnum = grub_cpu_to_be16 (grub_be_to_cpu16 (ehdr.e_phnum) + 1);      /* Fill in p_offset so the callees know where to write.  */      phdr->p_offset = grub_cpu_to_be32 (ALIGN_UP (grub_util_get_fp_size (out),						   sizeof (long)));      load_note (phdr, out);    }  /* Don't bother preserving the section headers.  */  ehdr.e_shoff = 0;  ehdr.e_shnum = 0;  ehdr.e_shstrndx = 0;  /* Append entire segment table to the file.  */  phdroff = ALIGN_UP (grub_util_get_fp_size (out), sizeof (long));  grub_util_write_image_at (phdrs, grub_be_to_cpu16 (ehdr.e_phentsize)			    * grub_be_to_cpu16 (ehdr.e_phnum), phdroff,			    out);  /* Write ELF header.  */  ehdr.e_phoff = grub_cpu_to_be32 (phdroff);  grub_util_write_image_at (&ehdr, sizeof (ehdr), 0, out);  free (phdrs);  free (kernel_path);}static struct option options[] =  {    {"directory", required_argument, 0, 'd'},    {"output", required_argument, 0, 'o'},    {"help", no_argument, 0, 'h'},    {"note", no_argument, 0, 'n'},    {"version", no_argument, 0, 'V'},    {"verbose", no_argument, 0, 'v'},    { 0, 0, 0, 0 },  };static voidusage (int status){  if (status)    fprintf (stderr, "Try ``grub-mkimage --help'' for more information.\n");  else    printf ("\Usage: grub-mkimage -o FILE [OPTION]... [MODULES]\n\\n\Make a bootable image of GRUB.\n\\n\-d, --directory=DIR     use images and modules under DIR [default=%s]\n\-o, --output=FILE       output a generated image to FILE\n\-h, --help              display this message and exit\n\-n, --note              add NOTE segment for CHRP Open Firmware\n\-V, --version           print version information and exit\n\-v, --verbose           print verbose messages\n\\n\Report bugs to <%s>.\n\", GRUB_DATADIR, PACKAGE_BUGREPORT);  exit (status);}intmain (int argc, char *argv[]){  FILE *fp;  char *output = NULL;  char *dir = NULL;  int chrp = 0;  progname = "grub-mkimage";  while (1)    {      int c = getopt_long (argc, argv, "d:o:hVvn", options, 0);      if (c == -1)	break;      switch (c)	{	  case 'd':	    if (dir)	      free (dir);	    dir = xstrdup (optarg);	    break;	  case 'h':	    usage (0);	    break;	  case 'n':	    chrp = 1;	    break;	  case 'o':	    if (output)	      free (output);	    output = xstrdup (optarg);	    break;	  case 'V':	    printf ("grub-mkimage (%s) %s\n", PACKAGE_NAME, PACKAGE_VERSION);	    return 0;	  case 'v':	    verbosity++;	    break;	  default:	    usage (1);	    break;	}  }  if (!output)    usage (1);  fp = fopen (output, "wb");  if (! fp)    grub_util_error ("cannot open %s", output);  add_segments (dir ? : GRUB_DATADIR, fp, chrp, argv + optind);  fclose (fp);  return 0;}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文字幕永久在线不卡| 欧洲视频一区二区| 一区二区三区在线不卡| 久久免费精品国产久精品久久久久| 91在线精品秘密一区二区| 狠狠色狠狠色综合系列| 日韩国产精品大片| 一区二区三区精品久久久| 国产精品的网站| 日本一区二区不卡视频| 亚洲精品在线免费播放| 欧美久久久久久久久中文字幕| 91片在线免费观看| 97久久超碰国产精品电影| 国产不卡一区视频| 国产mv日韩mv欧美| 国产成人综合自拍| 国产69精品一区二区亚洲孕妇 | 国产91丝袜在线播放| 中文字幕在线播放不卡一区| 中文字幕av一区二区三区免费看| 精品少妇一区二区| 久久先锋资源网| 久久麻豆一区二区| 国产日本亚洲高清| 国产精品视频在线看| 国产精品久久久久影院亚瑟| 欧美成人官网二区| 国产亚洲一区字幕| 中文字幕一区二区三区乱码在线 | 久久精品亚洲精品国产欧美kt∨ | 久久99国产精品麻豆| 日本中文字幕不卡| 狠狠色综合日日| youjizz久久| 欧美视频在线不卡| 欧美一二三区精品| 国产欧美日韩综合| 伊人色综合久久天天人手人婷| 亚洲国产精品自拍| 亚洲一区二区三区美女| 日韩精品每日更新| 国产精品123| 色88888久久久久久影院按摩 | 99视频国产精品| 欧美私人免费视频| 日韩欧美激情一区| 中文字幕在线观看一区二区| 午夜欧美电影在线观看| 国产精品77777| 91视频你懂的| 欧美电视剧免费观看| 国产精品麻豆久久久| 午夜欧美在线一二页| 国产成人精品亚洲午夜麻豆| 在线看不卡av| 欧美韩国日本不卡| 午夜欧美大尺度福利影院在线看| 老司机精品视频导航| 91视频免费观看| 久久欧美中文字幕| 污片在线观看一区二区| 床上的激情91.| 欧美一区二区三区小说| 欧美va天堂va视频va在线| 国产精品美女久久久久aⅴ| 无码av中文一区二区三区桃花岛| 丁香亚洲综合激情啪啪综合| 91精品国产色综合久久| 亚洲欧洲国产日韩| 国内精品久久久久影院一蜜桃| 欧美影视一区二区三区| 久久免费电影网| 美国av一区二区| 欧美系列在线观看| ...xxx性欧美| 国产一区二区三区蝌蚪| 欧美日韩aaaaaa| 亚洲男同性视频| 激情另类小说区图片区视频区| 在线视频国产一区| 国产精品久久久久久久午夜片| 极品少妇xxxx精品少妇| 欧美一级艳片视频免费观看| 一级日本不卡的影视| a4yy欧美一区二区三区| 日本一二三不卡| 国产精品亚洲成人| 亚洲四区在线观看| 国产激情偷乱视频一区二区三区| 91精品国产91久久综合桃花| 亚洲成av人片一区二区三区| 色综合一区二区| 亚洲欧美aⅴ...| 91色在线porny| 亚洲人成在线播放网站岛国| 成人综合婷婷国产精品久久| 国产日韩v精品一区二区| 粉嫩av一区二区三区| 中文字幕av一区二区三区高| 成人一级片在线观看| 国产精品五月天| 色婷婷av一区| 亚洲在线一区二区三区| av一二三不卡影片| 一区二区三区小说| 欧美日韩在线播放三区| 日韩精品国产欧美| 精品毛片乱码1区2区3区| 国产一区在线精品| 日韩一区二区免费电影| 激情综合色丁香一区二区| 久久精品视频免费观看| 91免费国产在线观看| 亚洲激情在线激情| www.66久久| 亚洲国产精品久久久久婷婷884| 欧美日韩国产首页| 久久国产精品99久久久久久老狼| 国产亚洲精品超碰| 色综合久久久久久久| 亚洲18女电影在线观看| 精品国产成人在线影院| 日韩午夜中文字幕| 国产91富婆露脸刺激对白| 亚洲乱码国产乱码精品精小说 | 久久久精品天堂| 欧美视频在线一区二区三区| 成人性色生活片| 久久99国产精品尤物| 五月天精品一区二区三区| 国产精品私人自拍| 久久久久久久av麻豆果冻| 制服丝袜日韩国产| 欧洲国产伦久久久久久久| 不卡一区中文字幕| 国精产品一区一区三区mba视频| 午夜亚洲福利老司机| 一区二区视频免费在线观看| 国产精品国产成人国产三级| 久久久久久97三级| 精品三级av在线| 2020国产精品| 精品国产凹凸成av人导航| 日韩欧美成人午夜| 91精品国产综合久久福利软件| 欧美精品在线视频| 8v天堂国产在线一区二区| 欧美午夜精品一区| 精品视频在线免费| 欧美色图一区二区三区| 在线观看日韩精品| 色视频一区二区| 欧美综合天天夜夜久久| 色乱码一区二区三区88 | 亚洲一区二区高清| 一区二区三区不卡在线观看| 一区二区免费在线播放| 一区二区成人在线视频| 五月天激情小说综合| 日本亚洲天堂网| 狠狠色狠狠色综合日日91app| 精彩视频一区二区| 国产精品18久久久久久vr| 欧美日韩一区成人| 日韩西西人体444www| 久久综合狠狠综合久久激情| 久久久亚洲午夜电影| 国产精品大尺度| 亚洲国产裸拍裸体视频在线观看乱了| 午夜精品久久久久久久久久久 | 国产精品久线观看视频| 亚洲三级在线播放| 香蕉加勒比综合久久| 日本不卡视频在线| 国产精品一区二区你懂的| www.久久精品| 欧美亚洲精品一区| 日韩精品一区二区三区中文不卡| 久久综合九色综合欧美98| 日韩美女精品在线| 日精品一区二区三区| 国产成人av一区二区三区在线| 95精品视频在线| 日韩精品专区在线影院观看| 中文字幕免费不卡在线| 亚洲一级不卡视频| 国产成人综合在线| 欧美日韩精品福利| 久久精品一区二区三区不卡牛牛| 亚洲免费观看高清完整版在线| 免费成人在线网站| 91丨porny丨首页| 日韩三级精品电影久久久| 国产精品国产成人国产三级| 免费在线看成人av| 在线欧美小视频| 国产欧美va欧美不卡在线| 日韩成人dvd| 91精彩视频在线观看|