Skip to content

Commit

Permalink
Fix 8ulp only download spl
Browse files Browse the repository at this point in the history
8ulp use container, uuu get size of container.
8ulp use ROMAPI, need download whole image.

Signed-off-by: Frank Li <frank.li@nxp.com>
  • Loading branch information
nxpfrankli committed Mar 30, 2021
1 parent d1c466c commit 08c58c9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
7 changes: 5 additions & 2 deletions libuuu/rominfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ static constexpr std::array<ROM_INFO, 15> g_RomInfo
ROM_INFO{ "MXRT106X", 0x1000, ROM_INFO_HID | ROM_INFO_HID_MX6 | ROM_INFO_HID_SKIP_DCD },
ROM_INFO{ "MX8QXP", 0x0, ROM_INFO_HID | ROM_INFO_HID_NO_CMD | ROM_INFO_HID_UID_STRING },
ROM_INFO{ "MX28", 0x0, ROM_INFO_HID},
ROM_INFO{ "MX815", 0x0, ROM_INFO_HID | ROM_INFO_HID_NO_CMD | ROM_INFO_HID_UID_STRING | ROM_INFO_HID_EP1 | ROM_INFO_HID_PACK_SIZE_1020 },
ROM_INFO{ "MX815", 0x0, ROM_INFO_HID | ROM_INFO_HID_NO_CMD | ROM_INFO_HID_UID_STRING | ROM_INFO_HID_EP1 | ROM_INFO_HID_PACK_SIZE_1020 | ROM_INFO_HID_ROMAPI},
ROM_INFO{ "SPL", 0x0, ROM_INFO_HID | ROM_INFO_HID_MX6 | ROM_INFO_SPL_JUMP | ROM_INFO_HID_SDP_NO_MAX_PER_TRANS},
ROM_INFO{ "SPL1", 0x0, ROM_INFO_HID | ROM_INFO_HID_MX6 | ROM_INFO_SPL_JUMP | ROM_INFO_HID_SDP_NO_MAX_PER_TRANS | ROM_INFO_AUTO_SCAN_UBOOT_POS},
};
Expand Down Expand Up @@ -123,8 +123,11 @@ static constexpr uint32_t IMG_V2X = 0x0B;
#pragma pack ()


size_t GetContainerActualSize(shared_ptr<FileBuffer> p, size_t offset)
size_t GetContainerActualSize(shared_ptr<FileBuffer> p, size_t offset, bool bROMAPI)
{
if(bROMAPI)
return p->size() - offset;

auto hdr = reinterpret_cast<struct rom_container *>(p->data() + offset + CONTAINER_HDR_ALIGNMENT);
if (hdr->tag != CONTAINER_TAG)
{
Expand Down
3 changes: 2 additions & 1 deletion libuuu/rominfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ constexpr uint32_t ROM_INFO_HID_EP1 = 0x1000;
constexpr uint32_t ROM_INFO_HID_PACK_SIZE_1020 = 0x2000;
constexpr uint32_t ROM_INFO_HID_SDP_NO_MAX_PER_TRANS = 0x4000;
constexpr uint32_t ROM_INFO_AUTO_SCAN_UBOOT_POS = 0x8000;
constexpr uint32_t ROM_INFO_HID_ROMAPI = 0x10000;

struct ROM_INFO
{
Expand All @@ -65,5 +66,5 @@ struct ROM_INFO
const ROM_INFO * search_rom_info(const std::string &s);
const ROM_INFO * search_rom_info(const ConfigItem *item);

size_t GetContainerActualSize(std::shared_ptr<FileBuffer> p, size_t offset);
size_t GetContainerActualSize(std::shared_ptr<FileBuffer> p, size_t offset, bool bROMAPI=false);
size_t GetFlashHeaderSize(std::shared_ptr<FileBuffer> p, size_t offset = 0);
2 changes: 1 addition & 1 deletion libuuu/sdps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ int SDPSCmd::run(CmdCtx *pro)
return -1;
}

size_t sz = GetContainerActualSize(p, offset);
size_t sz = GetContainerActualSize(p, offset, rom->flags & ROM_INFO_HID_ROMAPI);

if (!(rom->flags & ROM_INFO_HID_NO_CMD))
{
Expand Down

0 comments on commit 08c58c9

Please sign in to comment.