13 Pages V   1 2 3 > »   
Reply to this topic
 UBCD5.00 (beta7) grub4dos menu
post Oct 30 2008, 02:02 AM
Post #1
Icecube
Silver Member   ****
Group: Advanced user

  Joined: 7-September 08
Posts: 641
Thank(s): 172


Belgium


It seems that there are people who want a grub4dos menu for Ultimate Boot CD. If you want a grub4dos menu in UBCD500, it is now time to make it.

See: http://www.ultimatebootcd.com/forums/viewtopic.php?t=1635


--------------------

The revenue from clicking on publicity at this post is helping Icecube
Boot Land shares publicity revenue with its members.

.
+Quote Post
post Dec 22 2008, 10:27 PM
Post #2
Icecube
Silver Member   ****
Group: Advanced user

  Joined: 7-September 08
Posts: 641
Thank(s): 172


Belgium


Is nobody interested in making grub4dos menu entries for ultimate boot cd V5.00 so a download to the official page can be added?

Download UBCD50beta7 from: http://www.ultimatebootcd.com/forums/viewtopic.php?t=1698.


--------------------
+Quote Post
post Dec 23 2008, 01:01 AM
Post #3
mr_
Frequent Member   ***
Group: Members

  Joined: 19-June 08
Posts: 357
Thank(s): 9


Germany


I am interested to see grub4dos in UBCD and UBCD4WIN.

However, I can join only a limited number of projects therefore I am not interested in contributing.
+Quote Post
post Dec 23 2008, 09:16 AM
Post #4
was_jaclaz
Finder   ******
Group: Advanced user

  Joined: 14-July 06 From: Gone in the mist

Posts: 7,230
Thank(s): 564


Italy


It seems to me that poorman over at http://www.ultimatebootcd.com/forums/viewtopic.php?t=1635 is willing to do the work.

If he starts from the "base" from ilko:
http://www.boot-land.net/forums/index.php?...=4486&st=11

I am sure he can do much of the work by himself.

If he has any doubt/needs any help in the "translation", we are here. smile.gif

jaclaz


--------------------
+Quote Post
post Dec 23 2008, 09:55 AM
Post #5
Icecube
Silver Member   ****
Group: Advanced user

  Joined: 7-September 08
Posts: 641
Thank(s): 172


Belgium


The last post from him is from 30 Oct 2008 so I don't expect much of it.

There is a problem with GRUB4dos for the fdubcd.img (freedos image), which needs additional command line parameters passed after the memdisk command.

CODE
title Ranish Partition Manager V2.40
kernel /isolinux/memdisk ubcdcmd=ranish
initrd /ubcd/images/fdubcd.igz


Info about the Freedos image of UBCD

If you want that you can launch the freedos image with the selected program directly, with the help of the ubcdcmd=ranish parameter, grub4dos needs a change.

The freedos image (fdubcd.igz) gets this parameter from memdisk by the program getargs.com inside this freedos image. The getargs.com program reads the parameters that are passed to memdisk from the memory of memdisk. See: http://people.cs.uchicago.edu/~gmurali/gui/downloads.html for the source code.

If you want that you can use grub4dos floppy emulation for booting dosubcd.igz with a command line parameter, you have to write (or ask bean or tinybit) a similar dos program for grub4dos, which is able to read out the command line parameters which are passed to the kernel command line.

If you we have such a program, I will let it incorporate in the freedos image.

Or a similar command to the grub4dos write ADDR VAL command which can use a syntax like:
CODE
memdiskargs ubcdcmd=ranish initrd=/ubcd/images/dosubcd.igz

that writes to a specific memory address that can retrieved by getargs.com or a similar program.


--------------------
+Quote Post
post Dec 23 2008, 01:26 PM
Post #6
was_jaclaz
Finder   ******
Group: Advanced user

  Joined: 14-July 06 From: Gone in the mist

Posts: 7,230
Thank(s): 564


Italy


