20 Jan, 2016

1 commit

  • On bootup the emmc's hw partition is always set to 0 and the partition
    table is read from it. When switching to another hw partition the
    partition table's id is not updated but instead the old one from
    hw partition 0 is used. If there is no partition table on hw partition 0
    then the code will terminate and return error even if the desired hw
    partition contains a perfectly fine partition table. This fix updates
    the partition table struct to correspond to the specified hw partition
    before testing if the partition table is valid or not.

    Signed-off-by: Erik Tideman
    Reviewed-by: Tom Rini
    [trini: Squash the patch that corrected whitespace in the original into
    this one, wrap with HAVE_BLOCK_DEVICE test]
    Signed-off-by: Tom Rini

    Erik Tideman
     

15 Jan, 2016

1 commit


14 Jan, 2016

2 commits


24 Nov, 2015

2 commits

  • The optional parameter bootable is added in gpt command to set the
    partition attribute flag "Legacy BIOS bootable"

    This flag is used in extlinux and so in with distro to select
    the boot partition where is located the configuration file
    (please check out doc/README.distro for details).

    With this parameter, U-Boot can be used to create the boot partition
    needed for device using distro.

    example of use:

    setenv partitions "name=u-boot,size=60MiB;name=boot,size=60Mib,bootable;\
    name=rootfs,size=0"

    > gpt write mmc 0 $partitions

    > part list mmc 0

    Partition Map for MMC device 0 -- Partition Type: EFI

    Part Start LBA End LBA Name
    Attributes
    Type GUID
    Partition GUID
    1 0x00000022 0x0001e021 "u-boot"
    attrs: 0x0000000000000000
    type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
    guid: cceb0b18-39cb-d547-9db7-03b405fa77d4
    2 0x0001e022 0x0003c021 "boot"
    attrs: 0x0000000000000004
    type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
    guid: d4981a2b-0478-544e-9607-7fd3c651068d
    3 0x0003c022 0x003a9fde "rootfs"
    attrs: 0x0000000000000000
    type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
    guid: 6d6c9a36-e919-264d-a9ee-bd00379686c7

    > part list mmc 0 -bootable devplist

    > printenv devplist

    devplist=2

    Then the distro scripts will search extlinux in partition 2
    and not in the first partition.

    Signed-off-by: Patrick Delaunay

    Patrick Delaunay
     
  • This commit provides definition and declaration of GPT verification
    functions - namely gpt_verify_headers() and gpt_verify_partitions().
    The former is used to only check CRC32 of GPT's header and PTEs.
    The latter examines each partition entry and compare attributes such as:
    name, start offset and size with ones provided at '$partitions' env
    variable.

    Signed-off-by: Lukasz Majewski
    Reviewed-by: Tom Rini
    Reviewed-by: Przemyslaw Marczak

    Lukasz Majewski
     

13 Nov, 2015

2 commits

  • short strings can be used in type parameter of gpt command
    to replace the guid string for the types known by u-boot

    partitions = name=boot,size=0x6bc00,type=data; \
    name=root,size=0x7538ba00,type=linux;
    gpt write mmc 0 $partitions

    and they are also used to display the type of partition
    in "part list" command

    Partition Map for MMC device 0 -- Partition Type: EFI

    Part Start LBA End LBA Name
    Attributes
    Type GUID
    Partition GUID
    1 0x00000022 0x0000037f "boot"
    attrs: 0x0000000000000000
    type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
    type: data
    guid: d117f98e-6f2c-d04b-a5b2-331a19f91cb2
    2 0x00000380 0x003a9fdc "root"
    attrs: 0x0000000000000000
    type: 0fc63daf-8483-4772-8e79-3d69d8477de4
    type: linux
    guid: 25718777-d0ad-7443-9e60-02cb591c9737

    Signed-off-by: Patrick Delaunay

    Patrick Delaunay
     
  • code under flag CONFIG_PARTITION_TYPE_GUID
    add parameter "type" to select partition type guid

    example of use with gpt command :

    partitions = uuid_disk=${uuid_gpt_disk}; \
    name=boot,size=0x6bc00,uuid=${uuid_gpt_boot}; \
    name=root,size=0x7538ba00,uuid=${uuid_gpt_root}, \
    type=0fc63daf-8483-4772-8e79-3d69d8477de4;

    gpt write mmc 0 $partitions

    Signed-off-by: Patrick Delaunay

    Patrick Delaunay
     

25 Oct, 2015

2 commits


12 Sep, 2015

1 commit


09 Jan, 2015

1 commit

  • According to the UEFI Spec (Table 16, section 5.2.3 of the version 2.4 Errata
    B), the protective MBR partition record size must be set to the size of the
    disk minus one, in LBAs.

    However, the current code was setting the size as the total number of LBAs on
    the disk, resulting in an off-by-one error.

    This confused the AM335x ROM code, and will probably confuse other tools as
    well.

    Signed-off-by: Maxime Ripard

    Maxime Ripard
     

18 Dec, 2014

2 commits


27 Nov, 2014

1 commit


25 Oct, 2014

