Originally Posted by tytung
Kernel reads the real WiFi MAC from SPL memory space.
You can visit [Dev] Real WiFi MAC address
for more info.
On WM, we can get WiFi MAC from SPL/HSPL. (It's loaded into the memory, so we can dump the whole SPL/HSPL from the memory and get WiFi MAC.)
When using SD build on WM, we can access SPL/HSPL too.
However, we cannot access HSPL when using MAGLDR and cLK bootloaders.
Maybe the memory space of HSPL has been overwritten by bootloaders.
Maybe the memory address of WiFi MAC is changed so that the kernel gets the wrong value.
Since you're developing cLK, I think you may know how cLK works.
Is there any cLK code to be related to HSPL?
From what i have been working on, MAGLDR and cLK are ARM compiled binaries and flashed to the OS partition (0x400) in terms of nbh files.
When (H)SPL (OSPL would not even flash unsigned files to device although it might boot them, refer SSPL. Also there *COULD* be some difference as Cotulla had advised not to use SSPL for MAGLDR somewhere.) boots, it does not now what is there in that partition, it just loads the code stored there and jumps to entry point of cLK/MAGLDR. They perform hardware initialization in their own different ways (*MAYBE*) and then load the kernel + initramfs stored in boot partition to 0x11800000 and 0x00a00000 respectively and jump to the linux kernel. While also cLK remaps the reset vector of the aCPU to 0x11800004 where it jumps to right before loading linux kernel and MAGLDR does the RMNET magic.
That shouldn't change much as compared to WM/HARET boot. Unless HaRet or WinMo initialization code include some special stuff which is not included in the method used to initialize hardware using cLK or MAGLDR.
I too am not an expert in this area but trying to learn, So i might be wrong but i did my work before writing this post.
Also a bit into history - lk was developed by Travis for fun ~ 2006 and picked up by codeaurora forums and worked on for Qualcomm devices (Qualcomm is partner in Codeaurora) A branch was forked and worked on by google and used as Bootloader for g1 i guess and was later removed/depreciated and moved to legacy code. HTC had a branch forked themselves and worked on it and named it HBOOT. When Android arrived on NAND, cedesmith took lk and ported it to LEO, it was just a hobby project then as per the IRC logs but then grew into much more as many were dissatisfied by the closeness of magldr (Which is actually just from my POV as cotulla mentioned his code could be used by crooks to wreak havoc and what not like change IMEI and other nasty stuff but also attract attention of manufacturers to the weakness/hole he exploited in their code making future devices hard to crack) and especially the GO GO GO screen