Patchwork unify types in kconfig

login
register
about
Submitter Myles Watson
Date 2009-08-25 21:41:11
Message ID <2831fecf0908251441s2e33c6fbu8359cddf34bcb23e@mail.gmail.com>
Download mbox | patch
Permalink /patch/193/
State Accepted
Headers show

Comments

Myles Watson - 2009-08-25 21:41:11
On Tue, Aug 25, 2009 at 12:41 PM, Myles Watson<mylesgw@gmail.com> wrote:
> On Tue, Aug 25, 2009 at 11:37 AM, ron minnich<rminnich@gmail.com> wrote:
>> On Tue, Aug 25, 2009 at 10:14 AM, Uwe Hermann<uwe@hermann-uwe.de> wrote:
>>
>>> Hm, you could be right. This was per-mainboard in Config.lb, but in
>>> kconfig it should be a global/common option, and not set in each board.
>>
>> yes, we really need to start using the power of Kconfig now. Let's
>> make it so people can choose this in menuconfig.
>
 Here's another attempt.
 Signed-off-by: Myles Watson <mylesgw@gmail.com>

  It doesn't link.  The errors I'm getting look familiar, but the past
solution isn't working for me:
    CC         coreboot_ram
/home/myles/try/buildrom-devel/work/coreboot/svn/build/coreboot_ram.o:
In function `div_long':
(.text+0x11c79): undefined reference to `__umoddi3'
/home/myles/try/buildrom-devel/work/coreboot/svn/build/coreboot_ram.o:
In function `div_long':
(.text+0x11c92): undefined reference to `__udivdi3'
/home/myles/try/buildrom-devel/work/coreboot/svn/build/coreboot_ram.o:
In function `idiv_long':
(.text+0x11dca): undefined reference to `__moddi3'
/home/myles/try/buildrom-devel/work/coreboot/svn/build/coreboot_ram.o:
In function `idiv_long':
(.text+0x11de3): undefined reference to `__divdi3'
collect2: ld returned 1 exit status
make: *** [/home/myles/try/buildrom-devel/work/coreboot/svn/build/coreboot_ram]
Error 1

These errors look like the same ones that can be fixed with
gcc-multilib, but I have that installed.  I'm not sure how these files
should be built now.

Thanks,
Myles
Cristi Magherusan - 2009-08-26 08:01:49
On Tue, 2009-08-25 at 15:41 -0600, Myles Watson wrote:
> On Tue, Aug 25, 2009 at 12:41 PM, Myles Watson<mylesgw@gmail.com> wrote:
> > On Tue, Aug 25, 2009 at 11:37 AM, ron minnich<rminnich@gmail.com> wrote:
> >> On Tue, Aug 25, 2009 at 10:14 AM, Uwe Hermann<uwe@hermann-uwe.de> wrote:
> >>
> >>> Hm, you could be right. This was per-mainboard in Config.lb, but in
> >>> kconfig it should be a global/common option, and not set in each board.
> >>
> >> yes, we really need to start using the power of Kconfig now. Let's
> >> make it so people can choose this in menuconfig.
> >
>  Here's another attempt.
>  Signed-off-by: Myles Watson <mylesgw@gmail.com>
> 
>   It doesn't link.  The errors I'm getting look familiar, but the past
> solution isn't working for me:
>     CC         coreboot_ram
> /home/myles/try/buildrom-devel/work/coreboot/svn/build/coreboot_ram.o:
> In function `div_long':
> (.text+0x11c79): undefined reference to `__umoddi3'
> /home/myles/try/buildrom-devel/work/coreboot/svn/build/coreboot_ram.o:
> In function `div_long':
> (.text+0x11c92): undefined reference to `__udivdi3'
> /home/myles/try/buildrom-devel/work/coreboot/svn/build/coreboot_ram.o:
> In function `idiv_long':
> (.text+0x11dca): undefined reference to `__moddi3'
> /home/myles/try/buildrom-devel/work/coreboot/svn/build/coreboot_ram.o:
> In function `idiv_long':
> (.text+0x11de3): undefined reference to `__divdi3'
> collect2: ld returned 1 exit status
> make: *** [/home/myles/try/buildrom-devel/work/coreboot/svn/build/coreboot_ram]
> Error 1
> 
> These errors look like the same ones that can be fixed with
> gcc-multilib, but I have that installed.  I'm not sure how these files
> should be built now.

Hello,

I stumbled upon these errors when porting to Asus M2V-MX-SE, and they
are related to libgcc. Coreboot needs to be linked against libgcc when
using 64bit arithmetic in 32bit code. 

There are a few approaches for fixing this, like:
-link against libgcc (statically)
-implement the needed functions ourselves (copied from libgcc)
-avoid using 64bit arithmetic

I'm in inclined to vote for the first approach.

Cristi
ron minnich - 2009-08-26 15:27:08
On Wed, Aug 26, 2009 at 1:01 AM, Cristi
Magherusan<Cristi.Magherusan@net.utcluj.ro> wrote:

> There are a few approaches for fixing this, like:
> -link against libgcc (statically)

Won't work on FC11.

From a note on 9fans:

=============
also, i discovered something new today:

"... decided to link everything dynamically. To enforce this (allmost)
all static libraries are removed (or not even build)..."

$ gcc t.c -static
/usr/bin/ld: cannot find -lc
collect2: ld returned 1 exit status
==============


> -implement the needed functions ourselves (copied from libgcc)

I vote for this one. Every time we count on stable (or even sane)
behavior from all linux distros or gnu toolchain, we get burned. I
think we need to be as standalone as possible.

There are, what, four functions at issue?

What really amazes me is that with all the inlining that is done
nowadays, these trivial functions are not inlined!

ron
Myles Watson - 2009-08-26 15:41:56
>  Here's another attempt.
>  Signed-off-by: Myles Watson <mylesgw@gmail.com>
Ping.  Now it builds.

Thanks,
Myles
Cristi Magherusan - 2009-08-26 16:01:04
On Wed, 2009-08-26 at 08:27 -0700, ron minnich wrote:
> On Wed, Aug 26, 2009 at 1:01 AM, Cristi
> Magherusan<Cristi.Magherusan@net.utcluj.ro> wrote:
> 
> > There are a few approaches for fixing this, like:
> > -link against libgcc (statically)
> 
> Won't work on FC11.
> 
> From a note on 9fans:
> 
> =============
> also, i discovered something new today:
> 
> "... decided to link everything dynamically. To enforce this (allmost)
> all static libraries are removed (or not even build)..."
> 
> $ gcc t.c -static
> /usr/bin/ld: cannot find -lc
> collect2: ld returned 1 exit status
> ==============
> 
> 
> > -implement the needed functions ourselves (copied from libgcc)
> 
> I vote for this one. Every time we count on stable (or even sane)
> behavior from all linux distros or gnu toolchain, we get burned. I
> think we need to be as standalone as possible.
> 
> There are, what, four functions at issue?
> 
> What really amazes me is that with all the inlining that is done
> nowadays, these trivial functions are not inlined!
> 
> ron
> 
Hello,

This issue will be decided and fixed in time, maybe even cleaner,
but now we need to have as much boards as possible work with
kconfig/Kbuild and the workaround I submitted makes it possible, not to
mention it was already done the same way in the older buildsystem.


Cristi
ron minnich - 2009-08-26 16:04:09
On Wed, Aug 26, 2009 at 9:01 AM, Cristi
Magherusan<Cristi.Magherusan@net.utcluj.ro> wrote:

> This issue will be decided and fixed in time, maybe even cleaner,
> but now we need to have as much boards as possible work with
> kconfig/Kbuild and the workaround I submitted makes it possible, not to
> mention it was already done the same way in the older buildsystem.


Agreed. You all made the right decision.

ron

Patch

Index: src/devices/Kconfig
===================================================================
--- src/devices/Kconfig	(revision 4582)
+++ src/devices/Kconfig	(working copy)
@@ -21,33 +21,35 @@ 
 menu "Devices"
 
 config VGA_ROM_RUN
-	bool
+	bool "Run VGA Option ROMs"
 	help
-	  Execute PCI/AGP option ROMs if available. This is required to
-	  enable PCI/AGP VGA plugin cards.
+	  Execute VGA option ROMs if found. This is required to enable PCI/AGP
+	  VGA plugin cards. 
 
-choice
-	prompt "Execute PCI option ROMs"
-	default PCI_OPTION_ROM_RUN_REALMODE
+config PCI_ROM_RUN
+	bool "Run non-VGA Option ROMs"
 	help
-	  Execute PCI/AGP option ROMs if available. You can choose to
-	  execute PCI option ROMs natively (32bit x86 system required),
-	  in an emulator (x86emu), or ignore option ROM execution.
+	  Execute non-VGA PCI option ROMs if found.
 
