Announcement

Collapse
No announcement yet.

Android 9 partition repack tool!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #76
    OHHHH, i had no idea. i just searched "todays posts" and thought i found something neat lol


    sorry

    Comment


      #77
      I know some Linux but haven't done any mods before, so all the experts please bear with me. What I want to do is to modify the SLIMBOX firmware (https://forum.xda-developers.com/and...imbox-t4152049) and add a few apps of my own. I read README.md a few times (using Google Translate) and this is my understanding of what I need to do:
      1. Place the firmware file as afck/ingredients/aml_upgrade_package.img.
      2. Run 'make img-unpack' to extract the partition files.
      3. Run 'make mod-unpack' to extract all files.
      4. Add my apks to appropriate folders under system or vendor.
      5. Run 'make mod-system' and/or 'make mod-vendor' to repack system and/or vendor partitions.
      6. Run 'make ubt' to repack partitions into img.
      For a test, I don't want to make any changes. I simply want to unpack and repack to see if the new img works properly. After running 'make img-unpack', I can see all the partition files created under afck/out/amlogic/device/1-2g/img-unpack, so so far so good. But after running 'make mod-unpack', I don't see the unpacked files. The last command 'rm -rf out/amlogic/device/1-2g/img-ubt/*' seemed to have deleted all the unpacked files under img-ubt. So I am now a bit lost on what to do next.

      Using another tool, I was able to unpack the img into a file structure that includes system folder, vendor folder, file_contexts file, system_statfile.txt file, and vendor_statfile.txt file. If someone could point me in the right direction on how to repack the file structure back into an img file using the bc-tool, that would be great! Thank you all, and your help is much appreciated.

      Comment


        #78
        @Ic01
        You are reading inattentively - step 2 is wrong and only applies to Android 8 project. Step 6 is wrong and only applies to Android 8 project. The img-ubt directory has nothing to do with the Android 9 project and is cleaned up after the image is extracted; all extracted partitions are located in bc-tool/<partition>

        Comment


          #79
          How do I pre set default app shortcuts for ATV in the rom

          Comment


            #80
            Please only the questions regarding bc-tool, the intervention in the SystemUI has nothing to do with this..

            Comment


              #81
              Hou to fix that?
              img is https://drive.google.com/file/d/1F5Q...pEp80rdpR/view
              android 9
              sistem is ubuntu 18.04


              ubuntu:~/afck$ sudo make mod-product
              mkdir -p "bc-tool/stamp"
              cd bc-tool/product && ./build
              check source folder...
              ok

              product/lost+found is already removed!
              previous build doesn't exist

              dtb check ok!
              calculate IMG size
              Error at '/partitions/product': FDT_ERR_BADMAGIC
              size: 0

              building...
              mkdir: cannot create directory ‘out’: File exists

              create ext4 fs...
              #################
              0+0 records in
              0+0 records out
              0 bytes copied, 0.000298639 s, 0.0 kB/s
              mke2fs 1.43.3 (04-Sep-2016)
              mke2fs: Device size reported to be zero. Invalid partition specified, or
              partition table wasn't reread after running fdisk, due to
              a modified partition being busy and in use. You may need to reboot
              to re-read your partition table.

              set android_sparse flag for e2fsdroid
              #################
              mke2fs 1.43.3 (04-Sep-2016)
              mke2fs: invalid blocks '0' on device 'out/product.PARTITION'
              compile file_contexts.bin

              create a sparse img...
              ##################
              ./build: line 89: 8307 Segmentation fault sudo contrib/e2fsdroid -T $TIME -B out/$PART.map -S out/$SLCB -f $PART -a /$PART out/$OUT
              build/mod.mak:61: recipe for target 'bc-tool/stamp/.stamp.mod-product' failed
              make: *** [bc-tool/stamp/.stamp.mod-product] Error 1


              Comment


                #82
                klobes

                post _aml_dtb.PARTITION here, the link above is not available..

                Comment


                  #83
                  hi the file are on link
                  https://filebin.net/pksw1st3wz13gm4r

                  Comment


                    #84
                    Originally posted by klobes View Post
                    hi the file are on link
                    https://filebin.net/pksw1st3wz13gm4r
                    Where did you get this DTB partition from? It does contain the multi-dtb header, but not a single single dtb. Use unchanged original dtb partition

                    Comment


                      #85
                      when do mod-unpack after that not get DTB partitioon , and after make mod-product it generate by self.

                      Comment


                        #86
                        Originally posted by klobes View Post
                        when do mod-unpack after that not get DTB partitioon , and after make mod-product it generate by self.
                        1. After make mod-unpack the _aml_dtb.PARTITION is copied into the bc-tool directory as a DTB file (unchanged).
                        2. After make mod-<partition> the build script checks the DTB header and selects between 3 possible DTB variants - single-dtb, multi-dtb, single- or multi dtb gzipped.
                        In the case of a multi-dtb, the script cuts off the DTB header so that the information about the partition size can be extracted via ftdget.
                        The original/unchanged DTB file is saved during this process (regardless of the dtb variant) as a DT end file and is used as a template for fdtget.

                        Because of a faulty DTB file in your case, the fdtget outputs "FDT_ERR_BADMAGIC" because no valid dt_header_magic (0xedfe0dd0) was found.
                        Where did you download this Android ROM? Post the link..

                        Comment


                          #87
                          Link of the link is : https://drive.google.com/file/d/1F5Q...pEp80rdpR/view
                          The DTB is singel file and format is gz
                          in post is the link of img
                          The android is A95x_f3_air
                          procesor is s905x3
                          Ram 2gb
                          Rom 16Gb

                          Comment


                            #88
                            I've been having an issue when I use make mod-system, this comes up:

                            mkdir -p "bc-tool/stamp"
                            cd bc-tool/system && ./build
                            check source folder...
                            ok

                            remove system/lost+found
                            previous build doesn't exist

                            multi-dtb detected...
                            92+0 records in
                            92+0 records out
                            188416 bytes (188 kB, 184 KiB) copied, 0.00121957 s, 154 MB/s
                            calculate IMG size
                            size: -524288

                            building...

                            create ext4 fs...
                            #################
                            dd: invalid number: ‘-524288’
                            check uuid hash
                            tune2fs: No such file or directory while trying to open out/system.PARTITION
                            Couldn't find valid filesystem superblock.
                            Filesystem UUID:
                            Directory Hash Seed:

                            set android_sparse flag...
                            ##################
                            contrib/mke2fs: invalid option -- '5'
                            Usage: mke2fs [-c|-l filename] [-b block-size] [-C cluster-size]
                            [-i bytes-per-inode] [-I inode-size] [-J journal-options]
                            [-G flex-group-size] [-N number-of-inodes] [-d root-directory]
                            [-m reserved-blocks-percentage] [-o creator-os]
                            [-g blocks-per-group] [-L volume-label] [-M last-mounted-directory]
                            [-O feature[,...]] [-r fs-revision] [-E extended-option[,...]]
                            [-t fs-type] [-T usage-type ] [-U UUID] [-e errors_behavior][-z undo_file]
                            [-jnqvDFSV] device [blocks-count]
                            generate fs_config
                            compile file_contexts.bin

                            create a sparse img...
                            ##################
                            ./build: line 109: 13724 Segmentation fault sudo contrib/e2fsdroid -T $TIME -C out/$FSC -B out/$PART.map -S out/$SLCB -f $PART -a / out/$OUT
                            make: *** [build/mod.mak:62: bc-tool/stamp/.stamp.mod-system] Error 1

                            I have no clue where it's getting this negative number as its image size. I'm using the stock GT King ROM:
                            https://drive.google.com/file/d/1XG4...2WvEoZA3v/view

                            I have no issues when I use make mod-vendor though.

                            Comment


                              #89
                              SteampunkJedi
                              Install this update on the pre-installed bc-tool..

                              download:
                              update_part_size_fix.tar.xz

                              install update:
                              Code:
                              tar xvJf update_part_size_fix.tar.xz -C ~/afck
                              klobes your dtb partition is encrypted, copy meson1.dtb (afck /out/amlogic/device/1-2g/img-unpack/meson1.dtb) to afck/bc-tool/ and rename this file to DTB, run make mod- <partition>. I will add support for this in the next update.
                              Last edited by bumerc; 01-14-2021, 14:13.

                              Comment


                                #90
                                bumerc


                                ???????download:
                                update_part_size_fix.tar.xz

                                The link is not working, can you re-upload it? I have the same problem with the negative image file size.

                                Thank you

                                Comment

                                Working...
                                X