[Android General] JengaMasterG:
Welcome!

This Megathread is to help bring the different threads together for the Xiaomi Black Shark (SKR-A0 or SKR-H0) since the xiaomi-black-shark tag is broken (at least for me it is). This will also serve as a one-stop shop for people who need general black shark support!

Disclaimer: You (the user) assume the risk for any bootloader unlocking, rooting, or any other modifying of your device. These can lead to phone's being bricked or boot-looped. We aren't to blame if the directions aren't followed to the T!

Tips before modding your phone

1. Stay organized! Make a folder for any files you download or data your backup so you don't lose anything important

2. Backup your user data onto your computer. It is guaranteed 100% of the time that your phone's data will be wiped when installing of uninstalling ANY of the modifications listed below. Unless you have been rooting and unlocking bootloaders for years, you don't want to skip this step.

Common ADB and Fastboot Commands

These are some commands you'll need to get to know:

adb devices: this shows what devices are currently connected to your computer

adb pull: this pulls a file from your phone and saves it to a location on your computer. You will need to specify the location of the file and the save location of the file

adb reboot bootloader: this reboots the phone into fastboot mode to use fastboot commands

fastboot devices: this shows what devices are connected to your computer in fastboot mode

fastboot boot filename.img: this boots the phone with using a image file of your choice

fastboot flash disk_partiton filename.img: this will flash an image file over the disk partition you want.

Example:

fastboot system system.img flashes a new system_a.img over the system parition of your phone's storage. This is where the main operating system is held on the phone.​

fastboot reboot: reboots the phone

fastboot continue: boots the phone straight from fastboot into the system, not restarting the phone.

Unlock/Relock your Bootloader

WARNING: This WILL wipe your internal data

On Android, the phone must have an unlocked bootloader to enable some of the common modding features. These steps will unlock your bootloader.

Pre-requisites:

1. You will need the SDK Platform Tools downloaded onto your computer. This has the necessary adb and fastboot programs you will need in order to unlock your bootloader.

2. Enable Developer Options on the Phone

-Go to Settings -> About phone and tap the Build Number 7 times to enable Developer Options

3. Enable OEM unlocking

-For CN Version (SKR-A0):

Go to Settings -> Other Settings -> Advanced Settings -> Developer Options and Enable OEM unlocking. It will give you a warning pop up. Click yes to enable OEM unlocking.

-For Global Version (SKR-H0):

Go to Settings -> Developer Options and Enable OEM unlocking. It will give you a warning pop up. Click yes to enable OEM unlocking.

4. Enable USB Debugging. This lets you use ADB (Android Debugging Bridge) to send commands from your computer to the phone.

-For CN Version (SKR-A0):

Go to Settings -> Other Settings -> Advanced Settings -> Developer Options and Enable USB debugging.

-For Global Version (SKR-H0):

Go to Settings -> Developer Options and Enable USB debugging.

5. Boot into fastboot mode.

-Booting from the Phone:

Turn the Phone off

Press and hold the Volume Down Button

Turn the phone on while holding the volume down button

-Booting from the PC:

Connect your phone to your computer.

Go to where you downloaded the SDK platform tools. The folder name should be "platform-tools" and have "adb" and "fastboot" exe files in it.

Open a command prompt/terminal from that folder.

Run the command: adb devices

A pop up should show up on your phone. Click the checkmark next to "Always allow from this computer" and click ok. Your computer is now allowed to send commands to the phone.​

Now run the command: adb reboot bootloader

You should now be in fastboot mode!

To check if you're in fastboot mode:

Go to where you downloaded the SDK platform tools. The folder name should be "platform-tools" and have "adb" and "fastboot" exe files in it.

Open a command prompt/terminal from that folder.

Run the command: fastboot devices

If your device shows up then you're in fastboot mode! You should also see a line of text that says something like:

"Bootloader Locked"

"Bootloader Unlocked"

Unlocking your Bootloader:

1. If your phone says bootloader is locked:

While connected to your PC run the following commands:

-For SKR-A0

fastboot oem unlock

-For SKR-H0

fastboot flashing unlock

If there is a warning click to proceed with the unlock. THIS WILL WIPE YOUR DATA AT THIS TIME.

If your phone says bootloader is unlocked:

Skip this step!

Your Bootloader is now Unlocked!!

Relocking your Bootloader:[/size]

1. Boot into fastboot mode

2. Connect your phone to your computer

