summaryrefslogtreecommitdiffstats
path: root/common/blspec.c
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'for-next/misc'Sascha Hauer2016-10-101-2/+2
|\
| * blspec: fix typoUlrich Ölmann2016-09-281-1/+1
| | | | | | | | | | Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * convert users to %pI4Sascha Hauer2016-09-221-1/+1
| | | | | | | | | | | | | | Convert users of ip_to_string() and print_IPaddr() to %pI4 and remove the now unused functions. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | blspec: fix return value of entry_is_of_compatible()Ulrich Ölmann2016-09-281-1/+1
| | | | | | | | | | | | | | | | | | The function returns a boolean and not an integer. Hence the former explicit/implicit cast of an ERR_PTR to a boolean has led to a return value of true although a bootspec entry with a faulty devicetree is not compatible. Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | blspec: fix erroneus free in entry_is_of_compatible()Ulrich Ölmann2016-09-271-0/+1
|/ | | | | | | | | Whenever of_unflatten_dtb() encountered an error it already released the memory before returning the error code. Make this apparent by setting the pointer to NULL to avoid an erroneus free. Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* blspec: Turn message back to debug levelSascha Hauer2016-07-261-1/+1
| | | | | | | | | Normally one should not be interested that the blspec code scans a directory. In case blspec is not actively used it might even be confusing, so lower priority of the message in blspec_scan_directory() to pr_debug. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* blspec: Make blspec_boot staticSascha Hauer2016-07-261-78/+78
| | | | | | | Since blspec_boot is now only used locally we can make it static. Move it up to avoid a static declaration. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* blspec: separate bootentries from blspec entriesSascha Hauer2016-07-261-1/+27
| | | | | | | | | This completes the separation of the blspec code from the boot code. With this the boot code only handles generic boot entries of type struct bootentry which are embedded into the type (blspec/bootscript) specific structs. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootentries: Add title/descriptionSascha Hauer2016-07-261-5/+4
| | | | | | | | | | We currently have to special case blspec entries vs. boot scripts in the common boot code since we want to print different informations about them. This adds a 'title' and 'description' which can be filled in with different information by bootscripts and blspec entries and so we get rid of the special handling. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* blspec: factor out a struct bootentrySascha Hauer2016-07-261-4/+7
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* blpec: rename struct lspec -> bootentriesSascha Hauer2016-07-261-29/+29
| | | | | | | | | | | The code in common/boot.c collects the different boot entries in lists of type struct blspec, eventhough many of them may not be bootloader spec entries but for example boot scripts. This is the first step of separating the data structures from boot entries and bootloader spec: As struct blspec is merely a container for collecting boot entries We simply rename struct blspec to struct bootentries. No functional change. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* include: Move bulk of boot.h to bootm.hSascha Hauer2016-07-261-1/+1
| | | | | | | | The majority of the stuff currently in include/boot.h is about bootm code implemented common/bootm.c. To be more consistent move it to a new file include/bootm.h. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* blspec: Remove once/default handlingSascha Hauer2016-07-221-56/+1
| | | | | | | | This is widely unused and in the way of subsequent cleanups. If you are indeed using it please complain on the list, we'll find a solution to add it back in a different way. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* blspec: remove unused blspec_boot_devicenameSascha Hauer2016-07-221-30/+0
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/include-cleanup'Sascha Hauer2016-05-091-16/+18
|\
| * string: Fix (v)asprintf prototypesSascha Hauer2016-04-151-16/+18
| | | | | | | | | | | | | | | | | | | | Our asprintf and vasprintf have different prototypes than the glibc functions. This causes trouble when we want to share barebox code with userspace code. Change the prototypes for (v)asprintf to match the glibc prototypes. Since the current (v)asprintf are convenient to use change the existing functions to b(v)asprintf. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | blspec: push appendroot handling to bootmSascha Hauer2016-05-041-26/+13
|/ | | | | | | The bootm code now can handle the adding of the root= option itself, so drop the code and let bootm do it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* blspec: ignore lines beginning with '#'Sascha Hauer2016-02-111-0/+3
| | | | | | According to the bootloader spec these should be treated as comments. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* blspec: Do not crash on config files without newline on last lineSascha Hauer2016-02-111-1/+1
| | | | | | | When the last line in a config file has no newline then 'next' is NULL on the the loop iteration. Check that before derefencing 'next'. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* introduce strerrorpSascha Hauer2015-09-231-1/+1
| | | | | | | | | | putting an error pointer into strerror can be a bit confusing since strerror takes a positive error code but PTR_ERR returns a negative number, so we have to do strerror(-PTR_ERR(errp)). Some places got this wrong already, so introduce a strerrorp function which directly takes an error pointer. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/blspec'Sascha Hauer2015-07-061-1/+28
|\
| * blspec: Automatically append rootargSascha Hauer2015-06-181-1/+28
| | | | | | | | | | | | | | | | | | | | | | This patch makes it possible to automatically add a suitable root= option for booting Linux from the same filesystem on which the bootspec entry has been found. This adds an additional 'linux-appendroot' option to bootspec which if set to 'true' will cause barebox to automatically add a root= option. This currently works for NFS, UBIFS and regular block devices like ATA, SD/MMC using the root=PARTUUID= mechanism. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/mtd'Sascha Hauer2015-07-031-8/+1
|\ \ | | | | | | | | | | | | Conflicts: drivers/mtd/core.c
| * | blspec: Use device_detect_by_nameSascha Hauer2015-06-261-8/+1
| |/ | | | | | | | | | | | | device_detect_by_name will automatically separate by colons now, we no longer have to do this in the blspec code. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / blspec: Automatically attach UBI devicesSascha Hauer2015-06-171-5/+45
|/ | | | | | | | | | When blspec_scan_cdev finds an UBI device then attach it. This allows us to boot blspec entries found on the UBIFS images inside UBI volumes by pointing to the corresponding mtd partition. With this we can do 'boot nand0.root' or even 'boot=nand0' on the commandline. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* blspec: put blspec bootargs into a .dyn bootargs variableSascha Hauer2015-02-101-1/+1
| | | | | | So that they get deleted later when something else is booted. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* blspec: print error when devicetree not foundSascha Hauer2014-12-161-0/+1
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* blspec: fix incompatible pointer type warningLucas Stach2014-11-071-1/+1
| | | | | | | | | The warning is correct in that we pass in size_t instead of int. As we are not interested in the size of the property at this point, just remove the assignment. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* move file helper functions to separate fileSascha Hauer2014-08-071-0/+1
| | | | | | | | | | We have our file helper functions in several places. Move them all to lib/libfile.c. With this we no longer have file helpers in fs/fs.c which contains the core fs functions and no functions in lib/libbb.c which are not from busybox. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: Drop devicetree merge supportSascha Hauer2014-05-221-1/+1
| | | | | | | | | | | | 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>
* blspec: Check if an entry is compatible with the current machineSascha Hauer2014-03-241-2/+79
| | | | | | | | | When a bootspec entry has the 'devicetree' property specified, check if the tree is compatible with the currently running machine, otherwise ignore the entry. This makes it possible to have entries for multiple machines on an SD card and pick a suitable one. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* blspec: Add NFS supportSascha Hauer2014-03-071-2/+112
| | | | | | | | | With this barebox can start root filesystems containing bootloader spec entries via NFS. It is used as: boot nfs://<ipaddr>[:<port]//path/to/nfsroot Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mount: support filesystem options passed via -oUwe Kleine-König2014-02-101-1/+1
| | | | | | | | | | | Similar to mount(8) the barebox command mount now supports passing a string to the file system driver via -o. This is used in the next commit to let the user specify port numbers for nfs mounts. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* blspec: fix documention of blspec_scan_directory's return codeUwe Kleine-König2013-11-081-2/+1
| | | | | Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* blspec: Make error message more clearSascha Hauer2013-11-051-1/+1
| | | | | | | "Nothing found on" is a bit unspecific. Make clear that no bootspec entry is found. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* blspec: make cdev optionalSascha Hauer2013-11-051-11/+13
| | | | | | | | | the cdev for a given directory can be determined by get_cdev_by_mountpath(). Use this function and remove the cdev argument from blspec_scan_directory(). Also, export the function to make code possible which boots the bootloader spec entries found in directories. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* blspec: Let scan functions return the number of entries foundSascha Hauer2013-11-051-20/+33
| | | | | | So that callers can detect whether entries are found or not. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* blspec: Allow to boot partitionsSascha Hauer2013-11-051-0/+17
| | | | | | | | | | | | | Instead of only allowing complete devices we now also allow single partitions to look for bootloader spec entries. Normally the bootloader spec defines a way to find a partition containing /boot on a device. On embedded systems it's often useful instead to have only a single partition image which contains both the kernel and the root filesystems. This partition image may be written to the device multiple times. With this patch they can be booted with 'boot emmc0.<partno>' Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* blspec: rename _hwdevice functions to _devicenameSascha Hauer2013-11-051-5/+5
| | | | | | | Since it's not necessarily the hardware device this seems to be a more appropriate name. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* blspec: Push device_detect into blspec_scan_deviceSascha Hauer2013-11-051-2/+2
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* blspec: Fix once/default bootingSascha Hauer2013-10-211-3/+5
| | | | | | | The default/once files contain the full path to the entries, not only the filename. This fixes booting the once and default entries. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Implement bootloader spec support for bareboxSascha Hauer2013-10-141-0/+516
The Bootloader Specification describes a way how kernels can be installed on devices and how they can be started by the bootloader. The bootloader spec is currently supported by (x86) gummiboot and by systemd which provides a kernel-install script. With the bootloader spec it's possible for the Operating system to install a new kernel without knowing about the bootloader and for the bootloader it's possible to discover and start Operating Systems on a media without being configured. For more details about the spec see: http://www.freedesktop.org/wiki/Specifications/BootLoaderSpec/ This patch adds barebox support for the spec. It enhances the 'boot' command so that not only boot script names can be given, but also devices containing bootloader spec entries. With this it's possible to call the 'boot' command like: 'boot sd emmc net'. It would then first look for bootloader spec entries on the (removable) sd card, then, is nothing is found, on the internal emmc and if still unsuccessful would call the 'net' bootscript. The bootloader Spec currently doesn't specify which entry should be default if multiple entries are found on a single device. Therefore barebox currently has two extensions of the spec. The $BOOT diretory can contain a file named 'default'. If present, the content of the file is treated as a filename under $BOOT/loader/entries/ which is used as default. Similarly if a file named 'once' is present, the entry is started once and the file is removed afterwards. This is useful for testing if a newly installed kernel works before making it the default. As on ARM and other Architectures a devicetree has to be specified for the kernel, the 'devicetree' property is used to specify a devicetree. Like 'kernel' and 'initrd' this also contains a pth relative to $BOOT. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>