linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] bootwrapper: arch/powerpc/boot code reorg patches
@ 2006-07-19 22:53 Mark A. Greer
  2006-07-22 15:04 ` Tom Rini
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Mark A. Greer @ 2006-07-19 22:53 UTC (permalink / raw)
  To: linuxppc-dev

Hi,

The following emails from me in this thread are the latest set of
patches that reorg the bootwrapper code so that OF and non-OF
platforms can live together.

I punted somewhat on "The Tool" that's been talked about that takes a
kernel and attaches a flattened device tree (fdt) to it.  I thought
about it for a while but I think we need to clarify the requirements
better before it makes sense to spend a lot of cycles on it.

In the interim, dt_blob_start defined in arch/powerpc/boot/main.c allocates
8KB in a separate ELF section called '__builtin_fdt'.  You can then
'dd' a dtb generated by the dtc utility directly into that section and it
the bootwrapper will use it.  I tried playing with loader scripts so
that the section could be deleted and a new, larger one added
(and that preserves all the alignments, etc. in the zImage) but couldn't
figure out the magic so I've given up for now.

I hope that after OLS (or during?), "The Tool" will be discussed and we
can get that finished.  Unless what I've done is good enough but I doubt it...

Notes:
- These patches will collide with Milton Miller's kexec patches but they
  haven't been accepted yet so I didn't put my patches on top of them.
- Below is the script that I use to copy a dtb into the __builtin_fdt
  section of a zImage so that non-OF machines can use the zImage.
  Its basically a hack of the script that Michal Ostrowski provided
  for copying a new cmdline to an ELF section.

Mark
--

#!/bin/bash
#
# Copyright (C) 2006 Michal Ostrowski <mostrows at watson.ibm.com <https://ozlabs.org/mailman/listinfo/linuxppc-dev>>, IBM Corp.
#
# Modified to put a dtb into the "__builtin_fdt" section by Mark A. Greer
# <mgreer@mvista.com>
#
# 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

usage(){
    echo 'set_builtin_fdt [--fdt <file>] <input_obj> [<output_obj>]'
    echo '    Sets the builtin command line embedded in an object file.'
    echo
    echo '    If <output_obj> is not specified, <input_obj> is modified'
    echo '    in place.'
    echo '    If --fdt <file> argument is present contents of embedded'
    echo '    command line will be copied from <file>, otherwise from stdin.'
    exit 1
}

fdt_file=

while case "$#" in 0) break ;; esac
do
  
        case "$1" in
        --fdt)
		case "$#" in
		    1)
			usage ;;
		    *)
			fdt_file="$2";
			shift;;
		esac;;
        *)
                set x "$@"
                shift
                break ;;
        esac
        shift
done

if [ "$#" -lt 1 ]; then
    echo "No input object specified." ; 
    usage;
fi

if [ "$#" -gt 2 ]; then
    echo "Unrecognized arguments: $@";
    usage;
fi


infile=$1
shift;

if [ ! -r "$infile" ] ; then 
    echo "Can't read '$infile'."; 
    usage;
fi

if [ "$#" -eq 0 ] ; then
    outfile=$infile;
else
    outfile=$1;
    if ! cp $infile $outfile ;  then
	echo "Can't create output: '$outfile' $?" 
	usage;
    fi
    shift;
fi

offset=$(objdump -h  $infile | \
         gawk -- '{if($2=="__builtin_fdt") {print strtonum("0x" $6);}}')
size=$(objdump -h  $infile | \
       gawk -- '{if($2=="__builtin_fdt") {print strtonum("0x" $3);}}')

if [ "x$offset" != "x" ] ; then 
    if [ "$offset" -ne 0  ] ; then
	set -e
	# Zero the destination buffer first
	exec 2>/dev/null
	dd if=$fdt_file of=$outfile bs=1 seek=$offset conv=notrunc count=$size
	exit $?
    fi
fi

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/6] bootwrapper: arch/powerpc/boot code reorg patches
  2006-07-19 22:53 [PATCH 0/6] bootwrapper: arch/powerpc/boot code reorg patches Mark A. Greer
@ 2006-07-22 15:04 ` Tom Rini
  2006-08-08 19:14 ` Mark A. Greer
  2006-09-08  3:32 ` Mark A. Greer
  2 siblings, 0 replies; 7+ messages in thread
