This is your last remaining issue. Its not possible for the offset to be 0x0, that is the location of the bootloader on the flash. From your binwalk output, the correct offset would be (offset of loader + 0xDC8). Anytime you see "offset" this is relative to the start of flash, not relative to the position of the loader. The loader doesn't know where it is, but the start of flash is always 0x0. I had the same issue until I realized this
Also its worth noting. We have to be careful including the loader in the sysupgrade.bin. If there is any change to the loader in the future, the size of the loader might change, which would then change the offset location of the actual kernel. This is why in my commit for the ENS202EXT there is a dedicated partition for the loader. I would recommend padding to the nearest 4k and then setting offset to 0x1000 (which is 4k in hex).
Here I was explaining how it worked on my commit, for the ENS202EXT, the numbers don't apply here, but the idea is the same.
That makes sense! But, then a few questions ... ;-),
this is where it starts it's search, looking for the magic header ... right? I have the step set to 1 (for now), so it will find it, just not as efficiently as it could, no?
no issue changing the value, but why would that stop the loader from starting? I don't even get the "intro" message, saying that's going to go look for the kernel
there is a pad in the recipe (append-loader-okli $(1) | pad-to $$$$(BLOCKSIZE)), but it's not really padding?
Agreed! But again, if it starts a bit too low (in terms of offset), and steps by 1 ... it will find it, right? Again, perhaps not 100% efficient, but it should work (I think)?
I may be missing your point, by all means disagree. To me the problem is why the loader isn't even starting.
Not sure, but if you modified loader.c make sure you reverse those changes
You either know where these things on the flash are or you don't. The value of LOADER_FLASH_OFFS is simply the answer to the question "Where is the kernel on the flash chip?"
Maybe post your partition table again, with some detailed notes?
I shortened the recipe line, like you suggested - that seemed to make a difference. It boots now! Pasting a couple things here, to make it easier to read (vs. all inline). https://paste.ubuntu.com/p/2QrrZQG83M/
And it's almost all working! Boots now, finds the header by searching, boots ... and just a hiccup with the partitions now?
"Where the loader is" would include the header, because thats what u-boot needs to find in order to boot it. That doesn't matter though, we care about the kernel location. I know the variable is called "loader" flash offset, but it is actually for telling the loader where the kernel is.
Not sure how that made a difference LOL
Do you make clean between builds?
From your log:
[ 0.834524] VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6
[ 0.849507] Please append a correct "root=" boot option; here are the available partitions:
This is related to your DTS. I had the same issue. Need to fix your "compatible" property, as it is not splitting the "firmware" mtd into kernel and rootfs.
Try this: compatible = "openwrt,okli";
This goes in the firmware parition node
I admit - I do not . Just tried that, not fixing my issues ... so let me run a full make dirclean, and update / reset .config. Will see if that works. I admit, I struggle to reliably rebuild the kernel (often find it's "old"), so I don't clean very often. Will report back, as a full dirclean and rebuild takes a bit.
Awesome - thanks! Trying this now (with the full rebuild ).
Still the same, doesn't seem to be splitting that "firmware" partition. I did check, the link you sent does seem to be in the code I have locally (sanity check ).
Probably it's required that you have to make a separate partition for the loader. I don't remember any example where this isn't done. However you might just have to skip the space with the loader
try this along with the 4k pad and LOADER_FLASH_OFFS := 0x51000
OK, but I think you're saying ... for now, as none of the rest of that is written out, just skip that 0x1000, and offset the firmware partition - right?
But I'm not seeing the padding really working, at least based on binwalk. I do have the pad-to in there, but binwalk isn't showing nice boundaries?
Figured it out ... padding needs to come after lzma, as that is what actually gets written to flash. Agreed? binwalk sort of shows me this ... LOL. Uncompressed size is 4k, not compressed.
uImage lzma adds the header, with the information that the following data is lzma compressed. Otherwise the bootloader wouldn't know what it is or how to use it
And ... so close . Built, loaded -> and again the stuck at "Starting kernel ...". Seems that wasn't just the clean and line shortening. Something to it. Not sure why it's freezing on boot. Hmmm.
Let me add a print statement or two (temporary! ), to see if the loader is at least getting launched.
BTW, something else to fix later perhaps - as @xabolcs pointed out, to rebuild the loader you manually need to, rm build_dir/target-*/linux-*/loader-*