9
0
Fork 0
Commit Graph

42 Commits

Author SHA1 Message Date
Sascha Hauer d384b5639f of: Drop devicetree merge support
I assume I am the only person knowing that barebox is able to
merge devicetrees. This feature seems broken for a while now since
trying to merge devicetress results in:

unflatten: too many end nodes

Remove this feature to save the complexity.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-22 08:09:13 +02:00
Lucas Stach 0839e3f402 ARM: bootm: fix default uImage placement
For small systems we would put the zImage at 32KiB after
the start of memory, and put the DT a bit after the uImage.
The kernel will always try to relocate itself and overwrite
the DT.

Try to be more clever at uImage placement to avoid
triggering the kernel relocation.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-05 15:09:09 +02:00
Lucas Stach d79618aa66 ARM: bootm: be more clever while deciding where to put zImage
For small systems we would put the zImage at 8MiB after
the start of memory, and put the DT a bit after the zImage.
When we encounter an image which is bigger than 8MiB
uncompressed, the kernel would try to relocate itself
and overwrite the DT.

Try to be more clever at zImage placement to avoid
triggering the kernel relocation.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-05 15:09:09 +02:00
Sascha Hauer 0c66005aea ARM: bootm: pass free memory to __do_bootm_linux
This improves the initrd/devicetree placement in the bootm code.
We used to put the initrd at the start of the kernel + 8MiB. This
of course fails once the kernel gets bigger than 8MiB. Also the
place for the devicetree was allocated using malloc(). This can
lead to the problem that the devicetree is outside of the kernels
lowmem and thus not reachable for the kernel.
With this patch __do_bootm_linux gets a pointer to free space where
the devicetree and the initrd can be safely put.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-22 08:01:02 +01:00
Sascha Hauer cf3e82b35b ARM: bootm: locate zImage higher into RAM
The zImage should be placed where it won't be overwritten by the
uncompressed image, otherwise the kernel decompressing code has
to relocate the zImage before decompression. As Kernels tend to
become bigger put it into 32MiB into RAM if we have enough RAM
available.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-22 08:01:02 +01:00
Sascha Hauer 76ccd96f4a bootm: introduce bootm_load_initrd helper
Make the bootm handlers simpler by factoring out an initrd load
function.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-14 12:36:03 +01:00
Sascha Hauer 1984af4f28 ARM: bootm: move os loading to do_bootm_linux
__do_bootm_linux is called from the uImage, zImage and raw handlers.
In case of the zImage handler the kernel will already be loaded and
the kernel load code in __do_bootm_linux will do nothing. Move the
loading code to do_bootm_linux so that __do_bootm_linux will always
be called with the kernel already loaded.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-10 11:53:19 +01:00
Sascha Hauer 9bd67f5e61 bootm: introduce bootm_load_os helper
The common bootm code used to load uImage contents to SDRAM
before calling into the handlers if possible. This makes the
handlers complicated since they have to handle many cases. Instead,
introduce a helper to load the os after the handlers have figured
out a good load address.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-10 11:53:18 +01:00
Sascha Hauer 8e3ddc13eb ARM: boot barebox with kernel calling convention
Start a 2nd stage barebox with the Linux Kernel calling convention.
Right now barebox does not interpret ATAGs or devicetree passed
to it, but it doesn't hurt to pass parameters so that future bareboxes
can use them.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-06 14:25:06 +01:00
Sascha Hauer 1f3ac50f52 ARM: bootm: Print Kernel commandline unconditionally
The Kernel commandline is an important debugging aid when people
ask why their Kernel won't start, so print it unconditionally.
This is done in !dt mode anyway, so also do it with dt.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-27 07:48:18 +02:00
Sascha Hauer 5f56c35060 Merge branch 'for-next/of' 2013-06-02 16:28:34 +02:00
Alexander Shiyan 81118f1b7b ARM: Using unsigned specifiers for unsigned arguments for printf
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-31 08:53:51 +02:00
Sascha Hauer b5167ee51c bootm: print Kernel commandline in verbose mode
Without devicetree support we print the Kernel commandline in
verbose mode. Do the same with devicetree boot aswell.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-31 08:32:37 +02:00
Sascha Hauer 08026afdeb bootm: make sure to print fixed oftree
when doing bootm -v -v we dumped the original tree to the console.
Make sure to print the fixed tree instead so that the fixups can
be examined.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-31 08:32:32 +02:00
Sascha Hauer a51d06d679 of: remove unused libfdt
Now that we are completely independent of libfdt remove the unused
code.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-06 11:41:29 +01:00
Sascha Hauer 973e58e3ab ARM bootm: Switch initrd support to unflattened tree
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-06 11:41:29 +01:00
Sascha Hauer 6d6edfcf53 bootm: Pass unflattened devicetree to handlers
This makes it possible to modify the tree in the handlers.
This is necessary because the initrd addresses are only
known inside the handlers, but not to the generic bootm
code.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-06 11:41:29 +01:00
Sascha Hauer 8f458074e7 ARM: bootm: rework concatenated oftree
Without compiled in devicetree support we used to copy the
concatenated devicetree directly behind the zImage. This is
unnecessary, even if we do not have devicetree support we can
copy the devicetree whereever we like and pass the kernel a
pointer to it. This makes the code a bit easier.
While at it, add the missing free calls in the error case.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-06 11:41:29 +01:00
Sascha Hauer 64c199dd29 of: Pass barebox internal format devicetree to of_get_fixed_tree
With this every devicetree is first converted to the barebox internal
format before it's converted back to dtb again.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-06 11:41:28 +01:00
Sascha Hauer 04bd477ee4 ARM bootm: Use of_get_fixed_tree
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-06 11:41:27 +01:00
Sascha Hauer f3e173f6c2 ARM bootm: only use concatenated oftree when no other is available
When an oftree is already specified use it. This lets the user
boot a kernel with an oftree he provided himself rather than
hardcoding the concatenated one.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-19 11:48:17 +01:00
Sascha Hauer da852397e0 ARM android image: remove double of_fix_tree
With bootm of_fix_tree() will already be called from the generic bootm
code, so do not do this again in the Android image handler.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2013-01-11 14:10:01 +01:00
Sascha Hauer 5e74263762 filetype: Pass bufsize
Pass the buffer size to the file detection code. This makes sure we do not
read past the buffer. This is especially useful for ext filesystem detection
as the magic is at byte offset 1080. Also introduce a FILE_TYPE_SAFE_BUFSIZE
define which is set to the minimum bufsize the detection code needs to detect
all known filetypes.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-12-03 11:23:25 +01:00
Vicente 8083e2e024 bootm: close open files
Signed-off-by: Vicente <vicencb@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-10 09:29:58 +02:00
Jean-Christophe PLAGNIOL-VILLARD 5bc3870d67 arm/bootm: fix initrd_start init
initrd_start need to be init to data->initrd_address and updated only if the
addr is invalid.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-08-13 14:48:12 +08:00
Sascha Hauer 32fe6b09c2 bootm: Fix undefined reference to of_fix_tree
It's only available when oftree support is enabled.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-07-25 09:27:27 +02:00
Sascha Hauer 5f03074ea9 resource: store 'end' instead of 'size' in struct resource
Storing the size instead of the resource end in struct resource was
a mistake. 'size' ranges from 0 to UINT[32|64]_MAX + 1 which obviously
leads to problems. 'end' on the other hand will never exceed
UINT[32|64]_MAX. Also this way we can express a iomem region covering
the whole address space.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-07-01 08:18:53 +02:00
Sascha Hauer ee4cab9e58 booting: more flexible Linux bootargs generation
We currently use the environment variable 'bootargs' to get the
Linux bootargs. This patch allows for a more flexible bootargs
generation using global variables. With it the Linux bootargs
are concatenated from multiple variables. This allows to replace
parts of the bootargs string without having to reconstruct it
completely.
With this bootargs can be constructed like:

