~ubuntu-branches/ubuntu/trusty/grub2/trusty

« back to all changes in this revision

Viewing changes to grub-core/kern/emu/main.c

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2014-01-16 15:18:04 UTC
  • mfrom: (17.6.38 experimental)
  • Revision ID: package-import@ubuntu.com-20140116151804-3foouk7fpqcq3sxx
Tags: 2.02~beta2-2
* Convert patch handling to git-dpm.
* Add bi-endian support to ELF parser (Tomohiro B Berry).
* Adjust restore_mkdevicemap.patch to mark get_kfreebsd_version as static,
  to appease "gcc -Werror=missing-prototypes".
* Cherry-pick from upstream:
  - Change grub-macbless' manual page section to 8.
* Install grub-glue-efi, grub-macbless, grub-render-label, and
  grub-syslinux2cfg.
* grub-shell: Pass -no-pad to xorriso when building floppy images.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
17
17
 */
18
18
 
 
19
#include <config.h>
 
20
#include <config-util.h>
 
21
 
19
22
#include <time.h>
20
23
#include <stdio.h>
21
24
#include <stdlib.h>
22
25
#include <setjmp.h>
23
 
#include <sys/stat.h>
24
26
#include <string.h>
25
27
#include <signal.h>
26
28
#include <sys/types.h>
27
 
#include <unistd.h>
28
29
 
29
30
#include <grub/dl.h>
30
31
#include <grub/mm.h>
40
41
#include <grub/env.h>
41
42
#include <grub/partition.h>
42
43
#include <grub/i18n.h>
 
44
#include <grub/loader.h>
 
45
#include <grub/util/misc.h>
 
46
 
 
47
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
43
48
 
44
49
#include "progname.h"
45
50
#include <argp.h>
52
57
/* Store the prefix specified by an argument.  */
53
58
static char *root_dev = NULL, *dir = NULL;
54
59
 
55
 
int grub_no_autoload;
56
 
 
57
60
grub_addr_t grub_modbase = 0;
58
61
 
59
62
void
75
78
}
76
79
 
77
80
void
78
 
grub_machine_fini (void)
 
81
grub_machine_fini (int flags)
79
82
{
80
 
  grub_console_fini ();
 
83
  if (flags & GRUB_LOADER_FLAG_NORETURN)
 
84
    grub_console_fini ();
81
85
}
82
86
 
83
87
 
94
98
  { 0, 0, 0, 0, 0, 0 }
95
99
};
96
100
 
 
101
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
 
102
 
97
103
static char *
98
104
help_filter (int key, const char *text, void *input __attribute__ ((unused)))
99
105
{
108
114
    }
109
115
}
110
116
 
 
117
#pragma GCC diagnostic error "-Wformat-nonliteral"
 
118
 
111
119
struct arguments
112
120
{
113
121
  const char *dev_map;
164
172
 
165
173
 
166
174
 
167
 
void grub_hostfs_init (void);
168
 
void grub_hostfs_fini (void);
169
 
void grub_host_init (void);
170
 
void grub_host_fini (void);
171
 
void grub_emu_init (void);
 
175
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
172
176
 
173
177
int
174
178
main (int argc, char *argv[])
180
184
    };
181
185
  volatile int hold = 0;
182
186
 
183
 
  set_program_name (argv[0]);
 
187
  grub_util_host_init (&argc, &argv);
184
188
 
185
189
  dir = xstrdup (DEFAULT_DIRECTORY);
186
190
 
205
209
    }
206
210
 
207
211
  signal (SIGINT, SIG_IGN);
208
 
  grub_emu_init ();
209
212
  grub_console_init ();
210
213
  grub_host_init ();
211
214
 
216
219
 
217
220
  grub_hostfs_init ();
218
221
 
219
 
  grub_emu_post_init ();
220
 
 
221
222
  /* Make sure that there is a root device.  */
222
223
  if (! root_dev)
223
224
    root_dev = grub_strdup ("host");
232
233
  grub_hostfs_fini ();
233
234
  grub_host_fini ();
234
235
 
235
 
  grub_machine_fini ();
 
236
  grub_machine_fini (GRUB_LOADER_FLAG_NORETURN);
236
237
 
237
238
  return 0;
238
239
}
239
 
 
240
 
#ifdef __MINGW32__
241
 
 
242
 
void
243
 
grub_millisleep (grub_uint32_t ms)
244
 
{
245
 
  Sleep (ms);
246
 
}
247
 
 
248
 
#else
249
 
 
250
 
void
251
 
grub_millisleep (grub_uint32_t ms)
252
 
{
253
 
  struct timespec ts;
254
 
 
255
 
  ts.tv_sec = ms / 1000;
256
 
  ts.tv_nsec = (ms % 1000) * 1000000;
257
 
  nanosleep (&ts, NULL);
258
 
}
259
 
 
260
 
#endif