It should be these lines in autoexec.bat:
CODE
set _memdisk=
set _linux=
if not exist %ramdrv%\bin\getargs.* goto _ngetargs
getargs >nul
if errorlevel 3 if not errorlevel 4 set _memdisk=3
if errorlevel 2 if not errorlevel 3 set _memdisk=2
if errorlevel 1 if not errorlevel 2 set _memdisk=1
:_ngetargs
if "%_memdisk%"=="" goto _nmemdsk
echo AUTOEXEC: MEMDISK(%_memdisk%)
getargs M >nul
if errorlevel 52 if not errorlevel 53 set _linux=4
if errorlevel 51 if not errorlevel 52 set _linux=3
if errorlevel 50 if not errorlevel 51 set _linux=2
if errorlevel 49 if not errorlevel 50 set _linux=1
if not "%_linux%"=="" echo AUTOEXEC: (%_linux%)LINUX
if not "%_linux%"=="1" goto _nmemdsk
if exist %ramdrv%\bin\modboot.* goto _nmemdsk


Unless I am mistaken, which is very possible unsure.gif, it seems to me like memdisk is required anyway for the batch to work, or at least the %_memdisk% variable needs to be defined.

In other words it seems like grub4dos should "emulate" memdisk in order to work with current getargs.com, or, as you proposed smile.gif, write a new (fictional name) getargsg4.com to parse differently memory and find the arguments, which however need to define the %_memdisk% variable.


Definitely it is something that will need tinybit or bean attention.

Personally I like more the idea of the "write ADDR VAL", since it does not need a change in the code.

Do you have any idea about the values of ADDR and VAL?

We could easily write a small batch to translate the actual needed values into a form compatible with grub4dos syntax.

I.e. leaving everything "as is" we submit to the batch the values from the partmgmt.cfg and we'll have the command lines to be added to the corresponding grub4dos .lst entry.

jaclaz





--------------------
+Quote Post
post Dec 23 2008, 02:23 PM
Post #7
Icecube
Silver Member   ****
Group: Advanced user

  Joined: 7-September 08
Posts: 641
Thank(s): 172


Belgium


The batch now requires indeed the memdisk variable, which is generated by the getargs.com program (reads the parameters passed by isolinux to memdisk from memory and it includes also the MEMDISK variable itself. This is outputted to a batch file which is run afterwards).
as702 is the maintainer of the freedos image now. So this can be changed easily (e.g.: a grub4dos variable instead of the memdisk one).
QUOTE
Personally I like more the idea of the "write ADDR VAL", since it does not need a change in the code.

Personally I don't like it. It makes it very difficult to understand what is passed to memdisk and it makes the config file very long because you need a lot of write commands below each other.
For a prove of concept the write command is usefull of course.
QUOTE
Do you have any idea about the values of ADDR and VAL?

For the VAL yes (at least I think so).
CODE
initrd=/ubcd/images/fdubcd.igz  ubcdcmd=ranish BOOT_IMAGE=memdisk

For the ADDR no.
Maybe someone is able to get the ADDR from the ource code of getargs.com:
CODE
/* -*- c -*- ------------------------------------------------------------- *
*
* Copyright 2003 Murali Krishnan Ganapathy - All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, Inc., 53 Temple Place Ste 330,
* Bostom MA 02111-1307, USA; either version 2 of the License, or
* (at your option) any later version; incorporated herein by reference.
*
* ----------------------------------------------------------------------- */
/* memdiskinfo and related code taken from mdiskchk.c by HPA */

/* This program can be compiled for DOS with the OpenWatcom compiler
* (http://www.openwatcom.org/):
*
* wcl -3 -osx -mt getargs.c
*/

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <i86.h>

/*
*
* Calculate the boot time arguments passed in
* and output a batch file which sets the appropriate
* boot time arguments in environment variables
*
*/

#define BUFSIZE 513 // Max size of command line

typedef unsigned long uint32_t;
typedef unsigned int uint16_t;