global linux.bootargs.base="console=ttyS0,115200"
global linux.bootargs.ip="ip=dhcp"
global linux.mtdparts="physmap-flash.0:512K(nor0.barebox),-(root)"

This will then automatically be combined into a kernel bootargs
string during boot.

If the 'linux.bootargs.' variables are all empty the old standard
'bootargs' way will be used.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-05-14 09:16:31 +02:00
Sascha Hauer a7ddbc4086 Merge branch 'binfmt' of git://git.jcrosoft.org/barebox into next 2012-04-18 20:42:17 +02:00
Jean-Christophe PLAGNIOL-VILLARD 4e2a42766b arm: bootm: zImage: add error message when can not request the memory
This will allow to understand what happened.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-04-18 15:36:10 +02:00
Jean-Christophe PLAGNIOL-VILLARD bb618e309d arm: bootm: add barebox, zImage and aImage binfmt support
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-04-18 20:19:12 +08:00
Jean-Christophe PLAGNIOL-VILLARD a448a796da arm: fix zImage support when a oftree is concatenated
When a oftree is concatenated,the zImage is bigger than the size specified in
the zImage header. Detect it and copy it too.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-04-13 14:43:40 +02:00
Jean-Christophe PLAGNIOL-VILLARD 5efbed3b27 arm: add Android boot image support
The Android Image contains 3 components and params

 - kernel
 - initrd
 - second stage (optional)

 - tags addr
 - bootargs

