Connecting Android and Huawei P9 with Linux Mint. [Solved}

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
Pipeman

Connecting Android and Huawei P9 with Linux Mint. [Solved}

Post by Pipeman »

I have a Hawei P9 smartphone.

When plugging the phone into USB, the name Huawei comes up under Devices...but I can not access any files on the phone(when clicking on it it shows an empty screen).

It also brings up CD Rom(I think Linux sees the phone as a CD Rom instead of a phone?), in the devices. This folder has four files, of which one is HiSuiteDownLoader.exe. I suspect this is an install file for the phone software, but as it has a Windows icon.

I am not sure this will work on my Linux Mint 18.1 Cinnamon 64bit.

If so, where should this file be run from. When clicking on the .exe file, it it asks me if I would like to extract files. I'm out of my depth here...
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Pipeman

Re: Connecting Huawei P9 with Linux Mint.

Post by Pipeman »

I also found this article on a Google Search, but I'm dubious about running all these commands, just now I break something :D :D

http://www.modaco.com/forums/topic/3772 ... huawei-p9/

Here they describe the solution as follows:

Huawei have helpfully released the kernel source for the Huawei P9 on their download site. Impressively, the version posted there (3.10.90) actually matches the current release build (B136). However, the download itself is only part of the puzzle - it's important to then know how to compile it and use it. Hence this guide. :)

Some points to note first of all...

This guide refers to building on Linux. You can probably build on OSX or whatever too but seriously, it's less pain in the long run to spin up an Ubuntu VM.
In the download linked above, as well as the kernel, there are some other bits and pieces (some of which are quite bizarre). I've mirrored the kernel to Bitbucket, so you don't need to grab the whole download.
Got that? OK, so here's a step by step on how to build the kernel! I strongly recommend building stock first and testing that works for you, then you can start adding your tweaks in. I'm interested to hear what you add / change!

Open a terminal window on your Linux machine / in your Linux VM. No GUIs here. :) Change to the directory where you want the kernel / toolchain to live.
First of all, we're going to clone the toolchain from AOSP.
git clone https://android.googlesource.com/platfo ... ndroid-4.9
Next we're going to clone the kernel source itself from my git repo on bitbucket.

git clone https://gitlab.com/paulobrien/android_k ... wei_p9.git kernel
We need to add the toolchain location to the path.
export PATH=$(pwd)/aarch64-linux-android-4.9/bin:$PATH
We need to specify that we are cross compiling for arm64.
export CROSS_COMPILE=$(pwd)/aarch64-linux-android-4.9/bin/aarch64-linux-android-
Let's create a directory for our output to go in to.
mkdir out
We've got the kernel downloaded, so let's change to that directory so we're ready to go.
cd kernel
A bit of cleaning up before we get started...
make ARCH=arm64 O=../out mrproper
Specify that we're building for the P9 (hisi3650 chipset)...
make ARCH=arm64 O=../out p9_extracted_defconfig
And build it!
make ARCH=arm64 O=../out -j8
When this process completes, we can check the '../out' directory and you should find the file arch/arm64/boot/Image. This is the kernel that you've just built! You can't flash it as is though, you need to put it into a boot image first.

Here's how you do it...

Change out of the kernel directory back to its parent.
cd ..
Download tools for manipulating the boot image.
git clone https://github.com/xiaolu/mkbootimg_tools.git
Download the stock boot image (actually we're using the root ready version for convenience).
wget -O boot.img http://nigella.modaco.com/files/boot.st ... 9.b136.img
Extract the boot image.
mkbootimg_tools/mkboot boot.img boot.extracted
Copy the new kernel into the extracted boot folder.
cp out/arch/arm64/boot/Image.gz boot.extracted/kernel
Build a new boot image.
mkbootimg_tools/mkboot boot.extracted boot.newkernel.img
You now have a new boot image (boot.newkernel.img). All that's left is to flash it to your device! Reboot to bootloader (either using 'adb reboot bootloader' or by powering on with volume down held), flash using 'fastboot flash boot boot.newkernel.img' and then reboot using 'fastboot reboot'. Job done! In the About screen of settings you should see the date of the new kernel and details of your build machine.
1
Hoser Rob
Level 20
Level 20
Posts: 11796
Joined: Sat Dec 15, 2012 8:57 am

Re: Connecting Huawei P9 with Linux Mint.

Post by Hoser Rob »

That's a patched version of the 3.10 kernel. That is a rather old kernel. I use Mint 17.3 and the kernel version is the 3.19 series. I think 17 was kernel 3.13, and Mint 18 obviously uses a newer one.

You can't just drop older or newer kernels into Linux and expect them to work. It may fix one thing but it's just as likely to b reak 3 other things. IMO this crap of installing newer/older kernels to fix stuff is for amateurs who don't know how to use backports. Hackers, really. I'd expect this kernel to break stuff in 18.

I'd concentrate on the ANdroid aspect of things ...
For every complex problem there is an answer that is clear, simple, and wrong - H. L. Mencken
ninomrki
Level 3
Level 3
Posts: 100
Joined: Wed Jan 16, 2013 7:49 pm
Location: Zagreb, Croatia
Contact:

Re: Connecting Huawei P9 with Linux Mint.

Post by ninomrki »

Pipeman wrote:I have a Hawei P9 smartphone.

When plugging the phone into USB, the name Huawei comes up under Devices...but I can not access any files on the phone(when clicking on it it shows an empty screen).

It also brings up CD Rom(I think Linux sees the phone as a CD Rom instead of a phone?), in the devices. This folder has four files, of which one is HiSuiteDownLoader.exe. I suspect this is an install file for the phone software, but as it has a Windows icon.

I am not sure this will work on my Linux Mint 18.1 Cinnamon 64bit.

If so, where should this file be run from. When clicking on the .exe file, it it asks me if I would like to extract files. I'm out of my depth here...

Pull down the notification area on your phone and there will be a message that says "USB connected" with two buttons below (Photos and Files). Unless you pick one of the buttons, your PC will only charge the battery on your phone. If you touch the notification, you will get more options.
Home is where the Wi-Fi is.

Registered Linux user #562302
Pipeman

Re: Connecting Huawei P9 with Linux Mint.

Post by Pipeman »

Ok I found this post from another forum which helped.

https://www.androidpit.com/forum/716513 ... nect-to-pc

This started in Android 6.0 Marshmallow. Before that, there is no need to do that. Google (Android) makes it so troublesome for users.

This is supposed to be the solution, but may/may not work, because there are reports it didn't work on some phones even though the setting is Media Transfer Protocol (MTP).

Activate Developer Mode
- Goto Settings
- Tap About Device
- Tap Build Number 7 times to activate Developer mode

You will now have Developer Mode in Settings
- Goto Settings
- Tap Developer Mode (check under 'More' if you can't find it)
- Tap Select USB Configuration
- Select Media Transfer Protocol (MTP)

Generic instructions, not specific to Huawei phones
Pipeman

Re: Connecting Huawei P9 with Linux Mint.

Post by Pipeman »

After a while it bombed out on me and I could not see any files on the phone again in Devices.

Even though in settings on the phone it showed USB Mode set to MTP.

To get it back again I had to repeat the above. I changed the USB Mode to Charge Only, and once I selected MTP again, I could carry on with my file transfer.

Beware your phone is now in developer mode, don't do anything silly :shock: :idea: :mrgreen: Although they say you cant really break anything :roll:

For all intent and purposes I will now mark the thread as [Solved]

As the instructions are not Huawei Specific, I will add "Android and" to the subject line as well for searches.

Hope you guys find this useful for future!!
Locked

Return to “Beginner Questions”