struct memdiskinfo {
uint16_t bytes; /* Bytes from memdisk */
uint16_t version; /* Memdisk version */
uint32_t base; /* Base of disk in high memory */
uint32_t size; /* Size of disk in sectors */
char far * cmdline; /* Command line */
void far * oldint13; /* Old INT 13h */
void far * oldint15; /* Old INT 15h */
uint16_t olddosmem;

/* We add our own fields at the end */
int cylinders;
int heads;
int sectors;
};

struct memdiskinfo * query_memdisk(int drive)
{
static struct memdiskinfo mm;
uint32_t _eax, _ebx, _ecx, _edx;
uint16_t _es, _di;
unsigned char _dl = drive;

__asm {
.386;
mov eax, 454d0800h;
mov ecx, 444d0000h;
mov edx, 53490000h;
mov dl, _dl;
mov ebx, 3f4b0000h;
int 13h;
mov _eax, eax;
mov _ecx, ecx;
mov _edx, edx;
mov _ebx, ebx;
mov _es, es;
mov _di, di
}

if ( _eax >> 16 != 0x4d21 ||
_ecx >> 16 != 0x4d45 ||
_edx >> 16 != 0x4944 ||
_ebx >> 16 != 0x4b53 )
return NULL;

_fmemcpy((void far *)&mm, (void far *)MK_FP(_es,_di), 26);
mm.cylinders = ((_ecx >> 8) & 0xff) + ((_ecx & 0xc0) << 2) + 1;
mm.heads = ((_edx >> 8) & 0xff) + 1;
mm.sectors = (_ecx & 0x3f);

return &mm;
}

unsigned int argarray(unsigned char *cmdline, unsigned char ***args)
/*
* Return an array of pointer to chars (strings) which
* the identify different args
* Some spaces in cmdline replaced with \0x0 to indicate
* end of argument
*/
{
unsigned char **ans;
unsigned char *ptr;
unsigned char *pch;
unsigned int num = 0;
unsigned int curr = 0;

ptr = cmdline;
while (*ptr) {
while ((*ptr) && (*ptr == ' ')) ptr++; // Ignore initial spaces
if (*ptr) num++;
while ((*ptr) && (*ptr != ' ')) ptr++; // Ignore all till next space
}

// num = number of arguments found
*args = malloc(num * sizeof (char *)); // Allocate space
ptr = cmdline;
curr = 0; // Setup the current pointer
while (*ptr) {
while ((*ptr) && (*ptr == ' ')) ptr++; // Ignore initial spaces
if (*ptr) (*args)[curr++] = ptr;
while ((*ptr) && (*ptr != ' ')) ptr++; // Ignore all till next space
(*ptr) = 0;
ptr++;
}
return num;
}

void parsecmdline(unsigned char __far *cmdline)
{
unsigned char **args;
unsigned int num,ctr;
unsigned char *buffer;

buffer = malloc(BUFSIZE* (sizeof(unsigned char)));
_fstrncpy(buffer,cmdline,BUFSIZE-2); // Copy cmdline into our buffer
buffer[BUFSIZE-1] = 0; // For safety

num = argarray(buffer,&args);
if (num <= 0) return;
printf("@ECHO OFF\n");
for (ctr=0; ctr < num; ctr++)
{
if (strchr(args[ctr],'='))
printf("SET %s\n",args[ctr]);
else
printf("SET %s=TRUE\n",args[ctr]);
}
}

int main(int argc, char *argv[])
{
int d;
int found = 0;
struct memdiskinfo *m;

for ( d = 0; d <= 0xff; d++ ) {
if ( (m = query_memdisk(d)) != NULL ) {
parsecmdline(m->cmdline);
found++;
}
}

//if (!found) printf("No MEMDISK drive found\n");
return found;
}

A memory viewer can be useful to determine the address.


--------------------
+Quote Post
post Dec 23 2008, 06:03 PM
Post #8
tinybit
Frequent Member   ***
Group: Developer

  Joined: 14-August 07
Posts: 485
Thank(s): 70


China


