Jump to content

Armbian EMMC Image for NanoPi-K2


Recommended Posts

I'm posting here in the hope someone with a NanoPi-K2 board can test-boot the following LibreELEC image from an eMMC module and SD (the same image should boot both). If it does work the long-running mystery of how to combine various bits of upstream u-boot (2022.07) with Amlogic signed firmware and MBR structures is solved. I'm able to boot an S905 set-top box (WeTek Play2) so I'm fairly confident it should work.


Here's the test image: https://chewitt.libreelec.tv/testing/LibreELEC-AMLGX.arm-10.85.0-nanopi-k2.img.gz

Link to comment
Share on other sites

See commits here: https://github.com/chewitt/amlogic-boot-fip/commits/gxbb-sd-emmc which is based on the original detective work done by @Kwiboo here https://github.com/Kwiboo/u-boot/commit/6d0a17632922077a2e64b13ae1a6bdf0024b718f .. waaaay back in 2016, so the solution has been sitting under our noses all this time :)


The one difference from his instructions is that I don't use the same 'fusing' instructions, I use the standard LE ones https://github.com/LibreELEC/LibreELEC.tv/blob/master/projects/Amlogic/bootloader/mkimage#L8-L9


Here's the u-boot log https://pastebin.com/raw/pVSHMueQ and dmesg https://pastebin.com/raw/n5E3Rq96 showing emmc boot on the WP2.

Link to comment
Share on other sites

That's interesting (some clever work) but a slightly different topic. You're manipulating the Amlogic (2015.01 based) u-boot and the custom partition layout to suit Armbian/Linux. It looks rather fiddly to execute but suits TV box devices where you have no access to the vendor customised u-boot sources. I'm creating new distro images that boot using upstream u-boot (2022.07) from SD or eMMC and clean-install the OS with standard mbr/msdos partitions. This is cleaner, but needs access to the vendor u-boot sources to build/extract the FIPs and customised software bits needed for signing the modern u-boot binaries.


NB: I'd like to see an effort to script or create tools that deconstruct the contents of vendor images to extract the acs.bin/bl2.bin/bl301.bin files which are tweaked for the device (esp. acs.bin which has the often low-bin RAM timings). These could then be used with other common files (bl21.bin/bl30.bin/etc.) to create a FIP package for signing modern u-boot.


Спасибо, что поделились!

Link to comment
Share on other sites

@chewitt - not really automated, but at least a way to get the acs info from a box boot block: look at an existing acs file for that type of soc - usually it is possible to find the signature of its beginning in the boot area of a box dump and iirc the end is clear from size and some free space afterwards as well - this worked well for me for g12a and sm1 where acs can be assembed in properly when building new boot blocks - see: https://github.com/hexdump0815/u-boot-misc/blob/d75cf6cbb8f95d7b32ab7f66111c79196d7f7c07/readme.gxy#L153-L158


for gxl i extracted the bl* parts (one of which also contains the ram timing) from the box boot blocks via glximg and reassembled new bootblocks based on them - see: https://github.com/hexdump0815/u-boot-misc/blob/b10b9a5aca46438233fde86f96b452d76d7158f8/readme.gxl#L115-L160


but i guess you know most of that already


best wishes - hexdump

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines