qcom_mdt_read_metadata(9)
π qcom_mdt_read_metadata(9) β the kernel API manual, but make it make sense
okay so bestie, welcome to the qcom_mdt_read_metadata page from the Kernel API Manual β¨ this one is literally about pulling a header + metadata blob out of an mdt or an mbn file, and ngl it's giving "small function, big job" energy π
πΈ NAME πΈ
qcom_mdt_read_metadata β read header and metadata from mdt or mbn
like, that's it, that's the whole vibe. header + metadata, out of mdt or mbn, no cap π
β¨ SYNOPSIS β¨
void * qcom_mdt_read_metadata (const struct firmware *fw , size_t
*data_len , const char *fw_name , struct device *dev );
she returns a void *, she takes four things, and yes you have to keep them in that exact order π«Ά
π¦ ARGUMENTS π¦
fwβ the firmware of the mdt header or the mbn. this is the source material, the main character of the whole operation πdata_lenβ length of the read metadata blob. she's a pointer, so the function can hand you back how big the thing actually is πfw_nameβ name of the firmware, and it's used for construction of segment file names. so yes, she's functional, not just decorative πdevβ device handle to associate resources with. gotta know which device these resources belong to, periodt π₯
π DESCRIPTION π
okay so here's the situation, and it's honestly kind of iconic π The mechanism that performs the authentication of the loading firmware expects an ELF header directly followed by the segment of hashes β with no padding inbetween. like, none. zero. touching. that's the whole rule.
So this function allocates a chunk of memory for this pair (the header + the hashes, they're a package deal π) and copies the two pieces into the buffer.
And here's the little plot twist for split firmware π β in that case, the hash is found directly following the ELF header, rather than at p_offset as described by the second program header. yes, different location. yes, it matters. iykyk.
β οΈ bestie, listen to me: the caller is responsible to free (kfree) the returned pointer. she gives you memory, you give it back. that's the deal. don't leave her hanging π
β RETURN β
pointer to data, or ERR_PTR π«‘ so like β check that thing before you go dereferencing it, fr fr.
π SEE ALSO π
Kernel file ./drivers/soc/qcom/mdt_loader.c, plus these lovely little siblings:
go read them, they're all part of the same friend group π β¨
and that's the page!! π¦ this little gem lives under ./drivers/soc/qcom and it's dated October 2026, so like β mark your calendar, screenshot it, put it on your fyp, whatever you gotta do. bye bestie, go free that pointer ππΈπ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms