Fix dtb inclusion in zImage and split OF stuff
PATCH 1/1 Fix dtb inclusion in zImage and split OF stuff
This fixes the inclusion of device-tree blobs by the wrapper script, and splits of.c into of.c and ofcall.c, where ofcall.c contains the low-level interface to OF and of.c contains the platform definition for OF-based machines. This patch forms part of the changes I have been working on to get an IBM PReP machine booting with ARCH=powerpc.
Paul.
arch/powerpc/boot/Makefile +2 -2
@@ -40,8 +40,8 @@ zliblinuxheader := zlib.h zconf.h zutil. $(addprefix $(obj)/,$(zlib) main.o): $(addprefix $(obj)/,$(zliblinuxheader)) \ $(addprefix $(obj)/,$(zlibheader)) -src-wlib := string.S stdio.c main.c div64.S $(zlib) -src-plat := of.c +src-wlib := string.S stdio.c main.c ofcons.c ofcall.c div64.S $(zlib) +src-plat := of.c prep.c src-boot := crt0.S $(src-wlib) $(src-plat) empty.c src-boot := $(addprefix $(obj)/, $(src-boot))
arch/powerpc/boot/main.c +4 -8
@@ -27,6 +27,8 @@ extern char _vmlinux_start[];extern char _vmlinux_end[];extern char _initrd_start[];extern char _initrd_end[]; +extern char _dtb_start[]; +extern char _dtb_end[];struct addr_range {unsigned long addr;
@@ -285,12 +287,6 @@ static void set_cmdline(char *buf)setprop (devp,"bootargs" , buf,strlen (buf) +1 ); } -/* Section where ft can be tacked on after zImage is built */ -union blobspace { -struct boot_param_header hdr; -char space[8 *1024 ]; -} dt_blob __attribute__((__section__("__builtin_ft"))); -struct platform_ops platform_ops;struct dt_ops dt_ops;struct console_ops console_ops;
@@ -309,9 +305,9 @@ void start(unsigned long a1, unsigned lo/* Override the dt_ops and device tree if there was an flat dev * tree attached to the zImage. */ -if (dt_blob.hdr.magic ==OF_DT_HEADER ) { +if (_dtb_end > _dtb_start) { have_dt =1 ; -ft_init (&dt_blob); +ft_init (_dtb_start); }if (platform_init (promptr))
arch/powerpc/boot/of.c +8 -211
253 lines not on this page · raw message
arch/powerpc/boot/of.h new file +29 -0
@@ -0,0 +1,29 @@ +/* +* Copyright (C) Paul Mackerras 1997. +* +* 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. +*/ + +typedef void *ihandle ; +typedef void *phandle ; + +/* In ofcall.c */ +void of_init (void *promptr); +int call_prom (const char *service,int nargs,int nret, ...); +int call_prom_ret (const char *service,int nargs,int nret, +unsigned int *rets, ...); +void *of_claim (unsigned long virt,unsigned long size,unsigned long align); +void of_exit (void ); + +void *of_finddevice (const char *name); +int of_getprop (const void *phandle,const char *name,void *buf, +const int buflen); +int of_setprop (const void *phandle,const char *name,const void *buf, +const int buflen); +void of_tree_init (void ); + +/* In ofcons.c */ +void of_console_init (void );
arch/powerpc/boot/ofcall.c new file +200 -0
200 lines not on this page · raw message
arch/powerpc/boot/ofcons.c new file +50 -0
50 lines not on this page · raw message
arch/powerpc/boot/wrapper +2 -2
@@ -179,11 +179,11 @@ if [ -z "$cacheit" ]; then fi if [ -n "$initrd" ]; then - addsec $tmp "$initrd" initrd + addsec $tmp "$initrd" $isection fi if [ -n "$dtb" ]; then - addsec $tmp "$dtb" dtb + addsec $tmp "$dtb" .kernel:dtb fi if [ "$platform" != "miboot" ]; then
arch/powerpc/boot/zImage.lds.S +5 -0
@@ -21,6 +21,11 @@ SECTIONS __got2_end = .; } + . = ALIGN(8); + _dtb_start = .; + .kernel:dtb : { *(.kernel:dtb) } + _dtb_end = .; + . = ALIGN(4096); _vmlinux_start = .; .kernel:vmlinux.strip : { *(.kernel:vmlinux.strip) }