1 commit


25 Sep, 2014

1 commit


22 Jul, 2014

1 commit


24 Jun, 2014

1 commit

  • Commit 95fac6ab4589 "sandbox: Use os functions to read host device tree"
    removed the ability for get_device_and_partition() to handle the "host"
    device type, and redirect accesses to it to the host filesystem. This
    broke some unit tests that use this feature. So, revert that change. The
    code added back by this patch is slightly different to pacify checkpatch.

    However, we're then left with "host" being both:
    - A pseudo device that accesses the hosts real filesystem.
    - An emulated block device, which accesses "sectors" inside a file stored
    on the host.

    In order to resolve this discrepancy, rename the pseudo device from host
    to hostfs, and adjust the unit-tests for this change.

    The "help sb" output is modified to reflect this rename, and state where
    the host and hostfs devices should be used.

    Signed-off-by: Stephen Warren
    Tested-by: Josh Wu
    Acked-by: Simon Glass
    Tested-by: Simon Glass

    Stephen Warren
     

12 Jun, 2014

2 commits

  • Currently, get_device()/get_dev_hwpart() for MMC devices does not select
    an explicit HW partition unless the user explicitly requests one, i.e. by
    requesting device "mmc 0.0" rather than just "mmc 0". I think it makes
    more sense if the default is to select HW partition 0 (main data area)
    if the user didn't request a specific partition. Otherwise, the following
    happens, which feels wrong:

    Select HW partition 1 (boot0):
    mmc dev 0 1

    Attempts to access SW partition 1 on HW partition 1 (boot0), rather than
    SW partition 1 on HW partition 0 (main data area):
    ls mmc 0:1 /

    With this patch, the second command above re-selects the main data area.

    Many device types don't support HW partitions at all, so if HW partition
    0 is selected (either explicitly or as the default) and there's no
    select_hwpart function, we simply skip attempting to select a HW
    partition.

    Some MMC devices (i.e. SD cards) don't support HW partitions. However,
    this patch still works, since mmc_start_init() sets the current
    partition number to 0, and mmc_select_hwpart() succeeds if the requested
    partition is already selected.

    Signed-off-by: Stephen Warren
    Acked-by: Pantelis Antoniou

    Stephen Warren
     
  • Bug: SDCard with a messed up partition but still has a FAT signature
    intact is readable in Linux but unreadable in uboot with 'fatls'.

    Fix: When partition info checking fails, there is no checking for a
    FAT signature (DOS_PBR) which will fail 'fatls'. FAT signature checking
    is done when no valid partition is found in partition table. If FAT
    signature is found, the disk will be read as PBR and continue
    processing.

    Signed-off-by: Darwin Dingel

    Darwin Dingel
     

06 Jun, 2014

3 commits


23 May, 2014

2 commits

  • This enables specifying which eMMC HW partition to target for any U-Boot
    command that uses the generic get_partition() function to parse its
    command-line arguments.

    Acked-by: Pantelis Antoniou
    Signed-off-by: Stephen Warren

    Stephen Warren
     
  • Some device types (e.g. eMMC) have hardware-level partitions (for eMMC,
    separate boot and user data partitions). This change allows the user to
    specify the HW partition they wish to access when passing a device ID to
    U-Boot Commands such as part, ls, load, ums, etc.

    The syntax allows an optional ".$hwpartid" to be appended to the device
    name string for those commands.

    Existing syntax, for MMC device 0, default HW partition ID, SW partition
    ID 1:

    ls mmc 0:1 /

    New syntax, for MMC device 0, HW partition ID 1 (boot0), SW partition
    ID 2:

    ls mmc 0.1:2 /

    For my purposes, this is most useful for the ums (USB mass storage
    gadget) command, but there's no reason not to allow the new syntax
    globally.

    This patch adds the core support infra-structure. The next patch will
    provide the implementation for MMC.

    Acked-by: Pantelis Antoniou
    Signed-off-by: Stephen Warren

    Stephen Warren
     

13 May, 2014

1 commit


03 Apr, 2014

2 commits

  • Changes in lib/uuid.c to:
    - uuid_str_to_bin()
    - uuid_bin_to_str()

    New parameter is added to specify input/output string format in listed functions
    This change allows easy recognize which UUID type is or should be stored in given
    string array. Binary data of UUID and GUID is always stored in big endian, only
    string representations are different as follows.

    String byte: 0 36
    String char: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
    string UUID: be be be be be
    string GUID: le le le be be

    This patch also updates functions calls and declarations in a whole code.

    Signed-off-by: Przemyslaw Marczak
    Cc: Stephen Warren
    Cc: Lukasz Majewski
    Cc: trini@ti.com

    Przemyslaw Marczak
     
  • This commit introduces cleanup for uuid library.
    Changes:
    - move uuidstring conversion functions into lib/uuid.c so they can be
    used by code outside part_efi.c.
    - rename uuid_string() to uuid_bin_to_str() for consistency with existing
    uuid_str_to_bin()
    - add an error return code to uuid_str_to_bin()
    - update existing code to the new library functions.

    Signed-off-by: Przemyslaw Marczak
    Cc: Stephen Warren
    Cc: Lukasz Majewski
    Cc: trini@ti.com

    Przemyslaw Marczak
     

18 Mar, 2014

1 commit

  • At present we use U-Boot's filesystem layer to read the sandbox device tree,
    but this is problematic since it relies on a temporary feauture added
    there. Since we plan to implement proper block layer support for sandbox,
    change this code to use the os layer functions instead. Also use the new
    fdt_create_empty_tree() instead of our own code.

    Signed-off-by: Simon Glass

    Simon Glass
     

24 Feb, 2014

1 commit

  • The calloc() call was allocating space for the sizeof the struct
    pointer rather than for the struct contents.
    Besides, since this buffer is passed to mmc for writing and some
    platforms may use cache, the legacy_mbr struct should be cache-aligned.

    Signed-off-by: Hector Palacios
    Tested-by: Lukasz Majewski

    Hector Palacios
     

20 Feb, 2014

1 commit

  • Now we are ready to switch over to real Kbuild.

    This commit disables temporary scripts:
    scripts/{Makefile.build.tmp, Makefile.host.tmp}
    and enables real Kbuild scripts:
    scripts/{Makefile.build,Makefile.host,Makefile.lib}.

    This switch is triggered by the line in scripts/Kbuild.include
    -build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build.tmp obj
    +build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj

    We need to adjust some build scripts for U-Boot.
    But smaller amount of modification is preferable.

    Additionally, we need to fix compiler flags which are
    locally added or removed.

    In Kbuild, it is not allowed to change CFLAGS locally.
    Instead, ccflags-y, asflags-y, cppflags-y,
    CFLAGS_$(basetarget).o, CFLAGS_REMOVE_$(basetarget).o
    are prepared for that purpose.

    Signed-off-by: Masahiro Yamada
    Tested-by: Gerhard Sittig

    Masahiro Yamada
     

09 Jan, 2014

1 commit

  • Provide a way to use any host file or device as a block device in U-Boot.
    This can be used to provide filesystem access within U-Boot to an ext2
    image file on the host, for example.

    The support is plumbed into the filesystem and partition interfaces.

    We don't want to print a message in the driver every time we find a missing
    device. Pass the information back to the caller where a message can be printed
    if desired.

    Signed-off-by: Henrik Nordström
    Signed-off-by: Simon Glass
    - Removed change to part.c get_device_and_partition()

    Signed-off-by: Simon Glass
    Reviewed-by: Simon Glass

    Henrik Nordström
     

01 Nov, 2013

1 commit


15 Oct, 2013

1 commit


20 Sep, 2013

1 commit

  • the gpt_pte wasn't being freed if it was checked against an invalid
    partition. The resulting memory leakage could make it impossible
    to repeatedly attempt to load non-existent files in a script.

    Also, downgrade the message for not finding an invalid partition
    from a printf() to a debug() so as to minimize message spam in
    perfectly normal situations.

    Signed-off-by: Mark Langsdorf

    Mark Langsdorf
     

24 Jul, 2013

1 commit


22 Jul, 2013

1 commit

  • The problem here is that uboot can't mount ext4 filesystem with
    commit "50ce4c07df1" applied. We use hard-coded "SECTOR_SIZE"(512)
    before this commit, now we introduce (block_dev_desc_t *)->log2blksz
    to replace this macro. And after we calling do_ls()->fs_set_blk_dev(),
    the variable log2blksz is not initialized, which it's not correct.

    And this patch try to solve the problem by caculating the value of
    log2blksz from variable blksz.

    Lan Yixun (dlan)
     

16 Jul, 2013

1 commit

  • With CONFIG_SYS_64BIT_LBA, lbaint_t gets defined as a 64-bit type,
    which is required to represent block numbers for storage devices that
    exceed 2TiB (the block size usually is 512B), e.g. recent hard drives

    We now use lbaint_t for partition offset to reflect the lbaint_t change,
    and access partitions beyond or crossing the 2.1TiB limit.
    This required changes to signature of ext4fs_devread(), and type of all
    variables relatives to block sector.

    ext2/ext4 fs uses logical block represented by a 32 bit value. Logical
    block is a multiple of device block sector. To avoid overflow problem
    when calling ext4fs_devread(), we need to cast the sector parameter.

    Signed-off-by: Frédéric Leroy

    Frederic Leroy
     

05 Jun, 2013

1 commit

  • Make sure to never access beyond bounds of either EFI partition name
    or DOS partition name. This situation is happening:

    part.h: disk_partition_t->name is 32-byte long
    part_efi.h: gpt_entry->partition_name is 36-bytes long

    The loop in part_efi.c copies over 36 bytes and thus accesses beyond
    the disk_partition_t->name .

    Fix this by picking the shortest of source and destination arrays and
    make sure the destination array is cleared so the trailing bytes are
    zeroed-out and don't cause issues with string manipulation.

    Signed-off-by: Marek Vasut
    Cc: Tom Rini
    Cc: Simon Glass

    Marek Vasut