summaryrefslogtreecommitdiffstats
path: root/common/binfmt.c
Commit message (Collapse)AuthorAgeFilesLines
* filetype: return error and pass filetype as pointer argumentSascha Hauer2023-08-181-1/+5
| | | | | | | | | | | | | | | | | file_name_detect_type(), file_name_detect_type_offset() and cdev_detect_type() return the filetype. With this all errors from these functions remain undetected and are just returned as filetype_unknown. Explicitly return an error code and pass the filetype as pointer argument so that callers can detect and handle errors. This fixes a bug in the bootm code where the returned filetype was erroneously tested for being smaller than 0. This was never true and so the corresponding error message was never printed. Now with this patch a non existing initrd or device tree file is responded with a meaningful error message. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* common: replace license statements with SPDX-License-IdentifiersAhmad Fatoum2020-11-271-2/+1
| | | | | | | | | | | | | For all files in common/ that already have a license text: - Replace with appropriate SPDX-License-Identifier - Remove empty comment lines around replacement - remove comment completely if only thing remaining is name of file without description Reviewed-by: Roland Hieber <rhi@pengutronix.de> Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* command: Let builtin command take precedenceSascha Hauer2013-09-241-1/+4
| | | | | | | | | | | | | | | | In theory we can overwrite a builtin command with a script. However, I don't know a single case where this has been done. Scripts are often more unflexible than commands so it's unlikely that a script can extend the functionality of a builtin command. Moreover, the internal command is no longer accessible once it's overwritten by a script. Invert this logic so that a builtin command can overwrite an existing script. This will help when the 'boot' script is converted to a builting command. Then with old environments the builtin command will be used instead of the script. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Introduce binfmt supportJean-Christophe PLAGNIOL-VILLARD2012-04-181-0/+95
This will allow to execute any file and detect it's type to handle it. This will allow to use shell for bootp bootfile or dfu. You can register multiple hook for the same filetype. They will be execute in the invert order of register. If a hook does not handle the file you just return -ERESTARTNOHAND; This is only available with hush parser. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>