-config PCI_OPTION_ROM_RUN_REALMODE
-	prompt "Run VGA ROMs"
-	bool
-	select VGA_ROM_RUN
-	help
-	  Execute PCI/AGP option ROMs if available. This is required to
-	  enable PCI/AGP VGA plugin cards.
+choice
+        prompt "Option ROM Execution"
+        default  PCI_OPTION_ROM_RUN_REALMODE
+	depends on PCI_ROM_RUN || VGA_ROM_RUN
+        help
+          You can choose to execute PCI option ROMs natively (32bit x86 system
+	  required) or in an emulator (x86emu or YABEL).
 
-config NO_RUN
-	prompt "Do NOT run VGA ROMs"
-	bool
-	help
-	  Do not execute PCI/AGP option ROMs.
+	config PCI_OPTION_ROM_RUN_REALMODE
+		prompt "Real mode"
+		bool
 
+	config PCI_OPTION_ROM_RUN_YABEL
+		prompt "YABEL"
+		bool
+
+	config PCI_OPTION_ROM_RUN_X86EMU
+		prompt "X86EMU"
+		bool
 endchoice
 
 endmenu
Index: src/devices/Makefile.inc
===================================================================
--- src/devices/Makefile.inc	(revision 4582)
+++ src/devices/Makefile.inc	(working copy)
@@ -12,8 +12,8 @@ 
 obj-y += smbus_ops.o
 
 ifeq ($(CONFIG_PCI_ROM_RUN),y)
-obj-$(CONFIG_PCI_ROM_RUN) += pci_rom.o
-subdirs-$(CONFIG_PCI_ROM_RUN) += ../../util/x86emu
+obj-y += pci_rom.o
+subdirs-y += ../../util/x86emu
 else
 obj-$(CONFIG_VGA_ROM_RUN) += pci_rom.o
 subdirs-$(CONFIG_VGA_ROM_RUN) += ../../util/x86emu
Index: util/x86emu/Makefile.inc
===================================================================
--- util/x86emu/Makefile.inc	(revision 4582)
+++ util/x86emu/Makefile.inc	(working copy)
@@ -19,9 +19,12 @@ 
 ##
 
 subdirs-$(CONFIG_PCI_OPTION_ROM_RUN_X86EMU) += x86emu
-obj-$(CONFIG_PCI_OPTION_ROM_RUN_X86EMU) += biosemu.c
+obj-$(CONFIG_PCI_OPTION_ROM_RUN_X86EMU) += biosemu.o
 subdirs-$(CONFIG_PCI_OPTION_ROM_RUN_X86EMU) += pcbios
 
 obj-$(CONFIG_PCI_OPTION_ROM_RUN_REALMODE) += x86.o
 obj-$(CONFIG_PCI_OPTION_ROM_RUN_REALMODE) += x86_asm.o
 obj-$(CONFIG_PCI_OPTION_ROM_RUN_REALMODE) += x86_interrupts.o
+
+subdirs-$(CONFIG_PCI_OPTION_ROM_RUN_YABEL) += x86emu
+subdirs-$(CONFIG_PCI_OPTION_ROM_RUN_YABEL) += yabel
Index: util/x86emu/yabel/compat/Makefile.inc
===================================================================
--- util/x86emu/yabel/compat/Makefile.inc	(revision 0)
+++ util/x86emu/yabel/compat/Makefile.inc	(revision 0)
@@ -0,0 +1 @@ 
+obj-y += functions.o
Index: util/x86emu/yabel/Makefile.inc
===================================================================
--- util/x86emu/yabel/Makefile.inc	(revision 0)
+++ util/x86emu/yabel/Makefile.inc	(revision 0)
@@ -0,0 +1,8 @@ 
+obj-y += biosemu.o
+obj-y += debug.o
+obj-y += device.o
+obj-y += interrupt.o
+obj-y += io.o
+obj-y += mem.o
+obj-y += pmm.o
+subdirs-y += compat
Index: src/mainboard/amd/serengeti_cheetah/Kconfig
===================================================================
--- src/mainboard/amd/serengeti_cheetah/Kconfig	(revision 4582)
+++ src/mainboard/amd/serengeti_cheetah/Kconfig	(working copy)
@@ -188,8 +188,3 @@ 
 	default y
 	depends on BOARD_AMD_SERENGETI_CHEETAH
 
-config PCI_ROM_RUN
-	bool
-	default y
-	depends on BOARD_AMD_SERENGETI_CHEETAH
-
Index: src/Kconfig
===================================================================
--- src/Kconfig	(revision 4582)
+++ src/Kconfig	(working copy)
@@ -84,10 +84,6 @@ 
 	int
 	default 1
 
-config PCI_ROM_RUN
-	bool
-	default n
-
 config HT_CHAIN_UNITID_BASE
 	int
 	default 1