If SPL serial support is disabled nothing brings in sprintf, snprintf
or simple_strtoul:
env/built-in.o: In function `regex_callback':
env/attr.c:128: undefined reference to `sprintf'
disk/built-in.o: In function `blk_get_device_by_str':
disk/part.c:386: undefined reference to `simple_strtoul'
disk/part.c:395: undefined reference to `simple_strtoul'
disk/built-in.o: In function `blk_get_device_part_str':
disk/part.c:522: undefined reference to `simple_strtoul'
disk/built-in.o: In function `part_set_generic_name':
disk/part.c:704: undefined reference to `sprintf'
drivers/built-in.o: In function `init_peripheral_ep':
drivers/usb/musb-new/musb_gadget.c:1826: undefined reference to `sprintf'
drivers/built-in.o: In function `musb_core_init':
drivers/usb/musb-new/musb_core.c:1451: undefined reference to `snprintf'
Add those dependencies here.
Change-Id: I3512dc53bc93a556aee250d98d1a5977d9e2a537
Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit ab9e12f651d9211aa0d3c9b9e579c38bd8704054)
This patch takes over the responsibility of slot suffix appending from
developer to framework on querying partition, it makes slot suffix
invisible for developers.
Change-Id: I33e1e8f6611232c4797d68b7b844a70db88a3eb8
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Since the patch "3bdef7e gpt: return 1 directly when test the mbr sector"
always treats partition type as GPT, the error message is always printed
which may make developers miss understand.
Change-Id: I8be6cf5027ff4b61549b83132492d41d2b352ecd
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
In sd-update card, we use RKPARM partition in bootloader to load
firmware, and use MS-DOS partition in recovery to update system.
Now, we want to use gpt in bootloader and abandon the RKPARM
partition. So in new sd-update card, we write the MS-DOS partition
table and gpt to sd card. Then we must return 1 directly when test
the mbr sector otherwise the gpt is unavailable.
Change-Id: I994a0cb86e7829c6edadfe357cbf51ad00b65cec
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
TEST:
./make.sh rk3308
CONFIG:
CONFIG_SPL_EFI_PARTITION
CONFIG_SPL_LIBDISK_SUPPORT
Error message:
disk/part_efi.c:1219:11: error: ‘part_test_efi’ undeclared here
(not in a function) .test = part_test_efi,
disk/part_efi.c:1182:12: error: ‘is_pte_valid’ defined but not
used [-Werror=unused-function] static int is_pte_valid(gpt_entry * pte)
......
Change-Id: I231511eb54d998151aadff68f19db7ee8127f122
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Without this patch, it always returns the last partition when
"idx" is larger than the last partititon.
Change-Id: I1d126861327c02cab7dd8cc00dd0800651f7da3c
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
The disk part size is defined as number of blocks in partition rather
than bytes.So delete "<< 9".
Change-Id: I4428e5965c6456fcc69fb601d18a97fc48210617
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
There is some gpt table errors when use open source tools to download
gpt table or is destroyed by other procedure.
Such as:
1.Get error storage size.
2.Download the gpt table in the error place.
3.The gpt table is destroyed by other procedure.
So test the gpt table is correct or not firstly. If the gpt table header is
error, update the correct gpt table. If the last partition size error in
the gpt table entry, get the size of current storage by dev_desc and update
the last partition size.
Change-Id: I0ef91a0f8462eca52924d17c5aaefcdae602267d
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
- for some platform without storage, pre-loader passes partition info by atags.
- search order: mmc/nand -> atags
Change-Id: Ie2699e217999e4772168c96de3b16c084241891e
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
The memory leak will happen if there is a dev access switch, fix it
by free the memory before we get a new one.
Change-Id: I5d11609ab5b6cc37f2812d901f2427a1c83fd3a4
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
The print "invalid parameter" is confused, make it clear to show this is
a warning from RKPARM partition table.
Change-Id: I1381dd6e60d963f1f233d08c8527495b6ca6101c
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
The last partition with size '-' use all remain size.
Change-Id: Id91302d89927ac01c1975c8798c59543314689cd
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Do not re-use the partition table for 'mmc 1' from the partition
table of 'mmc 0', update the table if the device number changed.
Change-Id: I03b8509749d079ded6a0e0a87929be21732399fb
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
The 'next' will be NULL if next ',' is not found, and access to
'*next' will end with "Synchronous Abort" in 64 bit system because
the memory space is reserved for Trust area.
Change-Id: Id8ee9d6f7815977d7c5996d67a3b72feb74d00cf
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
If the param has no data, the cmdline is NULL, and system get abort:
"Synchronous Abort" handler, esr 0x96000010
Change-Id: Ia52594073287d55a7fd0b35b66d87ffe7f880fea
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
We use part_get_info_by_name to get partition, this will read MBR, GPT
header and GPT entry every time, optimize to read only once.
Change-Id: I4d6c508311f7cc661aa991b3c61460a2b8d63fac
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
System may fail to get partition table, return directly in this case.
Change-Id: Ib61f800302aee23fbc362d0d68a5f42ab353a2f0
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
delete unused "initrd=0x...,0x...", this for compatible
with legacy parameter.txt.
Change-Id: I9eb79578196ae4537b65e57a2776fdf0225de488
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
remove unused "initrd=0x...,0x...", this for compatible
with legacy parameter.txt.
Change-Id: I7d9c5708a6b183479ac5980a90067cff8f0872de
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Need to reserver first 4MB for EMMC while use the addr directly for NAND.
Change-Id: I5c6309e41a9c287388cb6c0ff7ba5b1ef9ff29bf
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
The SPL must be located at 8kB (16 sectors) offset. That's right in the
middle of the GPT, so we need to define a smaller amount of partitions to
accomodate for that location.
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Change-Id: I7932a388389b15237bed18321606f034a47534a3
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 5dc0256d1210cb38ba11b22a8eb2ccc101460963)
On some SoCs, the SPL needs to be located right in the middle of the GPT
partition entries.
One way to work around that is to create partition entries for a smaller
number of partitions to accomodate with where the SPL will be. Create a
Kconfig option to allow to do that.
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Change-Id: Ic06f18722c0a835829042540f1f7a4364924624d
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 4ce521977f79a883f9c47984ef675c4b2267b7ad)
Before this patch one could receive following errors when executing
"gpt write" command on machine with cache enabled:
display5 factory > gpt write mmc ${mmcdev} ${partitions}
Writing GPT:
CACHE: Misaligned operation at range [4ef8f7f0, 4ef8f9f0]
CACHE: Misaligned operation at range [4ef8f9f8, 4ef939f8]
CACHE: Misaligned operation at range [4ef8f9f8, 4ef939f8]
CACHE: Misaligned operation at range [4ef8f7f0, 4ef8f9f0]
success!
To alleviate this problem - the calloc()s have been replaced with
malloc_cache_aligned() and memset().
After those changes the buffers are properly aligned (with both start
address and size) to SoC cache line.
Change-Id: I13782d942b327d3941de6446b2cbc49a3d7901dc
Signed-off-by: Lukasz Majewski <lukma@denx.de>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit bb021013ba1ea4f7ade55ed932ab9d807e8a09ea)
the partition starting at 0x4400 is refused with overlap error:
$> gpt write mmc 0 "name=test,start=0x4400,size=0"
Writing GPT: Partition overlap
error!
even if the 0x4400 is the first available offset for LBA35 with default
value:
- MBR=LBA1
- GPT header=LBA2
- PTE= 32 LBAs (128 entry), 3 to 34
And the command to have one partition for all the disk failed also :
$> gpt write mmc 0 "name=test,size=0"
After the patch :
$> gpt write mmc 0 "name=test,size=0"
Writing GPT: success!
$> 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 0x01ce9fde "test"
attrs: 0x0000000000000000
type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
type: data
guid: b4b84b8a-04e3-4000-0036-aff5c9c495b1
And 0x22 = 34 LBA => offset = 0x4400 is accepted as expected
Reviewed-by: Łukasz Majewski <lukma@denx.de>
Tested-by: Stephen Warren <swarren@nvidia.com>
Change-Id: I464741a434f02d960083c4e5a3e443cbe8b6f45b
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit ae0e0228e664f31ac3c6093758ddc85b664e2d08)
The test and info callbacks into the partition callback struct are
used by the "part list" command on the command line. That command
is used by the distro script.
With verb=1 set, "part list" thus throws a lot of warnings about
partitions it can't find when an upper layer searches for partitions.
So let's reduce verbosity to bring it to the same level of noise
as the other partition targets.
Change-Id: I289d3fe2f1d11b18183b834189463578ba5cab90
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit b16339e254371b2823f48186889775b90b044f7e)
While this goes somewhat against normal coding style we should ensure
that dev_desc is not NULL before we dereference it in allocation of
legacy_mbr.
Change-Id: Ife52a9f595a429aa265c1fed92099295f80458dc
Reported-by: Coverity (CID: 167292)
Signed-off-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit b351ccf11ae5616bba183aedb2c433b97123be4f)
U-Boot widely uses error() as a bit noisier variant of printf().
This macro causes name conflict with the following line in
include/linux/compiler-gcc.h:
# define __compiletime_error(message) __attribute__((error(message)))
This prevents us from using __compiletime_error(), and makes it
difficult to fully sync BUILD_BUG macros with Linux. (Notice
Linux's BUILD_BUG_ON_MSG is implemented by using compiletime_assert().)
Let's convert error() into now treewide-available pr_err().
Done with the help of Coccinelle, excluing tools/ directory.
The semantic patch I used is as follows:
// <smpl>
@@@@
-error
+pr_err
(...)
// </smpl>
Change-Id: I921807c1770d36a91e692c48ab477558bb2ed0b8
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
[trini: Re-run Coccinelle]
Signed-off-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 9b643e312d528f291966c1f30b0d90bf3b1d43dc)
Needed to support efi file protocol. The fallback.efi loader wants
to be able to read the contents of the /EFI directory to find an OS
to boot.
Modelled after POSIX opendir()/readdir()/closedir(). Unlike the other
fs APIs, this is stateful (ie. state is held in the FS_DIR "directory
stream"), to avoid re-traversing of the directory structure at each
step. The directory stream must be released with closedir() when it
is no longer needed.
Change-Id: I5a977a73024ff4646fc3c4f7c49993de0b5b6256
Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Łukasz Majewski <lukma@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 4bbcc965f995564870ca02606137e60e873e0a1f)
EFI client programs need the signature information from the partition
table to determine the disk a partition is on, so we need to fill that
in here.
Change-Id: I27b62e383a2003e82e5424859bc9574d3b2190a2
Signed-off-by: Peter Jones <pjones@redhat.com>
[separated from efi_loader part, and fixed build-errors for non-
CONFIG_EFI_PARTITION case]
Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit ff98cb90514d9b787ddc097c203ac8db2941efe1)
blk_dread returns negtive error code or blocks number
that read successfully.
Change-Id: I0f2afe98cfb64fe8e83a065fa64b91481856f5be
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Do not need to scan disk every time when we get part info
by name.
Change-Id: Id79a3a9065731815567055329a2f7f80b3c8c9d4
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
We can get the new part table when we write a new partition table to
a blank disk with this patch, or else we have to reset the board
to get new partition table.
Change-Id: If6688149a4a3ae9d6f5731757a1b5831494a9152
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Rockchip parameter parameter is a partition type like cmdline partition,
widely used in rockchip legacy system.
Change-Id: I107748733c4cfed22f3a2ef8716033211eafdf7c
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
This patch add the nand flash support for Rockchip Soc(RK3128, RK3126x,
RK3188, Rk3229 etc).
Change-Id: I35ea09f0714b303b247a97ed13cc6e0e56675a0e
Signed-off-by: Yifeng Zhao <zyf@rock-chips.com>
The current code checks that no partitions overlap with the GPT partition
table using the offset of the first LBA usable for that partition.
This works fine, unless you have a partition entry that is further away
than it usually is and you want to create partitions in the gap between the
GPT header and the GPT partition entries, for example to reflash a
bootloader that needs to be set there.
Rework the test to something a bit smarter that checks whether a partition
would overlap with either the GPT header or the partition entries, no
matter where it is on the disk.
Partitions that do not have a start LBA specified will still start at the
first LBA usable set in the GPT header, to avoid weird behaviours.
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
The gpt_fill_pte will need to access the device block size. Let's pass the
device descriptor as an argument.
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
The start variable is only used inside a loop, and is never affected inside
it, so it's a purely local variable.
In the same way the partition size is accessed several times, so we can
store it in a variable.
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Tom Rini <trini@konsulko.com>