Why not use a DHCP boot - you can still boot from the HD, but the DHCP server will give a different grub menu depending on the time.
Kjeld > -----Original Message----- > From: > [EMAIL PROTECTED] > > [mailto:bug-grub-bounces+kjeld.flarup.christensen=ericsson.com @gnu.org] On Behalf Of adrian15 > Sent: 10. februar 2006 10:08 > To: [email protected] > Subject: need to program grub by hour and date? > > Hi. I am planning to add some commands to Grub in order to > work with hour and date. > > I need situations on which this will be useful and requests > on how would the commands will be run. > > I propose you two situations. > > 1) Situation. Clusters > In an university or high school BIOS are set to be awake > at 00:00 hours. > Grub checks it is 00:00 or later but not later than 07:00 > (when the lessons begin) and runs an special boot entry for > making the computer a cluster client. > > 2) Situation. Lessons on high school. > Teachers and pupils don't dominate Grub menu... you have > to press keys with strange arrows and it is difficult. What a > stupid program! We cannot use Mouse! > So... menu.lst file is set up with the new dayow, and hour > commands so that the timetable is reflected when there's a > classroom related to computer sciences Linux is boot and when > there's an English or Physics classroom Windows is boot. > > So I am waiting your thoughts. > > > The idea would be commands such as: > > dayow 1 4 : Gives error if it's not Monday, Tuesday, > Wednesday or Thursday. > dayom 1 4 : Gives error if it's not 1 or 2 or 3 or 4 on the > current month. > hour 22 00 07 00 : Gives error if it's a time between 07:01 > AM and 09:59 PM (21:59h). > > If you have seen Super Grub Disk source code you will know > that I will use default and fallback entries to boot one > thing or another depending on errors. > > I have some code to use on the commands but I have not yet > worked on them: > > #define RTC_PORT_WRITE 0x70 > #define RTC_PORT_READ 0x71 > > #define RTC_REG_SECOND 0x00 > #define RTC_REG_MINUTE 0x02 > #define RTC_REG_HOUR 0x04 > #define RTC_REG_DOW 0x06 > #define RTC_REG_DAY 0x07 > #define RTC_REG_MONTH 0x08 > #define RTC_REG_YEAR 0x09 > > > > #define NIBBLE2DEC(x) (((x&0xf0)>>4)*10 + (x&0x0f) ) > /* alternativa: no hacer nada > #define NIBBLE2DEC(x) (x) > */ > > void rtc_read(void) > { > /* variables: hacer algo con ellas, o globales o lo que sea */ > char second, minute, hour; > char weekdate, day, month, year; > > /* Leer time */ > outb(RTC_PORT_WRITE, RTC_REG_SECOND); > second = NIBBLE2DEC(inb(RTC_PORT_READ)); > > outb(RTC_PORT_WRITE, RTC_REG_MINUTE); > minute = NIBBLE2DEC(inb(RTC_PORT_READ)); > > outb(RTC_PORT_WRITE, RTC_REG_HOUR); > hour = NIBBLE2DEC(inb(RTC_PORT_READ)); > > /* Leer fecha */ > outb(RTC_PORT_WRITE, RTC_REG_DOW); > weekdate = inb(RTC_PORT_READ); > > outb(RTC_PORT_WRITE, RTC_REG_DAY); > day = NIBBLE2DEC(inb(RTC_PORT_READ)); > > outb(RTC_PORT_WRITE, RTC_REG_MONTH); > month = NIBBLE2DEC(inb(RTC_PORT_READ)); > > outb(RTC_PORT_WRITE, RTC_REG_YEAR); > year = NIBBLE2DEC(inb(RTC_PORT_READ)); > > } > > void rtc_read(void) > { > /* variables: hacer algo con ellas, o globales o lo que sea */ > char second, minute, hour; > char weekdate, day, month, year; > char string[18], *str; > > /* Leer time */ > outb(RTC_PORT_WRITE, RTC_REG_SECOND; > second = inb(RTC_PORT_READ); > > outb(RTC_PORT_WRITE, RTC_REG_MINUTE; > minute = inb(RTC_PORT_READ); > > outb(RTC_PORT_WRITE, RTC_REG_HOUR; > hour = inb(RTC_PORT_READ); > > /* Leer fecha */ > outb(RTC_PORT_WRITE, RTC_REG_DOW; > weekdate = inb(RTC_PORT_READ; > > outb(RTC_PORT_WRITE, RTC_REG_DAY; > day = inb(RTC_PORT_READ); > > outb(RTC_PORT_WRITE, RTC_REG_MONTH; > month = inb(RTC_PORT_READ); > > outb(RTC_PORT_WRITE, RTC_REG_YEAR; > year = inb(RTC_PORT_READ); > > str = string; > *str++ = (day>>4)+'0'; > *str++ = (day&0x0f)+'0'; > *str++ = "/"; > *str++ = (month>>4)+'0'; > *str++ = (month&0x0f)+'0'; > *str++ = "/"; > *str++ = (year>>4)+'0'; > *str++ = (year&0x0f)+'0'; > *str++ = " "; > *str++ = (hour>>4)+'0'; > *str++ = (hour&0x0f)+'0'; > *str++ = ":"; > *str++ = (minute>>4)+'0'; > *str++ = (minute&0x0f)+'0'; > *str++ = ":"; > *str++ = (second>>4)+'0'; > *str++ = (second&0x0f)+'0'; > *str++ = 0; > } > > adrian15 > > > _______________________________________________ > Bug-grub mailing list > [email protected] > http://lists.gnu.org/mailman/listinfo/bug-grub > _______________________________________________ Bug-grub mailing list [email protected] http://lists.gnu.org/mailman/listinfo/bug-grub