From: Tom Rini @ 2006-07-22 15:04 UTC (permalink / raw)
  To: Mark A. Greer; +Cc: linuxppc-dev

On Wed, Jul 19, 2006 at 03:53:56PM -0700, Mark A. Greer wrote:

> The following emails from me in this thread are the latest set of
> patches that reorg the bootwrapper code so that OF and non-OF
> platforms can live together.
> 
> I punted somewhat on "The Tool" that's been talked about that takes a
> kernel and attaches a flattened device tree (fdt) to it.  I thought
> about it for a while but I think we need to clarify the requirements
> better before it makes sense to spend a lot of cycles on it.

Great!  As the last person to know what all this code was doing in
arch/ppc/boot, I'll try and give it all a review..

-- 
Tom Rini

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/6] bootwrapper: arch/powerpc/boot code reorg patches
  2006-07-19 22:53 [PATCH 0/6] bootwrapper: arch/powerpc/boot code reorg patches Mark A. Greer
  2006-07-22 15:04 ` Tom Rini
@ 2006-08-08 19:14 ` Mark A. Greer
  2006-08-15 19:37   ` Hollis Blanchard
  2006-09-08  3:32 ` Mark A. Greer
  2 siblings, 1 reply; 7+ messages in thread
From: Mark A. Greer @ 2006-08-08 19:14 UTC (permalink / raw)
  To: linuxppc-dev

Just a note that I will respin my patches to address all of your
comments.  However, it looks like the fdt code is going to change
to use code from a common source base.  I'm going to wait until
that has settled and then I'll modify the code and repost the patches.

Mark

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/6] bootwrapper: arch/powerpc/boot code reorg patches
  2006-08-08 19:14 ` Mark A. Greer
@ 2006-08-15 19:37   ` Hollis Blanchard
  2006-08-18 21:46     ` Mark A. Greer
  0 siblings, 1 reply; 7+ messages in thread
From: Hollis Blanchard @ 2006-08-15 19:37 UTC (permalink / raw)
  To: Mark A. Greer; +Cc: linuxppc-dev

On Tue, 2006-08-08 at 12:14 -0700, Mark A. Greer wrote:
> Just a note that I will respin my patches to address all of your
> comments.  However, it looks like the fdt code is going to change
> to use code from a common source base.  I'm going to wait until
> that has settled and then I'll modify the code and repost the patches.

By the way, I don't expect the (ft_build.h) interface to change much
from what I emailed last week. So I think it's safe to build on top of
those.

The only addition I'd like to make is creating an ft_set_prop() that
will handle resizing the tree for you. With that change, you wouldn't
ft_get_prop() and then write directly to that pointer (as is done
currently).

I'm still waiting to hear the outcome of Matt's patches. I don't need
them, but if u-boot does then I'll have to merge them into the
standalone code.

-Hollis

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/6] bootwrapper: arch/powerpc/boot code reorg patches
  2006-08-18 21:46     ` Mark A. Greer
@ 2006-08-18 21:41       ` Jon Loeliger
  0 siblings, 0 replies; 7+ messages in thread
From: Jon Loeliger @ 2006-08-18 21:41 UTC (permalink / raw)
  To: Mark A. Greer; +Cc: linuxppc-dev

On Fri, 2006-08-18 at 16:46, Mark A. Greer wrote:

> > I'm still waiting to hear the outcome of Matt's patches. I don't need
> > them, but if u-boot does then I'll have to merge them into the
> > standalone code.
> 
> Another note.  Hollis and I have been talking some more and may change
> some code.  IOW, I'm still going to wait a bit to see what comes out of
> it before respining the patches.
> 
> Mark

As a point of information, the current 8641 HPCN tree
fully depends on Matt's patches in U-Boot.  The U-Boot
with these patches in it can be found on jdl.com.

Thanks,
jdl

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/6] bootwrapper: arch/powerpc/boot code reorg patches
  2006-08-15 19:37   ` Hollis Blanchard
