summaryrefslogtreecommitdiffstats
path: root/common/partitions.c
Commit message (Collapse)AuthorAgeFilesLines
* x86: drop legacy (PC BIOS) boot in favor of EFIAhmad Fatoum2021-03-251-2/+0
| | | | | | | | | | | | | The 16-bit port has experienced bitrot and failed to compile with more recent linkers for at least a year. Fixing the linker error is insufficient to restore a barebox that can boot to shell. This continued breakage likely means that there are no users interested in updating. As new x86 projects should be using MACH_EFI_GENERIC anyway, retire support for 16-bit legacy boot (MACH_X86_GENERIC). Acked-by: Juergen Borleis <jbe@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* common: drop done TODO about 4G partitionsAhmad Fatoum2021-03-251-1/+0
| | | | | | | | With recent changes, barebox can handle partitions bigger than 4G. Remove the todo. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* partitions: don't allocate dma capable memoryAhmad Fatoum2021-03-231-3/+2
| | | | | | | | | | | While block drivers may do DMA, they always use block caching chunks as bounce buffer. No dma is every done directly to the block_read data argument, so it doesn't need to be allocated with dma_alloc. The buffer also need not be zeroed, as block_read will either overwrite it completely or fail. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* block: use 64-bit types for sector offset and count on all platformsAhmad Fatoum2021-02-181-1/+1
| | | | | | | | | | | barebox' use of int for the sector offset puts an upper bound of 1TB on the size of supported block devices, which is already exceeded by common place USB mass storage. Increasing the sizes involved to 64 bit like Linux does won't magically add missing driver support, but it gives us at least a fighting chance. Do so. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* common: replace license statements with SPDX-License-IdentifiersAhmad Fatoum2020-11-271-12/+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>
* partition: include partuuid string in debug stringAhmad Fatoum2019-10-231-2/+2
| | | | | | | | When debugging partitions detected by barebox, knowing the partuuid can be useful. Include it in the dev_dbg output. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: partitions: flag partitions from a partition tableSascha Hauer2017-03-311-0/+2
| | | | | | | | | We are going to call the of_partition_fixup for regular block devices like MMC/SD aswell. Add a flag to partitions indicating they are instanciated from a on-disk partition table so that they won't be added as device tree partitions during fixup. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* string: Fix (v)asprintf prototypesSascha Hauer2016-04-151-1/+1
| | | | | | | | | | 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>
* partition: Create links with partition namesSascha Hauer2016-01-081-13/+7
| | | | | | | When a partition has a name create a link to the original partition rather than registering a second cdev. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* cdev: Add partuuid string to struct cdevSascha Hauer2015-06-181-0/+1
| | | | | | | | This adds the partuuid string to struct cdev in order to have this available for constructing a suitable Linux root=PARTUUID= option for booting Linux. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* common: fix mbr filetype detectionZahari Doychev2014-11-051-0/+2
| | | | | | | | | | | | | | 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>
* cdev: store dos partition type in struct cdevSascha Hauer2013-10-141-1/+3
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* devfs: let devfs_add_partition return the new partitionSascha Hauer2013-07-151-4/+8
| | | | | | Useful for unregistering later or for adding addional flags. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* block: implement block_read/block_write functionsSascha Hauer2013-05-311-1/+1
| | | | | | | | | Some drivers use blk->ops->read/write. This bypasses the caching block layer and was never intended like this. The upper API to the block layer is the cdev layer. This patch adds block_read and block_write functions and uses them where appropriate. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* common/partition: check only for partition table typesHubert Feurstein2013-04-291-2/+2
| | | | | | | | The detection of the partition table fails when we have a barebox image in the MBR. So check only for partition table types. Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* disk: introduce partition nameJean-Christophe PLAGNIOL-VILLARD2013-02-161-12/+42
| | | | | | | | so we can register partion with name as present in EFI GPT 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>
* partitons: add frameworkJean-Christophe PLAGNIOL-VILLARD2013-02-161-86/+55
| | | | | | | | | | so we can support multiple format use filetpye to detect the parser to use 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>
* Merge branch 'for-next/misc'Sascha Hauer2012-11-161-1/+2
|\ | | | | | | | | | | | | Conflicts: commands/Makefile Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * common/partitions.c: make use of is_fat_or_mbrFranck Jullien2012-10-121-1/+2
| | | | | | | | | | Signed-off-by: Franck Jullien <franck.jullien@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | common/paritions.c: force little endian readsFranck Jullien2012-10-121-4/+4
|/ | | | | | | | When reading values from a DOS disk, we need to force a little endian reading. Signed-off-by: Franck Jullien <franck.jullien@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* 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/size-decrease'Sascha Hauer2012-07-021-1/+1
|\
| * dos partitions: enable disk size guessing only for bios disksSascha Hauer2012-06-281-1/+1
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/dma-cache-align'Sascha Hauer2012-07-021-2/+3
|\ \
| * | partition: Use dma_alloc for allocating buffersSascha Hauer2012-06-301-2/+3
| |/ | | | | | | | | | | | | Drivers may use dma to transfer blocks, so put them into dma save memory. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / partitions: Make 64bit capableSascha Hauer2012-06-301-29/+0
|/ | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* dos partitions: Do not register as fixed partitionsSascha Hauer2012-02-171-1/+1
| | | | | | | | A fixed partition means that we can't remove it. This is only suitable for our vital /dev/self0 and /dev/env0 partitions, so remove the fixed flag. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* DISK: Add common partition handling for disk like mediaJuergen Beisert2011-11-281-0/+200
This covers disk like media like SD card, CF cards, regular hard disks and also USB mass storage devices. Most common used partition table is still of DOS type. This implementation is prepared to support more partition types in the future. Signed-off-by: Juergen Beisert <jbe@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>