No need to use the obsolete “write addr val” method. smile.gif

Zw2312914 has invented a new approach. He makes use of the existing features of “default” and “savedefault” commands to write an integer value into the file “default”.

Here are the details:

First, create a file DEFAULT in the root dir of the image file. You need to copy the DEFAULT file from the grub4dos release.

Second, map this image file in memory using "map --mem ....... (fd0)", and followed by "map --hook".

Third, in a menu, use "default (fd0)/default" to specify the file DEFAULT for subsequent write by the savedefault command. Note that the DEFAULT file is now in the (fd0), and it is in memory.

Fourth, use savedefault command to write an integer into the file DEFAULT. This integer will act as a parameter that is passed to the image.

Fifth, boot the (fd0).

Sixth, a program in the (fd0) will read the integer stored previously as a parameter and take corresponding measures. Yes, the program can read the DEFAULT file because the DEFAULT file is in the root dir of (fd0).

At first glance, this process is difficult to understand. But this is certainly feasible, and has been in use.
1 user(s) said "Thank you!" to tinybit for this fantastic post:
Icecube
+Quote Post
post Dec 26 2008, 04:20 PM
Post #9
Icecube
Silver Member   ****
Group: Advanced user

  Joined: 7-September 08
Posts: 641
Thank(s): 172


Belgium


QUOTE
Zw2312914 have invented a new approach. He make use of the existing features of “default” and “savedefault” command to write an integer value into the file “default”.

Thanks, it works (but you have to add a number (e.g.: 0) in the beginning of the DEFAULT file (replace the first space), else you get an error).
  • Ungzip /ubcd/images/fdubcd.igz (rename to fdubcd.img.gz first).
  • Edit mount fdubcd.img.
  • Add a directory /args/ to the image.
  • Rename the DEFAULT file (2048 bytes) of the grub4dos package to grub4dos.arg
  • Change the first space in the grub4dos.arg to a 0.
  • Make grub4do2.arg and a grub4do3.arg file with the same content.
  • Save/unmount the fdubcd.img.
  • Gzip fdubcd.img and save as /ubcd/images/fdubcd.igz.


Converting a UBCD entry which uses the freedos image (fdubcd.igz) and the ubcdcmd= parameter to grub4dos syntax.
e.g.:
CODE
MENU LABEL Intel Processor Frequency ID V7.2.20041115 (P3 and below)
TEXT HELP
Reports information about your Intel CPU, including brand name, rated and
tested speed, cache memory, technologies and classification. Supports older
Intel CPU (P3 and below).
ENDTEXT
KERNEL memdisk
APPEND initrd=/ubcd/images/fdubcd.igz ubcdcmd=intelfid

Luckily for us, the “default” and “savedefault” command to write an integer value into a specified file can be done multiple times in the same menu entry.

Make a menu.lst file:
CODE
# Save the value after the ubcdcmd= parameter in the grub4do*.arg files
# Because the default command only accepts numbers,
# we have to convert all characters of the ubcdcmd parameter
# to ASCII codes (only the 2 cipher ones).
#
# Each grub4do*.arg file can hold 7 ciphers at maximum,
# we can use only 6 of them because when the total number
# starts with a 0, it will be stripped by grub4dos.
#   e.g.: "0123456" becomes "123456"
#
# We have 3 files to which we can save the ASCII codes (grub4do*.arg).
# So the maximum parameter name of the ubcdcmd parameter
# must be limited to 9 (3 files * 3 ASCII codes).
# The ubcdcmd parameter contains filenames of files without
# extension in the /ubcd/dosapps/ directory.
# The limit of 9 ASCII codes won't give a problem because
# filenames in dos are limited to 8 characters
# ( + 3 for the extension).
#
#
# Use the the following table to convert the charaters after
# the 'ubcdcmd=' parameter to ASCII codes:
#
###################################################
#   0: 48        A: 65        K: 75        U: 85  #
#   1: 49        B: 66        L: 76        V: 86  #
#   2: 50        C: 67        M: 77        W: 87  #
#   3: 51        D: 68        N: 78        X: 88  #
#   4: 52        E: 69        O: 79        Y: 89  #
#   5: 53        F: 70        P: 80        Z: 90  #
#   6: 54        G: 71        Q: 81               #
#   7: 55        H: 72        R: 82               #
#   8: 56        I: 73        S: 83               #
#   9: 57        J: 74        T: 84               #
###################################################
# We treat small and capital letters the same (A=a=65).
# For dos filenames it doesn't matter if it a small or a capital letter .

title Intel Processor Frequency ID V7.2.20041115 (P3 and below)
    find --set-root /ubcd/images/fdubcd.igz
    map --mem /ubcd/images/fdubcd.igz (fd0)
    map --hook
    chainloader (fd0)+1
    root (fd0)

    # What follows it the replacement of the ubcdcmd=intelfid parameter for grub4dos
    # Write the first 3 characters ('int') in ASCII (=737884) /args/grub4dos.arg
    default (fd0)/args/grub4dos.arg
    savedefault 737884
    # Write the next 3 characters ('elf') in ASCII (=697670) /args/grub4do2.arg
    default (fd0)/args/grub4do2.arg
    savedefault 697670
    # Write the last 2 characters ('id') in ASCII (=7368) to /args/grub4do3.arg
    default (fd0)/args/grub4do3.arg
    savedefault 7368

    boot

When you type vc (F3 to view file content) at the end of the boot process, you can find the right values in the grub4do*.arg files.

So a script can now read and convert the ubcdcmd parameter that is needed to unpack and launch the right package from the /ubcd/dosapps folder.

I am no dosguru so I don't know (yet?) how to do it.

Is there a way to replace (or to add below) the following text with a help text like the menu.c32 and vesamenu.c32 of syslinux can do?
CODE
Use the ↑ and ↓ keys to highlight an entry. Press ENTER or 'b' to boot.
Press 'e' to edit the commands before booting, or 'c' for a command line.


--------------------
+Quote Post
post Dec 26 2008, 08:23 PM
Post #10
was_jaclaz
Finder   ******
Group: Advanced user

  Joined: 14-July 06 From: Gone in the mist

Posts: 7,230
Thank(s): 564


Italy


QUOTE (tinybit @ Dec 23 2008, 08:03 PM) *
Zw2312914 has invented a new approach. He makes use of the existing features of “default” and “savedefault” commands to write an integer value into the file “default”.

What I do LOVE about grub4dos and it's developers is that with grub4dos and thanks to them you can do almost everything.
What I do HATE about grub4dos developers wink.gif is that to get some info or documentation from them or to get in Western countries what the good Chinese guys already know, is one of the most difficult things in the world.

I guess I'll have to study a bit of Chinese just to keep me up-to-date. roll1.gif


QUOTE (Icecube)
I am no dosguru so I don't know (yet?) how to do it.


Neither am I, but I'll see what I can do. smile.gif


jaclaz


--------------------
+Quote Post

13 Pages V   1 2 3 > » 
Reply to this topic
3 User(s) are reading this topic ()



Collapse

  Topic Replies Topic Starter Views Last Action
No New Posts Grub4dos iso Size Limit?
1 sara - pmedia 106 Yesterday, 08:31 AM
Last post by: Wonko the Sane
No new grub4dos booting ubuntu iso
29 mipstien 12,435 27th August 2010 - 10:27 AM
Last post by: Wonko the Sane
No new Topic has attachmentsGRUB4DOS + WinVBlock
47 Sha0 2,744 25th August 2010 - 01:12 PM
Last post by: Wonko the Sane
No New Posts Grub4Dos savedefault does not work
4 davidwolf 1,507 17th August 2010 - 09:13 PM
Last post by: tinybit
No new Pinned: Topic has attachmentsGrub4dos Guide/Tutorial
79 diddy 67,758 15th August 2010 - 08:26 AM
Last post by: Wonko the Sane