- Feb 26, 2021
-
-
This adds support for things like "#partname" and "0.1#partname". The block device parsing is done like in blk_get_device_part_str. Signed-off-by:
Sean Anderson <sean.anderson@seco.com> Reviewed-by:
Simon Glass <sjg@chromium.org>
-
This adds an option to part_get_info_by_dev_and_name_or_num to allow callers to specify whether whole-disk partitions are fine. Signed-off-by:
Sean Anderson <sean.anderson@seco.com> Reviewed-by:
Simon Glass <sjg@chromium.org>
-
Several functions in disk/part.c just return -1 on error. This makes them return different errnos for different failures. This helps callers differentiate between failures, even if they cannot read stdout. Signed-off-by:
Sean Anderson <sean.anderson@seco.com> Reviewed-by:
Simon Glass <sjg@chromium.org>
-
- Feb 02, 2021
-
-
Move this out of the common header and include it only where needed. In a number of cases this requires adding "struct udevice;" to avoid adding another large header or in other cases replacing / adding missing header files that had been pulled in, very indirectly. Finally, we have a few cases where we did not need to include <asm/global_data.h> at all, so remove that include. Signed-off-by:
Simon Glass <sjg@chromium.org> Signed-off-by:
Tom Rini <trini@konsulko.com>
-
- Feb 01, 2021
-
-
Fixes issues when switching from GPT to MBR partition tables. Signed-off-by:
Gary Bisson <gary.bisson@boundarydevices.com> Acked-by:
Marek Szyprowski <m.szyprowski@samsung.com>
-
- Jan 30, 2021
-
-
Commands like 'fatinfo' call dev_print() to print device information. If the block device is created via 'host bind', we should print accurate information. Signed-off-by:
Heinrich Schuchardt <xypron.glpk@gmx.de>
-
- Jan 29, 2021
-
-
Fixes fastboot issues when switching from mbr to gpt partition tables. Signed-off-by:
Gary Bisson <gary.bisson@boundarydevices.com> Reviewed-by:
Heinrich Schuchardt <xypron.glpk@gmx.de>
-
- Jan 16, 2021
-
-
There's no reason to require an appropriately sized output parameter for the string, that's error-prone should the table ever grow an element with a longer string. We can just return the const char* pointer directly. Update the only caller accordingly, and get rid of pointless ifdeffery in the header so that the compiler always sees a declaration and can thus do type-checking, whether or not PARTITION_TYPE_GUID is enabled or not. Signed-off-by:
Rasmus Villemoes <rasmus.villemoes@prevas.dk>
-
- Jan 15, 2021
-
-
Add a code for creating and writing MBR partition layout. The code generates similar layout of EBRs (Exteneded Block Records) and logical volumes as Linux's fdisk utility. Signed-off-by:
Marek Szyprowski <m.szyprowski@samsung.com>
-
Make functions not used outside this file static. Signed-off-by:
Marek Szyprowski <m.szyprowski@samsung.com> [trini: Use __maybe_unused as there are cases they may not be used] Signed-off-by:
Tom Rini <trini@konsulko.com>
-
Use a generic helper for reading LE32 integers. Signed-off-by:
Marek Szyprowski <m.szyprowski@samsung.com>
-
Add some handy defines for some hardcoded magic numbers related to extended partition handling. Signed-off-by:
Marek Szyprowski <m.szyprowski@samsung.com>
-
write_mbr_partition() function name is a bit misleading, so rename it to write_mbr_sector(). This is a preparation for adding code for writing a complete MBR partition layout. Signed-off-by:
Marek Szyprowski <m.szyprowski@samsung.com>
-
- Sep 22, 2020
-
-
512 * 2^32 bytes equals 2 tebibytes. Signed-off-by:
Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by:
Simon Glass <sjg@chromium.org>
-
- Aug 14, 2020
-
-
Add initial infrastructure for Xen para-virtualized block device. This includes compile-time configuration and the skeleton for the future driver implementation. Add new class UCLASS_PVBLOCK which is going to be a parent for virtual block devices. Add new interface type IF_TYPE_PVBLOCK. Implement basic driver setup by reading XenStore configuration. Signed-off-by:
Andrii Anisov <andrii_anisov@epam.com> Signed-off-by:
Anastasiia Lukianenko <anastasiia_lukianenko@epam.com> Signed-off-by:
Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
-
- May 19, 2020
-
-
Move this header out of the common header. Signed-off-by:
Simon Glass <sjg@chromium.org>
-
- May 18, 2020
-
-
Move this uncommon header out of the common header. Signed-off-by:
Simon Glass <sjg@chromium.org>
-
We should not be using typedefs and these make it harder to use forward declarations (to reduce header file inclusions). Drop the typedef. Signed-off-by:
Simon Glass <sjg@chromium.org>
-
Move this header out of the common header. Network support is used in quite a few places but it still does not warrant blanket inclusion. Note that this net.h header itself has quite a lot in it. It could be split into the driver-mode support, functions, structures, checksumming, etc. Signed-off-by:
Simon Glass <sjg@chromium.org>
-
Move this uncommon header out of the common header. Signed-off-by:
Simon Glass <sjg@chromium.org>
-
- May 15, 2020
-
-
Have this symbol follow the pattern of all other such symbols. Signed-off-by:
Trevor Woerner <twoerner@gmail.com>
-
- Apr 30, 2020
-
-
Heinrich Schuchardt authored
Up to now for MBR and GPT partitions the info field 'bootable' was set to 1 if either the partition was an EFI system partition or the bootable flag was set. Turn info field 'bootable' into a bit mask with separate bits for bootable and EFI system partition. This will allow us to identify the EFI system partition in the UEFI sub-system. Signed-off-by:
Heinrich Schuchardt <xypron.glpk@gmx.de>
-
- Mar 18, 2020
-
-
Some config symbols are found in *almost* every _defconfig file for Allwinner boards, because those options are actually a platform choice, and not a per-board decision. Some of these options are older, some have recently been added. Move those options to be set for all Allwinner boards in their respective Kconfig files. The rationales are as follows: - NR_DRAM_BANKS: All Allwinner SoC map DRAM at one contiguous region of address space only, starting at 1 GB. So it's always one bank. - SPL_{DOS,EFI}_PARTITION: The Allwinner SPL does only support raw MMC accesses, we don't care about filesystems or partitions in there, so there is no need to define those symbols at all. - USE_PREBOOT: We start USB early when a keyboard is configured, using the preboot env variable, so we need to set this variable. - SYS_RELOC_GD_ENV_ADDR: We don't specify any ENV_ADDR, so need this symbol to be set (according to 8d8ee47e). - SYS_USB_EVENT_POLL_VIA_INT_QUEUE: According to commit eab9433a, specifying this reduces the latency of the USB keyboard handling, so this was formerly enabled in config headers for all Allwinner boards. Signed-off-by:
Andre Przywara <andre.przywara@arm.com> Acked-by:
Maxime Ripard <mripard@kernel.org> Tested-by: Jagan Teki <jagan@amarulasolutions.com> # Amarula A64-Relic Reviewed-by:
Jagan Teki <jagan@amarulasolutions.com>
-
- Jan 23, 2020
-
-
div_by is a misleading parameter name, when we are doing >> div_by. Rename it to right_shift. Reported-by:
Simon Glass <sjg@chromium.org> Signed-off-by:
Heinrich Schuchardt <xypron.glpk@gmx.de>
-
- Dec 02, 2019
-
-
Drop inclusion of crc.h in common.h and use the correct header directly instead. With this we can drop the conflicting definition in fw_env.h and rely on the crc.h header, which is already included. Signed-off-by:
Simon Glass <sjg@chromium.org> Reviewed-by:
Tom Rini <trini@konsulko.com>
-
- Oct 31, 2019
-
-
The signature 0x55 0xAA in bytes 510 and 511 of the first sector can either indicate a DOS partition table of the first sector of a FAT file system. The current code tries to check if the partition table is valid by looking at the boot indicator of the partition entries. But first of all it does not count from 0 to 3 but only from 0 to 2. And second it misses to increment the pointer for the partition entry. If it is a FAT file system can be discovered by looking for the text 'FAT' at offset 0x36 or 'FAT32' at offset 0x52. In a DOS PBR there are no partition entries, so those bytes are undefined. Don't require the byte at offset 0x1BE to differ from 0x00 and 0x80. With the patch the logic is changed as follows: If the partition table has either an invalid boot flag for any partition or has no partition at all, check if the first sector is a DOS PBR by looking at the FAT* signature. Signed-off-by:
Heinrich Schuchardt <xypron.glpk@gmx.de>
-
- Sep 19, 2019
-
-
The blk_dread() following the mbr allocation reads one block from the device. This will lead to overflow if block size is greater than the size of legacy_mbr. Fix this by allocating at least one block size. Signed-off-by:
Faiz Abbas <faiz_abbas@ti.com> Acked-by:
Alexey Brodkin <abrodkin@synopsys.com>
-
- Aug 23, 2019
-
-
Some ChromeOS devices (atleast veyron speedy) have the first 8MiB of the eMMC write protected and equipped with a dummy 'IGNOREME' GPT header - instead of spewing error messages about it, just silently try the backup GPT. Note: this does not touch the gpt cmd writing/verifying functions, those will still complain. Signed-off-by:
Urja Rannikko <urjaman@gmail.com> Reviewed-by:
Kever Yang <kever.yang@rock-chips.com>
-
There were 3 copies of the same sequence, make it into a function. Signed-off-by:
Urja Rannikko <urjaman@gmail.com> Reviewed-by:
Kever Yang <kever.yang@rock-chips.com>
-
- Aug 11, 2019
-
-
Move env_get() over to the new header file. Acked-by:
Joe Hershberger <joe.hershberger@ni.com> Signed-off-by:
Simon Glass <sjg@chromium.org>
-
- Jul 24, 2019
-
-
This patch adds part_get_info_by_dev_and_name_or_num() function which allows us to get partition info from its number or name. Partition of interest is specified by string like "device_num:partition_number" or "device_num#partition_name". The patch was extracted from [1]. [1] https://android-review.googlesource.com/c/platform/external/u-boot/+/729880/2 Signed-off-by:
Ruslan Trofymenko <ruslan.trofymenko@linaro.org> Signed-off-by:
Igor Opaniuk <igor.opaniuk@gmail.com> Reviewed-by:
Alistair Strachan <astrachan@google.com> Reviewed-by:
Sam Protsenko <semen.protsenko@linaro.org> Reviewed-by:
Simon Glass <sjg@chromium.org>
-
- Jul 18, 2019
-
-
part_get_info_extended and print_partition_extended can recurse infinitely while parsing a self-referential filesystem or one with a silly number of extended partitions. This patch adds a limit to the number of recursive partitions. Signed-off-by:
Paul Emge <paulemge@forallsecure.com>
-
- Jul 16, 2019
-
-
Heinrich Schuchardt authored
When building with GCC 9.1 an error occurs: disk/part_efi.c: In function ‘gpt_verify_partitions’: disk/part_efi.c:737:49: error: taking address of packed member of ‘struct _gpt_entry’ may result in an unaligned pointer value [-Werror=address-of-packed-member] 737 | gpt_convert_efi_name_to_char(efi_str, gpt_e[i].partition_name, | ~~~~~~~~^~~~~~~~~~~~~~~ cc1: all warnings being treated as errors make[1]: *** [scripts/Makefile.build:279: disk/part_efi.o] Error 1 make: *** [Makefile:1594: disk] Error 2 Adjust gpt_convert_efi_name_to_char() to accept unaligned strings. Reported-by:
Ramon Fried <rfried.dev@gmail.com> Signed-off-by:
Heinrich Schuchardt <xypron.glpk@gmx.de>
-
- Jul 06, 2019
-
-
Heinrich Schuchardt authored
In part_get_info_efi() we use the output of print_efiname() to set info->name[]. The size of info->name is PART_NAME_LEN = 32 but print_efiname() returns a string with a maximum length of PARTNAME_SZ + 1 = 37. Use snprintf() instead of sprintf() to avoid buffer overflow. Signed-off-by:
Heinrich Schuchardt <xypron.glpk@gmx.de>
-
- Jun 21, 2019
-
-
blk_get_device_by_str was skipping part_init when hw partition 0 was selected because it is the default. However, this caused issues when switching to a non-zero partition and then back to partition zero, as stale data from the wrong partition was returned. Remove this optimization and call part_init regardless of the selected partition. Signed-off-by:
Robert Hancock <hancock@sedsystems.ca>
-
- Jun 14, 2019
-
-
Heinrich Schuchardt authored
When compiling with FTRACE=1 an error ld.bfd: disk/built-in.o: in function `lba512_muldiv': disk/part.c:114: undefined reference to `__udivmoddi4 occurred. Use '>> 11' instead of '/ 2048' to avoid the division. Signed-off-by:
Heinrich Schuchardt <xypron.glpk@gmx.de>
-
- May 02, 2019
-
-
Below is what happens on R-Car H3ULCB-KF using clean U-Boot v2019.04-00810-g6aebc0d11a10 and r8a7795_ulcb_defconfig: => ### interrupt autoboot => gpt verify mmc 1 No partition list provided - only basic check Verify GPT: success! => ### keep calling 'gpt verify mmc 1' => ### on 58th call, we are out of memory: => gpt verify mmc 1 alloc_read_gpt_entries: ERROR: Can't allocate 0X4000 bytes for GPT Entries GPT: Failed to allocate memory for PTE gpt_verify_headers: *** ERROR: Invalid Backup GPT *** Verify GPT: error! This is caused by calling is_gpt_valid() twice (hence allocating pte also twice via alloc_read_gpt_entries()) while freeing pte only _once_ in the caller of gpt_verify_headers(). Fix that by freeing the pte allocated and populated for primary GPT _before_ allocating and populating the pte for backup GPT. The latter will be freed by the caller of gpt_verify_headers(). With the fix applied, the reproduction scenario [1-2] has been run hundreds of times in a loop w/o running into OOM. [1] gpt verify mmc 1 [2] gpt verify mmc 1 $partitions Fixes: cef68bf9 ("gpt: part: Definition and declaration of GPT verification functions") Signed-off-by:
Eugeniu Rosca <erosca@de.adit-jv.com> Reviewed-by:
Heinrich Schuchardt <xypron.glpk@gmx.de>
-
Below is what happens on R-Car H3ULCB-KF using clean U-Boot v2019.04-00810-g6aebc0d11a10 and r8a7795_ulcb_defconfig: => ### interrupt autoboot => gpt guid mmc 1 21200400-0804-0146-9dcc-a8c51255994f success! => ### keep calling 'gpt guid mmc 1' => ### on 59th call, we are out of memory: => gpt guid mmc 1 alloc_read_gpt_entries: ERROR: Can't allocate 0X4000 bytes for GPT Entries GPT: Failed to allocate memory for PTE get_disk_guid: *** ERROR: Invalid GPT *** alloc_read_gpt_entries: ERROR: Can't allocate 0X4000 bytes for GPT Entries GPT: Failed to allocate memory for PTE get_disk_guid: *** ERROR: Invalid Backup GPT *** error! After some inspection, it looks like get_disk_guid(), added via v2017.09 commit 73d6d18b ("GPT: add accessor function for disk GUID"), unlike other callers of is_gpt_valid(), doesn't free the memory pointed out by 'gpt_entry *gpt_pte'. The latter is allocated by is_gpt_valid() via alloc_read_gpt_entries(). With the fix applied, the reproduction scenario has been run hundreds of times ('while true; do gpt guid mmc 1; done') w/o running into OOM. Fixes: 73d6d18b ("GPT: add accessor function for disk GUID") Signed-off-by:
Eugeniu Rosca <erosca@de.adit-jv.com> Reviewed-by:
Heinrich Schuchardt <xypron.glpk@gmx.de>
-
- Apr 26, 2019
-
-
%g/rathen then/rather than/ Signed-off-by:
Heinrich Schuchardt <xypron.glpk@gmx.de>
-
- Jan 18, 2019
-
-
Make system_guid const. Signed-off-by:
Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by:
Simon Glass <sjg@chromium.org>
-