Skip to content
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

I have unpacked and repacked the files contained inside your boot.img file. Did I do everything correct or not ? #5

Open
Marietto2008 opened this issue Jul 5, 2023 · 10 comments

Comments

@Marietto2008
Copy link

Marietto2008 commented Jul 5, 2023

Hello,

I have unpacked and repacked files from your boot.img file. I have unpacked the files stored inside this boot.img file :

https://github.com/raspiduino/a6lte-kvm/releases/download/0.01/boot.tar

and I've used a tool called "unpackbootimg" that I've got from this link :

https://github.com/osm0sis/mkbootimg

this is how I have extracted the files from the boot.img file :

# /mnt/zroot2/zroot2/OS/Android-KVM/Galaxy-A6/osm0sis-mkbootimg# mkdir boot
# ./unpackbootimg -i /mnt/zroot2/zroot2/OS/Android-KVM/Galaxy-A6/Boot-Files/boot-orig.img -o boot

this is what happened :

ANDROID! magic found at: 0
BOARD_KERNEL_CMDLINE androidboot.selinux=permissive
androidboot.selinux=permissive
BOARD_KERNEL_BASE 0x10000000
BOARD_NAME SRPRA31B008KU
BOARD_PAGE_SIZE 2048
BOARD_HASH_TYPE sha1
BOARD_KERNEL_OFFSET 0x00008000
BOARD_RAMDISK_OFFSET 0x01000000
BOARD_SECOND_OFFSET 0x00f00000
BOARD_TAGS_OFFSET 0x00000100
BOARD_OS_VERSION 10.0.0
BOARD_OS_PATCH_LEVEL 2021-03
BOARD_DT_SIZE 509952

then I have removed the old kernel and I have replaced it with a new kernel re-compiled by me,where I have enabled KVM. At this point,I have repacked the files previously extracted and this is how I did that :

cd /mnt/zroot2/zroot2/OS/Android-KVM/Galaxy-A6/Boot-Files/boot/

mkdir ./ramdisk

cd ./ramdisk/

gzip -dc ../boot.img-ramdisk.gz | cpio -imd

find . ! -name . | LC_ALL=C sort | cpio -o -H newc -R root:root | gzip > ../new-boot.img-ramdisk.gz

mkbootimg
--kernel ./boot.img-kernel
--ramdisk ./new-boot.img-ramdisk.gz
--dtb ./boot.img-dt
--cmdline "$(cat ./boot.img-cmdline)"
--base "$(cat ./boot.img-base)"
--kernel_offset "$(cat ./boot.img-kernel_offset)"
--ramdisk_offset "$(cat ./boot.img-ramdisk_offset)"
--second_offset "$(cat ./boot.img-second_offset)"
--os_version ./boot.img-os_version
--os_patch_level ./boot.img-os_patch_level
--tags_offset "$(cat ./boot.img-tags_offset)"
--board ./boot.img-board
--pagesize "$(cat ./boot.img-pagesize)"
--output ./new-boot.img

I would like to know if I did everything correctly. I didn't see any error,but I'm not sure to have done the whole procedure correctly. Thanks.

@raspiduino
Copy link
Owner

I use the libmagiskboot in https://github.com/topjohnwu/Magisk, so I haven't test your way of repacking. But it seems to be correct. You can just test your repacked image, if it boots and you have done thing correctly :)). If it does not, you can just fallback to use libmagiskboot.

@Marietto2008
Copy link
Author

Marietto2008 commented Jul 6, 2023

I didn't use magiskboot because it does not work on Ubuntu. This point is not clear on your tutorial. How to do "magiskboot unpack boot.img" if I don't have any magiskboot on ubuntu ? Did you do this operation while you ran Android ? Did you run an Android emulator for Linux ? Did you install termux on Android to issue that command ? Can you you be clearer on these points on your instructions ? thanks.

@raspiduino
Copy link
Owner

Magisk has some native static linked binary for x86 packed inside their apk. Download the magisk's apk, unzip it, look inside lib/ and you will find some x86 binary. There will be libmagiskboot.so. Just run it like a normal Linux executable (./libmagiskboot.so)

@raspiduino
Copy link
Owner

image

@Marietto2008
Copy link
Author

Marietto2008 commented Jul 6, 2023

There aren't no binary inside the folder lib/x86 :

Istantanea_2023-07-06_18-58-17

@Marietto2008
Copy link
Author

No executables inside lib/x86_64 :

pIstantanea_2023-07-06_19-40-52

@Marietto2008
Copy link
Author

Marietto2008 commented Jul 6, 2023

Can you attach the missing executables here ? thanks.

The tutorial suggests to run magiskboot,but I don't have this executable.

Step 8: You need to extract the stock boot.img from stock rom. You can get stock rom from samfw.com or from my release page :). Then use magiskboot to unpack boot.img, replace stock kernel with our compiled Image in arch/arm64/boot/Image and repack boot.img using magiskboot repack boot.img new-boot.img

@raspiduino
Copy link
Owner

There aren't no binary inside the folder lib/x86 :

Istantanea_2023-07-06_18-58-17

chmod +x libmagiskboot.so and then ./libmagiskboot.so [sth]

@Marietto2008
Copy link
Author

Marietto2008 commented Jul 7, 2023

---> chmod +x libmagiskboot.so and then ./libmagiskboot.so

can you explain this on your tutorial ? I didn't know that the .so files could be executable. I know that they are only libraries. Excuse me for my ignorance. But maybe not everyone knows that this can be done.

@raspiduino
Copy link
Owner

can you explain this on your tutorial ? I didn't know that the .so files could be executable. I know that they are only libraries. Excuse me for my ignorance. But maybe not everyone know that this can be done.

My bad. I should have written that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants