* [PATCH 2/4] bootwrapper: Add a cuboot platform and a cuImage target.
2007-04-16 23:24 [PATCH 1/4] bootwrapper: Add CONFIG_DEVICE_TREE Scott Wood
@ 2007-04-16 23:25 ` Scott Wood
2007-04-16 23:25 ` [PATCH 3/4] bootwrapper: Add ppcboot.h Scott Wood
2007-04-16 23:25 ` [PATCH 4/4] bootwrapper: cuboot for 83xx Scott Wood
2 siblings, 0 replies; 8+ messages in thread
From: Scott Wood @ 2007-04-16 23:25 UTC (permalink / raw)
To: paulus; +Cc: linuxppc-dev
The cuImage target will build a uImage with bootwrapper code and a device
tree. The default device tree and platform file are determined by the
kernel configuration.
Signed-off-by: Scott Wood <scottwood@freescale.com>
---
This version of the patch handles "make clean" correctly.
arch/powerpc/Makefile | 2 +-
arch/powerpc/boot/.gitignore | 3 +++
arch/powerpc/boot/Makefile | 13 +++++++++++--
arch/powerpc/boot/wrapper | 21 +++++++++++++++++++--
4 files changed, 34 insertions(+), 5 deletions(-)
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index a00fe72..e6c3add 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -148,7 +148,7 @@ all: $(KBUILD_IMAGE)
CPPFLAGS_vmlinux.lds := -Upowerpc
-BOOT_TARGETS = zImage zImage.initrd uImage
+BOOT_TARGETS = zImage zImage.initrd uImage cuImage
PHONY += $(BOOT_TARGETS)
diff --git a/arch/powerpc/boot/.gitignore b/arch/powerpc/boot/.gitignore
index 0734b2f..eec7af7 100644
--- a/arch/powerpc/boot/.gitignore
+++ b/arch/powerpc/boot/.gitignore
@@ -18,6 +18,9 @@ kernel-vmlinux.strip.c
kernel-vmlinux.strip.gz
mktree
uImage
+cuImage
+cuImage.bin.gz
+cuImage.elf
zImage
zImage.chrp
zImage.coff
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 928b88a..d602b7c 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -129,7 +129,7 @@ image-$(CONFIG_PPC_CELLEB) += zImage.pseries
image-$(CONFIG_PPC_CHRP) += zImage.chrp
image-$(CONFIG_PPC_EFIKA) += zImage.chrp
image-$(CONFIG_PPC_PMAC) += zImage.pmac
-image-$(CONFIG_DEFAULT_UIMAGE) += uImage
+image-$(CONFIG_DEFAULT_UIMAGE) += uImage cuImage
# For 32-bit powermacs, build the COFF and miboot images
# as well as the ELF images.
@@ -162,6 +162,14 @@ $(obj)/zImage.initrd.ps3: vmlinux
$(obj)/uImage: vmlinux $(wrapperbits)
$(call if_changed,wrap,uboot)
+cuboot-plat-y += unknown-platform
+
+dts = $(if $(shell echo $(CONFIG_) | grep '^/'),\
+ ,$(srctree)/$(src)/dts/)$(CONFIG_DEVICE_TREE)
+
+$(obj)/cuImage: vmlinux $(wrapperbits)
+ $(call if_changed,wrap,cuboot-$(word 1,$(cuboot-plat-y)),$(dts))
+
$(obj)/zImage: $(addprefix $(obj)/, $(image-y))
@rm -f $@; ln $< $@
$(obj)/zImage.initrd: $(addprefix $(obj)/, $(initrd-y))
@@ -171,7 +179,8 @@ install: $(CONFIGURE) $(image-y)
sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" $<
# anything not in $(targets)
-clean-files += $(image-) $(initrd-) zImage zImage.initrd
+clean-files += $(image-) $(initrd-) zImage zImage.initrd \
+ cuImage.elf cuImage.bin.gz
# clean up files cached by wrapper
clean-kernel := vmlinux.strip vmlinux.bin
diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index e4566bd..5cedd90 100755
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -141,6 +141,9 @@ miboot|uboot)
ksection=image
isection=initrd
;;
+cuboot*)
+ gzip=
+ ;;
esac
vmz="$tmpdir/`basename \"$kernel\"`.$ext"
@@ -161,13 +164,17 @@ fi
vmz="$vmz$gzip"
case "$platform" in
-uboot)
- rm -f "$ofile"
+uboot|cuboot*)
version=`${CROSS}strings "$kernel" | grep '^Linux version [-0-9.]' | \
cut -d' ' -f3`
if [ -n "$version" ]; then
version="-n Linux-$version"
fi
+esac
+
+case "$platform" in
+uboot)
+ rm -f "$ofile"
mkimage -A ppc -O linux -T kernel -C gzip -a 00000000 -e 00000000 \
$version -d "$vmz" "$ofile"
if [ -z "$cacheit" ]; then
@@ -216,4 +223,14 @@ pmaccoff)
${CROSS}objcopy -O aixcoff-rs6000 --set-start "$entry" "$ofile"
$object/hack-coff "$ofile"
;;
+cuboot*)
+ base=`${CROSS}nm "$ofile" | grep ' _start$' | cut -d' ' -f1`
+ entry=`${CROSS}objdump -f "$ofile" | grep '^start address ' | \
+ cut -d' ' -f3`
+ mv "$ofile" "$ofile".elf
+ ${CROSS}objcopy -O binary "$ofile".elf "$ofile".bin
+ gzip -f -9 "$ofile".bin
+ mkimage -A ppc -O linux -T kernel -C gzip -a "$base" -e "$entry" \
+ $version -d "$ofile".bin.gz "$ofile"
+ ;;
esac
--
1.5.0.3
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 3/4] bootwrapper: Add ppcboot.h.
2007-04-16 23:24 [PATCH 1/4] bootwrapper: Add CONFIG_DEVICE_TREE Scott Wood
2007-04-16 23:25 ` [PATCH 2/4] bootwrapper: Add a cuboot platform and a cuImage target Scott Wood
@ 2007-04-16 23:25 ` Scott Wood
2007-04-17 9:03 ` Wolfgang Denk
2007-04-16 23:25 ` [PATCH 4/4] bootwrapper: cuboot for 83xx Scott Wood
2 siblings, 1 reply; 8+ messages in thread
From: Scott Wood @ 2007-04-16 23:25 UTC (permalink / raw)
To: paulus; +Cc: linuxppc-dev
This file describes the bd_t struct, which is used by old versions of
U-boot to pass information to the kernel. Platform code that needs to
interoperate with such firmware can use this; it should not be used for
anything new.
Signed-off-by: Scott Wood <scottwood@freescale.com>
---
arch/powerpc/boot/ppcboot.h | 108 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 108 insertions(+), 0 deletions(-)
create mode 100644 arch/powerpc/boot/ppcboot.h
diff --git a/arch/powerpc/boot/ppcboot.h b/arch/powerpc/boot/ppcboot.h
new file mode 100644
index 0000000..5290ff2
--- /dev/null
+++ b/arch/powerpc/boot/ppcboot.h
@@ -0,0 +1,108 @@
+/*
+ * This interface is used for compatibility with old U-boots *ONLY*.
+ * Please do not imitate or extend this.
+ */
+
+/*
+ * (C) Copyright 2000, 2001
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * 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
+ */
+
+#ifndef __PPCBOOT_H__
+#define __PPCBOOT_H__
+
+/*
+ * Board information passed to kernel from PPCBoot
+ *
+ * include/asm-ppc/ppcboot.h
+ */
+
+#include "types.h"
+
+typedef struct bd_info {
+ unsigned long bi_memstart; /* start of DRAM memory */
+ unsigned long bi_memsize; /* size of DRAM memory in bytes */
+ unsigned long bi_flashstart; /* start of FLASH memory */
+ unsigned long bi_flashsize; /* size of FLASH memory */
+ unsigned long bi_flashoffset; /* reserved area for startup monitor */
+ unsigned long bi_sramstart; /* start of SRAM memory */
+ unsigned long bi_sramsize; /* size of SRAM memory */
+#if defined(TARGET_8xx) || defined(TARGET_CPM2) || defined(TARGET_85xx) ||\
+ defined(TARGET_83xx)
+ unsigned long bi_immr_base; /* base of IMMR register */
+#endif
+#if defined(TARGET_PPC_MPC52xx)
+ unsigned long bi_mbar_base; /* base of internal registers */
+#endif
+ unsigned long bi_bootflags; /* boot / reboot flag (for LynxOS) */
+ unsigned long bi_ip_addr; /* IP Address */
+ unsigned char bi_enetaddr[6]; /* Ethernet address */
+ unsigned short bi_ethspeed; /* Ethernet speed in Mbps */
+ unsigned long bi_intfreq; /* Internal Freq, in MHz */
+ unsigned long bi_busfreq; /* Bus Freq, in MHz */
+#if defined(TARGET_CPM2)
+ unsigned long bi_cpmfreq; /* CPM_CLK Freq, in MHz */
+ unsigned long bi_brgfreq; /* BRG_CLK Freq, in MHz */
+ unsigned long bi_sccfreq; /* SCC_CLK Freq, in MHz */
+ unsigned long bi_vco; /* VCO Out from PLL, in MHz */
+#endif
+#if defined(TARGET_PPC_MPC52xx)
+ unsigned long bi_ipbfreq; /* IPB Bus Freq, in MHz */
+ unsigned long bi_pcifreq; /* PCI Bus Freq, in MHz */
+#endif
+ unsigned long bi_baudrate; /* Console Baudrate */
+#if defined(TARGET_4xx)
+ unsigned char bi_s_version[4]; /* Version of this structure */
+ unsigned char bi_r_version[32]; /* Version of the ROM (IBM) */
+ unsigned int bi_procfreq; /* CPU (Internal) Freq, in Hz */
+ unsigned int bi_plb_busfreq; /* PLB Bus speed, in Hz */
+ unsigned int bi_pci_busfreq; /* PCI Bus speed, in Hz */
+ unsigned char bi_pci_enetaddr[6]; /* PCI Ethernet MAC address */
+#endif
+#if defined(TARGET_HYMOD)
+ hymod_conf_t bi_hymod_conf; /* hymod configuration information */
+#endif
+#if defined(TARGET_EVB64260) || defined(TARGET_405EP) || defined(TARGET_44x) || \
+ defined(TARGET_85xx) || defined(TARGET_83xx)
+ /* second onboard ethernet port */
+ unsigned char bi_enet1addr[6];
+#define HAVE_ENET1ADDR
+#endif
+#if defined(TARGET_EVB64260) || defined(TARGET_440GX) || defined(TARGET_85xx)
+ /* third onboard ethernet ports */
+ unsigned char bi_enet2addr[6];
+#define HAVE_ENET2ADDR
+#endif
+#if defined(TARGET_440GX)
+ /* fourth onboard ethernet ports */
+ unsigned char bi_enet3addr[6];
+#define HAVE_ENET3ADDR
+#endif
+#if defined(TARGET_4xx)
+ unsigned int bi_opbfreq; /* OB clock in Hz */
+ int bi_iic_fast[2]; /* Use fast i2c mode */
+#endif
+#if defined(TARGET_440GX)
+ int bi_phynum[4]; /* phy mapping */
+ int bi_phymode[4]; /* phy mode */
+#endif
+} bd_t;
+
+#define bi_tbfreq bi_intfreq
+
+#endif /* __PPCBOOT_H__ */
--
1.5.0.3
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH 3/4] bootwrapper: Add ppcboot.h.
2007-04-16 23:25 ` [PATCH 3/4] bootwrapper: Add ppcboot.h Scott Wood
@ 2007-04-17 9:03 ` Wolfgang Denk
2007-04-17 16:35 ` Scott Wood
2007-04-24 5:17 ` Paul Mackerras
0 siblings, 2 replies; 8+ messages in thread
From: Wolfgang Denk @ 2007-04-17 9:03 UTC (permalink / raw)
To: Scott Wood; +Cc: linuxppc-dev, paulus
In message <20070416232553.GB26693@ld0162-tx32.am.freescale.net> you wrote:
> This file describes the bd_t struct, which is used by old versions of
> U-boot to pass information to the kernel. Platform code that needs to
> interoperate with such firmware can use this; it should not be used for
> anything new.
>
> Signed-off-by: Scott Wood <scottwood@freescale.com>
> ---
> arch/powerpc/boot/ppcboot.h | 108 +++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 108 insertions(+), 0 deletions(-)
> create mode 100644 arch/powerpc/boot/ppcboot.h
>
> diff --git a/arch/powerpc/boot/ppcboot.h b/arch/powerpc/boot/ppcboot.h
> new file mode 100644
> index 0000000..5290ff2
> --- /dev/null
> +++ b/arch/powerpc/boot/ppcboot.h
Shouldn't we finally get this straight and call the file "u-boot.h" as
it is called in U-Boot?
The PPCBoot projects has been discontinued for many years by now...
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, HRB 165235 Munich, CEO: Wolfgang Denk
Office: Kirchenstr. 5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
The man on tops walks a lonely street; the "chain" of command is
often a noose.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/4] bootwrapper: Add ppcboot.h.
2007-04-17 9:03 ` Wolfgang Denk
@ 2007-04-17 16:35 ` Scott Wood
2007-04-24 5:17 ` Paul Mackerras
1 sibling, 0 replies; 8+ messages in thread
From: Scott Wood @ 2007-04-17 16:35 UTC (permalink / raw)
To: Wolfgang Denk; +Cc: linuxppc-dev, paulus
Wolfgang Denk wrote:
> In message <20070416232553.GB26693@ld0162-tx32.am.freescale.net> you wrote:
>>diff --git a/arch/powerpc/boot/ppcboot.h b/arch/powerpc/boot/ppcboot.h
>>new file mode 100644
>>index 0000000..5290ff2
>>--- /dev/null
>>+++ b/arch/powerpc/boot/ppcboot.h
>
>
> Shouldn't we finally get this straight and call the file "u-boot.h" as
> it is called in U-Boot?
Probably... though the ppcboot.h name does reinforce the legacy nature
of the interface. Maybe old-u-boot.h?
Paul, feel free to change the name of the file in the patch if you want.
-Scott
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/4] bootwrapper: Add ppcboot.h.
2007-04-17 9:03 ` Wolfgang Denk
2007-04-17 16:35 ` Scott Wood
@ 2007-04-24 5:17 ` Paul Mackerras
2007-04-24 17:33 ` Scott Wood
1 sibling, 1 reply; 8+ messages in thread
From: Paul Mackerras @ 2007-04-24 5:17 UTC (permalink / raw)
To: Wolfgang Denk; +Cc: linuxppc-dev
Wolfgang Denk writes:
> Shouldn't we finally get this straight and call the file "u-boot.h" as
> it is called in U-Boot?
Is it identical to the one in U-Boot?
Paul.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/4] bootwrapper: Add ppcboot.h.
2007-04-24 5:17 ` Paul Mackerras
@ 2007-04-24 17:33 ` Scott Wood
0 siblings, 0 replies; 8+ messages in thread
From: Scott Wood @ 2007-04-24 17:33 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev
Paul Mackerras wrote:
> Wolfgang Denk writes:
>
>
>>Shouldn't we finally get this straight and call the file "u-boot.h" as
>>it is called in U-Boot?
>
>
> Is it identical to the one in U-Boot?
It's missing the MPC8220 and NX823 bits and the phynum/mode bits for 4xx
other than 440GP (which I guess were added after the kernel's ppcboot.h
forked), and u-boot's has been changed to have CONFIG_HAS_ETH1/2/etc.
rather than a list of targets, but otherwise it appears to be
functionally identical.
Do you want me to resubmit using the current u-boot file (as well as an
updated 83xx platform file to define CONFIG_HAS_ETH1)?
-Scott
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 4/4] bootwrapper: cuboot for 83xx
2007-04-16 23:24 [PATCH 1/4] bootwrapper: Add CONFIG_DEVICE_TREE Scott Wood
2007-04-16 23:25 ` [PATCH 2/4] bootwrapper: Add a cuboot platform and a cuImage target Scott Wood
2007-04-16 23:25 ` [PATCH 3/4] bootwrapper: Add ppcboot.h Scott Wood
@ 2007-04-16 23:25 ` Scott Wood
2 siblings, 0 replies; 8+ messages in thread
From: Scott Wood @ 2007-04-16 23:25 UTC (permalink / raw)
To: paulus; +Cc: linuxppc-dev
This adds cuboot support for MPC83xx platforms.
A device tree used with this must have linux,stdout-path in /chosen and
linux,network-index in any network device nodes that need mac addresses
assigned.
Signed-off-by: Scott Wood <scottwood@freescale.com>
---
arch/powerpc/boot/Makefile | 3 +-
arch/powerpc/boot/cuboot-83xx.c | 68 +++++++++++++++++++++++++++++++++++++++
2 files changed, 70 insertions(+), 1 deletions(-)
create mode 100644 arch/powerpc/boot/cuboot-83xx.c
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index d602b7c..3e172ff 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -43,7 +43,7 @@ $(addprefix $(obj)/,$(zlib) main.o): $(addprefix $(obj)/,$(zliblinuxheader)) \
src-wlib := string.S crt0.S stdio.c main.c flatdevtree.c flatdevtree_misc.c \
ns16550.c serial.c simple_alloc.c div64.S util.S \
gunzip_util.c elf_util.c $(zlib) devtree.c
-src-plat := of.c
+src-plat := of.c cuboot-83xx.c
src-boot := $(src-wlib) $(src-plat) empty.c
src-boot := $(addprefix $(obj)/, $(src-boot))
@@ -162,6 +162,7 @@ $(obj)/zImage.initrd.ps3: vmlinux
$(obj)/uImage: vmlinux $(wrapperbits)
$(call if_changed,wrap,uboot)
+cuboot-plat-$(CONFIG_83xx) += 83xx
cuboot-plat-y += unknown-platform
dts = $(if $(shell echo $(CONFIG_) | grep '^/'),\
diff --git a/arch/powerpc/boot/cuboot-83xx.c b/arch/powerpc/boot/cuboot-83xx.c
new file mode 100644
index 0000000..8f11d1e
--- /dev/null
+++ b/arch/powerpc/boot/cuboot-83xx.c
@@ -0,0 +1,68 @@
+/*
+ * Old U-boot compatibility for 83xx
+ *
+ * Author: Scott Wood <scottwood@freescale.com>
+ *
+ * Copyright (c) 2007 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ */
+
+#include "ops.h"
+#include "stdio.h"
+
+#define TARGET_83xx
+#include "ppcboot.h"
+
+static bd_t bd;
+extern char _end[];
+extern char _dtb_start[], _dtb_end[];
+
+static void platform_fixups(void)
+{
+ void *soc;
+
+ dt_fixup_memory(bd.bi_memstart, bd.bi_memsize);
+ dt_fixup_mac_addresses(bd.bi_enetaddr, bd.bi_enet1addr);
+ dt_fixup_cpu_clocks(bd.bi_intfreq, bd.bi_busfreq / 4, bd.bi_busfreq);
+
+ /* Unfortunately, the specific model number is encoded in the
+ * soc node name in existing dts files -- once that is fixed,
+ * this can do a simple path lookup.
+ */
+ soc = find_node_by_devtype(NULL, "soc");
+ if (soc) {
+ void *serial = NULL;
+
+ setprop(soc, "bus-frequency", &bd.bi_busfreq,
+ sizeof(bd.bi_busfreq));
+
+ while ((serial = find_node_by_devtype(serial, "serial"))) {
+ if (get_parent(serial) != soc)
+ continue;
+
+ setprop(serial, "clock-frequency", &bd.bi_busfreq,
+ sizeof(bd.bi_busfreq));
+ }
+ }
+}
+
+void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
+ unsigned long r6, unsigned long r7)
+{
+ unsigned long end_of_ram = bd.bi_memstart + bd.bi_memsize;
+ unsigned long avail_ram = end_of_ram - (unsigned long)_end;
+
+ memcpy(&bd, (bd_t *)r3, sizeof(bd));
+ loader_info.initrd_addr = r4;
+ loader_info.initrd_size = r4 ? r5 : 0;
+ loader_info.cmdline = (char *)r6;
+ loader_info.cmdline_len = r7 - r6;
+
+ simple_alloc_init(_end, avail_ram, 32, 64);
+ ft_init(_dtb_start, _dtb_end - _dtb_start, 32);
+ serial_console_init();
+ platform_ops.fixups = platform_fixups;
+}
--
1.5.0.3
^ permalink raw reply related [flat|nested] 8+ messages in thread