-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Utilizing more space for eMMC installation with ampart / 使用ampart来在eMMC安装中使用更多空间 #689
Comments
I want to put ampart in armbian firmware ( This feature is added by default in
If the partition is successful, its value is a fixed value: |
This is not correct due to the Bash syntax for array For bash arrays, if you just use its name, that'll be only the first item, to refer to the whole array, use a
An example script to only do the adjustment once:
Two continous runs yield the following output:
|
Ok, I have corrected the above error, you can check whether the mode I choose is the best (compatibility, applicability), is this usage correct? I put your |
Yes, something could be changed but they're just style preferences (i.e.
Yes, I'm open with its inclusion in other open-source projects. But would it be a pre-built binary or being built during firmware packing? Because I'm lazy with releases and the aarch64-static one is pretty big, so using the pre-built static aarch64 one would mean it would be (probably) old and big. You could build it yourself on your Armbian distro natively and use the dynamically linked one built by yourself, or with a cross toolchain. I don't limit the form how ampart come in other distros. |
|
I've adjusted the snapshot modes and now the last partition in snapshots won't have extra trailing space, please use the newest release:
Before the update, the comparasion would be false since there will be an extra space after the last partition. The comparasion would be With commit 7Ji/ampart@bd4409b, the last partition in a snapshot will not have trailing space anymore, the logic is now true and more intuitive. About the codes,
I was refering to a layout like this:
|
The format of |
Yes, the first positional argument given to ampart would be parsed as the This also means, for test and development, you can give the path of an eMMC dump you got with In the following command:
As long as the first positional argument is the target, and the other positional arguments are partitions, the command is correct |
If you need to keep the original Android partition table, you can specify it in the |
你的ampart工具在分区日志里输出的分区表很直观。 |
I've added a demo script that can automatically identify the eMMC block device and report EPT. The result table has more columns (end of each partition). Documentation: https://github.com/7Ji/ampart/blob/ampart/doc/scripting-what-is-my-ept.md Log:
|
太棒了,我学习学习,做个使用说明 |
@7Ji Good job!Wonderful tool for armbian-AML,especially for the home-assistant user like me!THANKS! |
https://7ji.github.io/crack/2023/01/08/decrypt-aml-dtb.html An updated note, it's possible to extract plain DTB from running Android on a box with encrypted DTB, and then it's possible to re-partition eMMC with ampart. |
7大 威武 👍 |
Quoting @ophub :
#620 (comment)
Originally posted by @ophub in #620 (comment)
ampart is a partition tool I wrote earlier this year for HybridELEC and EmuELEC to replace the closed-source ceemmc. It supports reading and editting Amlogic's proprietary eMMC partition table (shortened as
EPT
, which co-exists with MBR/GPT partition table on eMMC) and the partitions node in stock DTBs, and has since become the one and only partition tool forEPT
You can either download its static AArch64 release or build from source on Armbian (which is more suggested, as the releases could be out-of-date). It works both on raw eMMC device and corresponding dumps so you can try on dumps obtained with
dd
for testing. (It also works on DTBs, so you can modify the partitions in an Android burning image directly, but I won't cover that use case here)With a command like this, as posted by ophub:
You can tell ampart to adjust the DTB and EPT and move the essential partitions you could not overwrite to the beginning of the eMMC, to like this:
So now you can safely write on areas 4M-36M (the gap between
bootloader
andreserved
), 100M-116M (the gap betweenreserved
andenv
), and 117M to end (env
starts at 116M, but usually only contain 64K of data, so starting at 1M after 116M is more than safe)So the
armbian-install
script can be modified to use the eMMC space starting from 117M (if you do it manually, then the above free space could also be used, i.e. 4M-36M, 100M-116M):Although ampart has its documentation in my repo which you should refer to for more advanced uses (e.g. directly editting EPT instead of editting DTB and update EPT from DTB, move/clone/delete partitions, etc). But I'll explain why argument
data::-1:4
is used for this general case.The main usage for
dclone
mode is to restore a snapshot taken indsnapshot
mode, which, on a HK1Box that has not touched by ampart before, is like this:With a command like this, ampart can restore the partitions in DTB to exactly like when the snapshot is taken:
Each partition argument is in the
[name]:[offset]:[size]:[masks]
format, for DTB modes offset is not needed, and a special size-1
means the part should fill all the remaining spaceStarting from this, you can use
dedit
mode to remove partitions you don't want (^
+ name selects a partition by its name,?
deletes the partition):This brings the EPT to like this, where
logo
andmisc
is kept, so during booting you could still see the logo, and some misc things set by Android inmisc
partition could still be effective:So you can have 4M-36M, 100M-116M, 117M-132M, 140M-148M, 156M-end to use,
armbian-install
could be adapted like this:But if you just want say goodbye to all the stuffs not related to the Linux distro you're going to use, you can go further to delete even the
logo
andmisc
partitions:Then this will get you a partition table mentioned at the beginning.
And if we take a snapshot in this situation, the snapshot would be like:
Since there's only a single
data
partition in the DTB partitions, whose size should be automatically generated to fill up all the remaining eMMC space, and its masks is 4 (not related to Linux booting, but for Android, 4 means its a data partition that could be wiped)Additional notes:
ampart would try its best to preserve the DTB, and would remove the partitions node in the DTB as the last resort in direct EPT-modification modes (
eclone
,ecreate
,eedit
), for some boxes the u-boot may refuse to work if it found DTB "broken" like this, so DTB-modification modes (dclone
,dedit
) are always preferredampart supports plain DTB (the generic FDT format), Amlogic's multi DTB, and gzipped version of these two formats. However, it does not support encrypted DTB which is generated with each vendor's unique private key. The following devices are known to have encrypted DTB so ampart can't be used on them:
dclone
,dedit
), ampart would stick to the way Amlogic generates EPT to update the EPT. This has the following limitations:reserved
partition would always has a 32M gap before it, thebootloader
partition would always be placed at 0boot_a
,vbmeta_a
,vbmeta_system_a
is missing, so the argument used indclone
mode should be changed to like this:ampart
directly with DTB-modification modes, and remove unneccessary big Android data partitions, and then re-pack to get a ~4M burning image, so you can recover the box to a working state very fast since you don't need Android stuffs.The text was updated successfully, but these errors were encountered: