winnt5 Posted November 26, 2022 Posted November 26, 2022 @hexdumpI have a s905x box with secure boot enabled, I can run armbian from usb drive with your chainload uboot, and trying to run it on emmc. It looks like both chainloaded mainline uboot and armbian cannot find any partitions from emmc. My box have secure boot enabled so there is no way to replace the original u-boot. I have no idea how to deal with that.
SteeMan Posted November 26, 2022 Posted November 26, 2022 My first thought is that you don't actually have emmc in your box. You don't provide any details, so I am just guessing. I have 'identical' TX3 Mini boxes that on one the emmc works fine and the other it is not detected. When I opened the box, it turned out the manufacturer installed cheaper nand instead of the claimed emmc. And mainline kernels don't support nand storage. It is very common that boxes may not contain the components claimed (or can change randomly over time in an effort to cut production costs). This is one of many reasons TV boxes aren't supported by Armbian. https://forum.armbian.com/topic/16976-status-of-armbian-on-tv-boxes-please-read-first/
hexdump Posted November 26, 2022 Posted November 26, 2022 @winnt5 - it is quite normal that you do not see any partitions on emmc from the android system, as that uses hardcoded partitioning and not a normal mbr or gpt partition table ... also what @SteeMansays can be true: that there is no emmc at all in the box but just nand - this is easy to find out: just run "fdisk -l" on the box and if you can see another mmcblk device besides your sd card then you most probably have proper emmc. in case you have real emmc there are two options: the safe one to not touch emmc at all to not break your locked bootloader or the risky one to write an mbr partition table to the emmc which only covers the data partition of android - do not even think about touching any other partition/area besides the large data partition at the end of the emmc as some of the other partitions might be magic and required for booting (holding the dtb or other stuff required to boot - amlogic boxes are horrible in this direction) ... for that you would need to find out at which sector the user data partition starts from android (some math required maybe) and you should double check that the first 512bytes on emmc are empty via "hexdump -C" (i.e. writing the mbr there will not overwrite anything else) ... it worked for me at least on a mii s905x box with locked bootloader but there is no guarantee that it will work for you as well - so better chooese the safe option if you prefer to keep the box working for sure ... there might even be a way in the middle to hardcode a partition covering the data partition are also with a mainline kernel - for that reasearching about mtdparts might be a good idea - never tried that myself - this way you at least would not have to write a partition table to emmc ... just for completeness: this thread might be interesting to read as well as on s905 it is very complicated as well as bootloader and partition table overlap for the emmc case and some people were quite creative trying to overcome this - best wishes and good luck - hexdump
winnt5 Posted November 27, 2022 Author Posted November 27, 2022 @hexdumpThanks! 11 hours ago, hexdump said: @SteeMansays can be true: that there is no emmc at all in the box but just nand - this is easy to find out: just run "fdisk -l" on the box and if you can see another mmcblk device besides your sd card then you most probably have proper emmc. My box uses emmc. I have disassembled stock uboot with ghidra and I made uboot crack itself to boot unsigned android images by changing several instructions on boot using 'mw' command. So I have twrp and rooted android on my secure booted box. But only about 6GiB is available if only use data partition, I am using 'Armbian_22.11.0-trunk_Aml-s9xx-box_kinetic_edge_6.0.9_xfce_desktop.img.xz' in https://github.com/armbian/community It's more than 8GiB, and the one there without GUI is also very large. Is there any other options beside armbian community rolling release? Also, I realize that this armbian with xfce running in usb disk (there is no sd card slot on my box) is very laggy even though I set cpu scaling to performance, armbian without GUI is also a little bit laggy when typing commands.
winnt5 Posted November 27, 2022 Author Posted November 27, 2022 @SteeMan 13 hours ago, SteeMan said: My first thought is that you don't actually have emmc in your box. You don't provide any details, so I am just guessing. My box is xiaomi mdz-16-ab with 2GiB ram and 8GiB emmc.
hexdump Posted November 27, 2022 Posted November 27, 2022 @winnt5- you could boot and run from usb and from there create a btrfs filesystem with zstd compression on emmc data, rsync everything over, adjust fstab in it for btrfs and try that - i'm using zstd comressed btrfs root for years now (not with armbian) and it works very stable and saves close to half of the space - another option is to run from usb and put a swap partition or file to emmc - i think swapping/paging is most proably the reason for the performance problems you see when running from usb. good luck and best wishes - hexdump
winnt5 Posted December 1, 2022 Author Posted December 1, 2022 @hexdump I have confirmed that nothing is in the first 512 Bytes in EMMC, then how can I write an mbr partition table to it?
hexdump Posted December 1, 2022 Posted December 1, 2022 @winnt5 - any partitioning tool should like fdisk, gdisk etc. - just make sure you are creating an mbr partition table and not gpt and best is to some detailed mode if available in the tool used to be able to hit the block numbers of the data partition exactly good luck and best wishes - hexdump
winnt5 Posted December 2, 2022 Author Posted December 2, 2022 (edited) @hexdump My partition table is like this: parts: 16 00: cache 0000000010000000 2 01: logo 0000000000300000 1 02: encrypt 0000000000100000 1 03: recovery 0000000002000000 1 04: tee 0000000000800000 1 05: crypt 0000000002000000 1 06: misc 0000000002000000 1 07: boot 0000000001400000 1 08: dto 0000000000800000 1 09: cri_data 0000000000800000 2 10: param 0000000001000000 2 11: rsv 0000000001000000 1 12: system 0000000044c00000 1 13: oem 0000000012c00000 1 14: vendor 0000000006400000 1 15: data ffffffffffffffff 4 Is it possible to use cache partition area for booting armbian, and use system + oem + vendor + data partition area for armbian rootfs? Some partitions are not listed there but I found the addresses of them in reserved partition. Edited December 2, 2022 by winnt5
hexdump Posted December 2, 2022 Posted December 2, 2022 @winnt5 - maybe start with data only and see if you can handle it well from an sd-card booted system and then maybe move on from there ... maybe you can just partition everything from cache on (i.e. after its starting poiint if there is nothing reserved/hidden inbetween - better double check the layout a few times) as you like it as all those should be android partitions and not related to boot ... there is always a chance that something goes wrong and you brick the box - maybe do a dd dump of the full device beforehand ... in the end you are on your own if you play around with this
winnt5 Posted December 5, 2022 Author Posted December 5, 2022 (edited) @hexdumpI have partitioned emmc, is there a good way to copy armbian files to it? Edited December 5, 2022 by winnt5
SteeMan Posted December 5, 2022 Posted December 5, 2022 On 11/26/2022 at 11:26 PM, winnt5 said: I am using 'Armbian_22.11.0-trunk_Aml-s9xx-box_kinetic_edge_6.0.9_xfce_desktop.img.xz' in https://github.com/armbian/community If you are still using this image, there is a script in /root that is used to copy the image to emmc. (It is part of the instructions for that build posted here: https://forum.armbian.com/topic/17106-installation-instructions-for-tv-boxes-with-amlogic-cpus ) It brute forces some of the stuff you and hexdump have been discussing. But as far as what and how to copy over, this can be a guide.
hexdump Posted December 5, 2022 Posted December 5, 2022 but be careful with such scripts and check them by hand to make sure they do not touch the emmc low level or your created partitions ... for copying over "rsync -axADHSX --no-inc-recursive --delete /source/ /target" always worked well for me - be careful with the "--delete" and note that the source should have a "/" appended and the target not if you want target to be a 1:1 copy of source good luck and best wishes - hexdump
Recommended Posts