Seeking permission to use GRUB derived code in GPLv2 software (U-Boot)
Hello,
I am the current maintainer of the x86 port of U-Boot
(http://www.denx.de/wiki/U-Boot/WebHome). I have done a lot of work getting the x86 port up and running after a very long period of neglect and am now getting stuck into some rather 'interesting' areas. One of which is the Real/Protected mode switching.
I came across grub-core/kern/i386/realmode.S which has a really nice Real/Protected mode switching code that fits my needs perfectly. Only problem is, GRUB is GPLv3 and U-Boot is GPLv2 (most is GPLv2+). There are plans to move U-Boot to GPLv3 so I have two options:
1) Wait on (and work towards) U-Boot becoming GPLv3
2) Humbly ask permission to use the core of the GRUB realmode.S
I've included the relevant code below - Is there anyone that can provide a definitive directive as to whether or not I could include this code in U-Boot?
Thanks,
Graeme
/*
* (C) Copyright 2010
* Graeme Russ, [email protected]
*
* (C) Copyright 2002
* Daniel Engström, Omicron Ceti AB, [email protected]
*
* See file CREDITS for list of people who contributed to this
* project.
*
* 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; either version 2 of
* the License, or (at your option) any later version.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
/*
* The underlying concept for this code was taken from GRUB, the license
* for which is included below
*/
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 1999,2000,2001,2002,2003,2005,2006,2007,2009,2010 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 <asm/processor.h>
#include <asm/processor-flags.h>
#define a32 addr32
#define d32 data32
#define DECLARE_REAL_MODE_INTERRUPT(x) \ .globl rmirq_##x; \ .hidden rmirq_##x; \ .type rmirq_##x, @function; \ .code16; \ rmirq_##x:; \ pushw $##x; \ jmp rmirq_common_entry;
.section .realmode, "ax"
/*
* Note: U-Boot is compiled with the options -mrtd and -mregparm=3.
* So the first three arguments are passed in %eax, %edx, and %ecx, * respectively, and if a function has a fixed number of arguments * and the number if greater than three, the function must return * with "ret $N" where N is ((the number of arguments) - 3) * 4.
*/
/* force 4-byte alignment */
.p2align 2
/*
* These next two routines, "real_to_prot" and "prot_to_real" are structured
* in a very specific way. Be very careful when changing them. *
* NOTE: Use of either one messes up %eax and %ebp and changes %esp to
* point to the appropriate stack
*/
.globl real_to_prot
.hidden real_to_prot
.type real_to_prot, @functionreal_to_prot:
/* We are in Real Mode */ .code16 cli /* fixup %ds in case it was modified */ xorw %ax, %ax movw %ax, %ds /* restore the GDT register */
d32 a32 lgdt saved_gdt
/* set the PE bit of CR0 */ movl %cr0, %eax orl $X86_CR0_PE, %eax movl %eax, %cr0 /* flush prefetch queue, reload %cs */ movw $pm_jmp_ptr, %ax movw %ax, %bp
d32 ljmp *(%bp)
/*
* The 48-bit far pointer is here (in the middle of the code) to make it
* easier to see what is going on
*/pm_jmp_ptr:
.long protcsegsaved_cs:
.word 0
protcseg:
/* We are now in Protected Mode */
.code32
/* restore the segment registers */ movw saved_ds, %ds movw saved_es, %es movw saved_fs, %fs movw saved_gs, %gs movw saved_ss, %ss /* save the return address */ movl (%esp), %ebp /* switch back to the protected mode stack */ movl saved_sp, %esp /* put the return address onto the protected mode stack */ movl %ebp, (%esp) /* zero %eax */ xorl %eax, %eax /* restore the IDT register */ lidt saved_idt sti /* return on the old (or initialized) stack! */ ret
.globl prot_to_real
.hidden prot_to_real
.type prot_to_real, @functionprot_to_real:
/* We are in Protected Mode */
.code32
cli
/* save the protected mode IDT and GDT pointers */
sidt saved_idt
sgdt saved_gdt
/* save the segment registers */
movw %cs, saved_cs
movw %ds, saved_ds
movw %es, saved_es
movw %fs, saved_fs
movw %gs, saved_gs
movw %ss, saved_ss
/* save the protected mode stack pointer */
movl %esp, saved_sp
/* copy the return address to the real mode stack */
movl (%esp), %eax
movl %eax, real_mode_stack_top
/* switch to the 16 bit protected mode code segment */
ljmp $(GDT_ENTRY_16BIT_CS * 8), $tmpcseg
tmpcseg:
/* clear the PE bit of CR0 */ movl %cr0, %eax andl $(~X86_CR0_PE), %eax movl %eax, %cr0 /* flush prefetch queue, reload %cs */ ljmp $0, $realcseg
realcseg:
/* we are now in Real Mode */
.code16
/* load segment registers */ xorw %ax, %ax movw %ax, %ds movw %ax, %es movw %ax, %fs movw %ax, %gs movw %ax, %ss /* switch to the real mode stack */ movl $real_mode_stack_top, %eax movl %eax, %esp /* load the interrupt descriptor table */ lidt realmode_idt_ptr sti /* return on new stack! */
d32 ret
.section .realmode, "ax"
.globl rmirq_common_entry
.hidden rmirq_common_entry
.type rmirq_common_entry, @functionrmirq_common_entry:
/* we are in Real Mode */ .code16 cld pushw %ss pushw %gs pushw %fs pushw %es pushw %ds pushl %eax movl %esp, %eax add $40, %eax pushl %eax pushl %ebp pushl %edi pushl %esi pushl %edx pushl %ecx pushl %ebx movl %esp, %eax
d32 call rmirq_llsr
popl %ebx popl %ecx popl %edx popl %esi popl %edi popl %ebp popl %eax popl %eax popw %ds popw %es popw %fs popw %gs popw %ss addl $2, %esp iret DECLARE_REAL_MODE_INTERRUPT(0) DECLARE_REAL_MODE_INTERRUPT(1) DECLARE_REAL_MODE_INTERRUPT(2) DECLARE_REAL_MODE_INTERRUPT(3) DECLARE_REAL_MODE_INTERRUPT(4) DECLARE_REAL_MODE_INTERRUPT(5) DECLARE_REAL_MODE_INTERRUPT(6) DECLARE_REAL_MODE_INTERRUPT(7) DECLARE_REAL_MODE_INTERRUPT(8) DECLARE_REAL_MODE_INTERRUPT(9) DECLARE_REAL_MODE_INTERRUPT(10) DECLARE_REAL_MODE_INTERRUPT(11) DECLARE_REAL_MODE_INTERRUPT(12) DECLARE_REAL_MODE_INTERRUPT(13) DECLARE_REAL_MODE_INTERRUPT(14) DECLARE_REAL_MODE_INTERRUPT(15) DECLARE_REAL_MODE_INTERRUPT(16) DECLARE_REAL_MODE_INTERRUPT(17) DECLARE_REAL_MODE_INTERRUPT(18) DECLARE_REAL_MODE_INTERRUPT(19) DECLARE_REAL_MODE_INTERRUPT(20) DECLARE_REAL_MODE_INTERRUPT(21) DECLARE_REAL_MODE_INTERRUPT(22) DECLARE_REAL_MODE_INTERRUPT(23) DECLARE_REAL_MODE_INTERRUPT(24) DECLARE_REAL_MODE_INTERRUPT(25) DECLARE_REAL_MODE_INTERRUPT(26) DECLARE_REAL_MODE_INTERRUPT(27) DECLARE_REAL_MODE_INTERRUPT(28) DECLARE_REAL_MODE_INTERRUPT(29) DECLARE_REAL_MODE_INTERRUPT(30) DECLARE_REAL_MODE_INTERRUPT(31) DECLARE_REAL_MODE_INTERRUPT(32) DECLARE_REAL_MODE_INTERRUPT(33) DECLARE_REAL_MODE_INTERRUPT(34) DECLARE_REAL_MODE_INTERRUPT(35) DECLARE_REAL_MODE_INTERRUPT(36) DECLARE_REAL_MODE_INTERRUPT(37) DECLARE_REAL_MODE_INTERRUPT(38) DECLARE_REAL_MODE_INTERRUPT(39) DECLARE_REAL_MODE_INTERRUPT(40) DECLARE_REAL_MODE_INTERRUPT(41) DECLARE_REAL_MODE_INTERRUPT(42) DECLARE_REAL_MODE_INTERRUPT(43) DECLARE_REAL_MODE_INTERRUPT(44) DECLARE_REAL_MODE_INTERRUPT(45) DECLARE_REAL_MODE_INTERRUPT(46) DECLARE_REAL_MODE_INTERRUPT(47) DECLARE_REAL_MODE_INTERRUPT(48) DECLARE_REAL_MODE_INTERRUPT(49) DECLARE_REAL_MODE_INTERRUPT(50) DECLARE_REAL_MODE_INTERRUPT(51) DECLARE_REAL_MODE_INTERRUPT(52) DECLARE_REAL_MODE_INTERRUPT(53) DECLARE_REAL_MODE_INTERRUPT(54) DECLARE_REAL_MODE_INTERRUPT(55) DECLARE_REAL_MODE_INTERRUPT(56) DECLARE_REAL_MODE_INTERRUPT(57) DECLARE_REAL_MODE_INTERRUPT(58) DECLARE_REAL_MODE_INTERRUPT(59) DECLARE_REAL_MODE_INTERRUPT(60) DECLARE_REAL_MODE_INTERRUPT(61) DECLARE_REAL_MODE_INTERRUPT(62) DECLARE_REAL_MODE_INTERRUPT(63) DECLARE_REAL_MODE_INTERRUPT(64) DECLARE_REAL_MODE_INTERRUPT(65) DECLARE_REAL_MODE_INTERRUPT(66) DECLARE_REAL_MODE_INTERRUPT(67) DECLARE_REAL_MODE_INTERRUPT(68) DECLARE_REAL_MODE_INTERRUPT(69) DECLARE_REAL_MODE_INTERRUPT(70) DECLARE_REAL_MODE_INTERRUPT(71) DECLARE_REAL_MODE_INTERRUPT(72) DECLARE_REAL_MODE_INTERRUPT(73) DECLARE_REAL_MODE_INTERRUPT(74) DECLARE_REAL_MODE_INTERRUPT(75) DECLARE_REAL_MODE_INTERRUPT(76) DECLARE_REAL_MODE_INTERRUPT(77) DECLARE_REAL_MODE_INTERRUPT(78) DECLARE_REAL_MODE_INTERRUPT(79) DECLARE_REAL_MODE_INTERRUPT(80) DECLARE_REAL_MODE_INTERRUPT(81) DECLARE_REAL_MODE_INTERRUPT(82) DECLARE_REAL_MODE_INTERRUPT(83) DECLARE_REAL_MODE_INTERRUPT(84) DECLARE_REAL_MODE_INTERRUPT(85) DECLARE_REAL_MODE_INTERRUPT(86) DECLARE_REAL_MODE_INTERRUPT(87) DECLARE_REAL_MODE_INTERRUPT(88) DECLARE_REAL_MODE_INTERRUPT(89) DECLARE_REAL_MODE_INTERRUPT(90) DECLARE_REAL_MODE_INTERRUPT(91) DECLARE_REAL_MODE_INTERRUPT(92) DECLARE_REAL_MODE_INTERRUPT(93) DECLARE_REAL_MODE_INTERRUPT(94) DECLARE_REAL_MODE_INTERRUPT(95) DECLARE_REAL_MODE_INTERRUPT(96) DECLARE_REAL_MODE_INTERRUPT(97) DECLARE_REAL_MODE_INTERRUPT(98) DECLARE_REAL_MODE_INTERRUPT(99) DECLARE_REAL_MODE_INTERRUPT(100) DECLARE_REAL_MODE_INTERRUPT(101) DECLARE_REAL_MODE_INTERRUPT(102) DECLARE_REAL_MODE_INTERRUPT(103) DECLARE_REAL_MODE_INTERRUPT(104) DECLARE_REAL_MODE_INTERRUPT(105) DECLARE_REAL_MODE_INTERRUPT(106) DECLARE_REAL_MODE_INTERRUPT(107) DECLARE_REAL_MODE_INTERRUPT(108) DECLARE_REAL_MODE_INTERRUPT(109) DECLARE_REAL_MODE_INTERRUPT(110) DECLARE_REAL_MODE_INTERRUPT(111) DECLARE_REAL_MODE_INTERRUPT(112) DECLARE_REAL_MODE_INTERRUPT(113) DECLARE_REAL_MODE_INTERRUPT(114) DECLARE_REAL_MODE_INTERRUPT(115) DECLARE_REAL_MODE_INTERRUPT(116) DECLARE_REAL_MODE_INTERRUPT(117) DECLARE_REAL_MODE_INTERRUPT(118) DECLARE_REAL_MODE_INTERRUPT(119) DECLARE_REAL_MODE_INTERRUPT(121) DECLARE_REAL_MODE_INTERRUPT(122) DECLARE_REAL_MODE_INTERRUPT(123) DECLARE_REAL_MODE_INTERRUPT(124) DECLARE_REAL_MODE_INTERRUPT(125) DECLARE_REAL_MODE_INTERRUPT(126) DECLARE_REAL_MODE_INTERRUPT(127) DECLARE_REAL_MODE_INTERRUPT(128) DECLARE_REAL_MODE_INTERRUPT(129) DECLARE_REAL_MODE_INTERRUPT(130) DECLARE_REAL_MODE_INTERRUPT(131) DECLARE_REAL_MODE_INTERRUPT(132) DECLARE_REAL_MODE_INTERRUPT(133) DECLARE_REAL_MODE_INTERRUPT(134) DECLARE_REAL_MODE_INTERRUPT(135) DECLARE_REAL_MODE_INTERRUPT(136) DECLARE_REAL_MODE_INTERRUPT(137) DECLARE_REAL_MODE_INTERRUPT(138) DECLARE_REAL_MODE_INTERRUPT(139) DECLARE_REAL_MODE_INTERRUPT(140) DECLARE_REAL_MODE_INTERRUPT(141) DECLARE_REAL_MODE_INTERRUPT(142) DECLARE_REAL_MODE_INTERRUPT(143) DECLARE_REAL_MODE_INTERRUPT(144) DECLARE_REAL_MODE_INTERRUPT(145) DECLARE_REAL_MODE_INTERRUPT(146) DECLARE_REAL_MODE_INTERRUPT(147) DECLARE_REAL_MODE_INTERRUPT(148) DECLARE_REAL_MODE_INTERRUPT(149) DECLARE_REAL_MODE_INTERRUPT(150) DECLARE_REAL_MODE_INTERRUPT(151) DECLARE_REAL_MODE_INTERRUPT(152) DECLARE_REAL_MODE_INTERRUPT(153) DECLARE_REAL_MODE_INTERRUPT(154) DECLARE_REAL_MODE_INTERRUPT(155) DECLARE_REAL_MODE_INTERRUPT(156) DECLARE_REAL_MODE_INTERRUPT(157) DECLARE_REAL_MODE_INTERRUPT(158) DECLARE_REAL_MODE_INTERRUPT(159) DECLARE_REAL_MODE_INTERRUPT(160) DECLARE_REAL_MODE_INTERRUPT(161) DECLARE_REAL_MODE_INTERRUPT(162) DECLARE_REAL_MODE_INTERRUPT(163) DECLARE_REAL_MODE_INTERRUPT(164) DECLARE_REAL_MODE_INTERRUPT(165) DECLARE_REAL_MODE_INTERRUPT(166) DECLARE_REAL_MODE_INTERRUPT(167) DECLARE_REAL_MODE_INTERRUPT(168) DECLARE_REAL_MODE_INTERRUPT(169) DECLARE_REAL_MODE_INTERRUPT(170) DECLARE_REAL_MODE_INTERRUPT(171) DECLARE_REAL_MODE_INTERRUPT(172) DECLARE_REAL_MODE_INTERRUPT(173) DECLARE_REAL_MODE_INTERRUPT(174) DECLARE_REAL_MODE_INTERRUPT(175) DECLARE_REAL_MODE_INTERRUPT(176) DECLARE_REAL_MODE_INTERRUPT(177) DECLARE_REAL_MODE_INTERRUPT(178) DECLARE_REAL_MODE_INTERRUPT(179) DECLARE_REAL_MODE_INTERRUPT(180) DECLARE_REAL_MODE_INTERRUPT(181) DECLARE_REAL_MODE_INTERRUPT(182) DECLARE_REAL_MODE_INTERRUPT(183) DECLARE_REAL_MODE_INTERRUPT(184) DECLARE_REAL_MODE_INTERRUPT(185) DECLARE_REAL_MODE_INTERRUPT(186) DECLARE_REAL_MODE_INTERRUPT(187) DECLARE_REAL_MODE_INTERRUPT(188) DECLARE_REAL_MODE_INTERRUPT(189) DECLARE_REAL_MODE_INTERRUPT(190) DECLARE_REAL_MODE_INTERRUPT(191) DECLARE_REAL_MODE_INTERRUPT(192) DECLARE_REAL_MODE_INTERRUPT(193) DECLARE_REAL_MODE_INTERRUPT(194) DECLARE_REAL_MODE_INTERRUPT(195) DECLARE_REAL_MODE_INTERRUPT(196) DECLARE_REAL_MODE_INTERRUPT(197) DECLARE_REAL_MODE_INTERRUPT(198) DECLARE_REAL_MODE_INTERRUPT(199) DECLARE_REAL_MODE_INTERRUPT(200) DECLARE_REAL_MODE_INTERRUPT(201) DECLARE_REAL_MODE_INTERRUPT(202) DECLARE_REAL_MODE_INTERRUPT(203) DECLARE_REAL_MODE_INTERRUPT(204) DECLARE_REAL_MODE_INTERRUPT(205) DECLARE_REAL_MODE_INTERRUPT(206) DECLARE_REAL_MODE_INTERRUPT(207) DECLARE_REAL_MODE_INTERRUPT(208) DECLARE_REAL_MODE_INTERRUPT(209) DECLARE_REAL_MODE_INTERRUPT(210) DECLARE_REAL_MODE_INTERRUPT(211) DECLARE_REAL_MODE_INTERRUPT(212) DECLARE_REAL_MODE_INTERRUPT(213) DECLARE_REAL_MODE_INTERRUPT(214) DECLARE_REAL_MODE_INTERRUPT(215) DECLARE_REAL_MODE_INTERRUPT(216) DECLARE_REAL_MODE_INTERRUPT(217) DECLARE_REAL_MODE_INTERRUPT(218) DECLARE_REAL_MODE_INTERRUPT(219) DECLARE_REAL_MODE_INTERRUPT(221) DECLARE_REAL_MODE_INTERRUPT(222) DECLARE_REAL_MODE_INTERRUPT(223) DECLARE_REAL_MODE_INTERRUPT(224) DECLARE_REAL_MODE_INTERRUPT(225) DECLARE_REAL_MODE_INTERRUPT(226) DECLARE_REAL_MODE_INTERRUPT(227) DECLARE_REAL_MODE_INTERRUPT(228) DECLARE_REAL_MODE_INTERRUPT(229) DECLARE_REAL_MODE_INTERRUPT(230) DECLARE_REAL_MODE_INTERRUPT(231) DECLARE_REAL_MODE_INTERRUPT(232) DECLARE_REAL_MODE_INTERRUPT(233) DECLARE_REAL_MODE_INTERRUPT(234) DECLARE_REAL_MODE_INTERRUPT(235) DECLARE_REAL_MODE_INTERRUPT(236) DECLARE_REAL_MODE_INTERRUPT(237) DECLARE_REAL_MODE_INTERRUPT(238) DECLARE_REAL_MODE_INTERRUPT(239) DECLARE_REAL_MODE_INTERRUPT(240) DECLARE_REAL_MODE_INTERRUPT(241) DECLARE_REAL_MODE_INTERRUPT(242) DECLARE_REAL_MODE_INTERRUPT(243) DECLARE_REAL_MODE_INTERRUPT(244) DECLARE_REAL_MODE_INTERRUPT(245) DECLARE_REAL_MODE_INTERRUPT(246) DECLARE_REAL_MODE_INTERRUPT(247) DECLARE_REAL_MODE_INTERRUPT(248) DECLARE_REAL_MODE_INTERRUPT(249) DECLARE_REAL_MODE_INTERRUPT(250) DECLARE_REAL_MODE_INTERRUPT(251) DECLARE_REAL_MODE_INTERRUPT(252) DECLARE_REAL_MODE_INTERRUPT(253) DECLARE_REAL_MODE_INTERRUPT(254) DECLARE_REAL_MODE_INTERRUPT(255)
.globl rmirq_def
.hidden rmirq_def
.type rmirq_def, @functionrmirq_def:
pushw $0xffff jmp rmirq_common_entry
.code32
realmode_idt_ptr:
.word 0x0400 /* limit */ .long 0x00000000 /* base */
saved_gdt:
.word 0x0000 /* limit */ .long 0x00000000 /* base */
saved_idt:
.word 0x0000 /* limit */ .long 0x00000000 /* base */
saved_sp:
.long 0
saved_ds:
.long 0
saved_es:
.long 0
saved_fs:
.long 0
saved_gs:
.long 0
saved_ss:
.long 0
real_mode_stack_bottom:
.org (. + 0x1000) real_mode_stack_top: .long 0
Quoted 8 lines · Graeme Russ
Hello,
I am the current maintainer of the x86 port of U-Boot
(http://www.denx.de/wiki/U-Boot/WebHome). I have done a lot of work getting the x86 port up and running after a very long period of neglect and am now getting stuck into some rather 'interesting' areas. One of which is the Real/Protected mode switching.
Quoted 9 lines
I came across
grub-core/kern/i386/realmode.Swhich has a really nice Real/Protected mode switching code that fits my needs perfectly. Only problem is, GRUB is GPLv3 and U-Boot is GPLv2 (most is GPLv2+). There are plans to move U-Boot to GPLv3 so I have two options:1) Wait on (and work towards) U-Boot becoming GPLv3
2) Humbly ask permission to use the core of the GRUBrealmode.S
<responding quickly>
Such a permission can be only given by either FSF or by combined agreement of all involved authors.
In this particular case you can grab r466 from GRUB bzr. It was before the migration to 3+. The relevant code is in startup.S. And once you migrate U-boot to 3(+) you ill be able to upgrade to current realmode.S if necessary.
Also I would be interested in better U-Boot and GRUB2 integration on platforms supported by both (x86, ppc. Perhaps sparc64 too). As I understand U-Boot is a firmware, mostly for embedded devices. In particular I think 5 following goals should be reasonable:
a) Load GRUB2 by U-Boot when GRUB is on HDD
b) Flash U-Boot+GRUB2 together. Basically a variation on (a) with GRUB residing on flash.
c) Load U-Boot from GRUB2 (I suppose you can make a test version of U-boot loadable from disk)
d) support U-Boot protocols in GRUB2, meaning loading the kernels loadable by U-Boot
e) Look into possibilities of multiboot2, especially adding tags for info currently absent from it and allow in this way to reduce number of booting formats present around.
So how would you recommend to proceed and which system would you consider as typical for U-Boot? Beagleboard?
Thanks in advance.
Signature · 2 lines
Regards Vladimir 'φ-coder/phcoder' Serbinenko
2011/2/11 Vladimir 'φ-coder/phcoder' Serbinenko <[email protected]>:
Quoted 14 lines · Graeme Russ
Quoted 13 lines
Hello,
I am the current maintainer of the x86 port of U-Boot
(http://www.denx.de/wiki/U-Boot/WebHome). I have done a lot of work getting the x86 port up and running after a very long period of neglect and am now getting stuck into some rather 'interesting' areas. One of which is the Real/Protected mode switching.I came across
grub-core/kern/i386/realmode.Swhich has a really nice Real/Protected mode switching code that fits my needs perfectly. Only problem is, GRUB is GPLv3 and U-Boot is GPLv2 (most is GPLv2+). There are plans to move U-Boot to GPLv3 so I have two options:
Quoted 7 lines
Quoted 4 lines
1) Wait on (and work towards) U-Boot becoming GPLv3
2) Humbly ask permission to use the core of the GRUBrealmode.S<responding quickly>
Such a permission can be only given by either FSF or by combined agreement of all involved authors.
I assumed that would be the case
Quoted 4 lines
In this particular case you can grab r466 from GRUB bzr. It was before the migration to 3+. The relevant code is in
startup.S. And once you migrate U-boot to 3(+) you ill be able to upgrade to currentrealmode.Sif necessary.
OK, I'll look into that
Quoted 9 lines
Also I would be interested in better U-Boot and GRUB2 integration on platforms supported by both (x86, ppc. Perhaps sparc64 too). As I understand U-Boot is a firmware, mostly for embedded devices. In particular I think 5 following goals should be reasonable:
a) Load GRUB2 by U-Boot when GRUB is on HDD
b) Flash U-Boot+GRUB2 together. Basically a variation on (a) with GRUB residing on flash.
c) Load U-Boot from GRUB2 (I suppose you can make a test version of U-boot loadable from disk)
Quoted 8 lines
d) support U-Boot protocols in GRUB2, meaning loading the kernels loadable by U-Boot
e) Look into possibilities of multiboot2, especially adding tags for info currently absent from it and allow in this way to reduce number of booting formats present around.
So how would you recommend to proceed and which system would you consider as typical for U-Boot? Beagleboard?
Thanks in advance.
For x86, there is already Coreboot which I assume can load GRUB
a) would be fairly easy - U-Boot already has read-only support for a number of filesystems, so I would assume it would be fairly trivial to have U-Boot load GRUB from a filesystem (either in Flash, HDD or even USB)
b) As you say, similar to a) but have GRUB as a raw image in Flash
Note: For both a) and b), GRUB could be compressed to save space (U-Boot has a compressed image format)
c) I've already thought of this as a way to enabled testing U-Boot on boards which have a BIOS you want to replace before you burn a permanent U-Boot onto the boards BIOS chip
d) Not sure what you mean
e) Not familiat with Multiboot2
Two more:
f) Merge GRUB's 'jump straight into Linux kernel's protected mode entry point' into U-Boot (U-Boot currently does a pointless switch back into real mode for the kernel's decompression stub to do its work)
g) Have U-Boot setup a data structure representing the hardware (Device Tree?) and pass this to GRUB - Removes the requirement for GRUB to probe hardware
Regards,
Graeme