diff mbox

[8/9] PPC: Add u-boot firmware for e500

Message ID 5375F1E3.4010509@suse.de
State New
Headers show

Commit Message

Alexander Graf May 16, 2014, 11:09 a.m. UTC
On 16.05.14 08:06, Gerd Hoffmann wrote:
> On Do, 2014-05-15 at 18:32 +0200, Alexander Graf wrote:
>> This adds a special build of u-boot tailored for the e500 platforms we
>> emulate. It is based on the current version of upstream u-boot which
>> contains all the code necessary to drive our QEMU provided machines.
>>
>> Signed-off-by: Alexander Graf <agraf@suse.de>
> Adding build rules to roms/Makefile would be nice,
> so you can just do "make -C roms uboot" to build it.

Good idea. How about something like this? I had to jump through some 
hoops to make it work with a biarch 64/32 compiler because upstream 
u-boot assumes you always have a cross compiler for a specific target 
architecture which is not the case in normal enterprise distributions.

If you think this approach is fine (I do ;)), then I'll squash it into 
this patch but won't resend the patch - I don't want to clutter people's 
inboxes with random binary blobs.


Alex

Comments

Gerd Hoffmann May 16, 2014, 1:11 p.m. UTC | #1
Hi,

> +u-boot.e500:
> +    # examples fail to honor cflags, just remove them
> +    rm -rf u-boot/examples
> +    sed -i 's/examples//g' u-boot/Makefile
> +    # Make linker script biarch aware
> +    sed -i 's/OUTPUT_ARCH(powerpc)/OUTPUT_ARCH(powerpc:common)/' \
> +        u-boot/arch/powerpc/cpu/mpc85xx/u-boot.lds

Hmm.  Mucking with the source tree like this will leave the u-boot git
tree in a dirty state, which isn't exactly nice.  Fixable by sprinkling
in a "git reset --hard", but that obviously has other downsides, such as
seriously disturbing people trying to build a u-boot tree with local
changes.

Any chance to fix that without patching the source tree, by passing
SUBDIRS="<list-dirs-without-examples>" to $(MAKE) for example?
Or send patches to u-boot upstream to tackle this?

> +    # Compile u-boot
> +    $(MAKE) -C u-boot O=build.e500 qemu-ppce500_config
> +    $(MAKE) -C u-boot CROSS_COMPILE=$(powerpc64_cross_prefix) \
> +        O=build.e500 KCFLAGS=-m32 KAFLAGS=-m32 \
> +        LDFLAGS=-melf32ppc KCPPFLAGS=-m32 V=1 u-boot.bin
> +    strip u-boot/build.e500/u-boot -o ../pc-bios/u-boot.e500

$(powerpc64_cross_prefix)strip I guess ...

cheers,
  Gerd
diff mbox

Patch

diff --git a/roms/Makefile b/roms/Makefile
index 2721b02..1b6996c 100644
--- a/roms/Makefile
+++ b/roms/Makefile
@@ -55,6 +55,7 @@  default:
      @echo "  efirom         -- update nic roms (bios+efi, this needs"
      @echo "                    the EfiRom utility from edk2 / tianocore)"
      @echo "  slof           -- update slof.bin"
+    @echo "  u-boot.e500    -- update u-boot.e500"

  bios: build-seabios-config-seabios-128k build-seabios-config-seabios-256k
      cp seabios/builds/seabios-128k/bios.bin ../pc-bios/bios.bin
@@ -132,6 +133,19 @@  slof:
      $(MAKE) -C SLOF CROSS=$(powerpc64_cross_prefix) qemu
      cp SLOF/boot_rom.bin ../pc-bios/slof.bin

+u-boot.e500:
+    # examples fail to honor cflags, just remove them
+    rm -rf u-boot/examples
+    sed -i 's/examples//g' u-boot/Makefile
+    # Make linker script biarch aware
+    sed -i 's/OUTPUT_ARCH(powerpc)/OUTPUT_ARCH(powerpc:common)/' \
+        u-boot/arch/powerpc/cpu/mpc85xx/u-boot.lds
+    # Compile u-boot
+    $(MAKE) -C u-boot O=build.e500 qemu-ppce500_config
+    $(MAKE) -C u-boot CROSS_COMPILE=$(powerpc64_cross_prefix) \
+        O=build.e500 KCFLAGS=-m32 KAFLAGS=-m32 \
+        LDFLAGS=-melf32ppc KCPPFLAGS=-m32 V=1 u-boot.bin
+    strip u-boot/build.e500/u-boot -o ../pc-bios/u-boot.e500

  clean:
      rm -rf seabios/.config seabios/out seabios/builds
@@ -141,3 +155,4 @@  clean:
      rm -f sgabios/.depend
      $(MAKE) -C ipxe/src veryclean
      $(MAKE) -C SLOF clean
+    rm -rf u-boot/build.e500