bootwrapper: arch/powerpc/boot code reorg patches
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest6 patches 58 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/6 | bootwrapper: arch/powerpc/boot code reorgarch/ arch/ arch/ +1 more | +248 | 18 replies | |
| 2/6 | bootwrapper: Add in OF operations (and rename to of.c)arch/ arch/ arch/ +1 more | +305 | 1 reply | |
| 3/6 | bootwrapper: Add device tree ops for flattened device treearch/ arch/ | +526 | 16 replies | |
| 4/6 | bootwrapper: Add non-OF serial console supportarch/ arch/ arch/ +1 more | +360 | 3 replies | |
| 5/6 | bootwrapper: Add support for the DINK firmwarearch/ | +56 | 6 replies | |
| 6/6 | bootwrapper: Add support for the sandpoint platformarch/ arch/ arch/ | +259 | 8 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/6] bootwrapper: arch/powerpc/boot code reorg patches
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
# <[email protected]>
#
# 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
shiftdone
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