@ 2006-08-18 21:46     ` Mark A. Greer
  2006-08-18 21:41       ` Jon Loeliger
  0 siblings, 1 reply; 7+ messages in thread
From: Mark A. Greer @ 2006-08-18 21:46 UTC (permalink / raw)
  To: Hollis Blanchard; +Cc: linuxppc-dev

On Tue, Aug 15, 2006 at 02:37:06PM -0500, Hollis Blanchard wrote:
> On Tue, 2006-08-08 at 12:14 -0700, Mark A. Greer wrote:
> > Just a note that I will respin my patches to address all of your
> > comments.  However, it looks like the fdt code is going to change
> > to use code from a common source base.  I'm going to wait until
> > that has settled and then I'll modify the code and repost the patches.
> 
> By the way, I don't expect the (ft_build.h) interface to change much
> from what I emailed last week. So I think it's safe to build on top of
> those.
> 
> The only addition I'd like to make is creating an ft_set_prop() that
> will handle resizing the tree for you. With that change, you wouldn't
> ft_get_prop() and then write directly to that pointer (as is done
> currently).
> 
> I'm still waiting to hear the outcome of Matt's patches. I don't need
> them, but if u-boot does then I'll have to merge them into the
> standalone code.

Another note.  Hollis and I have been talking some more and may change
some code.  IOW, I'm still going to wait a bit to see what comes out of
it before respining the patches.

Mark

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/6] bootwrapper: arch/powerpc/boot code reorg patches
  2006-07-19 22:53 [PATCH 0/6] bootwrapper: arch/powerpc/boot code reorg patches Mark A. Greer
  2006-07-22 15:04 ` Tom Rini
  2006-08-08 19:14 ` Mark A. Greer
@ 2006-09-08  3:32 ` Mark A. Greer
  2 siblings, 0 replies; 7+ messages in thread
From: Mark A. Greer @ 2006-09-08  3:32 UTC (permalink / raw)
  To: Mark A. Greer; +Cc: linuxppc-dev

Hi,

I have respun all the patches in this series and will be submitting them
shortly.

Some things have changed from the previous patches.  In particular, the
guts of the flat dev tree code are now in
<file:arch/powerpc/boot/flatdevtree.[ch]>.  These files are only *copies*
of the files Hollis Blanchard is maintaining so please do not edit them
in the bootwrapper.  The code in those files is still being worked on
so I'm will not submit them in this patch series.  However, I will
start a separate email thread with the current copies so you can
build and so those changes don't hold up the acceptance of these patches.
Just don't surprised if the master code has changed by the time you read
this.

Also changed:
- The 'ops' struct & ptr are gone, now uses
  platform_ops/dt_ops/console_ops directly.
- There are a couple new files.  flatdevtree_env.h has header file
  glue so that flatdevtree.[ch] will compile/work.
  flatdevtree_misc.c contains interface glue between bootwrapper dt
  calls and the implementation in flatdevtree.c, and some functionality
  not provided by flatdevtree.c
- dink.c is renamed to simple_alloc.c because the code isn't dink specific.
- I'm submitting the kernel sandpoint code along with the dts (which I
  didn't do before) because people have asked for it.
- I changed the name of the section that holds the dtb from
  __builtin_fdt to __builtin_ft to match the prefixes used in the
  flatdevtree*.[ch] files.  If you made a script to attach a dtb to a
  zImage like what I emailed before, you'll have to edit it to change
  the section name.

Mark

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-09-08  3:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-19 22:53 [PATCH 0/6] bootwrapper: arch/powerpc/boot code reorg patches Mark A. Greer
2006-07-22 15:04 ` Tom Rini
2006-08-08 19:14 ` Mark A. Greer
2006-08-15 19:37   ` Hollis Blanchard
2006-08-18 21:46     ` Mark A. Greer
2006-08-18 21:41       ` Jon Loeliger
2006-09-08  3:32 ` Mark A. Greer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).