Use a choice for the CONSOLE_ACTIVATE_* variables, which is the natural
way of specifying mutually exclusive variabled in Kconfig. Also update
the help texts a bit.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
When CONFIG_CONSOLE_ACTIVATE_ALL is set, the banner will never be printed.
Also, the console buffer is emptied when the first console is registered,
even when it's not enabled.
This patch cleans it up in a way that:
- the console buffer is emptied once the first console is activated, not
when it's registered.
- Make sure that the banner is printed first, so that we can output things
to the buffer before the banner is printed without ending up in having
the banner in the middle of the other boot messages.
- Use IS_ENABLED rather than ifdefs
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
When a memory bank is already registered, return an error code
instead of throwing a bug. This can happen if a board has registered
a memory bank and the same bank is then probed from the devicetree.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This gets us rid of an initcall and also has the advantage that
request_iomem_region can be called at any time now.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This will allow to do not have 2 set of var for defaultenv and the new
defaultenv-2.
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
The dependencies for generating the environment do not work properly:
- If files are removed from the defaultenv, a subsequent make will not
update the default environment.
- If CONFIG_DEFAULT_ENVIRONMENT_PATH changes, the default environment
also will not be regenerated.
This patch fixes this by introducing a cmd_env which has the content of
$(ENV_FILES) in the command so that the if_changed mechanism recognizes
a change when $(ENV_FILE) changes. This also results in a nice " ENV "
string in the build process.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The CLEAN_FILES in common/Makefile are unused. All generated files
are removed from the toplevel Makefile.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This is unused now and not needed. We have a board_init_lowlevel. If a
board needs some architecture setup it can always call it from its
board_init_lowlevel.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
We may have some disk with MBR as a first sector. In this case, the
current FAT check returns an error. However, the FAT sector exist and
the MBR can tell us where it is.
This patch add to file_name_detect_type function the ability to find
the FAT boot sector on the first sector of the first partition in case
it is not on sector 0.
It also introduce is_fat_or_mbr to check if a buffer is a FAT boot
or MBR sector
Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The FSF address has changed in the past. Instead of updating it
each time the address changes, just drop it completely treewide.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This adds code to probe devices from a devicetree. Most helper
functions are directly imported from Linux.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This patch sync the image type list with the kernel in order to add
openrisc support.
Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Add functions to read the barebox_arm_head, check barebox magicword
and read out the barebox image size.
Create a inital partion of 1Mb to access the barebox image on nand.
Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Introduce a struct envfs_inode_end with more data.
Today this will just containt the file mode to be able to add the symlink
support.
But this is compatible with the previous envfs version as they will do not
care about the extra as the previous version is just reading the filename and
then consume the extra data without using them.
Increase the envfs version to 1.0
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
they are store in the super block at byte 16th and 17th.
set the verison at 0.1
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
execute_binfmt may return negative return values which hush interprets
as 'exit'. Catch this and print an error message instead.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
'exit' used to do its job by returning value < 0. This is a sign
for hush that 'exit' is executed. This has problems:
- Often commands accidently return a negative value. This causes
the shell to exit.
- execute_binfmt returns a negative value when it does not find
a binary to execute. This again causes the shell to exit.
Returning a negative error value seems to be the right thing
to do, but catching this in the shell would mean that the exit
command does not work anymore.
- if called without arguments exit is supposed to return the code
of the last command. As a command exit has no access to this code.
This patch changes exit to be a builtin and also fixes the last return
code problem. While at it, update the help text.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Allow to use the number key to jump to entry.
if already on a entry % number_key jump to the next +10 one if exit
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This allows for creating a lzo compressed binary unsing the pbl.
Only copy the piggydata if needed.
Add CONFIG_PBL_FORCE_PIGGYDATA_COPY option
In some case we need to copy the PIGGYDATA as the link address
as example we run from SRAM and shutdown the SDRAM/DDR for
reconfiguration but most of the time we just need to copy the
executable code.
based on Sascha Hauer
Add compressed image support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
This allows for creating a pre-bootloader binary for
- nand boot
- mmc boot
- compressed image
The pbl will be incharge of the lowlevel init if needed.
The barebox will skip it.
Import string functions from linux 3.4 (arch/arm/boot/compressed/string.c) and
implement a dummy panic.
For now on introduce dummy zbarebox* targets and c code that will contain later
the decompressor. This only implemeted on ARM.
This patch is based on Sascha Hauer <s.hauer@pengutronix.de>
Add compressed image support patch
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
enable is by default for simple and hush
we do not need to NO_SHELL
this allow to save 1KiB
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Both the uimage command and the bootm command need uImage support, so
add a Kconfig symbol for it to be able to select it properly.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Many architectures support a way to detect why the bootloader is running.
This patch adds a global variable to be able to use the cause in some kind of
shell code to do special things on demand. For example to do an emergency boot,
when the last boot fails and the watchdog reactivate the hanging system.
Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
- add usage information
- add option parsing:
-v verbose
-v -v more verbose
-l list b´possible boot sources
-d dryrun
The dryrun option sets the global variables necessary for booting
but does not actually boot the system. This way it is possible to
make additional adjustments to the boot variables and then invoke
bootm manually.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Make the nonopt arguments to a script available starting from $1
after running getopt. This allows for scripts which use option
parsing but also have nonopts.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
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>
Instead of calling print_menu_entry multiple times in each case, store
the repaint state in a variable and call it once at the end to save a
few bytes of binary space.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
We have the read_key function which reads a key and parses escape sequences.
Use it in the menu instead of reimplementing this manually.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
When a device parameter has dots in its name, we have to use strchr instead
of strrchr, because the devicename ends at the first dot, not at the last one.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Change function name to command_var_complete in all calls and its declaration.
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
It does not necessarily means a bug when block_get fails here,
this can also be a failure on the underlying device.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
parse_stream_outer used to convert a exit value to a return code,
but parse_stream_outer maybe inside a recursion. This means that
the exit status is lost in this case. Test case:
if [ 0 = 0 ]; then
false
exit $?
fi
echo "shouldn't be here"
Without this patch "shouldn't be here" will be printed.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
print_menu_entry() in common/menu.c depeneds on process_escape_sequence().
Signed-off-by: Alan Ott <alan@signal11.us>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
We can start a new interactive shell now using the 'sh' command on
the command line. This shell exits on ctrl-c though. Add a loop
around it to continue instead of exiting.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This adds a new environment template which aims to be more flexible
and configurable. Instead of having mainly two scripts (a config script
and a boot script) this template uses initscripts which control the
startup behaviour and configuration. Also we have boot scripts in
/env/boot which configure a single boot configuration. Additional
boot entries can be added by board specific entries or during runtime
by copying and editing a template entry.
Some more helpers handle for example network interfaces which can now
be brought up with 'ifup'. We use the automount feature to configure
mountpoints together with the commands to bring up the devices behind
these mountpoints.
Optionally menu support is available which hides many details behind
a nice looking interface.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
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>
This implements global shell variable support. This is done by registering
a new device named 'global', so global variables are just plain device
parameters.
Global variables are useful for storing the global state in the environment.
Currently we do this by sourcing scripts instead of executing them which is
quite limiting.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Normally errno contains a positive error value. A certain unnamed developer
mixed this up while implementing U-Boot-v2. Also, normally errno is never
set to zero by any library function.
This patch fixes this.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
file_to_sdram is used to load an initrd. The resource size is
then used to pass the initrd size to Linux. This means that
the resource size must exactly match the initrd size. Currently
this is not the case since we request the sdram region in chunks
of 8 Kbytes. Fix this by adjusting the resource size when the file
is loaded.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
On a systax error we have to bail out of the shell instead of
setting inp->p to NULL and crash barebox with a NULL pointer
deref. This only happened in scripts.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This fixes the problem I had (i.e. a boot loop caused by a stray fi in
/env/bin/init).
Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Tested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>