3. Run the Bootloader Lock command

3a. For Both Versions

fastboot flashing lock

WARNING: THIS WILL WIPE YOUR DATA.

Your bootloader is now Locked!

Rooting Using TWRP

Unlocked Bootloader Required!

Required files:

The latest Magisk Zip and APK files...it can be found here

A Computer with the latest SDK Platform tools

TWRP image file found at this thread

Do NOT download the installer.

1. Boot into fastboot mode and connect to your computer

2. Run the command: fastboot boot Name_of_twrp_file_.img

Replace Name_of_twrp_file.img with the name of the twrp image file you've downloaded for the blackshark

Tips:

If your screen is upside down, that's ok! Your touches will be in the same spot, the image is the only thing that's upside down.

On first boot, if TWRP is asking for a decryption password, you will need to wipe your data before going forward.

3. Move the Magisk Zip file to your phone's storage

4. On TWRP:

Click install -> Magisk.Zip file -> Swipe to confirm flash

5. After the install is complete: Swipe to reboot the phone

DO NOT INSTALL TWRP APP IF IT ASKS YOU TO

6. After the phone reboots, install the Magisk apk file

7. If you start the magisk app and it says Magisk is not installed, try rebooting your phone.

8. If you start the magisk app, and it asks to download extra resources, click ok.

You're now rooted!

Install GApps

Installing GApps should only be for the CN version!

You can find the directions and required files in this thread here

Factory Images

For the CN version (SKR-A0)

The factory images can be found on Google Drive here

For the Global version (SKR-H0)

[Guide] Restoring Black Shark 1 Global to Stock OTA bug fixed!

Using Project Treble (GSI) System Images!

What is Project Treble and GSI?

The Generic System Image (GSI) was added into Android 8.0 devices to enable OEM partners and developers to help with updating devices. Using an dual system approach (slot a and slot b) android phones can be updated seamlessly (without rebooting) and recover devices from a bad update.

Project Treble is an extension of this feature to enable developers to update their OS easier to new versions of Android! This includes *drum roll* the ROM commmunity!! So if your phone supports project treble and gsi (which the Black Shark does) we already have ROMs available to us!

The Downside to Project Treble Roms

Our Vendor File isn't compatible with Treble ROMs and we can't use other vendor files (as what I have seen so far) so these bugs will exist for now:

The S logo doesn't turn off. Stays Green lit.

You may not be able to increase screen brightness.

Fingerprint may not work on the Treble ROM.

Installing a Project Treble Rom

YOU WILL LOSE YOUR USERDATA. THERE IS NO GETTING AROUND THIS AS OF NOW.

Prerequisites:

Unlocked Bootloader on your phone and adb, fastboot, TWRP image and the most recent Magisk Zip on your computer.

For CN variants (SKR-A0) you may need to use the Global (SKR-H0) vendor and boot images. These steps were tested on using the Global Images

1. Choose your rom over here

2. Download the ARM64 A/B version of your rom of choice. The Black Shark supports Seamless Updates and it's based on the 64bit architecture (as are most modern phones).

3. Factory Reset your phone. You can do this either through the recovery or through the system settings.

4. Boot into bootloader mode on the phone and connect the phone to the PC.

5. Erase the system partition: fastboot erase system

6. Flash the new system OS: fastboot -u flash system system_image_file.img

7. Boot into TWRP from fastboot: fastboot boot twrp_file.img

8. Tap the DO NOT ALLOW SYSTEM MODIFICATIONS

9. Move the Magisk Zip file to your phone.

10. Click Install -> Magisk Zip -> Swipe to Install

11. Reboot the Phone

That's it! Your screen will be upside down during the media locking process (using a Disable Force Encryption file has not worked for me). Once your get to the setup page you may have to set it up with the screen upside down. THIS IS THE SAME AS HOW TWRP IS UPSIDE DOWN BUT THE TAPS ARE IN THE NORMAL SPOTS. If a warning comes up that's normal.

Android 9.0 Pie News!!!

https://xdaforums.com/android/development/news-black-shark-2-features-coming-to-t3924703

How to Get CN Rom's Shark Space and MI Market onto Global ROM:

https://xdaforums.com/android/development/port-cn-shark-space-mi-market-blackshark-t3927854

Credits:

TWRP by [MENTION=4712355]mauronofrio[/MENTION]

Offical XDA Magisk Thread

[MENTION=3907492]gilbert32[/MENTION] for factory global images