In fast boot the initrd is mandatory, in barebox we are less restrictive
use the initrd only if present

add to env params:
aimage_noverwrite_bootargs
	Disable overwrite of the bootargs with the one present in aimage

aimage_noverwrite_tags
	Disable overwrite of the tags addr with the one present in aimage

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: Magnus Damm <magnus.damm@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-04-13 12:08:42 +02:00
Sascha Hauer 56ddc233e4 ARM zImage: fix missing setting of load_address
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-12-21 11:33:39 +01:00
Sascha Hauer d4e5c6b8a0 bootm: use new uimage code
This switches the bootm code to the new uimage code. Also
bootm can now handle other types of images than uImages.
Currently the only architecture making use of this is
arm which allows to boot zImages, raw images and barebox
images.
I intended to make a more bisectable series from this but
I failed becuase there are many dependencies and no matter
how I tried the patches grew bigger and and bigger. So I
decided to put this all in a single patch.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-12-15 11:07:11 +01:00
Sascha Hauer 296cd8d638 ARM: call start_linux directly with initrd start/size and oftree
whoever calls this function is not necessarily aware of a struct
image_data, so remove the dependency from the function.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-12-15 10:26:03 +01:00
Sascha Hauer a5f5945c79 arm bootm: remove unnecessary include
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-11-29 21:07:10 +01:00
Sascha Hauer 351058fa51 bootm: push relocate_image up to the generic command
All handlers used to just relocate the image without any checks, so
we are doomed if we write outside of SDRAM or will overwrite ourselves.
Move the relocation up to the generic part where we have a chance
of catching these issues.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-11-29 20:59:56 +01:00
Sascha Hauer d1595f140f ARM bootm: remove now obsolete args
Now that the arch_number and system_rev variables can be set from
the environment we don't need the old bootm command line switch
mechanism anymore.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-11-29 20:55:50 +01:00
Jean-Christophe PLAGNIOL-VILLARD a0746e71c2 arm/bootm: enable multi uimage support
tested on imx53 loco board with a Multi uImage file

generate like this

mkimage -A arm -O linux -T multi -C none -a 0x70008000 -e 0x70008000 -n Linux-2.6.35.3-00745-gce4c61a-dirty -d zImage:rootfs.cpio.lzma uImage.Multi

and boot via bootm

bootm -r @1 -L 0x72000000 /dev/ram0.kernel

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-10-09 11:35:42 +02:00
Sascha Hauer 147affbd8d remove unused global_data.h
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-08-01 12:00:59 +02:00
Sascha Hauer bb7fff04af ARM: move bootm code to its own file
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-04 16:27:57 +02:00