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_WRITE0x70 #define RTC_PORT_READ 0x71 #define RTC_REG_SECOND0x00 #define RTC_REG_MINUTE0x02 #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)(((x0xf0)4)*10 + (x0x0f) ) /* 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++ = (day4)+'0'; *str++ = (day0x0f)+'0'; *str++ = /; *str++ = (month4)+'0'; *str++ = (month0x0f)+'0'; *str++ = /; *str++ = (year4)+'0'; *str++ = (year0x0f)+'0'; *str++ = ; *str++ = (hour4)+'0'; *str++ = (hour0x0f)+'0'; *str++ = :; *str++ = (minute4)+'0'; *str++ = (minute0x0f)+'0'; *str++ = :; *str++ = (second4)+'0'; *str++ = (second0x0f)+'0'; *str++ = 0; } adrian15 ___ Bug-grub mailing list Bug-grub@gnu.org http://lists.gnu.org/mailman/listinfo/bug-grub
RE: need to program grub by hour and date?
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: bug-grub@gnu.org 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_WRITE0x70 #define RTC_PORT_READ 0x71 #define RTC_REG_SECOND0x00 #define RTC_REG_MINUTE0x02 #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)(((x0xf0)4)*10 + (x0x0f) ) /* 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++ = (day4)+'0'; *str++ = (day0x0f)+'0'; *str++ = /; *str++ = (month4)+'0'; *str++ = (month0x0f)+'0'; *str++ = /; *str++ = (year4)+'0'; *str++ = (year0x0f)+'0'; *str++ = ; *str++ = (hour4)+'0'; *str++ = (hour0x0f)+'0'; *str++ = :; *str++ = (minute4)+'0'; *str++ = (minute0x0f)+'0'; *str++ = :; *str++ = (second4)+'0'; *str++ = (second0x0f)+'0'; *str++ = 0; } adrian15 ___ Bug-grub mailing list Bug-grub@gnu.org http://lists.gnu.org/mailman/listinfo/bug-grub ___ Bug-grub mailing list Bug-grub@gnu.org http://lists.gnu.org/mailman/listinfo/bug-grub
Re: need to program grub by hour and date?
Kjeld Flarup Christensen (ST/LMD) wrote: 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 I prefer the dchp method but there are some advantages with the offline method. 1) You don't have to depend on your dhcp admin for making it work. 2) You don't know how to set up a dhcp server or you don't have money for buying it. 3) You have used always Linux in a very user way. 4) You want that each computer works differently, not a single configuration for every computer. (I know that this can also be done with dhcp way). adrian15 ___ Bug-grub mailing list Bug-grub@gnu.org http://lists.gnu.org/mailman/listinfo/bug-grub
[bug #13338] link to 'grub wiki' doesn't work
Update of bug #13338 (project grub): Open/Closed:Open = Closed ___ Reply to this item at: http://savannah.gnu.org/bugs/?func=detailitemitem_id=13338 ___ Message sent via/by Savannah http://savannah.gnu.org/ ___ Bug-grub mailing list Bug-grub@gnu.org http://lists.gnu.org/mailman/listinfo/bug-grub
Using RPL to load grub
Hello, I have a touchscreen computer that has a RPL (remote program load) network boot ROM built into it. I was able to use the open source rpld program to load grub/stage2 and reached a grub command prompt. I was then able to use grub's DHCP and TFTP support to load an NFS root Linux kernel and net booted my touch panel with the stock network boot ROM. All is good. Except, I'd rather like to eliminate the interactive step at grub's command line, which is necessary because grub doesn't have a config file. So, rpld let's one place an arbitrary file into an arbitrary location in memory. If I were able to place the grub configuration file somehwere in memory where grub new to look for it, life would be happy indeed. Is there such a magical place? For reference, the rpld configuration file looks as follows: HOST { ethernet = 00:d0:c9:99:05:9c; FILE { path = /boot/grub/stage2; load = 0x8000; }; execute = 0x8000; }; Many thanks! Shaun ___ Bug-grub mailing list Bug-grub@gnu.org http://lists.gnu.org/mailman/listinfo/bug-grub
Re: rip-14.9: Modifying /boot/grub/menu.lst
On 2/9/06, Kjeld Flarup Christensen (ST/LMD) [EMAIL PROTECTED] wrote: Are you sure that your serial settings are correct? The settings were correct. It looks like the likely cause was a framebuffer patch he applied to GRUB on the RIP disc. I compiled GRUB 0.97 and replaced the version on the RIP disc, after which everything worked. -Original Message- From: [EMAIL PROTECTED] [mailto:bug-grub-bounces+kjeld.flarup.christensen=ericsson.com @gnu.org] On Behalf Of Svend Sorensen Sent: 8. februar 2006 01:07 To: bug-grub@gnu.org Subject: Fwd: rip-14.9: Modifying /boot/grub/menu.lst I am trying to modify RIP, a Linux live CD which uses GRUB to add serial console. After modifying the menu.lst file, GRUB will not boot any of the entries, and the menu gets scrambled. Here are the details, from the mail I sent to the developer of RIP: -- Forwarded message -- From: Svend Sorensen Date: Feb 6, 2006 3:39 PM Subject: rip-14.9: Modifying /boot/grub/menu.lst To: snip I am trying to remaster RIP v14.9, to add a default serial console to GRUB and Linux. GRUB refuses to boot after I have modified the menu.lst file. I followed the instructions in RIP.readme. After the step where the stock initrd is extracted: /rip2/boot/1# gzip -dc ../rootfs.cgz | cpio -iumdv I made a backup copy of ./boot/grub/menu.lst, then edited the menu.lst file to add a serial console: /rip2/boot/grub# cp -a menu.lst menu.lst.ORIG /rip2/boot/grub# vi menu.lst I have attached the final menu.lst file, but to summarize, I added the lines to set up GRUB's serial console output: serial --unit=0 --speed=9600 --word=8 --parity=no --stop=1 terminal --timeout=10 serial console and I made a copy of the Linux entries, adding serial console by appending the following to each kernel line: console=tty0 console=ttyS0,9600n8 I then modified the initrd, adding serial console support (my problem is with GRUB, so I will not go into these modifications). Finally I completed the instructions in RIP.readme regarding remastering. When I boot from the remastered disc, GRUB outputs the menu to the serial console correctly. However, when I attempt to boot a menu item (any item), GRUB complains: Filename must be either an absolute pathname or blocklist When it returns to the menu, the item titles are scrambled, and unreadable. I can select them, and edit them, but booting still results in the above error. GRUB behaves in this way whether I use the serial console, or the standard console. Do you have any idea why changing the menu.lst file results in GRUB refusing to boot anything? ___ Bug-grub mailing list Bug-grub@gnu.org http://lists.gnu.org/mailman/listinfo/bug-grub
Re: Using RPL to load grub
On Fri, Feb 10, 2006 at 10:53:05AM -0700, Shaun Jackman wrote: Hello, I have a touchscreen computer that has a RPL (remote program load) network boot ROM built into it. I was able to use the open source rpld program to load grub/stage2 and reached a grub command prompt. I was then able to use grub's DHCP and TFTP support to load an NFS root Linux kernel and net booted my touch panel with the stock network boot ROM. All is good. Except, I'd rather like to eliminate the interactive step at grub's command line, which is necessary because grub doesn't have a config file. So, rpld let's one place an arbitrary file into an arbitrary location in memory. If I were able to place the grub configuration file somehwere in memory where grub new to look for it, life would be happy indeed. Is there such a magical place? I have no idea, but I do not think it should be necessary - how did you compile your grub? I am pretty sure something like '--enable-diskless' should make it config through the network. I know this is so for nbgrub and pxegrub, but never tried what you did (rpl and stage2 directly). -- Didi ___ Bug-grub mailing list Bug-grub@gnu.org http://lists.gnu.org/mailman/listinfo/bug-grub
Re: Using RPL to load grub
On 2/10/06, Yedidyah Bar-David [EMAIL PROTECTED] wrote: I have no idea, but I do not think it should be necessary - how did you compile your grub? I am pretty sure something like '--enable-diskless' should make it config through the network. I know this is so for nbgrub and pxegrub, but never tried what you did (rpl and stage2 directly). I found the --enable-diskless option, but I didn't necessarily want to use nbgrub or pxegrub, since RPL is neither netboot nor PXE, although possibly it could be made to work with one of those. However, I found the stage2/diskless image -- which is usually used tacked onto a header image to create nbgrub and pxegrub -- is exactly what I want! Although, it's not installed by default. The open source rpld (Remote Program Load) can load it like this: FILE { path = /srv/tftp/diskless; load = 0x8200; }; execute = 0x8200; By default the diskless image fetches /boot/grub/menu.lst. Is it possible to specify something else? Preferably something dynamic, such as /tftpboot/grub/%s, where %s is the IP address of the booting machine. Cheers, Shaun ___ Bug-grub mailing list Bug-grub@gnu.org http://lists.gnu.org/mailman/listinfo/bug-grub
Re: Using RPL to load grub
On 2/10/06, Shaun Jackman [EMAIL PROTECTED] wrote: ... By default the diskless image fetches /boot/grub/menu.lst. Is it possible to specify something else? Preferably something dynamic, such as /tftpboot/grub/%s, where %s is the IP address of the booting machine. I used a text editor (vim) to patch the stage2/diskless image to replace the string /boot/grub/menu.lst with /srv/tftp/grub.conf. This trick worked great! It would be awesome though, if grub could accept a %s string here, which would be substituted for the device's IP address. Cheers, Shaun ___ Bug-grub mailing list Bug-grub@gnu.org http://lists.gnu.org/mailman/listinfo/bug-grub
savedefault missing?
I recently updated my debain system from 0.95 to .96 and grub-reboot seems to be missing from the install. Also savedefault no longer works at the command line. GNU GRUB version 0.97 (640K lower / 3072K upper memory) [ Minimal BASH-like line editing is supported. For the first word, TAB lists possible command completions. Anywhere else TAB lists the possible completions of a device/filename. ] grub savedefault Error 27: Unrecognized command grub savedefault 1 Error 27: Unrecognized command grub savedefault 3 Error 27: Unrecognized command grub I copied the stage files over after I did make install and I ran grub-install /dev/hda. Although I've seen other people ask about this problem .. I have not seen anyone post a solution and was wondering if you guys have it figured out yet? I've also tried grub-save-default and when it rebooted no changes were made. It just booted into the normal system. more info: neo:/boot/grub# ls -asl total 1249 1 drwxr-xr-x 2 root root1024 2006-02-11 02:24 . 1 drwxr-xr-x 4 root root1024 2006-02-10 06:28 .. 1 -rw-r--r-- 1 root root 197 2006-02-11 02:24 default 1 -rw-r--r-- 1 root root 30 2006-01-03 01:44 device.map 8 -rw-r--r-- 1 root root7744 2006-02-11 02:24 e2fs_stage1_5 8 -rw-r--r-- 1 root root7472 2006-02-11 02:24 fat_stage1_5 7 -rw-r--r-- 1 root root6752 2006-02-11 02:24 ffs_stage1_5 1055 -rwxr-xr-x 1 root root 1073160 2006-02-11 02:07 grub 7 -rw-r--r-- 1 root root6784 2006-02-11 02:24 iso9660_stage1_5 9 -rw-r--r-- 1 root root8288 2006-02-11 02:24 jfs_stage1_5 2 -rw-r--r-- 1 root root1387 2006-02-11 02:07 menu.lst 5 -rw-r--r-- 1 root root4185 2006-01-04 06:40 menu.lst~ 7 -rw-r--r-- 1 root root6944 2006-02-11 02:24 minix_stage1_5 9 -rw-r--r-- 1 root root9184 2006-02-11 02:24 reiserfs_stage1_5 1 -rw-r--r-- 1 root root 512 2006-02-11 02:24 stage1 103 -rw-r--r-- 1 root root 104370 2006-02-11 02:24 stage2 7 -rw-r--r-- 1 root root7124 2006-02-11 02:24 ufs2_stage1_5 7 -rw-r--r-- 1 root root6400 2006-02-11 02:24 vstafs_stage1_5 10 -rw-r--r-- 1 root root9224 2006-02-11 02:24 xfs_stage1_5 neo:/boot/grub# cat menu.lst default 0 timeout 5 color cyan/blue white/blue title WatchDog Kernel on Recovery root(hd0,0) kernel /vmlinuz-alrt root=/dev/hda4 ro savedefault boot title WatchDog Kernel on Normal root(hd0,0) kernel /vmlinuz-alrt root=/dev/hda3 ro savedefault boot title Debian GNU/Linux, kernel 2.6.8 root(hd0,0) kernel /vmlinuz-2.6.8 root=/dev/hda4 ro savedefault boot The splash screen shows the correct version on boot.. so I know I am using the current code. Suggestions? ___ Bug-grub mailing list Bug-grub@gnu.org http://lists.gnu.org/mailman/listinfo/bug-grub