2008-08-15 Bean <bean123ch@gmail.com>
* conf/i386-pc.rmk (pkglib_MODULES): Add datetime.mod, date.mod and datehook.mod. (datetime_mod_SOURCES): New macro. (datetime_mod_CFLAGS): Likewise. (datetime_mod_LDFLAGS): Likewise. (date_mod_SOURCES): Likewise. (date_mod_CFLAGS): Likewise. (date_mod_LDFLAGS): Likewise. (datehook_mod_SOURCES): Likewise. (datehook_mod_CFLAGS): Likewise. (datehook_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (pkglib_MODULES): Add datetime.mod, date.mod and datehook.mod. (datetime_mod_SOURCES): New macro. (datetime_mod_CFLAGS): Likewise. (datetime_mod_LDFLAGS): Likewise. (date_mod_SOURCES): Likewise. (date_mod_CFLAGS): Likewise. (date_mod_LDFLAGS): Likewise. (datehook_mod_SOURCES): Likewise. (datehook_mod_CFLAGS): Likewise. (datehook_mod_LDFLAGS): Likewise. * conf/i386-ieee1275.rmk (pkglib_MODULES): Add datetime.mod, date.mod and datehook.mod. (datetime_mod_SOURCES): New macro. (datetime_mod_CFLAGS): Likewise. (datetime_mod_LDFLAGS): Likewise. (date_mod_SOURCES): Likewise. (date_mod_CFLAGS): Likewise. (date_mod_LDFLAGS): Likewise. (datehook_mod_SOURCES): Likewise. (datehook_mod_CFLAGS): Likewise. (datehook_mod_LDFLAGS): Likewise. * conf/i386-efi.rmk (pkglib_MODULES): Add datetime.mod, date.mod and datehook.mod. (datetime_mod_SOURCES): New macro. (datetime_mod_CFLAGS): Likewise. (datetime_mod_LDFLAGS): Likewise. (date_mod_SOURCES): Likewise. (date_mod_CFLAGS): Likewise. (date_mod_LDFLAGS): Likewise. (datehook_mod_SOURCES): Likewise. (datehook_mod_CFLAGS): Likewise. (datehook_mod_LDFLAGS): Likewise. * conf/x86_64-efi.rmk (pkglib_MODULES): Add datetime.mod, date.mod and datehook.mod. (datetime_mod_SOURCES): New macro. (datetime_mod_CFLAGS): Likewise. (datetime_mod_LDFLAGS): Likewise. (date_mod_SOURCES): Likewise. (date_mod_CFLAGS): Likewise. (date_mod_LDFLAGS): Likewise. (datehook_mod_SOURCES): Likewise. (datehook_mod_CFLAGS): Likewise. (datehook_mod_LDFLAGS): Likewise. * kern/env.c (grub_env_insert): Fix a bug in prevp pointer. * commands/date.c: New file. * hook/datehook.c: Likewise. * include/grub/lib/datetime.h: Likewise. * include/grub/i386/cmos.h: Likewise. * lib/datetime.c: Likewise. * lib/i386/datetime.c: Likewise. * lib/efi/datetime.c: Likewise.
This commit is contained in:
parent
0e9242da3a
commit
42ce5170b7
21 changed files with 1799 additions and 86 deletions
78
ChangeLog
78
ChangeLog
|
@ -1,3 +1,81 @@
|
|||
2008-08-15 Bean <bean123ch@gmail.com>
|
||||
|
||||
* conf/i386-pc.rmk (pkglib_MODULES): Add datetime.mod, date.mod
|
||||
and datehook.mod.
|
||||
(datetime_mod_SOURCES): New macro.
|
||||
(datetime_mod_CFLAGS): Likewise.
|
||||
(datetime_mod_LDFLAGS): Likewise.
|
||||
(date_mod_SOURCES): Likewise.
|
||||
(date_mod_CFLAGS): Likewise.
|
||||
(date_mod_LDFLAGS): Likewise.
|
||||
(datehook_mod_SOURCES): Likewise.
|
||||
(datehook_mod_CFLAGS): Likewise.
|
||||
(datehook_mod_LDFLAGS): Likewise.
|
||||
|
||||
* conf/i386-coreboot.rmk (pkglib_MODULES): Add datetime.mod, date.mod
|
||||
and datehook.mod.
|
||||
(datetime_mod_SOURCES): New macro.
|
||||
(datetime_mod_CFLAGS): Likewise.
|
||||
(datetime_mod_LDFLAGS): Likewise.
|
||||
(date_mod_SOURCES): Likewise.
|
||||
(date_mod_CFLAGS): Likewise.
|
||||
(date_mod_LDFLAGS): Likewise.
|
||||
(datehook_mod_SOURCES): Likewise.
|
||||
(datehook_mod_CFLAGS): Likewise.
|
||||
(datehook_mod_LDFLAGS): Likewise.
|
||||
|
||||
* conf/i386-ieee1275.rmk (pkglib_MODULES): Add datetime.mod, date.mod
|
||||
and datehook.mod.
|
||||
(datetime_mod_SOURCES): New macro.
|
||||
(datetime_mod_CFLAGS): Likewise.
|
||||
(datetime_mod_LDFLAGS): Likewise.
|
||||
(date_mod_SOURCES): Likewise.
|
||||
(date_mod_CFLAGS): Likewise.
|
||||
(date_mod_LDFLAGS): Likewise.
|
||||
(datehook_mod_SOURCES): Likewise.
|
||||
(datehook_mod_CFLAGS): Likewise.
|
||||
(datehook_mod_LDFLAGS): Likewise.
|
||||
|
||||
* conf/i386-efi.rmk (pkglib_MODULES): Add datetime.mod, date.mod
|
||||
and datehook.mod.
|
||||
(datetime_mod_SOURCES): New macro.
|
||||
(datetime_mod_CFLAGS): Likewise.
|
||||
(datetime_mod_LDFLAGS): Likewise.
|
||||
(date_mod_SOURCES): Likewise.
|
||||
(date_mod_CFLAGS): Likewise.
|
||||
(date_mod_LDFLAGS): Likewise.
|
||||
(datehook_mod_SOURCES): Likewise.
|
||||
(datehook_mod_CFLAGS): Likewise.
|
||||
(datehook_mod_LDFLAGS): Likewise.
|
||||
|
||||
* conf/x86_64-efi.rmk (pkglib_MODULES): Add datetime.mod, date.mod
|
||||
and datehook.mod.
|
||||
(datetime_mod_SOURCES): New macro.
|
||||
(datetime_mod_CFLAGS): Likewise.
|
||||
(datetime_mod_LDFLAGS): Likewise.
|
||||
(date_mod_SOURCES): Likewise.
|
||||
(date_mod_CFLAGS): Likewise.
|
||||
(date_mod_LDFLAGS): Likewise.
|
||||
(datehook_mod_SOURCES): Likewise.
|
||||
(datehook_mod_CFLAGS): Likewise.
|
||||
(datehook_mod_LDFLAGS): Likewise.
|
||||
|
||||
* kern/env.c (grub_env_insert): Fix a bug in prevp pointer.
|
||||
|
||||
* commands/date.c: New file.
|
||||
|
||||
* hook/datehook.c: Likewise.
|
||||
|
||||
* include/grub/lib/datetime.h: Likewise.
|
||||
|
||||
* include/grub/i386/cmos.h: Likewise.
|
||||
|
||||
* lib/datetime.c: Likewise.
|
||||
|
||||
* lib/i386/datetime.c: Likewise.
|
||||
|
||||
* lib/efi/datetime.c: Likewise.
|
||||
|
||||
2008-08-14 Robert Millan <rmh@aybabtu.com>
|
||||
|
||||
* conf/common.rmk (bin_UTILITIES): Add `grub-mkelfimage'.
|
||||
|
|
145
commands/date.c
Normal file
145
commands/date.c
Normal file
|
@ -0,0 +1,145 @@
|
|||
/* date.c - command to display/set current datetime. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/normal.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/arg.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/lib/datetime.h>
|
||||
|
||||
#define GRUB_DATETIME_SET_YEAR 1
|
||||
#define GRUB_DATETIME_SET_MONTH 2
|
||||
#define GRUB_DATETIME_SET_DAY 4
|
||||
#define GRUB_DATETIME_SET_HOUR 8
|
||||
#define GRUB_DATETIME_SET_MINUTE 16
|
||||
#define GRUB_DATETIME_SET_SECOND 32
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_date (struct grub_arg_list *state __attribute__ ((unused)),
|
||||
int argc, char **args)
|
||||
{
|
||||
struct grub_datetime datetime;
|
||||
int limit[6][2] = {{1980, 2079}, {1, 12}, {1, 31}, {0, 23}, {0, 59}, {0, 59}};
|
||||
int value[6], mask;
|
||||
|
||||
if (argc == 0)
|
||||
{
|
||||
if (grub_get_datetime (&datetime))
|
||||
return grub_errno;
|
||||
|
||||
grub_printf ("%d-%02d-%02d %02d:%02d:%02d %s\n",
|
||||
datetime.year, datetime.month, datetime.day,
|
||||
datetime.hour, datetime.minute, datetime.second,
|
||||
grub_get_weekday_name (&datetime));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
grub_memset (&value, 0, sizeof (value));
|
||||
mask = 0;
|
||||
|
||||
for (; argc; argc--, args++)
|
||||
{
|
||||
char *p, c;
|
||||
int m1, ofs, n, cur_mask;
|
||||
|
||||
p = args[0];
|
||||
m1 = grub_strtoul (p, &p, 10);
|
||||
|
||||
c = *p;
|
||||
if (c == '-')
|
||||
ofs = 0;
|
||||
else if (c == ':')
|
||||
ofs = 3;
|
||||
else
|
||||
goto fail;
|
||||
|
||||
value[ofs] = m1;
|
||||
cur_mask = (1 << ofs);
|
||||
mask &= ~(cur_mask * (1 + 2 + 4));
|
||||
|
||||
for (n = 1; (n < 3) && (*p); n++)
|
||||
{
|
||||
if (*p != c)
|
||||
goto fail;
|
||||
|
||||
value[ofs + n] = grub_strtoul (p + 1, &p, 10);
|
||||
cur_mask |= (1 << (ofs + n));
|
||||
}
|
||||
|
||||
if (*p)
|
||||
goto fail;
|
||||
|
||||
if ((ofs == 0) && (n == 2))
|
||||
{
|
||||
value[ofs + 2] = value[ofs + 1];
|
||||
value[ofs + 1] = value[ofs];
|
||||
ofs++;
|
||||
cur_mask <<= 1;
|
||||
}
|
||||
|
||||
for (; n; n--, ofs++)
|
||||
if ((value [ofs] < limit[ofs][0]) ||
|
||||
(value [ofs] > limit[ofs][1]))
|
||||
goto fail;
|
||||
|
||||
mask |= cur_mask;
|
||||
}
|
||||
|
||||
if (grub_get_datetime (&datetime))
|
||||
return grub_errno;
|
||||
|
||||
if (mask & GRUB_DATETIME_SET_YEAR)
|
||||
datetime.year = value[0];
|
||||
|
||||
if (mask & GRUB_DATETIME_SET_MONTH)
|
||||
datetime.month = value[1];
|
||||
|
||||
if (mask & GRUB_DATETIME_SET_DAY)
|
||||
datetime.day = value[2];
|
||||
|
||||
if (mask & GRUB_DATETIME_SET_HOUR)
|
||||
datetime.hour = value[3];
|
||||
|
||||
if (mask & GRUB_DATETIME_SET_MINUTE)
|
||||
datetime.minute = value[4];
|
||||
|
||||
if (mask & GRUB_DATETIME_SET_SECOND)
|
||||
datetime.second = value[5];
|
||||
|
||||
return grub_set_datetime (&datetime);
|
||||
|
||||
fail:
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid datetime");
|
||||
}
|
||||
|
||||
GRUB_MOD_INIT(date)
|
||||
{
|
||||
(void) mod; /* To stop warning. */
|
||||
grub_register_command ("date", grub_cmd_date,
|
||||
GRUB_COMMAND_FLAG_BOTH,
|
||||
"date [[year-]month-day] [hour:minute[:second]]",
|
||||
"Command to display/set current datetime.", 0);
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(date)
|
||||
{
|
||||
grub_unregister_command ("date");
|
||||
}
|
|
@ -1,6 +1,30 @@
|
|||
# -*- makefile -*-
|
||||
# Generated by genmk.rb, please don't edit!
|
||||
|
||||
# For grub-mkelfimage.
|
||||
bin_UTILITIES += grub-mkelfimage
|
||||
grub_mkelfimage_SOURCES = util/elf/grub-mkimage.c util/misc.c \
|
||||
util/resolve.c
|
||||
CLEANFILES += grub-mkelfimage$(EXEEXT) grub_mkelfimage-util_elf_grub_mkimage.o grub_mkelfimage-util_misc.o grub_mkelfimage-util_resolve.o
|
||||
MOSTLYCLEANFILES += grub_mkelfimage-util_elf_grub_mkimage.d grub_mkelfimage-util_misc.d grub_mkelfimage-util_resolve.d
|
||||
|
||||
grub-mkelfimage: $(grub_mkelfimage_DEPENDENCIES) grub_mkelfimage-util_elf_grub_mkimage.o grub_mkelfimage-util_misc.o grub_mkelfimage-util_resolve.o
|
||||
$(CC) -o $@ grub_mkelfimage-util_elf_grub_mkimage.o grub_mkelfimage-util_misc.o grub_mkelfimage-util_resolve.o $(LDFLAGS) $(grub_mkelfimage_LDFLAGS)
|
||||
|
||||
grub_mkelfimage-util_elf_grub_mkimage.o: util/elf/grub-mkimage.c $(util/elf/grub-mkimage.c_DEPENDENCIES)
|
||||
$(CC) -Iutil/elf -I$(srcdir)/util/elf $(CPPFLAGS) $(CFLAGS) -DGRUB_UTIL=1 $(grub_mkelfimage_CFLAGS) -MD -c -o $@ $<
|
||||
-include grub_mkelfimage-util_elf_grub_mkimage.d
|
||||
|
||||
grub_mkelfimage-util_misc.o: util/misc.c $(util/misc.c_DEPENDENCIES)
|
||||
$(CC) -Iutil -I$(srcdir)/util $(CPPFLAGS) $(CFLAGS) -DGRUB_UTIL=1 $(grub_mkelfimage_CFLAGS) -MD -c -o $@ $<
|
||||
-include grub_mkelfimage-util_misc.d
|
||||
|
||||
grub_mkelfimage-util_resolve.o: util/resolve.c $(util/resolve.c_DEPENDENCIES)
|
||||
$(CC) -Iutil -I$(srcdir)/util $(CPPFLAGS) $(CFLAGS) -DGRUB_UTIL=1 $(grub_mkelfimage_CFLAGS) -MD -c -o $@ $<
|
||||
-include grub_mkelfimage-util_resolve.d
|
||||
|
||||
util/elf/grub-mkimage.c_DEPENDENCIES = Makefile
|
||||
|
||||
# For grub-probe.
|
||||
sbin_UTILITIES += grub-probe
|
||||
util/grub-probe.c_DEPENDENCIES = grub_probe_init.h
|
||||
|
|
|
@ -164,36 +164,11 @@ kernel_syms.lst: $(addprefix include/grub/,$(kernel_elf_HEADERS)) config.h genke
|
|||
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
||||
|
||||
# Utilities.
|
||||
bin_UTILITIES = grub-mkimage
|
||||
sbin_UTILITIES = grub-mkdevicemap
|
||||
ifeq ($(enable_grub_emu), yes)
|
||||
sbin_UTILITIES += grub-emu
|
||||
endif
|
||||
|
||||
# For grub-mkimage.
|
||||
grub_mkimage_SOURCES = util/elf/grub-mkimage.c util/misc.c \
|
||||
util/resolve.c
|
||||
CLEANFILES += grub-mkimage$(EXEEXT) grub_mkimage-util_elf_grub_mkimage.o grub_mkimage-util_misc.o grub_mkimage-util_resolve.o
|
||||
MOSTLYCLEANFILES += grub_mkimage-util_elf_grub_mkimage.d grub_mkimage-util_misc.d grub_mkimage-util_resolve.d
|
||||
|
||||
grub-mkimage: $(grub_mkimage_DEPENDENCIES) grub_mkimage-util_elf_grub_mkimage.o grub_mkimage-util_misc.o grub_mkimage-util_resolve.o
|
||||
$(CC) -o $@ grub_mkimage-util_elf_grub_mkimage.o grub_mkimage-util_misc.o grub_mkimage-util_resolve.o $(LDFLAGS) $(grub_mkimage_LDFLAGS)
|
||||
|
||||
grub_mkimage-util_elf_grub_mkimage.o: util/elf/grub-mkimage.c $(util/elf/grub-mkimage.c_DEPENDENCIES)
|
||||
$(CC) -Iutil/elf -I$(srcdir)/util/elf $(CPPFLAGS) $(CFLAGS) -DGRUB_UTIL=1 $(grub_mkimage_CFLAGS) -MD -c -o $@ $<
|
||||
-include grub_mkimage-util_elf_grub_mkimage.d
|
||||
|
||||
grub_mkimage-util_misc.o: util/misc.c $(util/misc.c_DEPENDENCIES)
|
||||
$(CC) -Iutil -I$(srcdir)/util $(CPPFLAGS) $(CFLAGS) -DGRUB_UTIL=1 $(grub_mkimage_CFLAGS) -MD -c -o $@ $<
|
||||
-include grub_mkimage-util_misc.d
|
||||
|
||||
grub_mkimage-util_resolve.o: util/resolve.c $(util/resolve.c_DEPENDENCIES)
|
||||
$(CC) -Iutil -I$(srcdir)/util $(CPPFLAGS) $(CFLAGS) -DGRUB_UTIL=1 $(grub_mkimage_CFLAGS) -MD -c -o $@ $<
|
||||
-include grub_mkimage-util_resolve.d
|
||||
|
||||
grub_mkimage_LDFLAGS = $(LIBLZO)
|
||||
util/elf/grub-mkimage.c_DEPENDENCIES = Makefile
|
||||
|
||||
# For grub-mkdevicemap.
|
||||
grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/misc.c \
|
||||
util/i386/get_disk_name.c
|
||||
|
@ -583,7 +558,7 @@ pkglib_MODULES = _linux.mod linux.mod normal.mod \
|
|||
_multiboot.mod multiboot.mod aout.mod \
|
||||
play.mod cpuid.mod serial.mod ata.mod \
|
||||
memdisk.mod pci.mod lspci.mod reboot.mod \
|
||||
halt.mod
|
||||
halt.mod datetime.mod date.mod datehook.mod
|
||||
|
||||
# For _linux.mod.
|
||||
_linux_mod_SOURCES = loader/i386/pc/linux.c
|
||||
|
@ -1809,4 +1784,194 @@ partmap-lspci_mod-commands_lspci.lst: commands/lspci.c $(commands/lspci.c_DEPEND
|
|||
lspci_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For datetime.mod
|
||||
datetime_mod_SOURCES = lib/datetime.c lib/i386/datetime.c
|
||||
CLEANFILES += datetime.mod mod-datetime.o mod-datetime.c pre-datetime.o datetime_mod-lib_datetime.o datetime_mod-lib_i386_datetime.o und-datetime.lst
|
||||
ifneq ($(datetime_mod_EXPORTS),no)
|
||||
CLEANFILES += def-datetime.lst
|
||||
DEFSYMFILES += def-datetime.lst
|
||||
endif
|
||||
MOSTLYCLEANFILES += datetime_mod-lib_datetime.d datetime_mod-lib_i386_datetime.d
|
||||
UNDSYMFILES += und-datetime.lst
|
||||
|
||||
datetime.mod: pre-datetime.o mod-datetime.o $(TARGET_OBJ2ELF)
|
||||
-rm -f $@
|
||||
$(TARGET_CC) $(datetime_mod_LDFLAGS) $(TARGET_LDFLAGS) $(MODULE_LDFLAGS) -Wl,-r,-d -o $@ pre-datetime.o mod-datetime.o
|
||||
if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-datetime.o: $(datetime_mod_DEPENDENCIES) datetime_mod-lib_datetime.o datetime_mod-lib_i386_datetime.o
|
||||
-rm -f $@
|
||||
$(TARGET_CC) $(datetime_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ datetime_mod-lib_datetime.o datetime_mod-lib_i386_datetime.o
|
||||
|
||||
mod-datetime.o: mod-datetime.c
|
||||
$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datetime_mod_CFLAGS) -c -o $@ $<
|
||||
|
||||
mod-datetime.c: moddep.lst genmodsrc.sh
|
||||
sh $(srcdir)/genmodsrc.sh 'datetime' $< > $@ || (rm -f $@; exit 1)
|
||||
|
||||
ifneq ($(datetime_mod_EXPORTS),no)
|
||||
def-datetime.lst: pre-datetime.o
|
||||
$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 datetime/' > $@
|
||||
endif
|
||||
|
||||
und-datetime.lst: pre-datetime.o
|
||||
echo 'datetime' > $@
|
||||
$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
|
||||
|
||||
datetime_mod-lib_datetime.o: lib/datetime.c $(lib/datetime.c_DEPENDENCIES)
|
||||
$(TARGET_CC) -Ilib -I$(srcdir)/lib $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datetime_mod_CFLAGS) -MD -c -o $@ $<
|
||||
-include datetime_mod-lib_datetime.d
|
||||
|
||||
CLEANFILES += cmd-datetime_mod-lib_datetime.lst fs-datetime_mod-lib_datetime.lst partmap-datetime_mod-lib_datetime.lst
|
||||
COMMANDFILES += cmd-datetime_mod-lib_datetime.lst
|
||||
FSFILES += fs-datetime_mod-lib_datetime.lst
|
||||
PARTMAPFILES += partmap-datetime_mod-lib_datetime.lst
|
||||
|
||||
cmd-datetime_mod-lib_datetime.lst: lib/datetime.c $(lib/datetime.c_DEPENDENCIES) gencmdlist.sh
|
||||
set -e; $(TARGET_CC) -Ilib -I$(srcdir)/lib $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datetime_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh datetime > $@ || (rm -f $@; exit 1)
|
||||
|
||||
fs-datetime_mod-lib_datetime.lst: lib/datetime.c $(lib/datetime.c_DEPENDENCIES) genfslist.sh
|
||||
set -e; $(TARGET_CC) -Ilib -I$(srcdir)/lib $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datetime_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh datetime > $@ || (rm -f $@; exit 1)
|
||||
|
||||
partmap-datetime_mod-lib_datetime.lst: lib/datetime.c $(lib/datetime.c_DEPENDENCIES) genpartmaplist.sh
|
||||
set -e; $(TARGET_CC) -Ilib -I$(srcdir)/lib $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datetime_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh datetime > $@ || (rm -f $@; exit 1)
|
||||
|
||||
|
||||
datetime_mod-lib_i386_datetime.o: lib/i386/datetime.c $(lib/i386/datetime.c_DEPENDENCIES)
|
||||
$(TARGET_CC) -Ilib/i386 -I$(srcdir)/lib/i386 $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datetime_mod_CFLAGS) -MD -c -o $@ $<
|
||||
-include datetime_mod-lib_i386_datetime.d
|
||||
|
||||
CLEANFILES += cmd-datetime_mod-lib_i386_datetime.lst fs-datetime_mod-lib_i386_datetime.lst partmap-datetime_mod-lib_i386_datetime.lst
|
||||
COMMANDFILES += cmd-datetime_mod-lib_i386_datetime.lst
|
||||
FSFILES += fs-datetime_mod-lib_i386_datetime.lst
|
||||
PARTMAPFILES += partmap-datetime_mod-lib_i386_datetime.lst
|
||||
|
||||
cmd-datetime_mod-lib_i386_datetime.lst: lib/i386/datetime.c $(lib/i386/datetime.c_DEPENDENCIES) gencmdlist.sh
|
||||
set -e; $(TARGET_CC) -Ilib/i386 -I$(srcdir)/lib/i386 $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datetime_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh datetime > $@ || (rm -f $@; exit 1)
|
||||
|
||||
fs-datetime_mod-lib_i386_datetime.lst: lib/i386/datetime.c $(lib/i386/datetime.c_DEPENDENCIES) genfslist.sh
|
||||
set -e; $(TARGET_CC) -Ilib/i386 -I$(srcdir)/lib/i386 $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datetime_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh datetime > $@ || (rm -f $@; exit 1)
|
||||
|
||||
partmap-datetime_mod-lib_i386_datetime.lst: lib/i386/datetime.c $(lib/i386/datetime.c_DEPENDENCIES) genpartmaplist.sh
|
||||
set -e; $(TARGET_CC) -Ilib/i386 -I$(srcdir)/lib/i386 $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datetime_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh datetime > $@ || (rm -f $@; exit 1)
|
||||
|
||||
|
||||
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For date.mod
|
||||
date_mod_SOURCES = commands/date.c
|
||||
CLEANFILES += date.mod mod-date.o mod-date.c pre-date.o date_mod-commands_date.o und-date.lst
|
||||
ifneq ($(date_mod_EXPORTS),no)
|
||||
CLEANFILES += def-date.lst
|
||||
DEFSYMFILES += def-date.lst
|
||||
endif
|
||||
MOSTLYCLEANFILES += date_mod-commands_date.d
|
||||
UNDSYMFILES += und-date.lst
|
||||
|
||||
date.mod: pre-date.o mod-date.o $(TARGET_OBJ2ELF)
|
||||
-rm -f $@
|
||||
$(TARGET_CC) $(date_mod_LDFLAGS) $(TARGET_LDFLAGS) $(MODULE_LDFLAGS) -Wl,-r,-d -o $@ pre-date.o mod-date.o
|
||||
if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-date.o: $(date_mod_DEPENDENCIES) date_mod-commands_date.o
|
||||
-rm -f $@
|
||||
$(TARGET_CC) $(date_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ date_mod-commands_date.o
|
||||
|
||||
mod-date.o: mod-date.c
|
||||
$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(date_mod_CFLAGS) -c -o $@ $<
|
||||
|
||||
mod-date.c: moddep.lst genmodsrc.sh
|
||||
sh $(srcdir)/genmodsrc.sh 'date' $< > $@ || (rm -f $@; exit 1)
|
||||
|
||||
ifneq ($(date_mod_EXPORTS),no)
|
||||
def-date.lst: pre-date.o
|
||||
$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 date/' > $@
|
||||
endif
|
||||
|
||||
und-date.lst: pre-date.o
|
||||
echo 'date' > $@
|
||||
$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
|
||||
|
||||
date_mod-commands_date.o: commands/date.c $(commands/date.c_DEPENDENCIES)
|
||||
$(TARGET_CC) -Icommands -I$(srcdir)/commands $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(date_mod_CFLAGS) -MD -c -o $@ $<
|
||||
-include date_mod-commands_date.d
|
||||
|
||||
CLEANFILES += cmd-date_mod-commands_date.lst fs-date_mod-commands_date.lst partmap-date_mod-commands_date.lst
|
||||
COMMANDFILES += cmd-date_mod-commands_date.lst
|
||||
FSFILES += fs-date_mod-commands_date.lst
|
||||
PARTMAPFILES += partmap-date_mod-commands_date.lst
|
||||
|
||||
cmd-date_mod-commands_date.lst: commands/date.c $(commands/date.c_DEPENDENCIES) gencmdlist.sh
|
||||
set -e; $(TARGET_CC) -Icommands -I$(srcdir)/commands $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(date_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh date > $@ || (rm -f $@; exit 1)
|
||||
|
||||
fs-date_mod-commands_date.lst: commands/date.c $(commands/date.c_DEPENDENCIES) genfslist.sh
|
||||
set -e; $(TARGET_CC) -Icommands -I$(srcdir)/commands $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(date_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh date > $@ || (rm -f $@; exit 1)
|
||||
|
||||
partmap-date_mod-commands_date.lst: commands/date.c $(commands/date.c_DEPENDENCIES) genpartmaplist.sh
|
||||
set -e; $(TARGET_CC) -Icommands -I$(srcdir)/commands $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(date_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh date > $@ || (rm -f $@; exit 1)
|
||||
|
||||
|
||||
date_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
date_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For datehook.mod
|
||||
datehook_mod_SOURCES = hook/datehook.c
|
||||
CLEANFILES += datehook.mod mod-datehook.o mod-datehook.c pre-datehook.o datehook_mod-hook_datehook.o und-datehook.lst
|
||||
ifneq ($(datehook_mod_EXPORTS),no)
|
||||
CLEANFILES += def-datehook.lst
|
||||
DEFSYMFILES += def-datehook.lst
|
||||
endif
|
||||
MOSTLYCLEANFILES += datehook_mod-hook_datehook.d
|
||||
UNDSYMFILES += und-datehook.lst
|
||||
|
||||
datehook.mod: pre-datehook.o mod-datehook.o $(TARGET_OBJ2ELF)
|
||||
-rm -f $@
|
||||
$(TARGET_CC) $(datehook_mod_LDFLAGS) $(TARGET_LDFLAGS) $(MODULE_LDFLAGS) -Wl,-r,-d -o $@ pre-datehook.o mod-datehook.o
|
||||
if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-datehook.o: $(datehook_mod_DEPENDENCIES) datehook_mod-hook_datehook.o
|
||||
-rm -f $@
|
||||
$(TARGET_CC) $(datehook_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ datehook_mod-hook_datehook.o
|
||||
|
||||
mod-datehook.o: mod-datehook.c
|
||||
$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datehook_mod_CFLAGS) -c -o $@ $<
|
||||
|
||||
mod-datehook.c: moddep.lst genmodsrc.sh
|
||||
sh $(srcdir)/genmodsrc.sh 'datehook' $< > $@ || (rm -f $@; exit 1)
|
||||
|
||||
ifneq ($(datehook_mod_EXPORTS),no)
|
||||
def-datehook.lst: pre-datehook.o
|
||||
$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 datehook/' > $@
|
||||
endif
|
||||
|
||||
und-datehook.lst: pre-datehook.o
|
||||
echo 'datehook' > $@
|
||||
$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
|
||||
|
||||
datehook_mod-hook_datehook.o: hook/datehook.c $(hook/datehook.c_DEPENDENCIES)
|
||||
$(TARGET_CC) -Ihook -I$(srcdir)/hook $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datehook_mod_CFLAGS) -MD -c -o $@ $<
|
||||
-include datehook_mod-hook_datehook.d
|
||||
|
||||
CLEANFILES += cmd-datehook_mod-hook_datehook.lst fs-datehook_mod-hook_datehook.lst partmap-datehook_mod-hook_datehook.lst
|
||||
COMMANDFILES += cmd-datehook_mod-hook_datehook.lst
|
||||
FSFILES += fs-datehook_mod-hook_datehook.lst
|
||||
PARTMAPFILES += partmap-datehook_mod-hook_datehook.lst
|
||||
|
||||
cmd-datehook_mod-hook_datehook.lst: hook/datehook.c $(hook/datehook.c_DEPENDENCIES) gencmdlist.sh
|
||||
set -e; $(TARGET_CC) -Ihook -I$(srcdir)/hook $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datehook_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh datehook > $@ || (rm -f $@; exit 1)
|
||||
|
||||
fs-datehook_mod-hook_datehook.lst: hook/datehook.c $(hook/datehook.c_DEPENDENCIES) genfslist.sh
|
||||
set -e; $(TARGET_CC) -Ihook -I$(srcdir)/hook $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datehook_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh datehook > $@ || (rm -f $@; exit 1)
|
||||
|
||||
partmap-datehook_mod-hook_datehook.lst: hook/datehook.c $(hook/datehook.c_DEPENDENCIES) genpartmaplist.sh
|
||||
set -e; $(TARGET_CC) -Ihook -I$(srcdir)/hook $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datehook_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh datehook > $@ || (rm -f $@; exit 1)
|
||||
|
||||
|
||||
datehook_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
datehook_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
include $(srcdir)/conf/common.mk
|
||||
|
|
|
@ -95,7 +95,7 @@ pkglib_MODULES = _linux.mod linux.mod normal.mod \
|
|||
_multiboot.mod multiboot.mod aout.mod \
|
||||
play.mod cpuid.mod serial.mod ata.mod \
|
||||
memdisk.mod pci.mod lspci.mod reboot.mod \
|
||||
halt.mod
|
||||
halt.mod datetime.mod date.mod datehook.mod
|
||||
|
||||
# For _linux.mod.
|
||||
_linux_mod_SOURCES = loader/i386/pc/linux.c
|
||||
|
@ -180,4 +180,19 @@ lspci_mod_SOURCES = commands/lspci.c
|
|||
lspci_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For datetime.mod
|
||||
datetime_mod_SOURCES = lib/datetime.c lib/i386/datetime.c
|
||||
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For date.mod
|
||||
date_mod_SOURCES = commands/date.c
|
||||
date_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
date_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For datehook.mod
|
||||
datehook_mod_SOURCES = hook/datehook.c
|
||||
datehook_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
datehook_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
include $(srcdir)/conf/common.mk
|
||||
|
|
193
conf/i386-efi.mk
193
conf/i386-efi.mk
|
@ -118,7 +118,8 @@ grub-install: util/i386/efi/grub-install.in $(util/i386/efi/grub-install.in_DEPE
|
|||
|
||||
# Modules.
|
||||
pkglib_MODULES = kernel.mod normal.mod _chain.mod chain.mod appleldr.mod \
|
||||
_linux.mod linux.mod cpuid.mod halt.mod reboot.mod pci.mod lspci.mod
|
||||
_linux.mod linux.mod cpuid.mod halt.mod reboot.mod pci.mod lspci.mod \
|
||||
datetime.mod date.mod datehook.mod
|
||||
|
||||
# For kernel.mod.
|
||||
kernel_mod_EXPORTS = no
|
||||
|
@ -1632,4 +1633,194 @@ partmap-lspci_mod-commands_lspci.lst: commands/lspci.c $(commands/lspci.c_DEPEND
|
|||
lspci_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For datetime.mod
|
||||
datetime_mod_SOURCES = lib/datetime.c lib/efi/datetime.c
|
||||
CLEANFILES += datetime.mod mod-datetime.o mod-datetime.c pre-datetime.o datetime_mod-lib_datetime.o datetime_mod-lib_efi_datetime.o und-datetime.lst
|
||||
ifneq ($(datetime_mod_EXPORTS),no)
|
||||
CLEANFILES += def-datetime.lst
|
||||
DEFSYMFILES += def-datetime.lst
|
||||
endif
|
||||
MOSTLYCLEANFILES += datetime_mod-lib_datetime.d datetime_mod-lib_efi_datetime.d
|
||||
UNDSYMFILES += und-datetime.lst
|
||||
|
||||
datetime.mod: pre-datetime.o mod-datetime.o $(TARGET_OBJ2ELF)
|
||||
-rm -f $@
|
||||
$(TARGET_CC) $(datetime_mod_LDFLAGS) $(TARGET_LDFLAGS) $(MODULE_LDFLAGS) -Wl,-r,-d -o $@ pre-datetime.o mod-datetime.o
|
||||
if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-datetime.o: $(datetime_mod_DEPENDENCIES) datetime_mod-lib_datetime.o datetime_mod-lib_efi_datetime.o
|
||||
-rm -f $@
|
||||
$(TARGET_CC) $(datetime_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ datetime_mod-lib_datetime.o datetime_mod-lib_efi_datetime.o
|
||||
|
||||
mod-datetime.o: mod-datetime.c
|
||||
$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datetime_mod_CFLAGS) -c -o $@ $<
|
||||
|
||||
mod-datetime.c: moddep.lst genmodsrc.sh
|
||||
sh $(srcdir)/genmodsrc.sh 'datetime' $< > $@ || (rm -f $@; exit 1)
|
||||
|
||||
ifneq ($(datetime_mod_EXPORTS),no)
|
||||
def-datetime.lst: pre-datetime.o
|
||||
$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 datetime/' > $@
|
||||
endif
|
||||
|
||||
und-datetime.lst: pre-datetime.o
|
||||
echo 'datetime' > $@
|
||||
$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
|
||||
|
||||
datetime_mod-lib_datetime.o: lib/datetime.c $(lib/datetime.c_DEPENDENCIES)
|
||||
$(TARGET_CC) -Ilib -I$(srcdir)/lib $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datetime_mod_CFLAGS) -MD -c -o $@ $<
|
||||
-include datetime_mod-lib_datetime.d
|
||||
|
||||
CLEANFILES += cmd-datetime_mod-lib_datetime.lst fs-datetime_mod-lib_datetime.lst partmap-datetime_mod-lib_datetime.lst
|
||||
COMMANDFILES += cmd-datetime_mod-lib_datetime.lst
|
||||
FSFILES += fs-datetime_mod-lib_datetime.lst
|
||||
PARTMAPFILES += partmap-datetime_mod-lib_datetime.lst
|
||||
|
||||
cmd-datetime_mod-lib_datetime.lst: lib/datetime.c $(lib/datetime.c_DEPENDENCIES) gencmdlist.sh
|
||||
set -e; $(TARGET_CC) -Ilib -I$(srcdir)/lib $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datetime_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh datetime > $@ || (rm -f $@; exit 1)
|
||||
|
||||
fs-datetime_mod-lib_datetime.lst: lib/datetime.c $(lib/datetime.c_DEPENDENCIES) genfslist.sh
|
||||
set -e; $(TARGET_CC) -Ilib -I$(srcdir)/lib $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datetime_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh datetime > $@ || (rm -f $@; exit 1)
|
||||
|
||||
partmap-datetime_mod-lib_datetime.lst: lib/datetime.c $(lib/datetime.c_DEPENDENCIES) genpartmaplist.sh
|
||||
set -e; $(TARGET_CC) -Ilib -I$(srcdir)/lib $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datetime_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh datetime > $@ || (rm -f $@; exit 1)
|
||||
|
||||
|
||||
datetime_mod-lib_efi_datetime.o: lib/efi/datetime.c $(lib/efi/datetime.c_DEPENDENCIES)
|
||||
$(TARGET_CC) -Ilib/efi -I$(srcdir)/lib/efi $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datetime_mod_CFLAGS) -MD -c -o $@ $<
|
||||
-include datetime_mod-lib_efi_datetime.d
|
||||
|
||||
CLEANFILES += cmd-datetime_mod-lib_efi_datetime.lst fs-datetime_mod-lib_efi_datetime.lst partmap-datetime_mod-lib_efi_datetime.lst
|
||||
COMMANDFILES += cmd-datetime_mod-lib_efi_datetime.lst
|
||||
FSFILES += fs-datetime_mod-lib_efi_datetime.lst
|
||||
PARTMAPFILES += partmap-datetime_mod-lib_efi_datetime.lst
|
||||
|
||||
cmd-datetime_mod-lib_efi_datetime.lst: lib/efi/datetime.c $(lib/efi/datetime.c_DEPENDENCIES) gencmdlist.sh
|
||||
set -e; $(TARGET_CC) -Ilib/efi -I$(srcdir)/lib/efi $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datetime_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh datetime > $@ || (rm -f $@; exit 1)
|
||||
|
||||
fs-datetime_mod-lib_efi_datetime.lst: lib/efi/datetime.c $(lib/efi/datetime.c_DEPENDENCIES) genfslist.sh
|
||||
set -e; $(TARGET_CC) -Ilib/efi -I$(srcdir)/lib/efi $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datetime_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh datetime > $@ || (rm -f $@; exit 1)
|
||||
|
||||
partmap-datetime_mod-lib_efi_datetime.lst: lib/efi/datetime.c $(lib/efi/datetime.c_DEPENDENCIES) genpartmaplist.sh
|
||||
set -e; $(TARGET_CC) -Ilib/efi -I$(srcdir)/lib/efi $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datetime_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh datetime > $@ || (rm -f $@; exit 1)
|
||||
|
||||
|
||||
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For date.mod
|
||||
date_mod_SOURCES = commands/date.c
|
||||
CLEANFILES += date.mod mod-date.o mod-date.c pre-date.o date_mod-commands_date.o und-date.lst
|
||||
ifneq ($(date_mod_EXPORTS),no)
|
||||
CLEANFILES += def-date.lst
|
||||
DEFSYMFILES += def-date.lst
|
||||
endif
|
||||
MOSTLYCLEANFILES += date_mod-commands_date.d
|
||||
UNDSYMFILES += und-date.lst
|
||||
|
||||
date.mod: pre-date.o mod-date.o $(TARGET_OBJ2ELF)
|
||||
-rm -f $@
|
||||
$(TARGET_CC) $(date_mod_LDFLAGS) $(TARGET_LDFLAGS) $(MODULE_LDFLAGS) -Wl,-r,-d -o $@ pre-date.o mod-date.o
|
||||
if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-date.o: $(date_mod_DEPENDENCIES) date_mod-commands_date.o
|
||||
-rm -f $@
|
||||
$(TARGET_CC) $(date_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ date_mod-commands_date.o
|
||||
|
||||
mod-date.o: mod-date.c
|
||||
$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(date_mod_CFLAGS) -c -o $@ $<
|
||||
|
||||
mod-date.c: moddep.lst genmodsrc.sh
|
||||
sh $(srcdir)/genmodsrc.sh 'date' $< > $@ || (rm -f $@; exit 1)
|
||||
|
||||
ifneq ($(date_mod_EXPORTS),no)
|
||||
def-date.lst: pre-date.o
|
||||
$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 date/' > $@
|
||||
endif
|
||||
|
||||
und-date.lst: pre-date.o
|
||||
echo 'date' > $@
|
||||
$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
|
||||
|
||||
date_mod-commands_date.o: commands/date.c $(commands/date.c_DEPENDENCIES)
|
||||
$(TARGET_CC) -Icommands -I$(srcdir)/commands $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(date_mod_CFLAGS) -MD -c -o $@ $<
|
||||
-include date_mod-commands_date.d
|
||||
|
||||
CLEANFILES += cmd-date_mod-commands_date.lst fs-date_mod-commands_date.lst partmap-date_mod-commands_date.lst
|
||||
COMMANDFILES += cmd-date_mod-commands_date.lst
|
||||
FSFILES += fs-date_mod-commands_date.lst
|
||||
PARTMAPFILES += partmap-date_mod-commands_date.lst
|
||||
|
||||
cmd-date_mod-commands_date.lst: commands/date.c $(commands/date.c_DEPENDENCIES) gencmdlist.sh
|
||||
set -e; $(TARGET_CC) -Icommands -I$(srcdir)/commands $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(date_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh date > $@ || (rm -f $@; exit 1)
|
||||
|
||||
fs-date_mod-commands_date.lst: commands/date.c $(commands/date.c_DEPENDENCIES) genfslist.sh
|
||||
set -e; $(TARGET_CC) -Icommands -I$(srcdir)/commands $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(date_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh date > $@ || (rm -f $@; exit 1)
|
||||
|
||||
partmap-date_mod-commands_date.lst: commands/date.c $(commands/date.c_DEPENDENCIES) genpartmaplist.sh
|
||||
set -e; $(TARGET_CC) -Icommands -I$(srcdir)/commands $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(date_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh date > $@ || (rm -f $@; exit 1)
|
||||
|
||||
|
||||
date_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
date_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For datehook.mod
|
||||
datehook_mod_SOURCES = hook/datehook.c
|
||||
CLEANFILES += datehook.mod mod-datehook.o mod-datehook.c pre-datehook.o datehook_mod-hook_datehook.o und-datehook.lst
|
||||
ifneq ($(datehook_mod_EXPORTS),no)
|
||||
CLEANFILES += def-datehook.lst
|
||||
DEFSYMFILES += def-datehook.lst
|
||||
endif
|
||||
MOSTLYCLEANFILES += datehook_mod-hook_datehook.d
|
||||
UNDSYMFILES += und-datehook.lst
|
||||
|
||||
datehook.mod: pre-datehook.o mod-datehook.o $(TARGET_OBJ2ELF)
|
||||
-rm -f $@
|
||||
$(TARGET_CC) $(datehook_mod_LDFLAGS) $(TARGET_LDFLAGS) $(MODULE_LDFLAGS) -Wl,-r,-d -o $@ pre-datehook.o mod-datehook.o
|
||||
if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-datehook.o: $(datehook_mod_DEPENDENCIES) datehook_mod-hook_datehook.o
|
||||
-rm -f $@
|
||||
$(TARGET_CC) $(datehook_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ datehook_mod-hook_datehook.o
|
||||
|
||||
mod-datehook.o: mod-datehook.c
|
||||
$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datehook_mod_CFLAGS) -c -o $@ $<
|
||||
|
||||
mod-datehook.c: moddep.lst genmodsrc.sh
|
||||
sh $(srcdir)/genmodsrc.sh 'datehook' $< > $@ || (rm -f $@; exit 1)
|
||||
|
||||
ifneq ($(datehook_mod_EXPORTS),no)
|
||||
def-datehook.lst: pre-datehook.o
|
||||
$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 datehook/' > $@
|
||||
endif
|
||||
|
||||
und-datehook.lst: pre-datehook.o
|
||||
echo 'datehook' > $@
|
||||
$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
|
||||
|
||||
datehook_mod-hook_datehook.o: hook/datehook.c $(hook/datehook.c_DEPENDENCIES)
|
||||
$(TARGET_CC) -Ihook -I$(srcdir)/hook $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datehook_mod_CFLAGS) -MD -c -o $@ $<
|
||||
-include datehook_mod-hook_datehook.d
|
||||
|
||||
CLEANFILES += cmd-datehook_mod-hook_datehook.lst fs-datehook_mod-hook_datehook.lst partmap-datehook_mod-hook_datehook.lst
|
||||
COMMANDFILES += cmd-datehook_mod-hook_datehook.lst
|
||||
FSFILES += fs-datehook_mod-hook_datehook.lst
|
||||
PARTMAPFILES += partmap-datehook_mod-hook_datehook.lst
|
||||
|
||||
cmd-datehook_mod-hook_datehook.lst: hook/datehook.c $(hook/datehook.c_DEPENDENCIES) gencmdlist.sh
|
||||
set -e; $(TARGET_CC) -Ihook -I$(srcdir)/hook $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datehook_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh datehook > $@ || (rm -f $@; exit 1)
|
||||
|
||||
fs-datehook_mod-hook_datehook.lst: hook/datehook.c $(hook/datehook.c_DEPENDENCIES) genfslist.sh
|
||||
set -e; $(TARGET_CC) -Ihook -I$(srcdir)/hook $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datehook_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh datehook > $@ || (rm -f $@; exit 1)
|
||||
|
||||
partmap-datehook_mod-hook_datehook.lst: hook/datehook.c $(hook/datehook.c_DEPENDENCIES) genpartmaplist.sh
|
||||
set -e; $(TARGET_CC) -Ihook -I$(srcdir)/hook $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datehook_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh datehook > $@ || (rm -f $@; exit 1)
|
||||
|
||||
|
||||
datehook_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
datehook_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
include $(srcdir)/conf/common.mk
|
||||
|
|
|
@ -75,7 +75,8 @@ grub_install_SOURCES = util/i386/efi/grub-install.in
|
|||
|
||||
# Modules.
|
||||
pkglib_MODULES = kernel.mod normal.mod _chain.mod chain.mod appleldr.mod \
|
||||
_linux.mod linux.mod cpuid.mod halt.mod reboot.mod pci.mod lspci.mod
|
||||
_linux.mod linux.mod cpuid.mod halt.mod reboot.mod pci.mod lspci.mod \
|
||||
datetime.mod date.mod datehook.mod
|
||||
|
||||
# For kernel.mod.
|
||||
kernel_mod_EXPORTS = no
|
||||
|
@ -167,4 +168,19 @@ lspci_mod_SOURCES = commands/lspci.c
|
|||
lspci_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For datetime.mod
|
||||
datetime_mod_SOURCES = lib/datetime.c lib/efi/datetime.c
|
||||
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For date.mod
|
||||
date_mod_SOURCES = commands/date.c
|
||||
date_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
date_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For datehook.mod
|
||||
datehook_mod_SOURCES = hook/datehook.c
|
||||
datehook_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
datehook_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
include $(srcdir)/conf/common.mk
|
||||
|
|
|
@ -161,36 +161,11 @@ kernel_syms.lst: $(addprefix include/grub/,$(kernel_elf_HEADERS)) config.h genke
|
|||
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
||||
|
||||
# Utilities.
|
||||
bin_UTILITIES = grub-mkimage
|
||||
sbin_UTILITIES = grub-mkdevicemap
|
||||
ifeq ($(enable_grub_emu), yes)
|
||||
sbin_UTILITIES += grub-emu
|
||||
endif
|
||||
|
||||
# For grub-mkimage.
|
||||
grub_mkimage_SOURCES = util/elf/grub-mkimage.c util/misc.c \
|
||||
util/resolve.c
|
||||
CLEANFILES += grub-mkimage$(EXEEXT) grub_mkimage-util_elf_grub_mkimage.o grub_mkimage-util_misc.o grub_mkimage-util_resolve.o
|
||||
MOSTLYCLEANFILES += grub_mkimage-util_elf_grub_mkimage.d grub_mkimage-util_misc.d grub_mkimage-util_resolve.d
|
||||
|
||||
grub-mkimage: $(grub_mkimage_DEPENDENCIES) grub_mkimage-util_elf_grub_mkimage.o grub_mkimage-util_misc.o grub_mkimage-util_resolve.o
|
||||
$(CC) -o $@ grub_mkimage-util_elf_grub_mkimage.o grub_mkimage-util_misc.o grub_mkimage-util_resolve.o $(LDFLAGS) $(grub_mkimage_LDFLAGS)
|
||||
|
||||
grub_mkimage-util_elf_grub_mkimage.o: util/elf/grub-mkimage.c $(util/elf/grub-mkimage.c_DEPENDENCIES)
|
||||
$(CC) -Iutil/elf -I$(srcdir)/util/elf $(CPPFLAGS) $(CFLAGS) -DGRUB_UTIL=1 $(grub_mkimage_CFLAGS) -MD -c -o $@ $<
|
||||
-include grub_mkimage-util_elf_grub_mkimage.d
|
||||
|
||||
grub_mkimage-util_misc.o: util/misc.c $(util/misc.c_DEPENDENCIES)
|
||||
$(CC) -Iutil -I$(srcdir)/util $(CPPFLAGS) $(CFLAGS) -DGRUB_UTIL=1 $(grub_mkimage_CFLAGS) -MD -c -o $@ $<
|
||||
-include grub_mkimage-util_misc.d
|
||||
|
||||
grub_mkimage-util_resolve.o: util/resolve.c $(util/resolve.c_DEPENDENCIES)
|
||||
$(CC) -Iutil -I$(srcdir)/util $(CPPFLAGS) $(CFLAGS) -DGRUB_UTIL=1 $(grub_mkimage_CFLAGS) -MD -c -o $@ $<
|
||||
-include grub_mkimage-util_resolve.d
|
||||
|
||||
grub_mkimage_LDFLAGS = $(LIBLZO)
|
||||
util/elf/grub-mkimage.c_DEPENDENCIES = Makefile
|
||||
|
||||
# For grub-mkdevicemap.
|
||||
grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/misc.c \
|
||||
util/i386/get_disk_name.c
|
||||
|
@ -599,7 +574,8 @@ grub-install: util/ieee1275/grub-install.in $(util/ieee1275/grub-install.in_DEPE
|
|||
# Modules.
|
||||
pkglib_MODULES = normal.mod halt.mod reboot.mod suspend.mod cpuid.mod \
|
||||
multiboot.mod _multiboot.mod aout.mod serial.mod linux.mod \
|
||||
_linux.mod nand.mod memdisk.mod pci.mod lspci.mod
|
||||
_linux.mod nand.mod memdisk.mod pci.mod lspci.mod datetime.mod \
|
||||
date.mod datehook.mod
|
||||
|
||||
# For normal.mod.
|
||||
normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \
|
||||
|
@ -1767,4 +1743,194 @@ partmap-lspci_mod-commands_lspci.lst: commands/lspci.c $(commands/lspci.c_DEPEND
|
|||
lspci_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For datetime.mod
|
||||
datetime_mod_SOURCES = lib/datetime.c lib/i386/datetime.c
|
||||
CLEANFILES += datetime.mod mod-datetime.o mod-datetime.c pre-datetime.o datetime_mod-lib_datetime.o datetime_mod-lib_i386_datetime.o und-datetime.lst
|
||||
ifneq ($(datetime_mod_EXPORTS),no)
|
||||
CLEANFILES += def-datetime.lst
|
||||
DEFSYMFILES += def-datetime.lst
|
||||
endif
|
||||
MOSTLYCLEANFILES += datetime_mod-lib_datetime.d datetime_mod-lib_i386_datetime.d
|
||||
UNDSYMFILES += und-datetime.lst
|
||||
|
||||
datetime.mod: pre-datetime.o mod-datetime.o $(TARGET_OBJ2ELF)
|
||||
-rm -f $@
|
||||
$(TARGET_CC) $(datetime_mod_LDFLAGS) $(TARGET_LDFLAGS) $(MODULE_LDFLAGS) -Wl,-r,-d -o $@ pre-datetime.o mod-datetime.o
|
||||
if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-datetime.o: $(datetime_mod_DEPENDENCIES) datetime_mod-lib_datetime.o datetime_mod-lib_i386_datetime.o
|
||||
-rm -f $@
|
||||
$(TARGET_CC) $(datetime_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ datetime_mod-lib_datetime.o datetime_mod-lib_i386_datetime.o
|
||||
|
||||
mod-datetime.o: mod-datetime.c
|
||||
$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datetime_mod_CFLAGS) -c -o $@ $<
|
||||
|
||||
mod-datetime.c: moddep.lst genmodsrc.sh
|
||||
sh $(srcdir)/genmodsrc.sh 'datetime' $< > $@ || (rm -f $@; exit 1)
|
||||
|
||||
ifneq ($(datetime_mod_EXPORTS),no)
|
||||
def-datetime.lst: pre-datetime.o
|
||||
$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 datetime/' > $@
|
||||
endif
|
||||
|
||||
und-datetime.lst: pre-datetime.o
|
||||
echo 'datetime' > $@
|
||||
$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
|
||||
|
||||
datetime_mod-lib_datetime.o: lib/datetime.c $(lib/datetime.c_DEPENDENCIES)
|
||||
$(TARGET_CC) -Ilib -I$(srcdir)/lib $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datetime_mod_CFLAGS) -MD -c -o $@ $<
|
||||
-include datetime_mod-lib_datetime.d
|
||||
|
||||
CLEANFILES += cmd-datetime_mod-lib_datetime.lst fs-datetime_mod-lib_datetime.lst partmap-datetime_mod-lib_datetime.lst
|
||||
COMMANDFILES += cmd-datetime_mod-lib_datetime.lst
|
||||
FSFILES += fs-datetime_mod-lib_datetime.lst
|
||||
PARTMAPFILES += partmap-datetime_mod-lib_datetime.lst
|
||||
|
||||
cmd-datetime_mod-lib_datetime.lst: lib/datetime.c $(lib/datetime.c_DEPENDENCIES) gencmdlist.sh
|
||||
set -e; $(TARGET_CC) -Ilib -I$(srcdir)/lib $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datetime_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh datetime > $@ || (rm -f $@; exit 1)
|
||||
|
||||
fs-datetime_mod-lib_datetime.lst: lib/datetime.c $(lib/datetime.c_DEPENDENCIES) genfslist.sh
|
||||
set -e; $(TARGET_CC) -Ilib -I$(srcdir)/lib $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datetime_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh datetime > $@ || (rm -f $@; exit 1)
|
||||
|
||||
partmap-datetime_mod-lib_datetime.lst: lib/datetime.c $(lib/datetime.c_DEPENDENCIES) genpartmaplist.sh
|
||||
set -e; $(TARGET_CC) -Ilib -I$(srcdir)/lib $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datetime_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh datetime > $@ || (rm -f $@; exit 1)
|
||||
|
||||
|
||||
datetime_mod-lib_i386_datetime.o: lib/i386/datetime.c $(lib/i386/datetime.c_DEPENDENCIES)
|
||||
$(TARGET_CC) -Ilib/i386 -I$(srcdir)/lib/i386 $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datetime_mod_CFLAGS) -MD -c -o $@ $<
|
||||
-include datetime_mod-lib_i386_datetime.d
|
||||
|
||||
CLEANFILES += cmd-datetime_mod-lib_i386_datetime.lst fs-datetime_mod-lib_i386_datetime.lst partmap-datetime_mod-lib_i386_datetime.lst
|
||||
COMMANDFILES += cmd-datetime_mod-lib_i386_datetime.lst
|
||||
FSFILES += fs-datetime_mod-lib_i386_datetime.lst
|
||||
PARTMAPFILES += partmap-datetime_mod-lib_i386_datetime.lst
|
||||
|
||||
cmd-datetime_mod-lib_i386_datetime.lst: lib/i386/datetime.c $(lib/i386/datetime.c_DEPENDENCIES) gencmdlist.sh
|
||||
set -e; $(TARGET_CC) -Ilib/i386 -I$(srcdir)/lib/i386 $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datetime_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh datetime > $@ || (rm -f $@; exit 1)
|
||||
|
||||
fs-datetime_mod-lib_i386_datetime.lst: lib/i386/datetime.c $(lib/i386/datetime.c_DEPENDENCIES) genfslist.sh
|
||||
set -e; $(TARGET_CC) -Ilib/i386 -I$(srcdir)/lib/i386 $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datetime_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh datetime > $@ || (rm -f $@; exit 1)
|
||||
|
||||
partmap-datetime_mod-lib_i386_datetime.lst: lib/i386/datetime.c $(lib/i386/datetime.c_DEPENDENCIES) genpartmaplist.sh
|
||||
set -e; $(TARGET_CC) -Ilib/i386 -I$(srcdir)/lib/i386 $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datetime_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh datetime > $@ || (rm -f $@; exit 1)
|
||||
|
||||
|
||||
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For date.mod
|
||||
date_mod_SOURCES = commands/date.c
|
||||
CLEANFILES += date.mod mod-date.o mod-date.c pre-date.o date_mod-commands_date.o und-date.lst
|
||||
ifneq ($(date_mod_EXPORTS),no)
|
||||
CLEANFILES += def-date.lst
|
||||
DEFSYMFILES += def-date.lst
|
||||
endif
|
||||
MOSTLYCLEANFILES += date_mod-commands_date.d
|
||||
UNDSYMFILES += und-date.lst
|
||||
|
||||
date.mod: pre-date.o mod-date.o $(TARGET_OBJ2ELF)
|
||||
-rm -f $@
|
||||
$(TARGET_CC) $(date_mod_LDFLAGS) $(TARGET_LDFLAGS) $(MODULE_LDFLAGS) -Wl,-r,-d -o $@ pre-date.o mod-date.o
|
||||
if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-date.o: $(date_mod_DEPENDENCIES) date_mod-commands_date.o
|
||||
-rm -f $@
|
||||
$(TARGET_CC) $(date_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ date_mod-commands_date.o
|
||||
|
||||
mod-date.o: mod-date.c
|
||||
$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(date_mod_CFLAGS) -c -o $@ $<
|
||||
|
||||
mod-date.c: moddep.lst genmodsrc.sh
|
||||
sh $(srcdir)/genmodsrc.sh 'date' $< > $@ || (rm -f $@; exit 1)
|
||||
|
||||
ifneq ($(date_mod_EXPORTS),no)
|
||||
def-date.lst: pre-date.o
|
||||
$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 date/' > $@
|
||||
endif
|
||||
|
||||
und-date.lst: pre-date.o
|
||||
echo 'date' > $@
|
||||
$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
|
||||
|
||||
date_mod-commands_date.o: commands/date.c $(commands/date.c_DEPENDENCIES)
|
||||
$(TARGET_CC) -Icommands -I$(srcdir)/commands $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(date_mod_CFLAGS) -MD -c -o $@ $<
|
||||
-include date_mod-commands_date.d
|
||||
|
||||
CLEANFILES += cmd-date_mod-commands_date.lst fs-date_mod-commands_date.lst partmap-date_mod-commands_date.lst
|
||||
COMMANDFILES += cmd-date_mod-commands_date.lst
|
||||
FSFILES += fs-date_mod-commands_date.lst
|
||||
PARTMAPFILES += partmap-date_mod-commands_date.lst
|
||||
|
||||
cmd-date_mod-commands_date.lst: commands/date.c $(commands/date.c_DEPENDENCIES) gencmdlist.sh
|
||||
set -e; $(TARGET_CC) -Icommands -I$(srcdir)/commands $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(date_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh date > $@ || (rm -f $@; exit 1)
|
||||
|
||||
fs-date_mod-commands_date.lst: commands/date.c $(commands/date.c_DEPENDENCIES) genfslist.sh
|
||||
set -e; $(TARGET_CC) -Icommands -I$(srcdir)/commands $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(date_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh date > $@ || (rm -f $@; exit 1)
|
||||
|
||||
partmap-date_mod-commands_date.lst: commands/date.c $(commands/date.c_DEPENDENCIES) genpartmaplist.sh
|
||||
set -e; $(TARGET_CC) -Icommands -I$(srcdir)/commands $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(date_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh date > $@ || (rm -f $@; exit 1)
|
||||
|
||||
|
||||
date_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
date_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For datehook.mod
|
||||
datehook_mod_SOURCES = hook/datehook.c
|
||||
CLEANFILES += datehook.mod mod-datehook.o mod-datehook.c pre-datehook.o datehook_mod-hook_datehook.o und-datehook.lst
|
||||
ifneq ($(datehook_mod_EXPORTS),no)
|
||||
CLEANFILES += def-datehook.lst
|
||||
DEFSYMFILES += def-datehook.lst
|
||||
endif
|
||||
MOSTLYCLEANFILES += datehook_mod-hook_datehook.d
|
||||
UNDSYMFILES += und-datehook.lst
|
||||
|
||||
datehook.mod: pre-datehook.o mod-datehook.o $(TARGET_OBJ2ELF)
|
||||
-rm -f $@
|
||||
$(TARGET_CC) $(datehook_mod_LDFLAGS) $(TARGET_LDFLAGS) $(MODULE_LDFLAGS) -Wl,-r,-d -o $@ pre-datehook.o mod-datehook.o
|
||||
if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-datehook.o: $(datehook_mod_DEPENDENCIES) datehook_mod-hook_datehook.o
|
||||
-rm -f $@
|
||||
$(TARGET_CC) $(datehook_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ datehook_mod-hook_datehook.o
|
||||
|
||||
mod-datehook.o: mod-datehook.c
|
||||
$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datehook_mod_CFLAGS) -c -o $@ $<
|
||||
|
||||
mod-datehook.c: moddep.lst genmodsrc.sh
|
||||
sh $(srcdir)/genmodsrc.sh 'datehook' $< > $@ || (rm -f $@; exit 1)
|
||||
|
||||
ifneq ($(datehook_mod_EXPORTS),no)
|
||||
def-datehook.lst: pre-datehook.o
|
||||
$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 datehook/' > $@
|
||||
endif
|
||||
|
||||
und-datehook.lst: pre-datehook.o
|
||||
echo 'datehook' > $@
|
||||
$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
|
||||
|
||||
datehook_mod-hook_datehook.o: hook/datehook.c $(hook/datehook.c_DEPENDENCIES)
|
||||
$(TARGET_CC) -Ihook -I$(srcdir)/hook $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datehook_mod_CFLAGS) -MD -c -o $@ $<
|
||||
-include datehook_mod-hook_datehook.d
|
||||
|
||||
CLEANFILES += cmd-datehook_mod-hook_datehook.lst fs-datehook_mod-hook_datehook.lst partmap-datehook_mod-hook_datehook.lst
|
||||
COMMANDFILES += cmd-datehook_mod-hook_datehook.lst
|
||||
FSFILES += fs-datehook_mod-hook_datehook.lst
|
||||
PARTMAPFILES += partmap-datehook_mod-hook_datehook.lst
|
||||
|
||||
cmd-datehook_mod-hook_datehook.lst: hook/datehook.c $(hook/datehook.c_DEPENDENCIES) gencmdlist.sh
|
||||
set -e; $(TARGET_CC) -Ihook -I$(srcdir)/hook $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datehook_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh datehook > $@ || (rm -f $@; exit 1)
|
||||
|
||||
fs-datehook_mod-hook_datehook.lst: hook/datehook.c $(hook/datehook.c_DEPENDENCIES) genfslist.sh
|
||||
set -e; $(TARGET_CC) -Ihook -I$(srcdir)/hook $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datehook_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh datehook > $@ || (rm -f $@; exit 1)
|
||||
|
||||
partmap-datehook_mod-hook_datehook.lst: hook/datehook.c $(hook/datehook.c_DEPENDENCIES) genpartmaplist.sh
|
||||
set -e; $(TARGET_CC) -Ihook -I$(srcdir)/hook $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datehook_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh datehook > $@ || (rm -f $@; exit 1)
|
||||
|
||||
|
||||
datehook_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
datehook_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
include $(srcdir)/conf/common.mk
|
||||
|
|
|
@ -97,7 +97,8 @@ grub_install_SOURCES = util/ieee1275/grub-install.in
|
|||
# Modules.
|
||||
pkglib_MODULES = normal.mod halt.mod reboot.mod suspend.mod cpuid.mod \
|
||||
multiboot.mod _multiboot.mod aout.mod serial.mod linux.mod \
|
||||
_linux.mod nand.mod memdisk.mod pci.mod lspci.mod
|
||||
_linux.mod nand.mod memdisk.mod pci.mod lspci.mod datetime.mod \
|
||||
date.mod datehook.mod
|
||||
|
||||
# For normal.mod.
|
||||
normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \
|
||||
|
@ -181,4 +182,19 @@ lspci_mod_SOURCES = commands/lspci.c
|
|||
lspci_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For datetime.mod
|
||||
datetime_mod_SOURCES = lib/datetime.c lib/i386/datetime.c
|
||||
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For date.mod
|
||||
date_mod_SOURCES = commands/date.c
|
||||
date_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
date_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For datehook.mod
|
||||
datehook_mod_SOURCES = hook/datehook.c
|
||||
datehook_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
datehook_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
include $(srcdir)/conf/common.mk
|
||||
|
|
193
conf/i386-pc.mk
193
conf/i386-pc.mk
|
@ -904,7 +904,8 @@ pkglib_MODULES = biosdisk.mod _chain.mod _linux.mod linux.mod normal.mod \
|
|||
vbe.mod vbetest.mod vbeinfo.mod video.mod gfxterm.mod \
|
||||
videotest.mod play.mod bitmap.mod tga.mod cpuid.mod serial.mod \
|
||||
ata.mod vga.mod memdisk.mod jpeg.mod png.mod pci.mod lspci.mod \
|
||||
aout.mod _bsd.mod bsd.mod pxe.mod pxecmd.mod
|
||||
aout.mod _bsd.mod bsd.mod pxe.mod pxecmd.mod datetime.mod date.mod \
|
||||
datehook.mod
|
||||
|
||||
# For biosdisk.mod.
|
||||
biosdisk_mod_SOURCES = disk/i386/pc/biosdisk.c
|
||||
|
@ -3177,4 +3178,194 @@ partmap-pxecmd_mod-commands_i386_pc_pxecmd.lst: commands/i386/pc/pxecmd.c $(comm
|
|||
pxecmd_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
pxecmd_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For datetime.mod
|
||||
datetime_mod_SOURCES = lib/datetime.c lib/i386/datetime.c
|
||||
CLEANFILES += datetime.mod mod-datetime.o mod-datetime.c pre-datetime.o datetime_mod-lib_datetime.o datetime_mod-lib_i386_datetime.o und-datetime.lst
|
||||
ifneq ($(datetime_mod_EXPORTS),no)
|
||||
CLEANFILES += def-datetime.lst
|
||||
DEFSYMFILES += def-datetime.lst
|
||||
endif
|
||||
MOSTLYCLEANFILES += datetime_mod-lib_datetime.d datetime_mod-lib_i386_datetime.d
|
||||
UNDSYMFILES += und-datetime.lst
|
||||
|
||||
datetime.mod: pre-datetime.o mod-datetime.o $(TARGET_OBJ2ELF)
|
||||
-rm -f $@
|
||||
$(TARGET_CC) $(datetime_mod_LDFLAGS) $(TARGET_LDFLAGS) $(MODULE_LDFLAGS) -Wl,-r,-d -o $@ pre-datetime.o mod-datetime.o
|
||||
if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-datetime.o: $(datetime_mod_DEPENDENCIES) datetime_mod-lib_datetime.o datetime_mod-lib_i386_datetime.o
|
||||
-rm -f $@
|
||||
$(TARGET_CC) $(datetime_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ datetime_mod-lib_datetime.o datetime_mod-lib_i386_datetime.o
|
||||
|
||||
mod-datetime.o: mod-datetime.c
|
||||
$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datetime_mod_CFLAGS) -c -o $@ $<
|
||||
|
||||
mod-datetime.c: moddep.lst genmodsrc.sh
|
||||
sh $(srcdir)/genmodsrc.sh 'datetime' $< > $@ || (rm -f $@; exit 1)
|
||||
|
||||
ifneq ($(datetime_mod_EXPORTS),no)
|
||||
def-datetime.lst: pre-datetime.o
|
||||
$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 datetime/' > $@
|
||||
endif
|
||||
|
||||
und-datetime.lst: pre-datetime.o
|
||||
echo 'datetime' > $@
|
||||
$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
|
||||
|
||||
datetime_mod-lib_datetime.o: lib/datetime.c $(lib/datetime.c_DEPENDENCIES)
|
||||
$(TARGET_CC) -Ilib -I$(srcdir)/lib $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datetime_mod_CFLAGS) -MD -c -o $@ $<
|
||||
-include datetime_mod-lib_datetime.d
|
||||
|
||||
CLEANFILES += cmd-datetime_mod-lib_datetime.lst fs-datetime_mod-lib_datetime.lst partmap-datetime_mod-lib_datetime.lst
|
||||
COMMANDFILES += cmd-datetime_mod-lib_datetime.lst
|
||||
FSFILES += fs-datetime_mod-lib_datetime.lst
|
||||
PARTMAPFILES += partmap-datetime_mod-lib_datetime.lst
|
||||
|
||||
cmd-datetime_mod-lib_datetime.lst: lib/datetime.c $(lib/datetime.c_DEPENDENCIES) gencmdlist.sh
|
||||
set -e; $(TARGET_CC) -Ilib -I$(srcdir)/lib $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datetime_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh datetime > $@ || (rm -f $@; exit 1)
|
||||
|
||||
fs-datetime_mod-lib_datetime.lst: lib/datetime.c $(lib/datetime.c_DEPENDENCIES) genfslist.sh
|
||||
set -e; $(TARGET_CC) -Ilib -I$(srcdir)/lib $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datetime_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh datetime > $@ || (rm -f $@; exit 1)
|
||||
|
||||
partmap-datetime_mod-lib_datetime.lst: lib/datetime.c $(lib/datetime.c_DEPENDENCIES) genpartmaplist.sh
|
||||
set -e; $(TARGET_CC) -Ilib -I$(srcdir)/lib $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datetime_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh datetime > $@ || (rm -f $@; exit 1)
|
||||
|
||||
|
||||
datetime_mod-lib_i386_datetime.o: lib/i386/datetime.c $(lib/i386/datetime.c_DEPENDENCIES)
|
||||
$(TARGET_CC) -Ilib/i386 -I$(srcdir)/lib/i386 $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datetime_mod_CFLAGS) -MD -c -o $@ $<
|
||||
-include datetime_mod-lib_i386_datetime.d
|
||||
|
||||
CLEANFILES += cmd-datetime_mod-lib_i386_datetime.lst fs-datetime_mod-lib_i386_datetime.lst partmap-datetime_mod-lib_i386_datetime.lst
|
||||
COMMANDFILES += cmd-datetime_mod-lib_i386_datetime.lst
|
||||
FSFILES += fs-datetime_mod-lib_i386_datetime.lst
|
||||
PARTMAPFILES += partmap-datetime_mod-lib_i386_datetime.lst
|
||||
|
||||
cmd-datetime_mod-lib_i386_datetime.lst: lib/i386/datetime.c $(lib/i386/datetime.c_DEPENDENCIES) gencmdlist.sh
|
||||
set -e; $(TARGET_CC) -Ilib/i386 -I$(srcdir)/lib/i386 $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datetime_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh datetime > $@ || (rm -f $@; exit 1)
|
||||
|
||||
fs-datetime_mod-lib_i386_datetime.lst: lib/i386/datetime.c $(lib/i386/datetime.c_DEPENDENCIES) genfslist.sh
|
||||
set -e; $(TARGET_CC) -Ilib/i386 -I$(srcdir)/lib/i386 $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datetime_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh datetime > $@ || (rm -f $@; exit 1)
|
||||
|
||||
partmap-datetime_mod-lib_i386_datetime.lst: lib/i386/datetime.c $(lib/i386/datetime.c_DEPENDENCIES) genpartmaplist.sh
|
||||
set -e; $(TARGET_CC) -Ilib/i386 -I$(srcdir)/lib/i386 $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datetime_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh datetime > $@ || (rm -f $@; exit 1)
|
||||
|
||||
|
||||
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For date.mod
|
||||
date_mod_SOURCES = commands/date.c
|
||||
CLEANFILES += date.mod mod-date.o mod-date.c pre-date.o date_mod-commands_date.o und-date.lst
|
||||
ifneq ($(date_mod_EXPORTS),no)
|
||||
CLEANFILES += def-date.lst
|
||||
DEFSYMFILES += def-date.lst
|
||||
endif
|
||||
MOSTLYCLEANFILES += date_mod-commands_date.d
|
||||
UNDSYMFILES += und-date.lst
|
||||
|
||||
date.mod: pre-date.o mod-date.o $(TARGET_OBJ2ELF)
|
||||
-rm -f $@
|
||||
$(TARGET_CC) $(date_mod_LDFLAGS) $(TARGET_LDFLAGS) $(MODULE_LDFLAGS) -Wl,-r,-d -o $@ pre-date.o mod-date.o
|
||||
if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-date.o: $(date_mod_DEPENDENCIES) date_mod-commands_date.o
|
||||
-rm -f $@
|
||||
$(TARGET_CC) $(date_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ date_mod-commands_date.o
|
||||
|
||||
mod-date.o: mod-date.c
|
||||
$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(date_mod_CFLAGS) -c -o $@ $<
|
||||
|
||||
mod-date.c: moddep.lst genmodsrc.sh
|
||||
sh $(srcdir)/genmodsrc.sh 'date' $< > $@ || (rm -f $@; exit 1)
|
||||
|
||||
ifneq ($(date_mod_EXPORTS),no)
|
||||
def-date.lst: pre-date.o
|
||||
$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 date/' > $@
|
||||
endif
|
||||
|
||||
und-date.lst: pre-date.o
|
||||
echo 'date' > $@
|
||||
$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
|
||||
|
||||
date_mod-commands_date.o: commands/date.c $(commands/date.c_DEPENDENCIES)
|
||||
$(TARGET_CC) -Icommands -I$(srcdir)/commands $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(date_mod_CFLAGS) -MD -c -o $@ $<
|
||||
-include date_mod-commands_date.d
|
||||
|
||||
CLEANFILES += cmd-date_mod-commands_date.lst fs-date_mod-commands_date.lst partmap-date_mod-commands_date.lst
|
||||
COMMANDFILES += cmd-date_mod-commands_date.lst
|
||||
FSFILES += fs-date_mod-commands_date.lst
|
||||
PARTMAPFILES += partmap-date_mod-commands_date.lst
|
||||
|
||||
cmd-date_mod-commands_date.lst: commands/date.c $(commands/date.c_DEPENDENCIES) gencmdlist.sh
|
||||
set -e; $(TARGET_CC) -Icommands -I$(srcdir)/commands $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(date_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh date > $@ || (rm -f $@; exit 1)
|
||||
|
||||
fs-date_mod-commands_date.lst: commands/date.c $(commands/date.c_DEPENDENCIES) genfslist.sh
|
||||
set -e; $(TARGET_CC) -Icommands -I$(srcdir)/commands $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(date_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh date > $@ || (rm -f $@; exit 1)
|
||||
|
||||
partmap-date_mod-commands_date.lst: commands/date.c $(commands/date.c_DEPENDENCIES) genpartmaplist.sh
|
||||
set -e; $(TARGET_CC) -Icommands -I$(srcdir)/commands $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(date_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh date > $@ || (rm -f $@; exit 1)
|
||||
|
||||
|
||||
date_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
date_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For datehook.mod
|
||||
datehook_mod_SOURCES = hook/datehook.c
|
||||
CLEANFILES += datehook.mod mod-datehook.o mod-datehook.c pre-datehook.o datehook_mod-hook_datehook.o und-datehook.lst
|
||||
ifneq ($(datehook_mod_EXPORTS),no)
|
||||
CLEANFILES += def-datehook.lst
|
||||
DEFSYMFILES += def-datehook.lst
|
||||
endif
|
||||
MOSTLYCLEANFILES += datehook_mod-hook_datehook.d
|
||||
UNDSYMFILES += und-datehook.lst
|
||||
|
||||
datehook.mod: pre-datehook.o mod-datehook.o $(TARGET_OBJ2ELF)
|
||||
-rm -f $@
|
||||
$(TARGET_CC) $(datehook_mod_LDFLAGS) $(TARGET_LDFLAGS) $(MODULE_LDFLAGS) -Wl,-r,-d -o $@ pre-datehook.o mod-datehook.o
|
||||
if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-datehook.o: $(datehook_mod_DEPENDENCIES) datehook_mod-hook_datehook.o
|
||||
-rm -f $@
|
||||
$(TARGET_CC) $(datehook_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ datehook_mod-hook_datehook.o
|
||||
|
||||
mod-datehook.o: mod-datehook.c
|
||||
$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datehook_mod_CFLAGS) -c -o $@ $<
|
||||
|
||||
mod-datehook.c: moddep.lst genmodsrc.sh
|
||||
sh $(srcdir)/genmodsrc.sh 'datehook' $< > $@ || (rm -f $@; exit 1)
|
||||
|
||||
ifneq ($(datehook_mod_EXPORTS),no)
|
||||
def-datehook.lst: pre-datehook.o
|
||||
$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 datehook/' > $@
|
||||
endif
|
||||
|
||||
und-datehook.lst: pre-datehook.o
|
||||
echo 'datehook' > $@
|
||||
$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
|
||||
|
||||
datehook_mod-hook_datehook.o: hook/datehook.c $(hook/datehook.c_DEPENDENCIES)
|
||||
$(TARGET_CC) -Ihook -I$(srcdir)/hook $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datehook_mod_CFLAGS) -MD -c -o $@ $<
|
||||
-include datehook_mod-hook_datehook.d
|
||||
|
||||
CLEANFILES += cmd-datehook_mod-hook_datehook.lst fs-datehook_mod-hook_datehook.lst partmap-datehook_mod-hook_datehook.lst
|
||||
COMMANDFILES += cmd-datehook_mod-hook_datehook.lst
|
||||
FSFILES += fs-datehook_mod-hook_datehook.lst
|
||||
PARTMAPFILES += partmap-datehook_mod-hook_datehook.lst
|
||||
|
||||
cmd-datehook_mod-hook_datehook.lst: hook/datehook.c $(hook/datehook.c_DEPENDENCIES) gencmdlist.sh
|
||||
set -e; $(TARGET_CC) -Ihook -I$(srcdir)/hook $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datehook_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh datehook > $@ || (rm -f $@; exit 1)
|
||||
|
||||
fs-datehook_mod-hook_datehook.lst: hook/datehook.c $(hook/datehook.c_DEPENDENCIES) genfslist.sh
|
||||
set -e; $(TARGET_CC) -Ihook -I$(srcdir)/hook $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datehook_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh datehook > $@ || (rm -f $@; exit 1)
|
||||
|
||||
partmap-datehook_mod-hook_datehook.lst: hook/datehook.c $(hook/datehook.c_DEPENDENCIES) genpartmaplist.sh
|
||||
set -e; $(TARGET_CC) -Ihook -I$(srcdir)/hook $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datehook_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh datehook > $@ || (rm -f $@; exit 1)
|
||||
|
||||
|
||||
datehook_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
datehook_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
include $(srcdir)/conf/common.mk
|
||||
|
|
|
@ -163,7 +163,8 @@ pkglib_MODULES = biosdisk.mod _chain.mod _linux.mod linux.mod normal.mod \
|
|||
vbe.mod vbetest.mod vbeinfo.mod video.mod gfxterm.mod \
|
||||
videotest.mod play.mod bitmap.mod tga.mod cpuid.mod serial.mod \
|
||||
ata.mod vga.mod memdisk.mod jpeg.mod png.mod pci.mod lspci.mod \
|
||||
aout.mod _bsd.mod bsd.mod pxe.mod pxecmd.mod
|
||||
aout.mod _bsd.mod bsd.mod pxe.mod pxecmd.mod datetime.mod date.mod \
|
||||
datehook.mod
|
||||
|
||||
# For biosdisk.mod.
|
||||
biosdisk_mod_SOURCES = disk/i386/pc/biosdisk.c
|
||||
|
@ -340,4 +341,19 @@ pxecmd_mod_SOURCES = commands/i386/pc/pxecmd.c
|
|||
pxecmd_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
pxecmd_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For datetime.mod
|
||||
datetime_mod_SOURCES = lib/datetime.c lib/i386/datetime.c
|
||||
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For date.mod
|
||||
date_mod_SOURCES = commands/date.c
|
||||
date_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
date_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For datehook.mod
|
||||
datehook_mod_SOURCES = hook/datehook.c
|
||||
datehook_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
datehook_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
include $(srcdir)/conf/common.mk
|
||||
|
|
|
@ -29,35 +29,11 @@ kernel_syms.lst: $(addprefix include/grub/,$(kernel_elf_HEADERS)) config.h genke
|
|||
pkglib_PROGRAMS = kernel.elf
|
||||
|
||||
# Utilities.
|
||||
bin_UTILITIES = grub-mkimage
|
||||
sbin_UTILITIES = grub-mkdevicemap
|
||||
ifeq ($(enable_grub_emu), yes)
|
||||
sbin_UTILITIES += grub-emu
|
||||
endif
|
||||
|
||||
# For grub-mkimage.
|
||||
grub_mkimage_SOURCES = util/elf/grub-mkimage.c util/misc.c \
|
||||
util/resolve.c
|
||||
CLEANFILES += grub-mkimage$(EXEEXT) grub_mkimage-util_elf_grub_mkimage.o grub_mkimage-util_misc.o grub_mkimage-util_resolve.o
|
||||
MOSTLYCLEANFILES += grub_mkimage-util_elf_grub_mkimage.d grub_mkimage-util_misc.d grub_mkimage-util_resolve.d
|
||||
|
||||
grub-mkimage: $(grub_mkimage_DEPENDENCIES) grub_mkimage-util_elf_grub_mkimage.o grub_mkimage-util_misc.o grub_mkimage-util_resolve.o
|
||||
$(CC) -o $@ grub_mkimage-util_elf_grub_mkimage.o grub_mkimage-util_misc.o grub_mkimage-util_resolve.o $(LDFLAGS) $(grub_mkimage_LDFLAGS)
|
||||
|
||||
grub_mkimage-util_elf_grub_mkimage.o: util/elf/grub-mkimage.c $(util/elf/grub-mkimage.c_DEPENDENCIES)
|
||||
$(CC) -Iutil/elf -I$(srcdir)/util/elf $(CPPFLAGS) $(CFLAGS) -DGRUB_UTIL=1 $(grub_mkimage_CFLAGS) -MD -c -o $@ $<
|
||||
-include grub_mkimage-util_elf_grub_mkimage.d
|
||||
|
||||
grub_mkimage-util_misc.o: util/misc.c $(util/misc.c_DEPENDENCIES)
|
||||
$(CC) -Iutil -I$(srcdir)/util $(CPPFLAGS) $(CFLAGS) -DGRUB_UTIL=1 $(grub_mkimage_CFLAGS) -MD -c -o $@ $<
|
||||
-include grub_mkimage-util_misc.d
|
||||
|
||||
grub_mkimage-util_resolve.o: util/resolve.c $(util/resolve.c_DEPENDENCIES)
|
||||
$(CC) -Iutil -I$(srcdir)/util $(CPPFLAGS) $(CFLAGS) -DGRUB_UTIL=1 $(grub_mkimage_CFLAGS) -MD -c -o $@ $<
|
||||
-include grub_mkimage-util_resolve.d
|
||||
|
||||
util/elf/grub-mkimage.c_DEPENDENCIES = Makefile
|
||||
|
||||
# For grub-mkdevicemap.
|
||||
grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/misc.c \
|
||||
util/ieee1275/get_disk_name.c
|
||||
|
|
|
@ -102,7 +102,8 @@ grub-install: util/i386/efi/grub-install.in $(util/i386/efi/grub-install.in_DEPE
|
|||
|
||||
# Modules.
|
||||
pkglib_MODULES = kernel.mod normal.mod _chain.mod chain.mod appleldr.mod \
|
||||
cpuid.mod halt.mod reboot.mod _linux.mod linux.mod pci.mod lspci.mod
|
||||
cpuid.mod halt.mod reboot.mod _linux.mod linux.mod pci.mod lspci.mod \
|
||||
datetime.mod date.mod datehook.mod
|
||||
|
||||
# For kernel.mod.
|
||||
kernel_mod_EXPORTS = no
|
||||
|
@ -1635,4 +1636,194 @@ partmap-lspci_mod-commands_lspci.lst: commands/lspci.c $(commands/lspci.c_DEPEND
|
|||
lspci_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For datetime.mod
|
||||
datetime_mod_SOURCES = lib/datetime.c lib/efi/datetime.c
|
||||
CLEANFILES += datetime.mod mod-datetime.o mod-datetime.c pre-datetime.o datetime_mod-lib_datetime.o datetime_mod-lib_efi_datetime.o und-datetime.lst
|
||||
ifneq ($(datetime_mod_EXPORTS),no)
|
||||
CLEANFILES += def-datetime.lst
|
||||
DEFSYMFILES += def-datetime.lst
|
||||
endif
|
||||
MOSTLYCLEANFILES += datetime_mod-lib_datetime.d datetime_mod-lib_efi_datetime.d
|
||||
UNDSYMFILES += und-datetime.lst
|
||||
|
||||
datetime.mod: pre-datetime.o mod-datetime.o $(TARGET_OBJ2ELF)
|
||||
-rm -f $@
|
||||
$(TARGET_CC) $(datetime_mod_LDFLAGS) $(TARGET_LDFLAGS) $(MODULE_LDFLAGS) -Wl,-r,-d -o $@ pre-datetime.o mod-datetime.o
|
||||
if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-datetime.o: $(datetime_mod_DEPENDENCIES) datetime_mod-lib_datetime.o datetime_mod-lib_efi_datetime.o
|
||||
-rm -f $@
|
||||
$(TARGET_CC) $(datetime_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ datetime_mod-lib_datetime.o datetime_mod-lib_efi_datetime.o
|
||||
|
||||
mod-datetime.o: mod-datetime.c
|
||||
$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datetime_mod_CFLAGS) -c -o $@ $<
|
||||
|
||||
mod-datetime.c: moddep.lst genmodsrc.sh
|
||||
sh $(srcdir)/genmodsrc.sh 'datetime' $< > $@ || (rm -f $@; exit 1)
|
||||
|
||||
ifneq ($(datetime_mod_EXPORTS),no)
|
||||
def-datetime.lst: pre-datetime.o
|
||||
$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 datetime/' > $@
|
||||
endif
|
||||
|
||||
und-datetime.lst: pre-datetime.o
|
||||
echo 'datetime' > $@
|
||||
$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
|
||||
|
||||
datetime_mod-lib_datetime.o: lib/datetime.c $(lib/datetime.c_DEPENDENCIES)
|
||||
$(TARGET_CC) -Ilib -I$(srcdir)/lib $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datetime_mod_CFLAGS) -MD -c -o $@ $<
|
||||
-include datetime_mod-lib_datetime.d
|
||||
|
||||
CLEANFILES += cmd-datetime_mod-lib_datetime.lst fs-datetime_mod-lib_datetime.lst partmap-datetime_mod-lib_datetime.lst
|
||||
COMMANDFILES += cmd-datetime_mod-lib_datetime.lst
|
||||
FSFILES += fs-datetime_mod-lib_datetime.lst
|
||||
PARTMAPFILES += partmap-datetime_mod-lib_datetime.lst
|
||||
|
||||
cmd-datetime_mod-lib_datetime.lst: lib/datetime.c $(lib/datetime.c_DEPENDENCIES) gencmdlist.sh
|
||||
set -e; $(TARGET_CC) -Ilib -I$(srcdir)/lib $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datetime_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh datetime > $@ || (rm -f $@; exit 1)
|
||||
|
||||
fs-datetime_mod-lib_datetime.lst: lib/datetime.c $(lib/datetime.c_DEPENDENCIES) genfslist.sh
|
||||
set -e; $(TARGET_CC) -Ilib -I$(srcdir)/lib $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datetime_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh datetime > $@ || (rm -f $@; exit 1)
|
||||
|
||||
partmap-datetime_mod-lib_datetime.lst: lib/datetime.c $(lib/datetime.c_DEPENDENCIES) genpartmaplist.sh
|
||||
set -e; $(TARGET_CC) -Ilib -I$(srcdir)/lib $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datetime_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh datetime > $@ || (rm -f $@; exit 1)
|
||||
|
||||
|
||||
datetime_mod-lib_efi_datetime.o: lib/efi/datetime.c $(lib/efi/datetime.c_DEPENDENCIES)
|
||||
$(TARGET_CC) -Ilib/efi -I$(srcdir)/lib/efi $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datetime_mod_CFLAGS) -MD -c -o $@ $<
|
||||
-include datetime_mod-lib_efi_datetime.d
|
||||
|
||||
CLEANFILES += cmd-datetime_mod-lib_efi_datetime.lst fs-datetime_mod-lib_efi_datetime.lst partmap-datetime_mod-lib_efi_datetime.lst
|
||||
COMMANDFILES += cmd-datetime_mod-lib_efi_datetime.lst
|
||||
FSFILES += fs-datetime_mod-lib_efi_datetime.lst
|
||||
PARTMAPFILES += partmap-datetime_mod-lib_efi_datetime.lst
|
||||
|
||||
cmd-datetime_mod-lib_efi_datetime.lst: lib/efi/datetime.c $(lib/efi/datetime.c_DEPENDENCIES) gencmdlist.sh
|
||||
set -e; $(TARGET_CC) -Ilib/efi -I$(srcdir)/lib/efi $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datetime_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh datetime > $@ || (rm -f $@; exit 1)
|
||||
|
||||
fs-datetime_mod-lib_efi_datetime.lst: lib/efi/datetime.c $(lib/efi/datetime.c_DEPENDENCIES) genfslist.sh
|
||||
set -e; $(TARGET_CC) -Ilib/efi -I$(srcdir)/lib/efi $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datetime_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh datetime > $@ || (rm -f $@; exit 1)
|
||||
|
||||
partmap-datetime_mod-lib_efi_datetime.lst: lib/efi/datetime.c $(lib/efi/datetime.c_DEPENDENCIES) genpartmaplist.sh
|
||||
set -e; $(TARGET_CC) -Ilib/efi -I$(srcdir)/lib/efi $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datetime_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh datetime > $@ || (rm -f $@; exit 1)
|
||||
|
||||
|
||||
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For date.mod
|
||||
date_mod_SOURCES = commands/date.c
|
||||
CLEANFILES += date.mod mod-date.o mod-date.c pre-date.o date_mod-commands_date.o und-date.lst
|
||||
ifneq ($(date_mod_EXPORTS),no)
|
||||
CLEANFILES += def-date.lst
|
||||
DEFSYMFILES += def-date.lst
|
||||
endif
|
||||
MOSTLYCLEANFILES += date_mod-commands_date.d
|
||||
UNDSYMFILES += und-date.lst
|
||||
|
||||
date.mod: pre-date.o mod-date.o $(TARGET_OBJ2ELF)
|
||||
-rm -f $@
|
||||
$(TARGET_CC) $(date_mod_LDFLAGS) $(TARGET_LDFLAGS) $(MODULE_LDFLAGS) -Wl,-r,-d -o $@ pre-date.o mod-date.o
|
||||
if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-date.o: $(date_mod_DEPENDENCIES) date_mod-commands_date.o
|
||||
-rm -f $@
|
||||
$(TARGET_CC) $(date_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ date_mod-commands_date.o
|
||||
|
||||
mod-date.o: mod-date.c
|
||||
$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(date_mod_CFLAGS) -c -o $@ $<
|
||||
|
||||
mod-date.c: moddep.lst genmodsrc.sh
|
||||
sh $(srcdir)/genmodsrc.sh 'date' $< > $@ || (rm -f $@; exit 1)
|
||||
|
||||
ifneq ($(date_mod_EXPORTS),no)
|
||||
def-date.lst: pre-date.o
|
||||
$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 date/' > $@
|
||||
endif
|
||||
|
||||
und-date.lst: pre-date.o
|
||||
echo 'date' > $@
|
||||
$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
|
||||
|
||||
date_mod-commands_date.o: commands/date.c $(commands/date.c_DEPENDENCIES)
|
||||
$(TARGET_CC) -Icommands -I$(srcdir)/commands $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(date_mod_CFLAGS) -MD -c -o $@ $<
|
||||
-include date_mod-commands_date.d
|
||||
|
||||
CLEANFILES += cmd-date_mod-commands_date.lst fs-date_mod-commands_date.lst partmap-date_mod-commands_date.lst
|
||||
COMMANDFILES += cmd-date_mod-commands_date.lst
|
||||
FSFILES += fs-date_mod-commands_date.lst
|
||||
PARTMAPFILES += partmap-date_mod-commands_date.lst
|
||||
|
||||
cmd-date_mod-commands_date.lst: commands/date.c $(commands/date.c_DEPENDENCIES) gencmdlist.sh
|
||||
set -e; $(TARGET_CC) -Icommands -I$(srcdir)/commands $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(date_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh date > $@ || (rm -f $@; exit 1)
|
||||
|
||||
fs-date_mod-commands_date.lst: commands/date.c $(commands/date.c_DEPENDENCIES) genfslist.sh
|
||||
set -e; $(TARGET_CC) -Icommands -I$(srcdir)/commands $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(date_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh date > $@ || (rm -f $@; exit 1)
|
||||
|
||||
partmap-date_mod-commands_date.lst: commands/date.c $(commands/date.c_DEPENDENCIES) genpartmaplist.sh
|
||||
set -e; $(TARGET_CC) -Icommands -I$(srcdir)/commands $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(date_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh date > $@ || (rm -f $@; exit 1)
|
||||
|
||||
|
||||
date_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
date_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For datehook.mod
|
||||
datehook_mod_SOURCES = hook/datehook.c
|
||||
CLEANFILES += datehook.mod mod-datehook.o mod-datehook.c pre-datehook.o datehook_mod-hook_datehook.o und-datehook.lst
|
||||
ifneq ($(datehook_mod_EXPORTS),no)
|
||||
CLEANFILES += def-datehook.lst
|
||||
DEFSYMFILES += def-datehook.lst
|
||||
endif
|
||||
MOSTLYCLEANFILES += datehook_mod-hook_datehook.d
|
||||
UNDSYMFILES += und-datehook.lst
|
||||
|
||||
datehook.mod: pre-datehook.o mod-datehook.o $(TARGET_OBJ2ELF)
|
||||
-rm -f $@
|
||||
$(TARGET_CC) $(datehook_mod_LDFLAGS) $(TARGET_LDFLAGS) $(MODULE_LDFLAGS) -Wl,-r,-d -o $@ pre-datehook.o mod-datehook.o
|
||||
if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-datehook.o: $(datehook_mod_DEPENDENCIES) datehook_mod-hook_datehook.o
|
||||
-rm -f $@
|
||||
$(TARGET_CC) $(datehook_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ datehook_mod-hook_datehook.o
|
||||
|
||||
mod-datehook.o: mod-datehook.c
|
||||
$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datehook_mod_CFLAGS) -c -o $@ $<
|
||||
|
||||
mod-datehook.c: moddep.lst genmodsrc.sh
|
||||
sh $(srcdir)/genmodsrc.sh 'datehook' $< > $@ || (rm -f $@; exit 1)
|
||||
|
||||
ifneq ($(datehook_mod_EXPORTS),no)
|
||||
def-datehook.lst: pre-datehook.o
|
||||
$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 datehook/' > $@
|
||||
endif
|
||||
|
||||
und-datehook.lst: pre-datehook.o
|
||||
echo 'datehook' > $@
|
||||
$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
|
||||
|
||||
datehook_mod-hook_datehook.o: hook/datehook.c $(hook/datehook.c_DEPENDENCIES)
|
||||
$(TARGET_CC) -Ihook -I$(srcdir)/hook $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datehook_mod_CFLAGS) -MD -c -o $@ $<
|
||||
-include datehook_mod-hook_datehook.d
|
||||
|
||||
CLEANFILES += cmd-datehook_mod-hook_datehook.lst fs-datehook_mod-hook_datehook.lst partmap-datehook_mod-hook_datehook.lst
|
||||
COMMANDFILES += cmd-datehook_mod-hook_datehook.lst
|
||||
FSFILES += fs-datehook_mod-hook_datehook.lst
|
||||
PARTMAPFILES += partmap-datehook_mod-hook_datehook.lst
|
||||
|
||||
cmd-datehook_mod-hook_datehook.lst: hook/datehook.c $(hook/datehook.c_DEPENDENCIES) gencmdlist.sh
|
||||
set -e; $(TARGET_CC) -Ihook -I$(srcdir)/hook $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datehook_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh datehook > $@ || (rm -f $@; exit 1)
|
||||
|
||||
fs-datehook_mod-hook_datehook.lst: hook/datehook.c $(hook/datehook.c_DEPENDENCIES) genfslist.sh
|
||||
set -e; $(TARGET_CC) -Ihook -I$(srcdir)/hook $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datehook_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh datehook > $@ || (rm -f $@; exit 1)
|
||||
|
||||
partmap-datehook_mod-hook_datehook.lst: hook/datehook.c $(hook/datehook.c_DEPENDENCIES) genpartmaplist.sh
|
||||
set -e; $(TARGET_CC) -Ihook -I$(srcdir)/hook $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(datehook_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh datehook > $@ || (rm -f $@; exit 1)
|
||||
|
||||
|
||||
datehook_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
datehook_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
include $(srcdir)/conf/common.mk
|
||||
|
|
|
@ -77,7 +77,8 @@ grub_install_SOURCES = util/i386/efi/grub-install.in
|
|||
|
||||
# Modules.
|
||||
pkglib_MODULES = kernel.mod normal.mod _chain.mod chain.mod appleldr.mod \
|
||||
cpuid.mod halt.mod reboot.mod _linux.mod linux.mod pci.mod lspci.mod
|
||||
cpuid.mod halt.mod reboot.mod _linux.mod linux.mod pci.mod lspci.mod \
|
||||
datetime.mod date.mod datehook.mod
|
||||
|
||||
# For kernel.mod.
|
||||
kernel_mod_EXPORTS = no
|
||||
|
@ -169,4 +170,19 @@ lspci_mod_SOURCES = commands/lspci.c
|
|||
lspci_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For datetime.mod
|
||||
datetime_mod_SOURCES = lib/datetime.c lib/efi/datetime.c
|
||||
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For date.mod
|
||||
date_mod_SOURCES = commands/date.c
|
||||
date_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
date_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For datehook.mod
|
||||
datehook_mod_SOURCES = hook/datehook.c
|
||||
datehook_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
datehook_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
include $(srcdir)/conf/common.mk
|
||||
|
|
106
hook/datehook.c
Normal file
106
hook/datehook.c
Normal file
|
@ -0,0 +1,106 @@
|
|||
/* datehook.c - Module to install datetime hooks. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/normal.h>
|
||||
#include <grub/lib/datetime.h>
|
||||
|
||||
static char *grub_datetime_names[] =
|
||||
{
|
||||
"YEAR",
|
||||
"MONTH",
|
||||
"DAY",
|
||||
"HOUR",
|
||||
"MINUTE",
|
||||
"SECOND",
|
||||
"WEEKDAY",
|
||||
};
|
||||
|
||||
static char *
|
||||
grub_read_hook_datetime (struct grub_env_var *var,
|
||||
const char *val __attribute__ ((unused)))
|
||||
{
|
||||
struct grub_datetime datetime;
|
||||
static char buf[6];
|
||||
|
||||
buf[0] = 0;
|
||||
if (! grub_get_datetime (&datetime))
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 7; i++)
|
||||
if (! grub_strcmp (var->name, grub_datetime_names[i]))
|
||||
{
|
||||
int n;
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
n = datetime.year;
|
||||
break;
|
||||
case 1:
|
||||
n = datetime.month;
|
||||
break;
|
||||
case 2:
|
||||
n = datetime.day;
|
||||
break;
|
||||
case 3:
|
||||
n = datetime.hour;
|
||||
break;
|
||||
case 4:
|
||||
n = datetime.minute;
|
||||
break;
|
||||
case 5:
|
||||
n = datetime.second;
|
||||
break;
|
||||
default:
|
||||
return grub_get_weekday_name (&datetime);
|
||||
}
|
||||
|
||||
grub_sprintf (buf, "%d", n);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
GRUB_MOD_INIT(datetime)
|
||||
{
|
||||
(void)mod; /* To stop warning. */
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 7; i++)
|
||||
grub_register_variable_hook (grub_datetime_names[i],
|
||||
grub_read_hook_datetime, 0);
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(datetime)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 7; i++)
|
||||
{
|
||||
grub_register_variable_hook (grub_datetime_names[i], 0, 0);
|
||||
grub_env_unset (grub_datetime_names[i]);
|
||||
}
|
||||
}
|
74
include/grub/i386/cmos.h
Normal file
74
include/grub/i386/cmos.h
Normal file
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_CPU_CMOS_H
|
||||
#define GRUB_CPU_CMOS_H 1
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/i386/io.h>
|
||||
|
||||
#define GRUB_CMOS_ADDR_REG 0x70
|
||||
#define GRUB_CMOS_DATA_REG 0x71
|
||||
|
||||
#define GRUB_CMOS_INDEX_SECOND 0
|
||||
#define GRUB_CMOS_INDEX_SECOND_ALARM 1
|
||||
#define GRUB_CMOS_INDEX_MINUTE 2
|
||||
#define GRUB_CMOS_INDEX_MINUTE_ALARM 3
|
||||
#define GRUB_CMOS_INDEX_HOUR 4
|
||||
#define GRUB_CMOS_INDEX_HOUR_ALARM 5
|
||||
#define GRUB_CMOS_INDEX_DAY_OF_WEEK 6
|
||||
#define GRUB_CMOS_INDEX_DAY_OF_MONTH 7
|
||||
#define GRUB_CMOS_INDEX_MONTH 8
|
||||
#define GRUB_CMOS_INDEX_YEAR 9
|
||||
|
||||
#define GRUB_CMOS_INDEX_STATUS_A 0xA
|
||||
#define GRUB_CMOS_INDEX_STATUS_B 0xB
|
||||
#define GRUB_CMOS_INDEX_STATUS_C 0xC
|
||||
#define GRUB_CMOS_INDEX_STATUS_D 0xD
|
||||
|
||||
#define GRUB_CMOS_STATUS_B_DAYLIGHT 1
|
||||
#define GRUB_CMOS_STATUS_B_24HOUR 2
|
||||
#define GRUB_CMOS_STATUS_B_BINARY 4
|
||||
|
||||
static inline grub_uint8_t
|
||||
grub_bcd_to_num (grub_uint8_t a)
|
||||
{
|
||||
return ((a >> 4) * 10 + (a & 0xF));
|
||||
}
|
||||
|
||||
static inline grub_uint8_t
|
||||
grub_num_to_bcd (grub_uint8_t a)
|
||||
{
|
||||
return (((a / 10) << 4) + (a % 10));
|
||||
}
|
||||
|
||||
static inline grub_uint8_t
|
||||
grub_cmos_read (grub_uint8_t index)
|
||||
{
|
||||
grub_outb (index, GRUB_CMOS_ADDR_REG);
|
||||
return grub_inb (GRUB_CMOS_DATA_REG);
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_cmos_write (grub_uint8_t index, grub_uint8_t value)
|
||||
{
|
||||
grub_outb (index, GRUB_CMOS_ADDR_REG);
|
||||
grub_outb (value, GRUB_CMOS_DATA_REG);
|
||||
}
|
||||
|
||||
#endif /* GRUB_CPU_CMOS_H */
|
44
include/grub/lib/datetime.h
Normal file
44
include/grub/lib/datetime.h
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef KERNEL_DATETIME_HEADER
|
||||
#define KERNEL_DATETIME_HEADER 1
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/err.h>
|
||||
|
||||
struct grub_datetime
|
||||
{
|
||||
grub_uint16_t year;
|
||||
grub_uint8_t month;
|
||||
grub_uint8_t day;
|
||||
grub_uint8_t hour;
|
||||
grub_uint8_t minute;
|
||||
grub_uint8_t second;
|
||||
};
|
||||
|
||||
/* Return date and time. */
|
||||
grub_err_t grub_get_datetime (struct grub_datetime *datetime);
|
||||
|
||||
/* Set date and time. */
|
||||
grub_err_t grub_set_datetime (struct grub_datetime *datetime);
|
||||
|
||||
int grub_get_weekday (struct grub_datetime *datetime);
|
||||
char *grub_get_weekday_name (struct grub_datetime *datetime);
|
||||
|
||||
#endif /* ! KERNEL_DATETIME_HEADER */
|
|
@ -146,10 +146,10 @@ grub_env_insert (struct grub_env_context *context,
|
|||
int idx = grub_env_hashval (var->name);
|
||||
|
||||
/* Insert the variable into the hashtable. */
|
||||
var->prevp = &context->vars[idx];;
|
||||
var->prevp = &context->vars[idx];
|
||||
var->next = context->vars[idx];
|
||||
if (var->next)
|
||||
var->next->prevp = &var;
|
||||
var->next->prevp = &(var->next);
|
||||
context->vars[idx] = var;
|
||||
}
|
||||
|
||||
|
|
49
lib/datetime.c
Normal file
49
lib/datetime.c
Normal file
|
@ -0,0 +1,49 @@
|
|||
/* datetime.c - Module for common datetime function. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/lib/datetime.h>
|
||||
|
||||
static char *grub_weekday_names[] =
|
||||
{
|
||||
"Sunday",
|
||||
"Monday",
|
||||
"Tuesday",
|
||||
"Wednesday",
|
||||
"Thursday",
|
||||
"Friday",
|
||||
"Saturday",
|
||||
};
|
||||
|
||||
int
|
||||
grub_get_weekday (struct grub_datetime *datetime)
|
||||
{
|
||||
int a, y, m;
|
||||
|
||||
a = (14 - datetime->month) / 12;
|
||||
y = datetime->year - a;
|
||||
m = datetime->month + 12 * a - 2;
|
||||
|
||||
return (datetime->day + y + y / 4 - y / 100 + y / 400 + (31 * m / 12)) % 7;
|
||||
}
|
||||
|
||||
char *
|
||||
grub_get_weekday_name (struct grub_datetime *datetime)
|
||||
{
|
||||
return grub_weekday_names[grub_get_weekday (datetime)];
|
||||
}
|
79
lib/efi/datetime.c
Normal file
79
lib/efi/datetime.c
Normal file
|
@ -0,0 +1,79 @@
|
|||
/* kern/efi/datetime.c - efi datetime function.
|
||||
*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/efi/api.h>
|
||||
#include <grub/efi/efi.h>
|
||||
#include <grub/lib/datetime.h>
|
||||
|
||||
grub_err_t
|
||||
grub_get_datetime (struct grub_datetime *datetime)
|
||||
{
|
||||
grub_efi_status_t status;
|
||||
struct grub_efi_time efi_time;
|
||||
|
||||
status = efi_call_2 (grub_efi_system_table->runtime_services->get_time,
|
||||
&efi_time, 0);
|
||||
|
||||
if (status)
|
||||
return grub_error (GRUB_ERR_INVALID_COMMAND,
|
||||
"can\'t get datetime using efi");
|
||||
else
|
||||
{
|
||||
datetime->year = efi_time.year;
|
||||
datetime->month = efi_time.month;
|
||||
datetime->day = efi_time.day;
|
||||
datetime->hour = efi_time.hour;
|
||||
datetime->minute = efi_time.minute;
|
||||
datetime->second = efi_time.second;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
grub_set_datetime (struct grub_datetime *datetime)
|
||||
{
|
||||
grub_efi_status_t status;
|
||||
struct grub_efi_time efi_time;
|
||||
|
||||
status = efi_call_2 (grub_efi_system_table->runtime_services->get_time,
|
||||
&efi_time, 0);
|
||||
|
||||
if (status)
|
||||
return grub_error (GRUB_ERR_INVALID_COMMAND,
|
||||
"can\'t get datetime using efi");
|
||||
|
||||
efi_time.year = datetime->year;
|
||||
efi_time.month = datetime->month;
|
||||
efi_time.day = datetime->day;
|
||||
efi_time.hour = datetime->hour;
|
||||
efi_time.minute = datetime->minute;
|
||||
efi_time.second = datetime->second;
|
||||
|
||||
status = efi_call_1 (grub_efi_system_table->runtime_services->set_time,
|
||||
&efi_time);
|
||||
|
||||
if (status)
|
||||
return grub_error (GRUB_ERR_INVALID_COMMAND,
|
||||
"can\'t set datetime using efi");
|
||||
|
||||
return 0;
|
||||
}
|
155
lib/i386/datetime.c
Normal file
155
lib/i386/datetime.c
Normal file
|
@ -0,0 +1,155 @@
|
|||
/* kern/i386/datetime.c - x86 CMOS datetime function.
|
||||
*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/lib/datetime.h>
|
||||
#include <grub/i386/cmos.h>
|
||||
|
||||
grub_err_t
|
||||
grub_get_datetime (struct grub_datetime *datetime)
|
||||
{
|
||||
int is_bcd, is_12hour;
|
||||
grub_uint8_t value, flag;
|
||||
|
||||
flag = grub_cmos_read (GRUB_CMOS_INDEX_STATUS_B);
|
||||
|
||||
is_bcd = ! (flag & GRUB_CMOS_STATUS_B_BINARY);
|
||||
|
||||
value = grub_cmos_read (GRUB_CMOS_INDEX_YEAR);
|
||||
if (is_bcd)
|
||||
value = grub_bcd_to_num (value);
|
||||
|
||||
datetime->year = value;
|
||||
datetime->year += (value < 80) ? 2000 : 1900;
|
||||
|
||||
value = grub_cmos_read (GRUB_CMOS_INDEX_MONTH);
|
||||
if (is_bcd)
|
||||
value = grub_bcd_to_num (value);
|
||||
|
||||
datetime->month = value;
|
||||
|
||||
value = grub_cmos_read (GRUB_CMOS_INDEX_DAY_OF_MONTH);
|
||||
if (is_bcd)
|
||||
value = grub_bcd_to_num (value);
|
||||
|
||||
datetime->day = value;
|
||||
|
||||
is_12hour = ! (flag & GRUB_CMOS_STATUS_B_24HOUR);
|
||||
|
||||
value = grub_cmos_read (GRUB_CMOS_INDEX_HOUR);
|
||||
if (is_12hour)
|
||||
{
|
||||
is_12hour = (value & 0x80);
|
||||
|
||||
value &= 0x7F;
|
||||
value--;
|
||||
}
|
||||
|
||||
if (is_bcd)
|
||||
value = grub_bcd_to_num (value);
|
||||
|
||||
if (is_12hour)
|
||||
value += 12;
|
||||
|
||||
datetime->hour = value;
|
||||
|
||||
value = grub_cmos_read (GRUB_CMOS_INDEX_MINUTE);
|
||||
if (is_bcd)
|
||||
value = grub_bcd_to_num (value);
|
||||
|
||||
datetime->minute = value;
|
||||
|
||||
value = grub_cmos_read (GRUB_CMOS_INDEX_SECOND);
|
||||
if (is_bcd)
|
||||
value = grub_bcd_to_num (value);
|
||||
|
||||
datetime->second = value;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
grub_set_datetime (struct grub_datetime *datetime)
|
||||
{
|
||||
int is_bcd, is_12hour;
|
||||
grub_uint8_t value, flag;
|
||||
|
||||
flag = grub_cmos_read (GRUB_CMOS_INDEX_STATUS_B);
|
||||
|
||||
is_bcd = ! (flag & GRUB_CMOS_STATUS_B_BINARY);
|
||||
|
||||
value = ((datetime->year >= 2000) ? datetime->year - 2000 :
|
||||
datetime->year - 1900);
|
||||
|
||||
if (is_bcd)
|
||||
value = grub_num_to_bcd (value);
|
||||
|
||||
grub_cmos_write (GRUB_CMOS_INDEX_YEAR, value);
|
||||
|
||||
value = datetime->month;
|
||||
|
||||
if (is_bcd)
|
||||
value = grub_num_to_bcd (value);
|
||||
|
||||
grub_cmos_write (GRUB_CMOS_INDEX_MONTH, value);
|
||||
|
||||
value = datetime->day;
|
||||
|
||||
if (is_bcd)
|
||||
value = grub_num_to_bcd (value);
|
||||
|
||||
grub_cmos_write (GRUB_CMOS_INDEX_DAY_OF_MONTH, value);
|
||||
|
||||
value = datetime->hour;
|
||||
|
||||
is_12hour = (! (flag & GRUB_CMOS_STATUS_B_24HOUR));
|
||||
|
||||
if (is_12hour)
|
||||
{
|
||||
value++;
|
||||
|
||||
if (value > 12)
|
||||
value -= 12;
|
||||
else
|
||||
is_12hour = 0;
|
||||
}
|
||||
|
||||
if (is_bcd)
|
||||
value = grub_num_to_bcd (value);
|
||||
|
||||
if (is_12hour)
|
||||
value |= 0x80;
|
||||
|
||||
grub_cmos_write (GRUB_CMOS_INDEX_HOUR, value);
|
||||
|
||||
value = datetime->minute;
|
||||
|
||||
if (is_bcd)
|
||||
value = grub_num_to_bcd (value);
|
||||
|
||||
grub_cmos_write (GRUB_CMOS_INDEX_MINUTE, value);
|
||||
|
||||
value = datetime->second;
|
||||
|
||||
if (is_bcd)
|
||||
value = grub_num_to_bcd (value);
|
||||
|
||||
grub_cmos_write (GRUB_CMOS_INDEX_SECOND, value);
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in a new issue