Extract (dump) all partition images from Huawei e8372h under GNU/Linux - General Questions and Answers

Hi there everyone, how would one go about checking what partitions are present on devices such as Huawei e3372h or e8372h and how to dump them using gnu/linux. I am OK with terminal/shell scripting, I've done some basic Arduino/Raspberry projects, but I want to get more into firmware (binwalk, repackaging, etc). Where would one start? What tools shall I look to familiarize myself with? I very much want to avoid using blobs like pre-compiled windows tools that are difficult to inspect. Is it possible to dump firmware (incl. boot partitions) using standard gnu/linux toolset (like dd) or at least tools that have source code available?
I have been looking for resources both here and on Russian/German fora, unfortunately most of posted solutions are based on Windows *.exe files and knowing a bit about Linux I am 100% sure that whatever these programs are doing is also possible to be done on Linux in a cleaner more transparent and reproducible manner (that is better for educating oneself).
Any hints much appreciated

If device's Android is rooted, if Android is version 6 and higher, then you can dd the partitions in question.

Thank you for your response! Is there an Android running on USB modems/routers such as Huawei e8372h? I am looking to dump all partitions from such device and to be able to restore them before I start any modifications. This way I should be able to restore devices to their original "factory" state if anything goes sideways (except if I hard-brick them).
I have a number of e3372h(-153) and e8372h(-153) devices that I can experiment with (they have different versions of firmware on them and the very-very first thing I want to do is to extract all images (including boot partition if possible) and test if I can restore from these backups). Only then I want to start modding them or checking other people's modifications...
So far I have managed to switch modes of these devices. For example for e8372 I can have it on the host machine (Ubuntu GNU/Linux laptop) visible as
virtual CD-ROM (/dev/sr0)
hi-link device (accessible from 192.168.8.1)
3 x TTY device (one of which can execute AT commands)
emergency boot mode with one TTY device
With the last one i have executed
balong-usbdload -p /dev/ttyUSB0 usblsafe-8372.bin (following https://gist.github.com/ValdikSS/323bcdfceb2f09d9c6ef02db1bc573e2 and https://github.com/forth32/balong-usbdload.git)
expecting to gain telnet acces to device and possibly dump the remaining partitions to the microDS card (using nanddump) but for some reason I still cannot log in using telnet
BTW Using Windows based tools that I have no source code for is pointless for me as my main goal is to learn the structure and functioning of these devices and be able to modify them myself.
If successful I intend to publish these images and tutorialize my notes on how to backup/restore, but for now I need a direction myself

IMO all tools, either compiled for Windows OS or Mac OS or Linux OS, in background simply run Android shell scripts.

Related

[tut]complete guide on installing linux on android [dual boot]

So , Hello everyone,
It will not remove or harm Android, it will just run Linux on top of android
This tutorial will guide you through installing Linux on mmx a116 with android side by side..
What is this all about?/Why put this on my device?
This projects aim is to bring a range of linux distros to your android device through a method known as 'chroot', see it has running a linux distro within a virtual machine on your phone (Although its not! its using native ARM ports and the Android kernel) . You can access this virtual machine and run it on your phone without causing any damage to your device, or having to overwrite anything. Why might you want this? well my apps are designed to make the install and set up process as easy as possible while still giving you some flexibility. Once you have the distro up and running then you can pretty much run and install any linux software you like (so long as there is a arm port or it is not architecturally dependent).
Wait this uses VNC why shouldn't I just VNC to a computer?
VNC is used to access the GUI as at the moment I have not yet implemented a native way of viewing the GUI. But the Linux distro itself is running within the phone and can be controlled via the terminal app so if your a seasoned Linux user you may never even want to use the GUI
What is Chroot?/How does this work?
"A chroot on Unix operating systems is an operation that changes the apparent root directory for the current running process and its children" - http://en.wikipedia.org/wiki/Chroot
This method of running linux distros with android has been around for some time. I have worked on my scripts to make the process more user friendly and give you far more options from the word go.
The scripts start by mounting the linux image file within the android file system and then mounts the sdcard and if you have it internal memory within the linux file system.
Chroot is then used to change the root directory to that of the mounted linux and a bash shell is then opened to allow you to control linux this is kind of like 'booting' the OS.
The likes of VNC and SSH are then set up when linux is 'booted' to allow you to connect to the GUI if you require it.
Note: This requires a lot of free space on sd cards(any)..atleast 2 GB ..
INSTRUCTIONS:
1-Go to play store and download 'Complete Linux Installer' and install it ..
2-if you have a custom or other kernel , you have to check wether it supports loop or not.So better be on Stock Kernel.
3- Now there are 2 ways to install and run distros(eg-linux,backtrack).One is easier but requires an internet connection on the phone.other is a bit difficult but can be done from PC also .
method 1 ( internet on smartphone )
Go to complete Linux Installer and select install guides and select the distro you want it will download and guide you further.(in the unzipping step , i recommend using a PC for it as its too slow on the phone.)
Method 2 ( using a PC )
Download the version and size of your preferable ubuntu from here -
http://sourceforge.net/projects/linuxonandroid/files/Ubuntu/
After that, download androidVNC and terminal emulator from play store
now extract ubuntu.zip and place it in a folder called ubuntu on root of your SD card.Now you are ready to boot too ubuntu. select the launch menu from complete linux installer.
you will be redirected to terminal emulator . press n if you are asked to check boot.img from md5 as it gets stuck there. set screen size to 1280x720 after few seconds you will see a message [email protected] . this means you are succesful.
go to android vnc type in port option 5900 and password and username as ubuntu an color settings as 24 bit..
congratulations! you have booted to Ubuntu!:highfive:
Hmmmm.
That's not dual boot.:sly:
It runs Linux in VM.
Thanks!
-Dracula
And i don't see why anyone would want to do this, it's just killing your phone by overloading it with a Desktop OS in a VM!
Also perhaps providing credit to the person that did all the hard work might be a good idea .......
Oh and its not a VM guys, it uses chroot which means native ARM linux running with the Android kernel, within Android.

Turning an existing phone into a virtual machine

I have an older Samsung Galaxy SII phone that I'm using to 'play with', to get a better understanding of the android file-system and how everything works.
What I'm trying to do is converting this existing phone to a virtual machine. I already tried to following;
- I made a physical image of the device and got a nice .bin file.
- I converted the .bin file to a virtual disk in .vdi format
(Linux command; "VBoxManage convertdd galaxy-s2.bin galaxy-s2.vdi")
(I also tried the following command, for a VMWare virtual disk; "sudo qemu-img convert galaxy-s2.bin galaxy-s2.vmdk", same problem in VMWare when booting)
- Then I created a virtual machine in virtualbox and selected the .vdi image. Obviously it didn't work, because I guess it's missing a bootloader?
(Error message; "FATAL: No bootable medium found! System halted.")
The above steps were the easy way and I already had in mind that this was to easy and not going to work.
So my questions are;
- Does anyone have any feedback about the above steps I took? Was "vboxmanage" the right tool to use or did I miss something?
- Is there a way to add a bootloader to a raw .bin file and converting it to a bootable virtual harddisk?
- Does anyone already tried converting a used phone to a virtual machine, containing the original data of the physical phone, etc.?
Thanks! Looking forward learning more about virtualizing existing physical phones. :good:
What you are doing sounds super interesting. I still consider myself a novice at digital forensics but maybe I can help you out.
How did you image the device? Getting a physical image of a device is a bit tricky. From what I remember, you either have to root the device and then run dd on several files in /dev/mtd, or use special forensic tools (MPE, Cellebrite, XRY,…).
kolejnik said:
What you are doing sounds super interesting. I still consider myself a novice at digital forensics but maybe I can help you out.
How did you image the device? Getting a physical image of a device is a bit tricky. From what I remember, you either have to root the device and then run dd on several files in /dev/mtd, or use special forensic tools (MPE, Cellebrite, XRY,…).
Click to expand...
Click to collapse
Thanks! In this case I got a physical image of the phone with the "Universal Forensic Extraction Device" from Cellebrite. I think that tool does some sort of temporary rooting.
I also created a new virtual machine with a similar Android version iso file. I added the virtual hard-disk of the phone I imaged (the Galaxy SII) to that virtual machine. When I wanted to install Android to a blank virtual disk, it did recognize the Galaxy SII image, but I was unable to mount it.
At the "choose partition" menu, during the Android installation, it said;
- sdb1 == EFI GPT == VBOX HARDDISK
Then I got an error, saying; "Cannot mount /dev/sdb1", "Do you want to format it?"
Maybe we need to find a way to add something to that raw image, like a bootloader or something? Or maybe I'm missing something else. I'll keep trying to get the virtual machine to work.. Any feedback or comments are appreciated, thanks!

Dump an entire Surface RT to external memory

Hi There.
I need to be able to dump and restore a Surface RTs main block device.
I am aware of the secure boot issue (OS needs to be signed, cannot be disabled)
Ideas that I had to solve this issue:
1. boot a Windows RT Recovery from Stick
(try dd for Windows http://www.chrysocome.net/dd or WinDD https://sourceforge.net/projects/windd/ , maybe via win86emu http://forum.xda-developers.com/windows-8-rt/rt-development/win86emu-0-6-windows-rt-8-1-t3237587)
2. boot a Windows RT PE (same as Recovery)
3. find a signed ARM-Linux
Problems I face:
1. I found a recovery Image (even exploitable 8.0), but no shell access to execute arbritrary commands
2. WinPE ARM is not available to the public. Even though "Windows ADK" offers the Option "arm", the files are not shipped with the tool publically
3. Seems like this does not exits:
http://www.dailytech.com/Microsoft+...ing+on+Windows+8+ARM+Devices/article23785.htm
http://forum.xda-developers.com/showthread.php?t=2655398
Any ideas, folks?
thank you for reading.

How to be a good tester

After having a really good tester @mrbtree98 I was convinced that everyone is really that good but after seeing some people on #twrp and some close friends telling their situations of their tester , and believe me its not good
So this read would explain a bunch of including :
[*]Attitude
[*]Basic Stuff
[*]Debugging
[*]Talking skills
[*]Patience
Lets start with attitude
Attitude
People may hear your words
But people feel your attitude
Click to expand...
Click to collapse
Attitude while talking to developer is very important it even sometimes decides your respect on a forum !
People on very forums highly respect the devs even if he is new to the forums , same applies to xda
IF you show your attitude then things will absolutely go wrong
What do I include when I talk about attitude ?
You throw sarcasm or even bad abuse him ! becuase his program messed anything with or phone or anything
You say you are tired of this testing stuff
You try to tell him that he is slow and inferior to other devs
I know this may seem hypothetical but its true , this does happens !
When Talking to dev always keep your temp down remember that he is doing all the work for you all guys and he wants your satisfaction
Basic Stuff
lets Boil down to basic stuff that you need to learn before testing anything in android
Adb
Adb :
Android Debug Bridge (adb) is a versatile command line tool that lets you communicate with an emulator instance or connected Android-powered device.
In order to use adb with a device connected over USB, you must enable USB debugging in the device system settings, under Developer options.
On Android 4.2 and higher, the Developer options screen is hidden by default. To make it visible, go to Settings > About phone and tap Build number seven times. Return to the previous screen to find Developer options at the bottom.
On some devices, the Developer options screen may be located or named differently.
Note: When you connect a device running Android 4.2.2 or higher to your computer, the system shows a dialog asking whether to accept an RSA key that allows debugging through this computer. This security mechanism protects user devices because it ensures that USB debugging and other adb commands cannot be executed unless you're able to unlock the device and acknowledge the dialog. This requires that you have adb version 1.0.31 (available with SDK Platform-tools r16.0.1 and higher) in order to debug on a device running Android 4.2.2 or higher.
Click to expand...
Click to collapse
fastboot : fastboot is a small tool that comes with the Android SDK (software developer kit) that can be used to re-flash partitions on your device. It is an alternative to the recovery mode for doing installations and updates.
Kernel :
A kernel is critical component of the Android and all operating systems. It can be seen as a sort of bridge between the applications and the actual hardware of a device. Android devices use the Linux kernel, but it's not the exact same kernel other Linux-based operating systems use. There's a lot of Android specific code built in, and Google's Android kernel maintainers have their work cut out for them. OEMs have to contribute as well, because they need to develop hardware drivers for the parts they're using for the kernel version they're using. This is why it takes a while for independent Android developers and hackers to port new versions to older devices and get everything working. Drivers written to work with the Gingerbread kernel on a phone won't necessarily work with the Ice Cream Sandwich kernel. And that's important, because one of the kernel's main functions is to control the hardware. It's a whole lot of source code, with more options while building it than you can imagine, but in the end it's just the intermediary between the hardware and the software. So basically if any instruction is given to mobile it first gives the command to kernel for the particular task execution.
Flashing a kernel :
adb reboot bootloader
fastboot flash boot boot.img
Bootloader :
The bootloader is code that is executed before any Operating System starts to run. Bootloaders basically package the instructions to boot operating system kernel and most of them also have their own debugging or modification environment. Think of the bootloader as a security checkpoint for all those partitions. Because if you’re able to swap out what’s on those partitions, you’re able to break things if you don’t know what you’re doing. So basically it commands the kernel of your device to Boot the Device properly without any issues.
Flash a kernel :
adb reboot bootloader
fastboot flash boot boot.img
Recovery :
Recovery is defined in simple terms as a source of backup. Whenever your phone firmware is corrupted, the recovery does the job in helping you to restore or repair your faulty or buggy firmware into working condition. It is also used for flashing the Rom’s , kernel and many more things.
Flash a recovery :
adb reboot bootloader
fastboot flash boot recovery.img
Radio
The lowest part of software layer is the radio: this is the very first thing that runs, just before the bootloader. It control all wireless communication like GSM Antenna, GPS etc.
taken by @jackeagle
You should know this basic stuff :good:
Debugging
Developer dont breath oxygen they breath logs
When he says recovery.log
If in normal mode (in the Operating System)
Using the phone itself :
Open a file manager app or textviwer
Navigate to /sdcard
Open the recovery.log
copy its content
paste it to paste.omnirom.og
Give him the link
If in the recovery itself :
Open up cmd or Terminal
Navigate to where adb is installed (Only windows )
Type
Code:
adb pull /tmp/recovery.log
The file would be at your folder where u navigated earlier or if on linux it would in the /home/{user}/recovery.log (if you didnt cd)
open it using a text viwer
Copy and Paste on paste.omnirom.org
Give him the link
[/INDENT
When he says last_kmsg
Open cmd
Type
Code:
adb pull /proc/last_kmsg
The file would be at your folder where u navigated earlier or if on linux it would in the /home/{user}/last_kmsg
(if you didnt cd)
open it using a text viwer
Copy and Paste on paste.omnirom.org
Give him the link
Talking skills
Dont ever give your thoughts !
Yes thats true the dev doesnt needs to know what he needs to do or not
But always report even a small change
My tester @mrbtree98 always tells me whether when booting the light is dimming or not he is getting the connect sound or not tell everything
Always talk with respect !
Patience
A rom build takes around 2 hours [highly approx , diff for everyone]
A boot.img takes me 20 mins [highly approx , diff for everyone]
So always be Patience
Even when you submit a log wait
A kmsg is around 5000 lines he / she needs to carefully see it to reach a conclusion so be patient
WIP
Flash a recovery :
adb reboot bootloader
fastboot flash boot recovery.img
Click to expand...
Click to collapse
Shouldn't there be "fastboot flash recovery recovery.img"?

Dualboot Android/Linux for Yoga Tab 2 830F

ALARM: the device could be bricked if something will go wrong.
Actually should work for 10' and 13' as well
Introduction
The Yoga Tab 2 devices are built on the Intel Baytrail SOC, which makes them not very different from cheap Intel Atom laptops and idea to make them run something more serious than Android is too tempting to resist. Even more interesting, the Windows version of the devices do exist, so running of the full desktop OS is definitely possible.
Beginning
The easiest method to boot Linux on the Yoga is to unlock bootloader and replace standard EFI loader with GRUB. To do it, use the set of files, available here.. Unzip the file, put the tablet into fastboot mode, connect to PC and use script hack.cmd to flash the ESP with GRUB. Now, the system will be booting the GRUB, which will normally boot Android (if no buttons is pressed). The volume buttons are configured as hotkeys in grub.cfg, so it is possible to load arbitrary system, supported by GRUB.
To modify the grub.cfg from Android, mount the ESP partition:
Code:
su
mkdir /esp
busybox mount /dev/block/by-name/ESP /esp
vi /esp/boot/grub.cfg
Kernel
The device is able to boot mainline Linux kernel in the described way, but due to erroneous ACPI tables majority of hardware won't work. I did my best to repair the tables to make system usable. Still, not everything is working, mainly screen brightness control and sound. The kernel development info is available at https://github.com/Trel725/yoga2linux
System
I've chosen Manjaro Linux as a distro to work with because of my own taste. It shouldn't be a problem to run any other distro with modified kernel, but I provide rootfs only for Manjaro.
How to get it working
1. Flash the modified ESP as desribed above.
2. Download the archive, create folder /factory/manjaro (folder /factory should be already present in the tablet) and unzip archive to that folder. It is necessary because GRUB can't access the external SD, so kernel need to be loaded from internal memory and then find SD card. /factory is just a partition, used for storing tablet configuration, and as it is usually empty for 90-99 % it is convenient to use it to store the kernel and initramfs.
3. Find a good SD card, format it to the ext3 or ext4 FS and unzip RootFS to the SD card. Insert card to the tablet.
4. Reboot and press Volume+ to boot Linux.
Some ideas
1. After tablet has booted Linux and USB is initialized, it keep it's state on reboot. This means that following trick is possible:
boot linux -> reboot -> get to GRUB (by pressing Volume-) -> USB keyboard should work as it was initialized -> go to the GRUB command line (press c) -> type exit, press enter -> should get to BIOS with working keyboard -> if USB flash disk was inserted before entering the BIOS (usb hub is needed as device has only one port) it is possible to boot from it.
2. TODO
Hello, do you have any Linux tutorials installed here?
Wordowg's post failed
Thanks for this, @Trel725.
No problem with 5.2 kernel? isn't it too new for such an old device?
Also -- maybe some stuff from here is relevant? e.g., WM5102.
NaEpoch said:
Hello, do you have any Linux tutorials installed here?
Wordowg's post failed
Click to expand...
Click to collapse
Which tutorials do you mean? Linux usage in general?
raenye said:
Thanks for this, @Trel725.
No problem with 5.2 kernel? isn't it too new for such an old device?
Click to expand...
Click to collapse
Linux is very good in backward compatibility, even support for 80386 (released in 1985) was discontinued only in kernel 3.8. Moreover, I am particularly interested in mainline kernel without need to support ancient code (like for majority of android devices).
raenye said:
Also -- maybe some stuff from here is relevant? e.g., WM5102.
Click to expand...
Click to collapse
Thank you for the suggestion. I didn't try the patch for WM5102 from github, hopefully it will work for mainline kernel. I will try to find some time for it in the future.
sorry,my bad
i mean install linux for yoga tablet2 ' tutorials.
The tutorials in the forums all failed.
If you are free, can you teach me how to install it?
Thanks very much.
Unfortunately I don't have time for complete guidance, but if you have any questions I will readily answer them. The more details you provide the easier to help you.
alright, Thank you all the same.
But if you have time, please help.
My E-mail is [email protected]
Just a simple tutorial.
thank you
I can get Manjaro to boot but it can't load LightDM. I'm on 1050L.
I cant get this to work... All i get is a shell command line. no dual boot. Doesnt default into Android if nothing is imputed.
I tried connecting a keyboard. And cant type anything in.
I feel some steps have been skipped.
Tried this and now can't do anything but sit in empty shell. Can't type, volume buttons do nothing

Categories

Resources