Using U-Boot to extract Boot Image from Pritom P7

This is a guide to extract the boot image from a cheap Android tablet based on Allwinner A133 using U-Boot (accessed via UART). The original firmware was not found on the internet. With the boot image and Magisk, you can root your Android tablet to make it more useful.

Pritom P7 is a very cheap Android tablet. I bought it for 33 USD from AliExpress, but it can be found for as low as 27 USD. This is a Google GMS-certified device (it passes Play Integrity, no malware was found when I received it), and it uses 32-bit Android Go. I am only using this to test some 32-bit Android app compatibility.

I bought it for 32.75 USD

They may have several variants of this model with different specifications. Mine is: Alwinner A133, 1.5GB RAM (advertised as 2GB, and shown as 2GB in the Android info), 32 GB ROM, only 2.4 GHz WIFI, no GPS.

Unlockable Bootloader

Luckily, we are allowed to unlock the bootloader of this device using the developer menu, adb reboot bootloader then using fastboot oem unlock. Some cheap Android devices don’t allow unlocking (for example, the ones that are based on recent Unisoc SOC).

I can allow bootloader unlock using the OEM Unlocking option

The product ID of my tablet is P7_EEA (Android 11) with kernel version Linux localhost 5.4.180-svn33409-ab20220924-092422 #28 SMP PREEMPT Sun Aug 20 19:13:45 CST 2023 armv8l. The build number is PRITOM_P7_EEA_20230820.

I did not find any Android exploit for this device, and I also didn’t find any backdoors. From my experience, some of these cheap Android devices have hidden su backdoors. Unable to find an exploit, I gave up trying to extract boot image from user space.

With some SOC, you can easily read/dump/extract the flash using PC software. I didn’t find any software for this Allwinner chip. An example of a SOC that allows flash reading is Unisoc (formerly Spreadtrum), but on the other hand, the bootloader on phones and tablets with the latest SOCs from Unisoc (that I know of) is not unlockable.

UART

Fortunately, this device is easy to open, and a UART pin is on the top left near the camera.

UART + FEL pad on top, near the camera

Here is a close-up:

The right-most pin is FEL if you want to enter FEL mode. But entering FEL mode can be done easily using: adb reboot efex.

To test that the pin does output something, I just connected the ground to the USB-C ground and held my hand, pressing a cable on the TX pad during startup.

No soldering is needed if you can hold your hand like this

U-Boot

Fortunately, we can break into u-boot (not locked down); from there, it is easy to dump the bootloader. There are many ways to do it, but this is how I did it. First, print the environment using env print to see what commands are used to load the boot partition:

bootdelay=0
boot_normal=sunxi_flash read 45000000 boot;bootm 45000000

Note: I suggest you change the bootdelay to make it easier to enter U-boot next time.

We can see that we can read the flash partition to a certain memory location using:

sunxi_flash read 45000000 boot

Now, we need to write this memory area to an SD Card. I prepared a FAT-formatted SD Card. Insert it, then: sunxi_card0_probe. This will detect the card. I need to do mmcinfo otherwise, the next command won’t work:mmc part

Now we can test listing the content of the card: fatls mmc 0:1. It should be empty since we just format it. Next is to write the memory to a file: fatwrite mmc 0:1 45000000 boot.img 4000000. Note: all numbers are in hexadecimal. 64 Megabytes is just a common size for the boot partition.

We can install Magisk APK to the tablet, run it, and then choose “Install” and “Select and patch file”. Patch our boot.img, then the magisk_patched_xx.img file can be flashed using : fastboot flash boot magisk_patched_xx.img.

Magisk Installed

I could have dumped all the partitions using u-boot, but I felt that u-boot is slow in writing to the SD Card. After we have a root access, we can easily dump the rest of the partitions by accessing the files in /dev/block/by-name.

Conclusion

I hope this guide can help you root your Allwinner device, even when you don’t have the original firmware.

I think this device is not worth buying unless you have a specific need for it. This tablet is OK if you want to test your app for Android Go or 32-bit Android libraries. This is also a good tablet for learning to hack Android hardware.

If you are using the same device and want to have the boot partition, you can download it here: please make sure that your hardware is exactly the same as mine to prevent bricking it.

https://tinyhack.com/files/pritom-P7_EEA-boot.img

Leave a Reply

Your email address will not be published. Required fields are marked *