[syslinux] default64 patch?
Luciano Rocha
strange at nsk.no-ip.org
Wed Jul 16 15:57:45 PDT 2008
On Wed, Jul 16, 2008 at 02:46:51PM -0700, H. Peter Anvin wrote:
> Daniel Baumann wrote:
> > Andrew Stuart wrote:
> >> The patch is against 3.51, but looks like it would port over to a
> >> current release easily enough.
> >
> > We have similar ones in Debian (for 3.70)
> >
> > http://git.debian.net/?p=syslinux.git;a=blob;f=debian/patches/02-64bit-autodetection.dpatch;h=c5b7d22c90943a50afbfc5c4346fbb205a4306ff;hb=debian
> >
> > and
> >
> > http://git.debian.net/?p=syslinux.git;a=blob;f=debian/patches/03-64bit-autodetection-menu.dpatch;h=c0a15524f4baaf0ec95ef8195155a743c403c313;hb=debian
> >
>
> I have rejected this before.
>
> I will not added this or any other hardware detection to the assembly
> code code. It can be done much more cleanly in a very small com32 module.
I've gone that route, and I submitted it on this list in April 2007:
http://syslinux.zytor.com/archives/2007-April/008383.html
My current code is attached.
But it could be simplified. Does syslinux_run_command() takes defined
labels in consideration?
--
lfr
0/0
-------------- next part --------------
/* ----------------------------------------------------------------------- *
*
* Copyright 2007 Luciano Rocha - 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,
* Boston MA 02111-1307, USA; either version 2 of the License, or
* (at your option) any later version; incorporated herein by reference.
*
* ----------------------------------------------------------------------- */
/*
* b32or64.c
*
* Load kernel depending on cpu support for long mode (64 bits)
*/
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <console.h>
#include <cpuid.h>
#include <syslinux/boot.h>
int main(int argc, char *argv[])
{
char **arg;
char cmdline[1024];
int i;
unsigned p;
s_cpu cpu;
openconsole(&dev_stdcon_r, &dev_stdcon_w);
if (argc < 5) {
fprintf(stderr, "missing options, usage:\n"
" b23or64 <32b kernel> <32b arg> \\"
" <64b kernel> <64b arg> \\"
" [common arguments]\n");
return 1;
}
detect_cpu(&cpu);
if (cpu.flags.lm) {
arg = argv + 3;
} else {
arg = argv + 1;
}
p = snprintf(cmdline, sizeof cmdline - 1, "%s %s ",
arg[0], arg[1]);
for (i = 5; i < argc; i++) {
unsigned l = strlen(argv[i]);
if ((p + l + 1) >= sizeof cmdline) {
fprintf(stderr, "command line exceeds internal "
"buffers, trimmed.\n");
break;
}
memcpy(cmdline + p, argv[i], l);
cmdline[p + l] = ' ';
p += l + 1;
}
cmdline[p] = '\0';
syslinux_run_command(cmdline);
return 1;
}
More information about the Syslinux
mailing list