summaryrefslogtreecommitdiffstats
path: root/common/filetype.c
Commit message (Collapse)AuthorAgeFilesLines
* filetype: support fastboot barebox_update with layerscape imageAhmad Fatoum2019-09-181-0/+2
| | | | | | | | | | We do not yet support USB on the Layerscape platforms, but when we do, it's imaginable that we would want to export barebox_update targets over Fastboot. Prepare for this by adding the layerscape images to those that filetype_is_barebox_image returns true for. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* filetype: add STM32 image typeAhmad Fatoum2019-07-151-0/+9
| | | | | | | | | | | | Both STM32MP BootROM and TF-A first stage expect subsequent bootloader stages to feature a specific 256-byte long STM32 file header. Add detection of the header to file_detect_type(). While there's only one version of the header so far, identify the new header as v1 anyway, so new versions can be unambiguously added. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/ubootenv'Sascha Hauer2019-06-111-0/+8
|\
| * filetype: Allow specifying cdev's filetype explicitlyAndrey Smirnov2019-06-071-0/+6
| | | | | | | | | | | | | | | | | | Allow specifying cdev's filetype explicitly to support the cases where the type of a cdev is known apriori, yet cannot be determined by reading the cdev's content. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * filetype: Add "U-Boot environmemnt variable data" filetypeAndrey Smirnov2019-06-071-0/+2
| | | | | | | | | | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | filetype: fix typoAntony Pavlov2019-06-071-1/+1
|/ | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* filetype: Detect Layerscape PBL imagesSascha Hauer2019-05-091-0/+7
| | | | | | | The Layerscape SoCs have their own boot image format. Add filetype detection for it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* common: Always return enum filetype in file_name_detect_type_offset()Andrey Smirnov2019-03-111-2/+2
| | | | | | | | | None of the callers of file_name_detect_type_offset() are prepared to deal with negative error code. Change the code to return filetype_unknown if open_and_lseek() fails. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* filetype: Add code to detect i.MX image v2Andrey Smirnov2018-08-311-0/+4
| | | | | | | | Modify file_detect_type() and add code needed to be able to detect i.MX boot images with v2 header. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* filetype: Add code to detect i.MX image v1Andrey Smirnov2018-08-311-0/+7
| | | | | | | | Modify file_detect_type() and add code needed to be able to detect i.MX boot images with v1 header. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/bootm'Sascha Hauer2018-07-091-0/+5
|\
| * filetype: add ELF typeAntony Pavlov2018-06-151-0/+5
| | | | | | | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | kwbimage_v0: add support to detect and boot a mvebu v0 imageUwe Kleine-König2018-06-041-5/+17
|/ | | | | | | | | The differences between v0 and v1 of the mvebu kwbimage are small enough that the function to boot such an image can be shared between both variants. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* filetype: Detect ARM aarch64 Linux imagesSascha Hauer2018-04-041-0/+3
| | | | | | ARM aarch64 Linux image have a special type. Allow to detect them. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* filetype: Add type detection at an offsetPhilipp Zabel2018-02-051-2/+8
| | | | | | | | Add file_name_detect_type_offset to allow file system detection for loop mounts at an offset. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* filetype: Add fastboot sparse format detectionSascha Hauer2018-01-171-0/+5
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* filetype: Add image type for boot images used on Armada 370 and XPUwe Kleine-König2017-03-021-0/+8
|
* Add filetype and detection for squashfs imagesEnrico Jorns2016-10-241-0/+4
| | | | | | | | | | | | | | | | | | | This adds `filetype_squashfs` to the list of known filetypes and adds a detection for squashfs files to file_detect_type(). This currently matches on the `hsqs` start sequence of an image file. Additionally, the newly introduced filetype is registered as the type of the squashfs_driver which allows, for example, to mount squashfs without the need to specify a type parameter. This changes enable booting a squashfs with the simple `boot` command pointing to the location (device) that holds the squashfs. Note that booting with blspec is limited as the current squashfs driver is not capable of handling symbolic links. Signed-off-by: Enrico Jorns <ejo@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* filetype: add new filetype for SoCFPGA xload imageSteffen Trumtrar2016-08-181-0/+4
| | | | | Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* filetype: Fix booting ARM Linux Kernels with CONFIG_EFI enabledSascha Hauer2016-04-191-2/+3
| | | | | | | | When an ARM kernel is built with CONFIG_EFI enabled, then the kernel image also looks like a EXE file. Move ARM zImage detection before EXE detection so that the kernel is still detected as zImage. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fastboot: Add a ARM Barebox filetype handlerMarkus Pargmann2016-03-111-0/+13
| | | | | | | | | This will automatically call barebox_update for the transfered file if it is an ARM Barebox image and the destination file is defined by some update handler. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* common: filetype: do not redetect MBR-type devices as a FAT-typePeter Mamonov2015-11-231-31/+0
| | | | | | | | | | | | | Deleted pieces of code detect MBR-containig device as a FAT-type device, if it's first partition contains a FAT filesystem. This behaviour enabled one to mount the FAT FS which is either directly on the device (disk0) or on the first partition (disk0.0) using the same command: mount /dev/disk0 /fat However, the desired behaviour can be reached with a: mount /dev/disk0 /fat || mount /dev/disk0.0 /fat || echo "Mounting failed" Signed-off-by: Peter Mamonov <pmamonov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* filetype: Use cdev_openSascha Hauer2015-10-151-1/+3
| | | | | | | a cdev has to be opened before usage. Use cdev_open instead of cdev_by_name. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* detect_fs: use device instead of fileVicente Bergas2015-10-021-0/+37
| | | | | | | | detect_fs would usually mount a device on a directory, so, use a device-specific type detection. Signed-off-by: Vicente Bergas <vicencb@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* filetype: Add filetype for MXS bootstreamSascha Hauer2015-06-121-0/+3
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/xz'Sascha Hauer2014-11-051-0/+4
|\
| * filetype: Add XZ filetype supportSascha Hauer2014-10-241-0/+4
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | common: fix mbr filetype detectionZahari Doychev2014-11-051-0/+48
|/ | | | | | | | | | | | | | Sometimes mbr is erroneously recocognised as FAT partion. Due to this the mbr partition parser is not being called and the partitions on the media are not detected. This patch should fix the problem. The checking is done as in the linux kernel. I have seen the problem using usb sticks. Although partitioning and formatting them under linux. The file system type field in the mbr remains there which causes the wrong detections as FAT32 type and not as mbr. Signed-off-by: Zahari Doychev <zahari.doychev@linux.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/efi'Sascha Hauer2014-08-071-0/+4
|\ | | | | | | | | | | | | Conflicts: .gitignore Makefile drivers/serial/Makefile
| * filetype: Add DOS EXE file detection supportSascha Hauer2014-07-141-0/+4
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | barebox: common: Add missing filetype descriptionWadim Egorov2014-07-241-0/+1
|/ | | | | | | Added missing filetype description for UBIFS. Signed-off-by: Wadim Egorov <w.egorov@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* barebox: common: added new filetypesWadim Egorov2014-07-091-0/+12
| | | | | | | | | - Added omap CH image header recognition * filetype_ch_image * filetype_ch_image_be Signed-off-by: Wadim Egorov <w.egorov@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* misc: upper-case some abbreviationsHolger Schurig2014-06-021-10/+10
| | | | | Signed-off-by: Holger Schurig <holgerschurig@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* filetype: Add detection for barebox environmentSascha Hauer2014-02-201-0/+4
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* filetype: add Binary PacKage BPK typeJean-Christophe PLAGNIOL-VILLARD2013-10-061-0/+3
| | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* filetype: Add ubifs detectionSascha Hauer2013-08-071-0/+2
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* lib: Add support for LZ4-compressed kernelKyungsik Lee2013-07-161-0/+4
| | | | | | | | | | | | This patch adds support for extracting LZ4-compressed kernel images, as well as LZ4-compressed ramdisk images in the kernel boot process. This depends on the patch below decompressor: Add LZ4 decompressor module Signed-off-by: Kyungsik Lee <kyungsik.lee@lge.com> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* common/filetype: move partition-table detection into own functionHubert Feurstein2013-04-291-12/+24
| | | | | Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* filetype: add GPT supportJean-Christophe PLAGNIOL-VILLARD2013-02-161-0/+52
| | | | | | | | GPT need to be check before MBR Cc: Rob Herring <rob.herring@calxeda.com> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* filetype: add is_barebox_mips_head supportJean-Christophe PLAGNIOL-VILLARD2013-01-221-1/+1
| | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* filetype: Make buf in file_detect_type constSascha Hauer2013-01-201-5/+5
| | | | | | This function has no business changing the buffer. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* add ext fs detection supportSascha Hauer2012-12-031-0/+8
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* filetype: Pass bufsizeSascha Hauer2012-12-031-12/+27
| | | | | | | | | | 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>
* filetype: add shortnamesSascha Hauer2012-10-301-19/+32
| | | | | | | The filetype strings are not really suitable for shell scripts, so add a shortname array of filetypes usable for shell scripts. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/remove-fsf-address'Sascha Hauer2012-10-031-4/+0
|\ | | | | | | | | | | Conflicts: drivers/net/miidev.c include/miidev.h
| * Treewide: remove address of the Free Software FoundationSascha Hauer2012-09-171-4/+0
| | | | | | | | | | | | | | 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>
* | Merge branch 'for-next/png'Sascha Hauer2012-10-031-0/+7
|\ \ | | | | | | | | | | | | | | | Conflicts: common/filetype.c include/filetype.h
| * | filetype: add PNG supportJean-Christophe PLAGNIOL-VILLARD2012-09-121-0/+4
| | | | | | | | | | | | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | filetype: add BMP supportJean-Christophe PLAGNIOL-VILLARD2012-09-121-0/+3
| |/ | | | | | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/omap'Sascha Hauer2012-10-031-1/+1
|\ \ | | | | | | | | | | | | Conflicts: Makefile