Ubuntu, Arch Linux, Tails on Acer Chromebook C720P & Asus CS10 Chromebook stick - Chromebooks

placeholder
I will try & summarise all my works to install Linux distros on USB's or using crouton on Chromebooks...
Make sure you are in developer mode...
1. crouton
Download crouton in ~/Downloads
Useful command in Chrome/Chromium OS to install crouton Linux distro ubuntu xenial with xfce & xiwi in Acer Chromebook C720P
in a ctrl-alt-t shell -
shell
sudo sh ~/Downloads/crouton -r xenial -t xfce,xiwi,touch,extension
After running the command, one should get the following message (generally)
Here's some tips:
Audio from the chroot will now be forwarded to CRAS (Chromium OS audio server),
through an ALSA plugin.
Future Chromium OS upgrades may break compatibility with the installed version
of CRAS. Should this happen, simply update your chroot.
You already have the Chromium OS extension installed, so you're good to go!
You can open your running chroot desktops by clicking on the extension icon.
Once in a crouton window, press fullscreen or the "switch window" key to switch
back to Chromium OS.
You can launch individual apps in crouton windows by using the "xiwi" command
in the chroot shell. Use startxiwi to launch directly from the host shell.
Use the startxiwi parameter -b to run in the background.
Example: sudo startxiwi -b xterm
You can start Xfce via the startxfce4 host command: sudo startxfce4
Unmounting /mnt/stateful_partition/crouton/chroots/xenial...
Sending SIGTERM to processes under /mnt/stateful_partition/crouton/chroots/xenial...
Done! You can enter the chroot using enter-chroot.
( to use xiwi, you need to install the crouton extension from the Google Web Store).
Not re-inventing the wheel, head on for further info to:
Complete Crouton Installation Guide (Linux on any Chromebook):
https://www.codedonut.com/chromebook/install-crouton-chromebook/
& the dev's crouton's github:
https://github.com/dnschneid/crouton
In case the crouton chroot is already installed without xiwi,
To update an installation with xiwi, apply:
sudo sh ~/Downloads/crouton -n xenial -t xfce,xiwi,touch,extension -u
Notes:
cons -
with crouton one is stuck with the Chrome OS host Linux Kernel , which for Acer CB C720P is Kernel v3.8
it is a chroot environment, so new Ubunture features such as snap packaging cannot be used.
pros -
xiwi allows running Linux apps in separate windows
share of the clipboard & ~/Downloads folder between host & guest
one does not leave the Chrome OS environment
it is like the new crostini feature they are pushing on Kernel 3.18 & above
I think crostini is crouton in Italian

Chromebrew
All I have to say about skycocker's chromebrew -
For a full arsenal of Linux commands at your fingertips in a crosh shell, install Chromebrew package manager on Chromebook or Chrome OS -
requisites: developer mode enabled.
https://github.com/skycocker/chromebrew …
curl -Ls http://git.io/vddgY | bash
crew <command> [-k|--keep] <package1> ...]
Note -
sad but true, I installed chromebrew to get access to the nano text editor - as I have never made the effort to master vi/vim despite using Linux since 1995...

Tails Linux distro with Tor privacy
Tails is an operating system based on Linux & the Tor anonymity project.
It's easy to install on a USB, & very portable as it can boot off MBR & EFI partitions.
It's only available for x86 & x86_64 computers, though they are looking into porting it to Arm.
I got it on a USB following instructions in the developers website: https://tails.boum.org/

Tor browser on any computer, Linux, Mac, Windows, Android.
1. relevant to Chromebooks or hacked with Android & Play Store - Orbot / Orfox:
Tor anonymising solution is now available on Play Store - the Tor proxy is called Orbot & a web browser was compiled to run with it based on mozilla firefox called Orfox.
The set Orbot / Orfox are available to download for free from the Play Store -
I won't describe any of it -
Initially before it was on Play Store, it could be downloaded from the devs group who ported it to Android it: https://guardianproject.info/apps/orbot/
It was also made available through an open source Android Store: F-Droid - https://guardianproject.info/fdroid/
F-Droid is a great source for free open source alternative Android software - it works seamlessly through the Android platform or within proprietary Android based like Amazon Fire.
2. For other x86 platforms like Windows, Linux, Mac...
all is in here: https://www.torproject.org/

F-Droid - a great open source software repository for Android applications
Great way to complement Amazon Appstore, or Android Play Store is F-Droid -
a software repository for Android applications, similar to Google Play store.
The main repository, hosted by the project, contains only apps that are free and open-source software.
https://f-droid.org/en/
https://twitter.com/inabster/status/956226183477317633
F-Droid have a repository for a Tor powered solution on Android platform worthy to those concerned about privacy Orbot is the open source app, & Orfox is the associated Tor Mozilla based (Firefox fork) browser - https://guardianproject.info/apps/orbot/ https://guardianproject.info/apps/orfox/
https://twitter.com/inabster/status/956229034169520130

Ubuntu on Chromebook from USB.
Seabios emulates an mbr boot, so allows booting to mbr using Ctrl-L
Ubuntu then installs as normal to mbr using a Ubuntu livecd.
It might be possible to install Ubuntu so it boots using Ctrl-U. I did not look into it.

Arch Linux on Chromebook & Asus Chromebit CS10
Arch Linux on Asus Chromebit CS10 -
Full instructions here:
https://archlinuxarm.org/platforms/armv7/rockchip/asus-chromebit-cs10
Mainline Kernel
The installation above will use the ChromeOS 3.14 kernel. The mainline kernel can be used instead, though some hardware may not be working yet. Two options are available to switch to the mainline kernel:
Replace kernel packages after installation
Install linux-armv7 packages, replacing the linux-veyron package, and the firmware-veyron package:
pacman -S linux-armv7 linux-armv7-chromebook firmware-veyron
Type y and hit enter when prompted to flash the kernel to the kernel partition.
Remove the veyron-libgl and xf86-video-armsoc-rockchip packages. Mali is not supported in mainline.
pacman -R veyron-libgl xf86-video-armsoc-rockchip
Reboot.
Perform a new installation with the above steps using the armv7-chromebook tarball:
http://os.archlinuxarm.org/os/ArchLinuxARM-armv7-chromebook-latest.tar.gz
Install the firmware-veyron package, or copy it to the drive for later installation for wifi support.
pacman -S firmware-veyron
Arch Linux on Chromebook -
Easiest instructions to install Arch Linux on a USB of Chromebook in BIOS legacy mode here:
https://gist.github.com/alphazo/3285090
https://twitter.com/inabster/status/692098848391610372

General consideration on Linux installs with uefi - notes to self
These are notes to myself to link up to - I have posted them on @twitter - but nice to have them ready for copy & paste.
Not related to Chromebooks generally, unless one uses Ctrl-U which is an uefi boot... I did not dabble in it...
Two important config files to get a successful Arch Linux or Ubuntu boot are:
grub.cfg
fstab
fstab is in /etc/
/etc/fstab
& tells the OS where relevant partitions are
... TBC

Linux Kernel related building commands for reference...
Build Ubuntu Kernel
sudo apt-get install git fakeroot build-essential ncurses-dev xz-utils libssl-dev bc
clone git kernel for source in home user folder ~/kernel
cd kernel
cp /boot/config-$(uname -r) .config
make menuconfig
sudo make -j 4 && sudo make modules_install -j 4 && sudo make install -j 4
sudo update-initramfs -c -k 4.xx.xx
sudo update-grub .../...
also
build kernel headers from source with: (at root of kernel directory) -
sudo make headers_install INSTALL_HDR_PATH=/usr/include

Arch Linux 4.19-LTS & 5.0.8 nasty bug
Testing Arch Linux on Chromebook
Arch Linux 4.19-LTS & 5.0.8 nasty bug
but for those using Arch Linux, avoid kernel 4.19-LTS & 5.0.8 like the plague,
both damage Arch Linux by disabling usb input devices, trackpad, mouse, keybooard, touch...
I had to put my rant somewhere, it damaged a 3 year Arch Linux USB stick for me
Since I am here, might as well post for reference my experience with getting a new USB loaded with Arch Linux
not doing it from scratch, too much effort...
found this - quite good too, Live USB persistent -
Arch Linux USB OS https://sourceforge.net/projects/arch-linux-usb-os/ …
It saves the trouble of building Arch Linux OS from scratch.
Uses Kernel 5.0.5 -
Linux robot 5.0.5-arch1-1-ARCH #1 SMP PREEMPT Wed Mar 27 17:53:10 UTC 2019 x86_64 GNU/Linux
if allowed to upgrade to 5.0.8 will bork the input, so only upgrade to 5.0.7 maximum (linux-rt), which I built through aur.
upgrading through aur to linux-rt 5.0.7
$ uname -a
Linux robot 5.0.7-rt5-1-rt #1 SMP PREEMPT RT Mon Apr 22 14:42:29 CEST 2019 x86_64 GNU/Linux
to get to boot with this kernel needs to replace linux with linux-rt in loader settings.
to stop kernel from upgrading -
ArchLinux is updated to the newest version with the command:
pacman -Syu
To stop it from updating the kernel (until they get their **** together) add
IgnorePkg = linux linux-headers
into /etc/pacman.conf
stuff / thingies
[email protected] ~ $ cd /run/archiso/bootmnt
[email protected] bootmnt $ ls
arch EFI loader
[email protected] bootmnt $ ls arch/boot
amd-ucode.img grub intel-ucode.img intel_ucode.LICENSE x86_64
[email protected] bootmnt $ ls arch/boot/x86_64/
initramfs-linux.img initramfs-linux-rt.img vmlinuz-linux vmlinuz-linux-rt
notes -
original shipped linux version is 5.0.5
upgraded linux version though aur is linux-rt 5.0.7
so needed to copy vmlinuz-linux-rt & initramfs-linux-rt.img to /run/archiso/bootmnt/arch/boot/x86_64/
cannot be done from a running instance, so had to boot from another live usb to copy it over from
[email protected] bootmnt $ ls /boot
amd-ucode.img initramfs-linux-rt-fallback.img syslinux
grub initramfs-linux-rt.img vmlinuz-linux
initramfs-linux.img intel-ucode.img vmlinuz-linux-rt
to automate replace loading linux with linux-rt, modify
/run/archiso/bootmnt/loader/entries/
[email protected] entries $ ls
Archlinux.conf Archlinux-terminal.conf uefi-shell-v2-x86_64.conf
Archlinux-copytoram.conf uefi-shell-v1-x86_64.conf
example
Archlinux.conf original
title Arch Linux UEFI
linux /arch/boot/x86_64/vmlinuz-linux
initrd /arch/boot/intel-ucode.img
initrd /arch/boot/amd-ucode.img
initrd /arch/boot/x86_64/initramfs-linux.img
options archisobasedir=arch archisolabel=USB-BOOT cow_label=usb-save loglevel=3
change to:
title Arch Linux UEFI
linux /arch/boot/x86_64/vmlinuz-linux-rt
initrd /arch/boot/intel-ucode.img
initrd /arch/boot/amd-ucode.img
initrd /arch/boot/x86_64/initramfs-linux-rt.img
options archisobasedir=arch archisolabel=USB-BOOT cow_label=usb-save loglevel=3
to be able to modify bootloader files
do above from a separate linux usb (mine is Ubuntu 18.04)
$ mkdir efi
$ sudo mount /dev/sdb1 efi
$ cd efi
$ ls
arch EFI loader
... etc as above.
News - Arch Linux released Kernel 5.0.9 - still has the nasty bug - do not upgrade, if you did, downgrade by installing the downgrade script from aur...
How to downgrade a Linux kernel...
https://arcolinux.com/how-to-downgrade-a-linux-kernel/
Borking my 3 year arch linux USB was a blessing in disguise, made me look for a persistent USB alternative...
the one described above boots Acer Chromebook C720P well, it works great, with kernels 5.0.5 & 5.0.7 -
I tested it on the modded full ROM MrChromebox firmware, but believe it will work as well in Seabios legacy mode.
notes to myself

Linux pot-pourri commands from my notes, for reference
these are copy & paste commands which I need put into one place, here...
I will rearrange them later with context where to be used...
placeholder...
Chromebook: Updating xenial to bionic w/ crouton:
$ sudo enter-chroot -n xenial
(xenial)[email protected]:~$ sudo apt-get install update-manager-core python-apt
(xenial)[email protected]:~$ sudo do-release-upgrade
$ sudo sh ~/Downloads/crouton -n xenial -u
$ sudo edit-chroot xenial -m bionic
Creating a dev environment in all Chrome OS x86 or arm:
shell
sudo dev_install
Creating a Visual Studio environment in arm:
shell
sudo su -
. <( curl -s https://code.headmelted.com/installers/chromebook.sh … )
Creating a Ubuntu chroot & X-Windows environment:
sudo sh ~/Downloads/crouton -t xfce -r xenial
If using rEFInd as bootloader, a useful command to get entries at boot in the UEFI menu is:
$ sudo efibootmgr -c -g -d /dev/sda -p 1 -w -L "rEFInd" -l '\EFI\refind\refind_x64.efi'
replace /dev/sda by /dev/sdx x=b,c... in other cases.
To check install is correct, issue:
$ [ -d /sys/firmware/efi ] && echo "EFI boot on HDD" || echo "Legacy boot on HDD]
Sometimes needed
1.:
$ sudo apt-get install --reinstall efibootmgr
$ sudo grub-install /dev/sda
$ sudo apt-get install --reinstall grub-efi
$ sudo grub-install /boot/efi
$ sudo grub-install --target=i386-efi /dev/sda1 --efi-directory=/boot/efi/ --boot-directory=/boot
2.:
$ sudo grub-mkconfig -o /boot/grub/grub.cfg
then again:
$ sudo apt-get -y install --reinstall grub-efi-ia32 grub-efi-ia32-bin
@ubuntu 18.04.1 works with efi on @bbenTech Intel Compute Stick (ICS) cherrytrail clone & with mbr (seabios legacy) on @Acer Chromebook C720P.
Managed to get it to boot w/ efi 32bit bootlader - but I had to get into GUI 1st & bypass the initramfs emergency mode - what was needed was correct UUID of EFI partition in /etc/fstab - then boot through grub manually...
UUID=XXXX-XXXX /boot/efi vfat umask=0077 0 1
When in grub, issue
set root=(hd0,gpt2)
configfile (hd0,gpt1)/efi/ubuntu/grub.cfg
(grub.cfg must have the UUID of (hd0,gpt2) in my case of /dev/sdb2
use
sudo blkid /dev/sdX to find UUID's)
that boots into Ubuntu 18.04
open terminal...
When in the GUI
in terminal issue:
sudo apt-get update
sudo apt-get -y install --reinstall grub-efi-ia32 grub-efi-ia32-bin
reboot
Notes:
Arch Linux
$ sudo grub-install --target=i386-efi /dev/sda2 --efi-directory=/boot/efi/ --boot-directory=/boot
$ sudo efibootmgr -c -g -d /dev/sda -p 2 -w -L "Arch" -l '\EFI\EFI\arch\grubia32.efi'
then:
$ sudo grub-mkconfig -o /boot/EFI/EFI/arch/grub.cfg
$ sudo mkinitcpio -p linux
from http://www.rodsbooks.com/efi-bootloaders/installation.html#alternative-naming
Arch Linux mainline kernel
$ sudo mount -o remount,size=6G,noatime /tmp
$ yaourt linux-mainline

more crouton / crostini stuff
Latest crostini kernel is 4.19.16 -
for lolz I installed mplayer, mpv & gnome-mpv (all Linux video players)
they do load videos from crostini, but with no sound (this is using cyan & eve v73) -
of course video works great in crouton Linux distros... or in Android with VLC etc...
RFC - Any idea how to get sound working through crostini?
of course this is not needed as within Android or crouton with say Ubuntu bionic, sound is perfectly fine
just fooling around crostini
from - https://forum.xda-developers.com/showpost.php?p=79527257&postcount=215
crouton bionic sound issues -
add following to /etc/pulse/daemon.conf -
default-sample-rate = 48000
default-fragments = 5
default-fragment-size-msec = 2
Access audio hardware directly (ALSA, JACK)
add yourself to the hwaudio group.
sudo usermod -a -G hwaudio "$USER"
Log out and log back in.
Test:
$ groups
slee2 hwaudio video sudo plugdev audio input
Stop CRAS
Make sure you've stopped CRAS, or else it will hold on to your audio device. In either ChromeOS or your chroot, run
$ sudo initctl stop cras
You might also need this to control audio -
$ alsamixer -c 0
from - https://github.com/dnschneid/crouton/wiki/Access-audio-hardware-directly-(ALSA,-JACK)
& https://github.com/dnschneid/crouton/wiki/Audio

Reinstall GRUB to the EFI partition using chroot
Notes to self-
sudo mount /dev/sdXXX /mnt
sudo mount /dev/sdXX /mnt/boot/efi
for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done
sudo chroot /mnt
grub-install /dev/sdX
update-grub
Note : sdX = disk | sdXX = efi partition | sdXXX = system partition
To identify the partitions use GParted, the tool is included in the installation medium.
After having run the commands GRUB will be installed in the separate EFI partition.

Deploying, bootloading OSes such as Ubuntu manually
I like to initially install an OS to a 16/32 GB USB 3.0 stick, then dd it to a bigger SSD of I am happy with it, follows some notes on how it is done...
In previous post, I described how to fix an efi booting, but there is a caveat, one needs to know where & how to modify settings of efi bootlader, & /etc/fstab that tells the OS where to find partitions to load itself (bootstrap)...
These are some successful partition settings I had to deal with -
1. efi/mbr mix
$ sudo fdisk -l
Disk /dev/sdb: 465.8 GiB, 500107861504 bytes, 976773167 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 33553920 bytes
Disklabel type: gpt
Disk identifier: ***
Device Start End Sectors Size Type
/dev/sdb1 2048 411647 409600 200M EFI System
/dev/sdb2 411648 210208767 209797120 100G Microsoft basic data
/dev/sdb3 210415616 337403903 126988288 60.6G Linux filesystem
/dev/sdb4 337403904 430872575 93468672 44.6G Linux filesystem
/dev/sdb5 430872576 435066879 4194304 2G Linux swap
/dev/sdb6 435066880 624490495 189423616 90.3G Microsoft basic data
/dev/sdb7 624490496 976766975 352276480 168G Microsoft basic data
/dev/sdb8 210208768 210415615 206848 101M BIOS boot
Partition table entries are not in disk order.
/dev/sdb8 is BIOS boot invoked by bios_grub flag in gparted manage flags partition editor
/dev/sdb1 is efi partition flagged as boot, esp & legacy_boot in gparted manage flags partition editor
$ sudo fdisk -l
Disk /dev/sdc: 931.5 GiB, 1000204885504 bytes, 1953525167 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: xxx
Device Start End Sectors Size Type
/dev/sdc1 2048 206847 204800 100M BIOS boot
/dev/sdc2 206848 135235583 135028736 64.4G Linux filesystem
/dev/sdc3 135235584 286480383 151244800 72.1G Linux filesystem
/dev/sdc4 286480384 599062527 312582144 149.1G Microsoft basic data
/dev/sdc5 599062528 599984127 921600 450M Windows recovery environment
/dev/sdc6 599984128 1007575039 407590912 194.4G Microsoft basic data
/dev/sdc7 1007575040 1949327359 941752320 449.1G Microsoft basic data
/dev/sdc8 1949329408 1953103871 3774464 1.8G Linux swap
/dev/sdc9 1953105920 1953519615 413696 202M EFI System
/dev/sdc1 is BIOS boot invoked by bios_grub flag in gparted manage flags partition editor
/dev/sdc9 is efi partition flagged as boot, esp & legacy_boot in gparted manage flags partition editor
2. pure mbr / no BIOS boot - using Windows boot loader & easyBCD 3.2 to load Linux/Ubuntu
$ sudo fdisk -l
Disk /dev/sdc: 931.5 GiB, 1000204885504 bytes, 1953525167 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 33553920 bytes
Disklabel type: dos
Disk identifier: 0x767e7d2d
Device Boot Start End Sectors Size Id Type
/dev/sdc1 * 2048 472768511 472766464 225.4G 7 HPFS/NTFS/exFAT
/dev/sdc2 472768512 1422079999 949311488 452.7G 7 HPFS/NTFS/exFAT
/dev/sdc3 1422080221 1479591932 57511712 27.4G 83 Linux
/dev/sdc4 1479591933 1953523711 473931779 226G f W95 Ext'd (LBA)
/dev/sdc5 1479591936 1949331455 469739520 224G 83 Linux
/dev/sdc6 1949333504 1953523711 4190208 2G 82 Linux swap / Solaris
3. pure mbr (just Ubuntu, nothing else)
$ sudo fdisk -l
Disk /dev/sdc: 14.6 GiB, 15693664256 bytes, 30651688 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 2BB06DCE-2D30-4778-94BD-2FD214CD3C3B
Device Start End Sectors Size Type
/dev/sdc1 2048 206847 204800 100M BIOS boot
/dev/sdc2 206848 28555263 28348416 13.5G Linux filesystem
/dev/sdc3 28555264 30650367 2095104 1023M Linux swap
In 3. this is what to expect when you install Ubuntu to mbr, it will ask you to also create a BIOS boot partition of at least 1 MB - I chose here 100 MB to safeguard for future change, it's kind of a blob with core image for booting...
4. pure efi (just Ubuntu & EFI partition, nothing else)
$ sudo fdisk -l
Disk /dev/sdc: 29.3 GiB, 31406948352 bytes, 61341696 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 0B9FB340-99D5-03A3-D0EC-E74275E6E800
Device Start End Sectors Size Type
/dev/sdc1 2048 411647 409600 200M EFI System
/dev/sdc2 411648 58195967 57784320 27.6G Linux filesystem
/dev/sdc3 58195968 61335551 3139584 1.5G Microsoft basic data
in 4. I prep a disk with the three partitions EFI, ROOT & SWAP Assign the flags for the EFI partition as as boot, esp & legacy_boot in gparted, then use an install dvd/usb disk to install by assigning the correct partitions...
3 & 4 I use to deploy, if it's just them, I just dd to a bigger disk,
if not, I use the ROOT to dd to a partition in a target partition in a bigger disk that is already populated with say Windows or OS X, or any other,
care has then to be taken not to disturb the initial order,
so ROOT for Ubuntu should be put at the end of the original installations, etc.
In the next post I will take an example & walk through it...

efi/mbr partitions in pictures
1. efi/mbr mix
https://forum.xda-developers.com/attachment.php?attachmentid=4779410&stc=1&d=1560960108
https://forum.xda-developers.com/attachment.php?attachmentid=4779411&stc=1&d=1560960108
2. pure mbr / no BIOS boot - using Windows boot loader & easyBCD 3.2 to load Linux/Ubuntu
https://forum.xda-developers.com/attachment.php?attachmentid=4779413&stc=1&d=1560960108
3. pure mbr (just Ubuntu, nothing else)
https://forum.xda-developers.com/attachment.php?attachmentid=4779412&stc=1&d=1560960108
4. pure efi (just Ubuntu & EFI partition, nothing else)
https://forum.xda-developers.com/attachment.php?attachmentid=4779414&stc=1&d=1560960108
pictures in @twitter feeds -
https://twitter.com/inabster/status/1141482400112926723
https://twitter.com/inabster/status/1141482980151615488
RFC - how do we get the pictures to appear in the posts?

Bootloading examples
Method in post #13 required to have both the efi & bios boot partitions present
https://forum.xda-developers.com/showpost.php?p=79742668&postcount=13
This is a set piece for
Device Start End Sectors Size Type
/dev/sdb1 2048 411647 409600 200M EFI System
/dev/sdb2 411648 210208767 209797120 100G Microsoft basic data
/dev/sdb3 210415616 337403903 126988288 60.6G Linux filesystem
/dev/sdb4 337403904 430872575 93468672 44.6G Linux filesystem
/dev/sdb5 430872576 435066879 4194304 2G Linux swap
/dev/sdb6 435066880 624490495 189423616 90.3G Microsoft basic data
/dev/sdb7 624490496 976766975 352276480 168G Microsoft basic data
/dev/sdb8 210208768 210415615 206848 101M BIOS boot
sudo mount /dev/sdb3 /mnt
sudo mount /dev/sdb1 /mnt/boot/efi
for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done
sudo chroot /mnt
grub-install /dev/sdb
update-grub
2nd example -
Device Start End Sectors Size Type
/dev/sdc1 2048 206847 204800 100M BIOS boot
/dev/sdc2 206848 135235583 135028736 64.4G Linux filesystem
/dev/sdc3 135235584 286480383 151244800 72.1G Linux filesystem
/dev/sdc4 286480384 599062527 312582144 149.1G Microsoft basic data
/dev/sdc5 599062528 599984127 921600 450M Windows recovery environment
/dev/sdc6 599984128 1007575039 407590912 194.4G Microsoft basic data
/dev/sdc7 1007575040 1949327359 941752320 449.1G Microsoft basic data
/dev/sdc8 1949329408 1953103871 3774464 1.8G Linux swap
/dev/sdc9 1953105920 1953519615 413696 202M EFI System
sudo mount /dev/sdc3 /mnt
sudo mount /dev/sdc9 /mnt/boot/efi
for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done
sudo chroot /mnt
grub-install /dev/sdc
update-grub
out of chroot, these commands are also useful:
sudo efibootmgr -c -g -d /dev/sdc -p 9 -w -L "ubuntu" -l '\EFI\refind\refind_x64.efi' #efi partition /dev/sdc9
sudo grub-install /boot/efi # this after having mounted in /etc/fstab /dev/sdc9 in /boot/efi
sudo efibootmgr -c -g -d /dev/sdb -p 1 -w -L "ubuntu" -l '\EFI\refind\refind_x64.efi' #efi partition /dev/sdb1
sudo grub-install --target=x86_64-efi /dev/sdb3 --efi-directory=/boot/efi/ --boot-directory=/boot
sudo grub-install --target=x86_64-efi /dev/sdc3 --efi-directory=/boot/efi/ --boot-directory=/boot
sudo grub-mkconfig -o /boot/grub/grub.cfg
sudo update-grub
To check install is correct, issue:
$ [ -d /sys/firmware/efi ] && echo "EFI boot on HDD" || echo "Legacy boot on HDD]
Two important config files to get a successful Arch Linux or Ubuntu boot are:
grub.cfg
fstab
fstab is in /etc/
/etc/fstab
grub.cfg can be found in /boot/grub & mounted efi partition /boot/efi in /boot/efi/EFI/ubuntu
grub.cfg can be used in a grub command line as follows:
set root=(hd0,gpt2)
configfile (hd0,gpt1)/efi/ubuntu/grub.cfg
(grub.cfg must have the UUID of (hd0,gpt2) in my case of /dev/sdb2
use
sudo blkid /dev/sdX to find UUID's)
or
configfile (hd0,gpt2)/boot/grub/grub.cfg

grub.cfg, fstab examples...
First
Disk /dev/sdb: 931.5 GiB, 1000204885504 bytes, 1953525167 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 807AFD80-12D5-03A5-60BF-1E60B544E900
Device Start End Sectors Size Type
/dev/sdb1 2048 206847 204800 100M BIOS boot
/dev/sdb2 206848 135235583 135028736 64.4G Linux filesystem
/dev/sdb3 135235584 286480383 151244800 72.1G Linux filesystem
/dev/sdb4 286480384 599062527 312582144 149.1G Microsoft basic data
/dev/sdb5 599062528 599984127 921600 450M Windows recovery environment
/dev/sdb6 599984128 1007575039 407590912 194.4G Microsoft basic data
/dev/sdb7 1007575040 1949327359 941752320 449.1G Microsoft basic data
/dev/sdb8 1949329408 1953103871 3774464 1.8G Linux swap
/dev/sdb9 1953105920 1953519615 413696 202M EFI System
$ sudo blkid /dev/sdb9
/dev/sdb9: LABEL="UEFI" UUID="B07A-6430" TYPE="vfat" PARTLABEL="Basic data partition" PARTUUID="f7ffc8f0-896a-01d2-78e0-eb63b544e900"
$ sudo blkid /dev/sdb3
/dev/sdb3: LABEL="UBUNTU16" UUID="8082d3f4-ec43-4310-af55-934b67078f05" TYPE="ext4" PARTLABEL="Basic data partition" PARTUUID="c0428fd0-896a-01d2-e843-2160b544e900"
$ sudo blkid /dev/sdb8
/dev/sdb8: TYPE="swap" PARTLABEL="Basic data partition" PARTUUID="0000e5a5-f7e0-c5fd-6ae9-f2754acb0100"
$ nano /etc/fstab
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sdc3 during installation
UUID=6e69ee53-1a57-4cb5-b46f-f0f079fdf666 / ext4
# /boot/efi was on /dev/sda2 during installation
UUID=B07A-6430 /boot/efi vfat defaults 0 1
# swap was on /dev/sdc1 during installation
UUID=0000e5a5-f7e0-c5fd-6ae9-f2754acb0100 none swap sw $
$ nano /boot/efi/EFI/ubuntu/grub.cfg
search.fs_uuid 3fcb8592-bcc3-cf01-3048-8592bcc3cf01 root hd1,gpt3
set prefix=($root)'/boot/grub'
configfile $prefix/grub.cfg
Second
Disk /dev/sda: 465.8 GiB, 500107861504 bytes, 976773167 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 33553920 bytes
Disklabel type: gpt
Disk identifier: 4CACF8A0-B3A8-039F-283E-2B13EAECE700
Device Start End Sectors Size Type
/dev/sda1 2048 411647 409600 200M EFI System
/dev/sda2 411648 210208767 209797120 100G Microsoft basic data
/dev/sda3 210415616 337403903 126988288 60.6G Linux filesystem
/dev/sda4 337403904 430872575 93468672 44.6G Linux filesystem
/dev/sda5 430872576 435066879 4194304 2G Linux swap
/dev/sda6 435066880 624490495 189423616 90.3G Microsoft basic data
/dev/sda7 624490496 976766975 352276480 168G Microsoft basic data
/dev/sda8 210208768 210415615 206848 101M BIOS boot
Partition table entries are not in disk order.
$ sudo blkid /dev/sda1
/dev/sda1: LABEL="EFI" UUID="4579-67B0" TYPE="vfat" PARTLABEL="Basic data partition" PARTUUID="42f7ecf0-d3b5-01d0-78f6-7ba1da69e800"
$ sudo blkid /dev/sda3
/dev/sda3: LABEL="UBUNTU18" UUID="6e69ee53-1a57-4cb5-b46f-f0f079fdf666" TYPE="ext4" PARTUUID="99b3c3d8-2c44-488b-a130-fefb68abbe5d"
$ sudo blkid /dev/sda5
/dev/sda5: UUID="93471658-7099-45fc-ac61-75e09b4bf08f" TYPE="swap" PARTUUID="fdb07319-debf-4394-9e71-27b3bca2a9ac"
$ nano /etc/fstab
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sdc3 during installation
UUID=6e69ee53-1a57-4cb5-b46f-f0f079fdf666 / ext4
# /boot/efi was on /dev/sda2 during installation
UUID=4579-67B0 /boot/efi vfat defaults 0 1
# swap was on /dev/sdc1 during installation
UUID=93471658-7099-45fc-ac61-75e09b4bf08f none swap sw
$ nano /boot/efi/EFI/ubuntu/grub.cfg
search.fs_uuid 6e69ee53-1a57-4cb5-b46f-f0f079fdf666 root hd1,gpt3
set prefix=($root)'/boot/grub'
configfile $prefix/grub.cfg
Looking at the above examples, you can tease out where identifiers need be, usually the commands listed on previous posts would look after that, but sometimes they do not, so you need to amend / correct grub.cfg & fstab manually...
I hope this helps

Fixing Windows 10 EFI boot
In multi boot situations installing Ubuntu, one sometimes loses UEFI settings booting Windows 10 - here are some ways to repair / recover...
Resource needed - relevant boot install usb/dvd for Windows 10.
Use diskpart to repair uefi from troubleshooting repair command prompt.

Related

[HOWTO] Install GNU/Linux on the Huawei S7 && Development thread (Kernel & GB)

[HOWTO] Install GNU/Linux on the Huawei S7 && Development thread (Kernel & GB)
Installing GNU/Linux on the Huawei IDEOS S7
( Using Debian or Ubuntu )
THIS GUIDE IS A WORK IN PROGRESS!
USE AT OWN RISK!​
Requirements:
Gnu/Linux experience! THIS IS NOT INTENDED FOR THE FAINTHEARTED!
Debian or Ubuntu.
The Google Android SDK Or at least adb and Fastboot
Busybox and a terminal emulator for Android.
A rooted device. See http://forum.xda-developers.com/showthread.php?p=14321729#post14321729 For how to root the Huawei S7 Android (2.2.2)
UPDATE:
New Image available.
Compatible and tested on :
-Huawei S7
-Huawei X5 / U8800(not quite done yet),
-RK2818 based devices,
-Samsung Galaxy s2.
Add "setprop ctl.stop bootanim" to the chroot command in "startnix-s7/other/rk.sh" on targets newer then gingerbread.
The image is using the MSM/QSD X11 driver for video,
ext3-4 modules for chroot on Android 2.2.2 stock image
xinput calibrator for screen calibration
Recompiled udev making that compatible.
And also a new sane kernel. which can be fastbooted with this image where ext3-4 are included and compiled-in. This kernel is necessary for enabling acceleration on the MSM/QSD X11 driver, using DRM. Swap and alsa(hopefully) are also enabled, ++, currently for _testing_only_!
Read post #11 for information - Merry Christmas and a Happy new year to you all!!
Setting up an image.
dd if=/dev/zero of=arm-linux.img bs=1024 count=2097152 to create a 2gb image.
mkfs.ext2,3 or 4 arm-linux.img , see post 10 for ext3 and 4 modules. as well as jbd and jbd2 which need to be insmodded.
Setting up a partition.
Plug it into your pc running Debian or Ubuntu, have usb storage selected on the device.
Back up everything on the 8GB Fat32 partition. I did this with a simple tar -cf android-back.tar /media/8gigandroidmountpoint. Verify that .android_secure is properly packed, but i also strongly suggest using titanium backup to backup application data and settings first then backup with a .tar. That cant fail.
Create a mountpoint and locate the special device of the S7.
Once you are absolutely sure you backed your partition, proceed with partitioning. Also be warned that ext2 is very prone to dataloss if not properly unmounted before rebooting, And by default, the s7 only supports ext2. So be sure and remember to have unmount any ext2 partition properly when done in Gnu/Linux, run sync as root before exiting, And have e2fsck handy. i have had to edit /etc/mtab back in due to corruption a dozen times when i was using ext2!
Code:
cfdisk -z /dev/sdx
I recommend at least 2Gb's. You can always increase the size of the partition later using tools such as gparted , but be aware, gparted might wreak havoc on your fat32 partition!
Now, create the first partition. It is very important that you make the first partition a Fat32 partition or the pad might go mad and operating systems with Multiple $clerosis wont see the partition! Choose "Type" and enter "0B" (FAT32). Create the second partition using the remaining space.
Select "Write" then Exit.
Now, do mkfs.vfat /dev/sdx1 and mkfs.ext2,3 or 4 /dev/sdx2.
Installing.
Once this is done we make ourselves a temporary directory, lets say mkdir /media/deb and loop mount the image or the partition there.
Instruct debootstrap to get the base packages for squeeze (Debian 6.0),
Squeeze is based on kernel 2.6.32 and is therefore safest to base our installation on, as Android 2.2 is designed with 2.6.32 in mind. The s7 is a armv7 so we could also use armhf, the drawbacks are its not quite done yet, and there is currently no video driver for our device available from me or the debian repo tested for armhf.
Code:
apt-get install debootstrap
# Adjust .nl. for your closest Debian mirror. Saves time and energy.
debootstrap --verbose --arch armel --foreign squeeze /media/deb [URL]ftp://ftp.nl.debian.org/debian[/URL]
Now using adb from the Google Android SDK and a usb cable, enter a shell and do the following.
(NOTE: I'm using /sdcard2 , which is the mountpoint to any external sdcard as the mountpoint, the reason for this is lazyness, creating a new folder on the s7's filesystem requires you run psneuter, remount the fs, then create your directory, see my rooting thread for that, you must change this if you are using an sdcard)
Code:
adb kill-server
adb start-server
adb shell
su
# For loopback image
mknod /dev/block/loop255 b 7 255
busybox losetup arm-linux.img /dev/block/loop255
mount -o rw -t ext2,3 or 4 /dev/block/loop255 /sdcard2
# For partition
mount -o rw -t ext2,3 or 4 /dev/block/vold/179:2 /sdcard2
export bin=/sdcard2/bin
export PATH=$bin:/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:$PATH
export TERM=linux
export HOME=/root
cp -r /etc/firwmare/* /sdcard2/lib/firmware/
cp -r /etc/wifi/* /sdcard2/lib/firmware/
cp /sbin/adbd /sdcard2/sbin
cp -r /dev /sdcard2/
chroot /sdcard2 /debootstrap/debootstrap --second-stage
# Adjust .nl. for your closest Debian mirror.
echo 'deb [URL]ftp://ftp.nl.debian.org/debian[/URL] squeeze main' > /sdcard2/etc/apt/sources.list
Tell it what nameserver to use, probably your routers IP address.
In this case we'll just use Googles DNS that should work in any case.
Code:
echo 'nameserver 8.8.8.8' > /sdcard2/etc/resolv.conf
echo 'nameserver 8.8.4.4' >> /sdcard2/etc/resolv.conf
Lets drop by our new home and make it nice and comfy.
Code:
chroot /sdcard2 /bin/bash
Once in, we need to do a quick few mounts, a fast few mknodes and a little bit of linking to make things fully functional.
Code:
mount -t devpts devpts /dev/pts
mount -t proc proc /proc
mount -t sysfs sysfs /sys
ln -s /proc/self/fd/0 /dev/stdin
ln -s /proc/self/fd/2 /dev/stderr
ln -s /proc/self/fd/1 /dev/stdout
mknod /dev/block/loop255 b 7 255 # Shouldn't really be needed as we just copied /dev
ln -s /dev/ptmx /dev/pts/ptmx
#mknod /dev/pts/ptmx c 5 2
# ln -s /dev/input/event0 /dev/event0
ln -s /dev/graphics/fb1 /dev/fb1
ln -s /dev/graphics/fb0 /dev/fb0
Creating the /etc/mtab file
The /etc/mtab file should look something like this.
Code:
/dev/block/vold/179:2 / ext2 rw,noatime 0 0
# or - You should have figured to adjust for ext 2 3 or 4 now?
/dev/block/loop255 / ext2 rw,noatime 0 0
proc /proc proc rw 0 0
sysfs /sys sysfs rw 0 0
devpts /dev/pts devpts rw 0 0
The FS should always be mounted with the noatime option! This reduces load considerably and conserves sdcard!
mount -o rw,noatime -t ext2 /dev/block/vold/179:2 /sdcard2 for instance
/etc/fstab should look like this: (remember to adjust / )
Code:
/dev/block/loop255 / ext3 defaults,noatime 1 1
tmpfs /lib/init/rw tmpfs rw,nosuid,mode=0755 0 0
proc /proc proc defaults 0 0
sysfs /sys sysfs defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts rw,gid=5,mode=620 0 0
Setup a password for the root account.
For some reason i had to run dhclient to get online at first, even though ifconfig shows me as connected. Also be aware that when Android falls asleep it puts the wlan0 device to sleep, dropping the connection. Pinging something with -i 90 is a temporary workaround for this.
Setting up OpenSSH
Code:
apt-get update
apt-get install openssh
(OPTIONAL) To configure your locale settings to use a language other than English, install the locales support package and configure it.
Currently the use of UTF-8 locales are recommended.
Code:
apt-get install locales
dpkg-reconfigure locales
(OPTIONAL! ) The "tasksel install standard" command installs all packages marked as "standard" packages for the selected distribution. Running just tasksel will promote you with several choices. tasksel --initial will promote you with installing the base system.
For things like the touchscreen to work properly we need to populate /dev.
Code:
# NOT NEEDED ANYMORE , USING DIFFERENT APPROACH! - leaving for reference
#mknod /dev/kgsl-3d0 c 244 0
#mkdir /dev/input
#mknod /dev/input/input0 c 13 64
#mknod /dev/input/input1 c 13 65
#mknod /dev/input/input3 c 13 67
#mknod /dev/input/input4 c 13 68
#mknod /dev/i2c-0 c 89 0
#mknod /dev/i2c-1 c 89 1
Poking around i figured out the touchscreen and stuff.
input0 = Hid Ofn
input1 = Touchscreen
input2 = Sensor
input3 = Keypad
input4 = Handset
After the installation there will be a lot of downloaded packages in /var/cache/apt/archives/. You can free up some diskspace by running:
apt-get clean
I then created a small script to drop into GNU/Linux a bit easier, note the path of the modules.
Code:
su &
if test -e /mnt/sdcard/arm-linux/linux/bin/bash # or /sdcard2/bin/ if your using a partition
then
echo "Already mounted."
else
busybox insmod /mnt/sdcard/arm-linux/s7/jbd.ko
busybox insmod /mnt/sdcard/arm-linux/s7/ext3.ko
busybox insmod /mnt/sdcard/arm-linux/s7/jbd2.ko
busybox insmod /mnt/sdcard/arm-linux/s7/ext4.ko
# For loopback image
mknod /dev/block/loop255 b 7 255
busybox losetup arm-linux.img /dev/block/loop255
mount -o rw,noatime -t ext2,3 or 4 /dev/block/loop255 /sdcard2
# For partition
mount -o rw,noatime -t ext2,3 or 4 /dev/block/vold/179:2 /sdcard2
fi
export bin=/sdcard2/bin/ # or /mnt/sdcard/arm-linux/linux if your using an image
export PATH=$bin:/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:$PATH
export TERM=linux
export HOME=/root
export SHELL=/bin/bash
# You can also do
#'setprop ctl.stop zygote & setprop ctl.stop media && chroot /sdcard2/ /bin/bash && setprop ctl.start zygote & setprop ctl.start media'
# This will kill the Android wm, start chroot, and once you quit return you to
# android, but that doens work in an android terminal, only via adb.
chroot /sdcard2 /bin/bash
This needs to be expanded with another script since you still need some mounts (sysfs devpts and proc), i just dropped them in the .bashrc file in /root for now.
Code:
if test -e /sys/class/graphics/fb0/uevent
then
echo "All sys mounts already mounted."
else
mount -a
#service hal start
hald --daemon=yes
service ssh start
fi
cd
For Xorg
I've compiled the MSM/QSD X11 drivers, which should provide "limited 3d acceleration, provided they works, here is the status of that so far:
http://threader.zapto.org/s7/dev/msm-drv/xf86-video-msm-6fd8528-gcc46-2-rgb-fix-accel-6.tar , Colour working, needs NoAccel on production kernel. With accel enabled on the production kernel, there are no errors shown when starting X as there were. But Lxde first appears, tjen the menu, taskbar, background, and the rest vanish in a puff of smoke, leaving only the pointer and which can be moved about corruption regions of the screen. This is because certain features were left out of the production kernel. Using the kernel provided in post #11, acceleration works!
You can always check http://threader.zapto.org/s7/dev/msm-drv/ and try out some of the others I've compiled and see if there are any speed issues, sources are also available.
Now to enter the X server, the first thing you really want to do is have your ssh server running and connect to it. You can start your xserver and have all resources devoted to it by having passed "setprop ctl.stop media & setprop ctl.stop zygote" to android in the ADB. Starting zygote again is merely a 'setprop ctl.start zygote & setprop ctl.start zygote'.
The HTC Dream is fairly similar to our device, similar as in its a QSD8x50 device, we should be able to borrow some of their work, this is probably optimized and should be fast, http://build.shr-project.org/shr-unstable/images/htcdream/ its good for reference anyway.
Some problems i ran into. # Outdated but leaving for reference.
When trying to ssh in, after a reboot, i got a rather nasty error.
PTY allocation request failed on channel 0
if present remove /dev/ptmx and do mknod /dev/ptmx c 5 2 then redo these mounts or make sure they are properly mounted.
mount -t devpts devpts /dev/pts
mount -t proc proc /proc
mount -t sysfs sysfs /sys
TIPS:
Install localepurge! This will save a lot of space!
Install a vncserver and try setting up an X session your happy with, i would recommend the use of lxde and openbox to minimize the memory footprint and to conserve space and ram as the s7's kernel is compiled without swap enabled (o,0).
Configure xorg.conf in /etc/X11/xorg.conf with the config i posted in #3 http://forum.xda-developers.com/showpost.php?p=14594464&postcount=3
Be sure to properly unmount the ext partition before you reboot your device! Especially ext2 partitions are prone to dataloss!!!!! Use "sync" as root atleast before exiting!
install matchbox-keyboard ( an onscreen keyboard )
Starting X11 was an oddball first few attempts! As the fbdev driver isn't really compatible with the qsd8250 gpu, it blanks out the screen and doesnt know how to revert it. With android still running, I experimented with startx -- :1 and stuff the xorg.conf but ended up using just startx and found that repeatedly pressing the power button (quite frantically) (once the screen blanked out), low and behold, the x session miraculously appeared! This was before i had even "thunk" about compiling the qsd msm driver and before the xf86-video-msm driver in wheezy Debian.
Congratulations, you should now have a fully working Debian install on your Huawei S7!
-------------------------------------------------------------------------------
Clean booting into the Debian partition!
Configure /etc/fstab: # Outdated , needs updating, see arm-linux.img
Code:
# /etc/fstab: static file system information.
#
# file system mount point type options dump pass
/dev/block/mmcblk0p2 / ext2 defaults 1 1
proc /proc proc defaults 0 0
/dev/mmcblk0p1 /media/sdcard vfat defaults 0 0
Add "/sbin/adbd &" to /etc/rc.local and make a symlink so adbd can find sh or bash. (NB, was unsuccessful in my attempts at this for unknown reasons, did not fight it to long.)
# mkdir -p /system/bin/
# ln -s /bin/bash /system/bin/sh
apt-get install wpasupplicant network-manager-gnome wireless-tools
mv /etc/init.d/udev /etc/init.d/dis for now, this is a showstopper.
Get fastboot http://developer.htc.com/adp.html
Grab the zImage
(s7 10x -- Self compiled kernel,with ext3-4,drm,alsa(hopefully,powermanagement etc. _TESTING_ONLY_ copy lib to / , System.map to /boot/ and add dhd.ko to /etc/modules run depmod somehow ) http://threader.zapto.org/s7/kernel/2.6.32.9-ideos-fs-snd-drm-sane-5.tar.bz2
(s7 101 -- stock rom image ) http://threader.zapto.org/s7/rom/extracted/output-brazil/kern/zImage
(s7 other then 101 -- stock rom image ) http://threader.zapto.org/s7/rom/extracted/output/zImage
Configure the network:
To configure the network we need to copy a module from android dhd.ko from /lib/modules/ to /lib/modules/2.6.32.9-ideos/kernel/ and create an entry in /lib/modules/2.6.32.9-ideos/modules.dep kernel/dhd.ko: then run depmod -a from within Debian and add dhd to /etc/modules
Boot Debian:
Put the device into fastboot mode
$ adb reboot bootloader
The '-c' flag specifies arguments to pass to the kernel for boot.
This is probably the bare minimum.
Format is "fastboot -c 'kernelcmdline' boot zImage"
fastboot -c 'root=/dev/mmcblk0p2 rw rootfs=ext2 init=/sbin/init rootwait noinitrd' boot zImage
Please help feed my Linux addiction! Go to http://threader.zapto.org and click Donate!
TODO:
Clean boot from the Debian partition using fastboot.- DONE
Compile the codeaurora.org MSM/QSD X11 drv - DONE
Compile a sane kernel, with all the features you'd expect from a Linux kernel - DONE
Create a boot image with the new kernel compatible with the S7 101-105 possibly 201(slim) capable of booting Android and Linux, either from an early boot menu or using chroot. (WIP)
Hack up an existing rom, or compile 2.3.7 and make a complete solution. (TBA)
Stop playing Angry Birds, Dragon, FLY! XConstruct, Finger physics and Skies Of Glory when i should be doing this! - NEARLY ALMOST MOSTLY COMPLETELY DONE(ish) ;Þ
References & useful stuff! This would never have been possible in this short of a time if it weren't for these excellent posts. (Woaw, i sounded so optimistic in june 2011. The initial work was quick, over half a year later though im still not done! "Just gotta fix that last little ting before... Hey! i discover another little thing ...!
http://www.saurik.com/id/10
http://www.debian.org/releases/stable/i386/apds03.html
http://www.irregular-expression.com/?p=30
forum.xda-developers.com/archive/index.php/t-830077.html
http://forum.xda-developers.com/archive/index.php/t-830077.html
For development
git clone git://codeaurora.org/kernel/msm.git android-msm-2.6.32
https://www.codeaurora.org/gitweb/quic/xwin/
https://www.codeaurora.org/gitweb/quic/xwin/?p=xf86-video-msm.git;a=shortlog;h=refs/heads/chromium
http://gitorious.org/htc-msm-2-6-32...d65936b8bbc8708f352719/include/drm/kgsl_drm.h
https://github.com/tmzt/androix-xserver
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
/etc/X11/xorg.conf
Code:
Section "Device"
Identifier "msm"
# For MSM/QSD X11
Driver "msm"
Option "fb" "/dev/fb0"
# For fbdev
# Driver "fbdev"
# Option "ShadowFB" "on"
# Option "Rotate" "CW"
# for MSM/QSD X11
Option "NoAccel" "true"
# Option "SWBlit" "true"
EndSection
Section "Screen"
Identifier "Framebuffer"
# Device "fbdev"
Device "msm"
Monitor "Monitor"
# DefaultFbBpp 24
SubSection "Display"
# Depth 24
Modes "800x480"
EndSubSection
EndSection
Section "ServerLayout"
Identifier "Builtin Default Layout"
Screen "Framebuffer"
# InputDevice "Trackball" "CorePointer" # Reserved for buttons .
InputDevice "Touchscreen" "CorePointer"
InputDevice "Keyboard" "CoreKeyboard"
EndSection
Section "InputDevice"
Identifier "Touchscreen"
Driver "evdev"
Option "Device" "/dev/input/input1"
# Option "ScreenNumber" "0"
Option "ReportingMode" "Raw"
Option "ReportingMode" "Scaled"
Option "ButtonNumber" "1"
Option "SendCoreEvents"
EndSection
Section "InputDevice"
Identifier "Keyboard"
Driver "kbd"
# Option "XkbLayout" "en_US"
EndSection
This is Debian running cleanly from without the chroot environment
After doing some debugging from within chroot and Android, without the /etc/xorg.conf doing a startx -- :1 and repeatedly pressing the power button (quite frantically) (once the screen blanked out) the x session miraculously appeared! But i couldn't use it since it didn't know of a pointer device.
I managed today to configure the touchsreen correctly, i can now use xfce and x11 from within chroot in android ,but ironically enough im unable to get it up (phun intended) in a clean boot at all, here im using matchbox-keyboard
zImage
Hello,
the links about zImage
Grab the zImage link(s7 101) link (s7 other then 101 dont know why this is 2 megs! and the other 1.4)
are broken.
Can you share zImage again?
Best regards and thanx for great work
Hi!
I've extract kernel using guide: HOWTO: Unpack, Edit, and Re-Pack Boot Images on android-dls.com/wiki/.
but at the end, i've have problems in dhd module. Can't modprobe without error at linux boot.
Now trying to run ubuntu 11.04. Installing "ubuntu-desktop" packages in chroot
santiagax99 said:
Hi!
I've extract kernel using guide: HOWTO: Unpack, Edit, and Re-Pack Boot Images on android-dls.com/wiki/.
but at the end, i've have problems in dhd module. Can't modprobe without error at linux boot.
Now trying to run ubuntu 11.04. Installing "ubuntu-desktop" packages in chroot
Click to expand...
Click to collapse
Hey, good stuff, use whatever kernel from whatever rom absolutely works on your droid.
It's also dawned on me there most probably might be an issue with the port of the x11 driver, thankfully i still have everything.
http://threader.zapto.org/ - im guessing everything i used is there, if i find more i'll put it up, if its down try again later. I also added a donate button to help feed my Linux addiction =)
The dhd.ko is here - http://threader.zapto.org/s7/rom/extracted/output/sys/lib/modules/dhd.ko
Also Ubuntu is a memory hungry beast, i would recommend Debian 6.0x/squeeze lxde+xfce.
Hi, how it's going with TODO:
Stop playing angrybirds, xconstruct and skies of glory when i should be doing this!
?
=)
installing Ubuntu fails because of my lazy =(
now i get some free time and trying to get working debian queeze on my S7.
I'll report back after finish.
---------- Post added at 03:22 PM ---------- Previous post was at 03:20 PM ----------
Also i think it's good idea to share complete image of partition with linux. Installing all packages on S7 takes much time =)
Hey,
Quite time consuming yes, and fiddly.
I was planning on sharing an image, but i had planned on having it a bit more complete and polished first. That just didn't happen however. But today i cleaned up http://threader.zapto.org and added an image of the partition. And got a fresh breath of motivation.
The image is 2.1 GB. If you write it to a partition, it needs to be equal to or greater then the image you write or you risk trashing the next partition or just failing to complete the write, i guess.
However, you can use a loop device Use the last available loop device, mknod /dev/block/loop255 b 7 255 to avoid conflict, and to mount the image using losetup /dev/block/loop255 s7-linux.img && mount -o noatime -t ext2 /dev/block/loop255 /sdcard2 . Do sync as root before rebooting.
http://threader.zapto.org/s7
http://shell.consolegfx.net/s7-linux.img.bz2 # Outdated - see post #11 or http://threader.zapto.org/arm-linux.tar.bz2
md5sum s7-linux.img
275b2fe0bbe0172910933e583835164c s7-linux.img
-rw-r--r-- 1 root root 2169503744 Nov 19 17:49 s7-linux.img
Password for root is root .
Now, i wont be working too much more on the fastboot approach, carrying around a pc to boot linux on the tablet just isnt practical at all. And i really need to have usb host confirmed and working. I have made progress on starting X11 cleanly. My current method of "setprop ctl.stop media & setprop ctl.stop zygote && chroot /mnt/sdcard/linux/ /bin/bash && setprop ctl.start media & setprop ctl.start zygote" works great from adb, but will fail in an android terminal emulator instantly restarting zygote as it quits the terminal app.
I also compiled some kernel modules and put up, mainly ext3 & 4, fuse, msdos, ntfs, but eventually some other goodies. Check http://threader.zapto.org/s7/modules/. None of these are included currently, and wont be until i upload a future version. That will be ext3, which hopefully wont be too far off, and i can already tell you it will include some substantial changes. It should also be infinently more usable, even for those that havent spent some 10+ years on linux. It would definitively be cool if i could releasing something with Digital video usb dongle support, wouldn't it?
Cheers!
-Mike
Btw. here's the next image running on the s7, as you can see there were some problems with the x11 driver, but i managed to fix that a bit so this is now working, but still Option "NoAccel". I can also report that even firefox 3.5 is running surprisingly smoothly. Over the next few days i will be working on the x11 driver and then internal gsm modem and bluetooth.
Driver working with Red and Blue switched:
Tada! Fixed driver!
Thanks where thanks are due must be given to Visor and Hydro for helping with hosting "o'huge ass image file" and such! Thanks!
KERNEL 'UPDATE!: :
--------------------------
I managed to find time to fix and compile the kernel! The new kernel boasts plenty of improvements over the stock kernel, most noticeably ext3-4 built in, drm, alsa, swap, some experimental features enabled like a new scheduler for the usb, and switch to the no-op scheduler, also a feature that could let us change kernels "mid flight", hopefully, with kexec. Added some fpu related optimizations. I was unable to get it booting with a newer compiler for now though, so its still soft-float. This kernel is half the size, or even less as debug symbols are disabled. The old kernel crawled to 7mb's , this is 3.3.
http://threader.zapto.org/s7/kernel/2.6.32.9-ideos-fs-snd-drm-sane-5.tar.bz2
Usage:
Take the tools folder from the tar.bz2 and copy it somewhere, preferably your home directory (as google sdk binaries are picky little pricks) extract the above archive and put zimage into the tools directory:
adb reboot fastboot
Kernel with modules, http://threader.zapto.org/s7/kernel/2.6.32.9-ideos-fs-snd-drm-sane-5.tar.bz2
Ramdisk extracted from stock bootrom: http://threader.zapto.org/s7/kernel/boot.img-ramdisk.gz
Extract 2.6.32.9-ideos-fs-snd-drm-sane-5.tar.bz2 somewhere on your machine, zImage is inside there.
Dont extract boot.img-ramdisk.gz
For booting Android:
Code:
fastboot -c 'console=ttyMSM2,115200n8 androidboot.hardware=qsd8k_s7' boot /path/to/2.6.32.9-ideos-fs-snd-drm-sane-5/zImage /path/to/boot.img-ramdisk.gz
For booting into linux (mmcblk0p2 is the device node for the second partition created on the 8gb internal sdcard, use mmcblk1p1 or 1p2 for external sdcard):
Code:
fastboot -c 'root=/dev/mmcblk0p2 rw rootfs=ext3 init=/sbin/init rootwait noinitrd' boot zImage
Thanks where thanks are due must be given to -ZEROsignal-. Visor and Hydro, for helping with hosting "o'huge ass image file" and such! Thanks!
Aosp 2.3.7 available for modders and powerusers!
Code:
experimental/aosp2.3/s7/README
Experimetnal build of gingerbread for the s7
Notes:
The build is 2G split, (vmsplit 2g), so given that a given library is compatible
these can be exchanged from 2.2 .
Its still software rendering via pixelflinger.
OpenGL works.
Notes on Wifi and Bluetooth, bcm4329 chipset.
An updated kernel driver, is included in /system/modules (bcm4329.ko).
I have however not come as far as to implement it properly, as i am currently fo
cused on the graphics bit.
Notes on graphics, gralloc-qsd8k has been fixed. Which meant updating the kernel
pmem driver a bit to accomodate this change.
renderscript (libRS and librs_ something ) crashes. Probably due to pixelflinger
Im sure a rom modder could have this rom running smoothly using the huawei 2.2 l
ibraries and such, and dhd.ko. Also delete /system/app/Provision.apk as this prevents booting!
Notes on boot.img:
The ramdisk content might be wrong! I might have copieid the wrong boot.img befo
re i left! This will get fixed.
And so it has, boot.img-dead is the old dead one, boot.img is the working one.
Directory structure named after build date
Cheers
-mike aka threader
Also arm-linux0.7 is shaping up, this is still an early version where i change a lot in preparation for a more general solution to publish on the google.code page.
Were now using freedreno x11 driver, which works well in chroot but doesnt work if you boot linux normally, the old msm-x11 driver works for this purpose.
I improved rendering alot, but still pixelflinger....it also appears that i introduced some rendering artefacts, these are however minimal.
http://code.google.com/p/lrfa/downloads/detail?name=system.img.bz2&can=2&q=
boot.img still on http://threader.zapto.org/experimental .
.
Hi! how's it going? what's new? long time no updates. Is there any success in running Linux? I would like to move to Linux as the primary operating system.
Hey.
Not much, still occasionally working to port the Codeaura Adreno GPU driver to the huawei kernel, which is a **** because of the version screweup which is the huawei kernel. Other then that there has been no news on the Android Gingerbread front since i last published http://threader.zapto.org/experimental/aosp2.3/s7/021212/ , which fixed audio and found a bug in the MDP which resulted in less glitching when fixed.
New kernel up on http://threader.zapto.org/experimental/s7/kernels/
Incomplete change list off the top of my head:
Patched from 2.6.32.9 to 2.6.32.60
Asturals msm kgsl with the following changes
- fixed kgsl_drm_init(null) which caused a kernel panic in older kgsl.
- patched exploit in kgsl
gcc 4.7 compatible - updated assembly.
clock code taken from 2.6.38.
AVS from 2.6.38
DRM from 2.6.38
Added memblock. Genalloc. Genlock.
Redone board file. (use board-qsd8x50-s7.c-full for full functionality)
msm-fb updated. Lcdc. Etc.
Retouched msm_battery-s7
and probably lots more.
Known bugs:
TBA ( TO BE ANSWERED )
Source : http://threader.zapto.org/experimental/s7/kernels/source/kernel-ideos-experimental-2.6.32.60.tar.bz2
Binary: http://threader.zapto.org/experimen...l-ideos-experimental-2.6.32.60/zimage-2gsplit
Happy hacking!
Hi threader, great work, will try and tell you how it goes.
One question have you tryied to move to 2.6.38 ?
cant we patch the 2.6.38 kernel with files we may need from 2.6.32 ?
hal_2000
Hey Hal.
Likewise
Still fixing some minor bugs, re-worked the board-qsd8x50-s7 file again to make dhd happy, and found a hw def that makes anything we compile think its a 8250. Tell me, is it the 103 or 20x that uses the 8250? I think that code should be moved to the board file.
I've been trying to move to 2.6.38, but i cant get it booting for some reason, i've actually got two 2.6.38 kernels i've been working on, neither give as much as a bleep. The one up in s7/experimental/ has everything it needs to boot, i think. I backported the board-qsd8x50.c file to the 2.6.32 kernel trying to rule that out, and thats whats in use there.. But its pretty hard to debug when i have no frame of reference (console output or anything).
Cheers
-Mike
hal_2000 said:
Hi threader, great work, will try and tell you how it goes.
One question have you tryied to move to 2.6.38 ?
cant we patch the 2.6.38 kernel with files we may need from 2.6.32 ?
hal_2000
Click to expand...
Click to collapse
Hi, i pick up the zimage file and make a boot.img file, it boot up the rom fusion but touch screen did not work and menu and home key also did not work.
Then used your kernel sources to try to compile a kernel for cm9 and it did not work, it hang at boot, i have a s7 model 105.
If you need more tests let me know.
as far i know que s7-10x uses a qsd8k board type and a cpu qualcomm snapdragon qsd8250 at 998Mhz, the 20x uses a diferent cpu. That why it uses diferent kernels, and i think there is more diference in hardware.
hal_2000

making a nook-bootable SD card (in general) on Linux

It took me a while to figure out why verygreen's image worked, but I was not able to reproduce the result by creating my own partitions and copying his files over. Looking more closely at verygreen's image and my own, I noticed that the first partitions started at different positions. I was able to get my homebrew SD card working just by making the first partition start at the 63rd sector:
Code:
$ sudo fdisk -l /dev/sdb
Disk /dev/sdb: 15.9 GB, 15931539456 bytes
64 heads, 32 sectors/track, 15193 cylinders, total 31116288 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000e525a
Device Boot Start End Blocks Id System
/dev/sdb1 * 63 329790 164864 e W95 FAT16 (LBA)
/dev/sdb2 329791 1312830 491520 83 Linux
/dev/sdb3 1312831 3409982 1048576 83 Linux
/dev/sdb4 3409983 31116287 13853152+ c W95 FAT32 (LBA)
How do you do this using fdisk? After you create the first partition, type 'x' for extra functionality (experts only). From there, you could then type 'b', then '1', then '63' to make your first partition start at the right place. Press 'r' to return to the main menu, and make the rest of your partitions from there. Note that this operation breaks whatever filesystem was originally on the first partition, so it would need to be reformatted. MAKE BACKUPS. Don't forget to write changes!
FatTire and nemith confirmed that the first partition needed to be special, and pointed to this informational page. It even contains a nifty script. I didn't need most of that, since tweaking the beginning-of-data worked for me every time, but give it a read anyway.
You know, I'm sure this was something very simple for the ones that knew. But I too struggled with creating a bootable sdcard from scratch. I would set up all the correct partitions with the correct flags and still nogo. Who would've thought it would be something as simple as that. Thanks for this!
-Racks
Now I can create my own "Verygreen" installer img, muah ha hah... It was that whole formatting the uSD thing with those special considerations that has been tripping me up the whole time.
This didnt work for me, anyone have a script that could format a boot partition and an ext 3 partition with it? one with custom boot size like 4Gb fat or 3GB fat or 5GB fat prefferably 4.5GB but if you know how to customise the script below to create 4.5 GB fat partiton right now this creates only a 73 Mb fat partition the rest ext3
#! /bin/sh
# mkcard.sh v0.5
# (c) Copyright 2009 Graeme Gregory <[email protected]>
# Licensed under terms of GPLv2
#
# Parts of the procudure base on the work of Denys Dmytriyenko
# http://wiki.omap.com/index.php/MMC_Boot_Format
export LC_ALL=C
if [ $# -ne 1 ]; then
echo "Usage: $0 <drive>"
exit 1;
fi
DRIVE=$1
dd if=/dev/zero of=$DRIVE bs=1024 count=1024
SIZE=`fdisk -l $DRIVE | grep Disk | grep bytes | awk '{print $5}'`
echo DISK SIZE - $SIZE bytes
CYLINDERS=`echo $SIZE/255/63/512 | bc`
echo CYLINDERS - $CYLINDERS
{
echo ,9,0x0C,*
echo ,,,-
} | sfdisk -D -H 255 -S 63 -C $CYLINDERS $DRIVE
sleep 1
if [ -x `which kpartx` ]; then
kpartx -a ${DRIVE}
fi
# handle various device names.
# note something like fdisk -l /dev/loop0 | egrep -E '^/dev' | cut -d' ' -f1
# won't work due to https://bugzilla.redhat.com/show_bug.cgi?id=649572
PARTITION1=${DRIVE}1
if [ ! -b ${PARTITION1} ]; then
PARTITION1=${DRIVE}p1
fi
DRIVE_NAME=`basename $DRIVE`
DEV_DIR=`dirname $DRIVE`
if [ ! -b ${PARTITION1} ]; then
PARTITION1=$DEV_DIR/mapper/${DRIVE_NAME}p1
fi
PARTITION2=${DRIVE}2
if [ ! -b ${PARTITION2} ]; then
PARTITION2=${DRIVE}p2
fi
if [ ! -b ${PARTITION2} ]; then
PARTITION2=$DEV_DIR/mapper/${DRIVE_NAME}p2
fi
# now make partitions.
if [ -b ${PARTITION1} ]; then
umount ${PARTITION1}
mkfs.vfat -F 32 -n "boot" ${PARTITION1}
else
echo "Cant find boot partition in /dev"
fi
if [ -b ${PARITION2} ]; then
umount ${PARTITION2}
mke2fs -j -L "Angstrom" ${PARTITION2}
else
echo "Cant find rootfs partition in /dev"
fi
DroidisLINUX said:
This didnt work for me, anyone have a script that could format a boot partition and an ext 3 partition with it? one with custom boot size like 4Gb fat or 3GB fat or 5GB fat prefferably 4.5GB but if you know how to customise the script below to create 4.5 GB fat partiton right now this creates only a 73 Mb fat partition the rest ext3
#! /bin/sh
# mkcard.sh v0.5
# (c) Copyright 2009 Graeme Gregory <[email protected]>
# Licensed under terms of GPLv2
#
# Parts of the procudure base on the work of Denys Dmytriyenko
# http://wiki.omap.com/index.php/MMC_Boot_Format
export LC_ALL=C
if [ $# -ne 1 ]; then
echo "Usage: $0 <drive>"
exit 1;
fi
DRIVE=$1
dd if=/dev/zero of=$DRIVE bs=1024 count=1024
SIZE=`fdisk -l $DRIVE | grep Disk | grep bytes | awk '{print $5}'`
echo DISK SIZE - $SIZE bytes
CYLINDERS=`echo $SIZE/255/63/512 | bc`
echo CYLINDERS - $CYLINDERS
{
echo ,9,0x0C,*
echo ,,,-
} | sfdisk -D -H 255 -S 63 -C $CYLINDERS $DRIVE
sleep 1
if [ -x `which kpartx` ]; then
kpartx -a ${DRIVE}
fi
# handle various device names.
# note something like fdisk -l /dev/loop0 | egrep -E '^/dev' | cut -d' ' -f1
# won't work due to https://bugzilla.redhat.com/show_bug.cgi?id=649572
PARTITION1=${DRIVE}1
if [ ! -b ${PARTITION1} ]; then
PARTITION1=${DRIVE}p1
fi
DRIVE_NAME=`basename $DRIVE`
DEV_DIR=`dirname $DRIVE`
if [ ! -b ${PARTITION1} ]; then
PARTITION1=$DEV_DIR/mapper/${DRIVE_NAME}p1
fi
PARTITION2=${DRIVE}2
if [ ! -b ${PARTITION2} ]; then
PARTITION2=${DRIVE}p2
fi
if [ ! -b ${PARTITION2} ]; then
PARTITION2=$DEV_DIR/mapper/${DRIVE_NAME}p2
fi
# now make partitions.
if [ -b ${PARTITION1} ]; then
umount ${PARTITION1}
mkfs.vfat -F 32 -n "boot" ${PARTITION1}
else
echo "Cant find boot partition in /dev"
fi
if [ -b ${PARITION2} ]; then
umount ${PARTITION2}
mke2fs -j -L "Angstrom" ${PARTITION2}
else
echo "Cant find rootfs partition in /dev"
fi
Click to expand...
Click to collapse
Code:
# fdisk /dev/sdb
Command (m for help): o
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Print card info:
Command (m for help): p
Disk /dev/sdb: 128 MB, 128450560 bytes
....
Note card size in bytes. Needed later below.
Then go into "Expert mode":
Command (m for help): x
Now we want to set the geometry to 255 heads, 63 sectors and calculate the number of cylinders required for the particular SD/MMC card:
Expert command (m for help): h
Number of heads (1-256, default 4): 255
Expert command (m for help): s
Number of sectors (1-63, default 62): 63
Warning: setting sector offset for DOS compatiblity
Expert command (m for help): c
Number of cylinders (1-1048576, default 1011): 15
In this case 128MB card is used (reported as 128450560 bytes by fdisk above), thus 128450560 / 255 / 63 / 512 = 15.6 rounded down to 15 cylinders. Numbers there are 255 heads, 63 sectors, 512 bytes per sector.
Now, return to main mode and create a new partition:
Expert command (m for help): r
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-15, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-15, default 15): 15
Mark it bootable:
Command (m for help): a
Partition number (1-4): 1
And change its type to FAT32:
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): c
Changed system type of partition 1 to c (W95 FAT32 (LBA))
The result is:
Command (m for help): p
Disk /dev/sdb: 128 MB, 128450560 bytes
255 heads, 63 sectors/track, 15 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 15 120456 c W95 FAT32 (LBA)
Now, really write configuration to card (until here, card is not changed):
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.
Done! What's left is to format our partition as FAT32 to be mounted and populated:
# mkfs.vfat -F 32 /dev/sdb1
mkfs.vfat 2.11 (12 Mar 2005)
Note: before running mkfs.vfat (included in the dosfstools package in Debian) make sure /dev/sdb is not mounted.
# mount /dev/sdb1 /mnt/tmp
Note: If you use additional mkfs.vfat parameter -n you can give the card a name, e.g. for easier identification (i.e. mkfs.vfat -n omap3 -F 32 /dev/sdb1)
The SD/MMC card is now ready to be used to boot OMAP3 boards.
sfdisk
In order to format same card using sfdisk, one needs to do the following:
# sfdisk -H 255 -S 63 -C 15 /dev/sdb << EOF
> ,,b,*
> EOF
This worked for me, once I used mkcard.sh I deleted the partitions then created a new partition following these steps and now I have a 4.5 Gb boot partition and a 3.0 ext3 Angstrom partition and a 500 Mb swap partition I found that the angstrom only needed about 2.7 to 2.8 Gb or space so that was why I wanted it this way so I could still have a large sdcard when I boot normaly.
I did have to do some math as my sdcard is a 8 GB sdcard not a 128 megs but once i did the math the cyclenders came out to be 966 and then I did everything else like it said make sure to add bootable flag and edit first sector at 63 on the first partition then it works, if you have problems try to change id to option e worked (W95 FAT16 (LBA)) and use mkfs.vfat -F 16 /dev/sdb1 other wise try option c mkfs.vfat -F 32 /dev/sdb1. I got the fat 32 to work so I am happy

Multi-Boot RPi from Command Line [31 Oct 2013]

I wrote a shell script to multi-boot my RPi from a terminal. Script can be executed remotely via SSH or VNC.
Features:
Automatically detect all ext4 partitions of all storage devices attached to RPi (ext4 is the default partition type for hosting an RPi-compatible OS)
Reconstruct boot device names (root=/dev/*) from partition editor output. No changes are made to storage devices
Generate table of boot options and prompt user for option
Include option to shutdown
Reboot to selected rootfs, e.g. /dev/sda2 according to user-selected boot option
Script uses partition editor (parted) to identify the storage device paths. I did have to install parted on Raspbmc:
Code:
sudo apt-get install parted
Presently I have triple boot:
Raspbian #1 on SD (/dev/mmcblk0p2)
Raspbian #2 on USB HD (/dev/sda2)
Raspbmc on USB HD (/dev/sda4)
Partition Info:
PNY 16GB SD
[email protected]:/boot# parted /dev/mmcblk0 print
Model: SD SD16G (sd/mmc)
Disk /dev/mmcblk0: 16.0GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 4194kB 62.9MB 58.7MB primary fat16 lba
2 62.9MB 16.0GB 15.9GB primary ext4
Western Digital 160GB HD 7200 RPM
[email protected]:/boot# parted /dev/sda print
Model: WDC WD1600BJKT-75F4T (scsi)
Disk /dev/sda: 160GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 4194kB 62.9MB 58.7MB primary fat16 lba
2 77.6MB 21.5GB 21.5GB primary ext4
3 21.5GB 25.8GB 4295MB primary linux-swap(v1)
4 25.8GB 160GB 134GB primary ext4
And here's the boot script (/boot/rpiboot.sh):
Code:
#!/bin/sh
echo
echo "Reboot RPi to rootfs... "
cd /boot
ftxt="cmdline.txt"
fbak="cmdline.bak"
fnew="cmdline.new"
if [ -f $fnew ]
then
rm $fnew
fi
echo
rootfs=$(awk '{for (i=1; i<NF; i++) if (match($i,"root=")) {sub("root=", "", $i); print $i} }' $ftxt)
echo "Current rootfs: $rootfs"
#Reconstructing device names from partition editor output
parted /dev/mmcblk0 print > parted.txt
mmcname=$(awk '/\/dev\// {printf "%s", substr($2,1,length($2)-1) }' parted.txt)
awk -v mmcname=$mmcname '/ext4/ {printf "%sp%d\n", mmcname, $1 > "ext4.txt" }' parted.txt
parted /dev/sda print > parted.txt
mmcname=$(awk '/\/dev\// {printf "%s", substr($2,1,length($2)-1) }' parted.txt)
awk -v mmcname=$mmcname '/ext4/ {printf "%s%d\n", mmcname, $1 >> "ext4.txt" }' parted.txt
echo
echo "Boot options for rootfs:"
cat -n ext4.txt > ext4_enum.txt
more ext4_enum.txt
echo
printf "Enter boot option (press ENTER to shutdown or CNTL-z to exit):"
read -r ext4_index
if test -z "$ext4_index"
then
echo
echo "Shutting down in 3 seconds..."
sleep 3
shutdown -h now
exit 0
fi
#Determine rootfs corresponding to boot option
rootfs=$(awk -v ext4_index=$ext4_index '{if (match($1,ext4_index)) print $2}' ext4_enum.txt)
if test -z "$rootfs"
then
echo
echo "Invalid boot option or other error. Exiting..."
exit 1
fi
awk -v rootfs=$rootfs -v fnew=$fnew '{
for (i=1; i<NF; i++) if (match($i,"root=")) {$i = "root=" rootfs; print $0 > fnew} }' $ftxt
if [ -f $fnew ]
then
printf "Press ENTER to reboot to $rootfs, or CNTL-z to exit."
read -r text
mv $ftxt $fbak
mv $fnew $ftxt
fi
echo
echo "/boot/cmdline.txt:"
more $ftxt
echo "Rebooting to $rootfs in 3 seconds..."
sleep 3
reboot
exit 0
Launching rpiboot.sh as root, here are my own results of a boot switch from /dev/sda2 (Raspbian) to /dev/sda4 (Raspbmc):
Code:
[email protected] ~ $ sudo sh /boot/rpiboot.sh
Reboot RPi to rootfs...
Current rootfs: /dev/sda2
Boot options for rootfs:
1 /dev/mmcblk0p2
2 /dev/sda2
3 /dev/sda4
Enter boot option (press ENTER to shutdown or CNTL-z to exit):3
Press ENTER to reboot to /dev/sda4, or CNTL-z to exit.
/boot/cmdline.txt:
dwc_otg.lpm_enable=0 root=/dev/sda4 rootfstype=ext4 noatime quiet rootwait loglevel=1 sdhci-bcm2708.enable_l
lm=1 dwc_otg.microframe_schedule=1 dwc_otg.fiq_fix_enable=0 dwc_otg.fiq_split_enable=0 dwc_otg.trans_backoff
=3000
Rebooting to /dev/sda4 in 3 seconds...
Broadcast message from [email protected] (pts/0) (Thu Oct 31 15:28:20 2013):
The system is going down for reboot NOW!
[email protected] ~ $ Connection to 10.0.0.16 closed by remote host.
Connection to 10.0.0.16 closed.
[email protected]:~#
And voila, Raspbmc comes up. I now SSH in from my Ubuntu laptop:
Code:
[email protected]:~# ssh [email protected]
[email protected]'s password:
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
[email protected]:~$
Of course VNC renders the elegant desktop experience, and setting up VNC is fairly straightforward:
http://learn.adafruit.com/adafruit-...control-with-vnc/running-vncserver-at-startup
However VNC does not work on Raspbmc since VNC relies on the X11 window system, while Raspbmc’s XBMC implementation is rendered in the framebuffer only. Thus VNC cannot be used as there is no X-session available for connection. See:
http://www.raspbmc.com/wiki/user/frequently-asked-questions/
But SSH works well.
Blessings. Enjoy!
tanks!
hello is verry good
please tuto create multiboot for noobs lol
And Raspbmc is EOL.
help
[email protected]:~ $ df -h
Sys. de fichiers Taille Utilis▒ Dispo Uti% Mont▒ sur
/dev/root 7,2G 4,5G 2,5G 65% /
devtmpfs 364M 0 364M 0% /dev
tmpfs 368M 0 368M 0% /dev/shm
tmpfs 368M 5,3M 363M 2% /run
tmpfs 5,0M 4,0K 5,0M 1% /run/lock
tmpfs 368M 0 368M 0% /sys/fs/cgroup
tmpfs 1,0M 4,0K 1020K 1% /var/pipeyelog
/dev/mmcblk0p1 60M 20M 41M 34% /boot
tmpfs 74M 0 74M 0% /run/user/1000
/dev/sda3 6,3G 15M 6,0G 1% /media/pi/e836e8e0-22be-4f6e-8836-1f4 039a627e8
/dev/sda2 7,2G 4,5G 2,5G 65% /media/pi/ad6203a1-ec50-4f44-a1c0-e6c 3dd4c9202
/dev/sda1 60M 20M 41M 34% /media/pi/boot
[email protected]:~ $ sudo sh /boot/rpiboot.sh
Reboot RPi to rootfs...
Current rootfs: /dev/mmcblk0p2
Boot options for rootfs:
1 /dev/mmcblk0p2
Enter boot option (press ENTER to shutdown or CNTL-z to exit):^Z
[1]+ Stopp▒ sudo sh /boot/rpiboot.sh
[email protected]:~ $
why not see my sda2 and sda3 partition ( Raspbian and raspbmc ) ??

Galaxy Grand Quattro Tutorial : Way To Become A Developer

The intention of this thread is to help newbies step by step to become an entry level developer so each one can contribute their ideas and opinions inspired by hands on experiment so as to share and increase the vast knowledge of Android
How To Setup Android Development Environment on Ubuntu 13.10
Hardware Needed : Atleat Dual Core 2.8 GHz. Processor, 4GB RAM (8GB recommended).
Software Needed For Virtualisation : VMware Workstation 10.0.1 Build 1379776
OS Needed : Ubuntu 13.10/13.04 x64 (64 bit recommended)
Virtual Machine Requirement : Atleast 3 GB RAM and 40 GB Hard Disk Space
Other Requirement : Atleast 1 Mbps (4 Mbps recommended) Shared Internet Connection.
http://forum.xda-developers.com/show....php?t=2302780 [Follow This Tutorial By Matt95. All Links Are Given There.]
JDK
$ sudo mkdir /usr/lib/jvm
$ cd ~/Downloads/
$ chmod +x jdk-6u45-linux-x64.bin
$ ./jdk-6u45-linux-x64.bin
$ sudo mv jdk1.6.0_45 /usr/lib/jvm/
$ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_45/bin/javac 1
$ sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_45/bin/java 1
$ sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk1.6.0_45/bin/jar 1
$ sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.6.0_45/bin/javaws 1
$ java -version
Now a restart is recommended before installing git.
GIT
$ sudo apt-get install git
$ y
PYTHON
$ cd ~/Downloads/
$ tar -xzvf Python-2.7.5.tgz
$ cd Python-2.7.5/
$ ./configure
$ make
$ sudo make altinstall
GNU
$ cd ~/Downloads/
$ tar -zxvf make-3.82.tar.gz
$ cd make-3.82
$ ./configure
$ make
$ sudo make install
[Do not use make 4.0]
OTHER PACKAGES
sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0 lib32stdc++6
ANDROID SDK
$ mkdir ~/development
$ cd ~/Downloads
$ tar -zxvf android-sdk_r22.2.1-linux.tgz
$ mv ~/Downloads/android-sdk-linux ~/development/
SETUP ADB/FASTBOOT
$ cd ~/development/android-sdk-linux/tools
$ ./android
SDK Path: Tools (Tick All)
Extras (Tick All)
[This process will take time depending upon the internet bandwidth]
$ sudo gedit .bashrc (ignore the error)
Now paste this at the end of the file:
#Android PATHS
export PATH=$PATH:~/development/android-sdk-linux/tools
export PATH=$PATH:~/development/android-sdk-linux/platform-tools
Save the file.
Now in a terminal window type
$ adb
$ fastboot
Both commands shows list of attributes.
Connected Samsung Galaxy Grand Quattro (I8552) to Workstation through USB Cable.
$ adb devices
Successfully Shows Device Number (Device is attached).
You are done!
How To Install, Initialize and Sync Repo on Ubuntu 13.10
How To Install, Initialize and Sync Repo on Ubuntu 13.10
Hardware Needed : Atleat Dual Core 2.8 GHz. Processor, 4GB RAM (8GB recommended).
Software Needed For Virtualisation : VMware Workstation 10.0.1 Build 1379776
OS Needed : Ubuntu 13.10/13.04 x64 (64 bit recommended)
Virtual Machine Requirement : Atleast 3 GB RAM and 40 GB Hard Disk Space
Other Requirement : Atleast 1 Mbps Shared Internet Connection.
A. INSTALL REPO PART
Install needed libs (Ubuntu 13.10) [Nearly 161 MB]
sudo apt-get install git-core flex bison gperf build-essential curl zlib1g-dev zlib1g-dev:i386 lib32ncurses5-dev x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 lib32z-dev libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc libreadline6-dev lib32readline-gplv2-dev lib32readline6 libreadline-dev libbz2-dev libghc-bzlib-dev lib32bz2-dev libsdl1.2-dev libesd0-dev squashfs-tools pngcrush schedtool libwxgtk2.8-dev
Create Directories
$ mkdir -p ~/bin && mkdir -p ~/android/system
Install Repo
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
Make Repo Executable
$ chmod a+x ~/bin/repo
Add "~/bin" to PATH of Execution
Start By Typing
gedit ~/.bashrc
Add The Below Line
export PATH=${PATH}:~/bin
B. CREATING AN ACCOUNT AT https://github.com
Go to github.com and register yourself. [If you are already a registered user then you do not have to register again]
In terminal type:
git config --global user.name "Your Name Here"
git config --global user.email "[email protected]"
[NOTE: Use the e-mail used in the website account creation]
Create your unique SSH public key
ssh-keygen -t rsa -C "[email protected]"
You can create a passphrase or omit.
Now press enter to save the ssh public keys.
Now two keys will be saved in/home/.ssh folder. (Hidden folder)
Now go to ~/.ssh folder and copy your id_rsa.pub content into account administration on github.com (double click id_rsa.pub, copy the key, login to github, go to account setting, click the SSH link and peste there).
Note: If this is the second time you are generating the ssh pubic key then after the generation copy it and visit Github. After clicking the ssh key link you will find a button "Add SSH Key". Click this and paste your new ssh key below the previous one.
Now check whether everything is ok by typing
ssh -T [email protected]
In the prompt type "yes" and you are done!
C. INITIALIZE REPO PART
$ cd ~/android/system/
repo init -u git://github.com/CyanogenMod/android.git -b jellybean
(instead of jellybean, depending on your built you may use gingerbread or ics)
D. SYNCING REPO PART
$ repo sync -j16
[This process will really take time depending on your bandwidth as this will download +16GB]
You can download all at a time or part by part. For downloading part by part just close the download at any time and safely logoff/shutdown your Ubuntu. Next time just cd to ~/android/system and type repo sync -j16. Just like any Window based download manager your download will begin from the point you closed in the last session.
You are done!
Can I also use Windows 7 for development. I have a video tutorial from YouTube indicating setting up android environment in windows. I am just asking because I never tested that I haven't a fast internet connection but if u approved for Windows 7 than I will download required sdk and exe from cafe and install them in my pc.
And also if u can please share tutorials for Windows.
Sent from my GT-I8552 using xda app-developers app
Vikas,
You are welcome to show developments in Windows. In-fact personally I feel that we can approach mass if Window is used as the development platform as newbies are much more accustomed with Window OS.
Also let me share my plan for this tutorial.
I started with ADB, the first step to connect Android based Smartphones to any OS based Workstation where Android environment is created. Then I discussed about Repo, the prime base for Android development.
Now the future plans are as following:
1. How to built a Device Tree for any new devices.
2. How to built CWM.
3. How to built Cyanogen Mod.
4. Tutorial about Eclipse.
5. Android Kitchen Setup.
6. Building Custom ROM.
The only condition is that all these steps must be shown in details for newbies in a step by step approach and it must be a generalized approach so that any devices developement can be done through these set of tutorials.
Thanks for cooperation sir give me 7-10 days and I will start development work because I truly want to learn something in android and if a support from expert side than definitely it will be more helpful.
I will start my dev from windows and very soon I will install all recommended files from tutorial and report u by pm.:thumbup::thumbup::thumbup::thumbup:
Sent from my GT-I8552 using xda app-developers app
Very useful guide...thanks for the initiative..appreciate the efforts..
You are welcome to post here.
Regards
nice info..
i just want to ask a question,
how do we compile android kernel by cygwin?
since dsixda kitchen are working flawlesly,but i wonder
why kernel seems not even compiling a kernel.
it say total errors...
i hope someone can make a clear instructions "how to"
cause ive came across all TUT in xda and i think something is missing in their TUT
Dear Jefry,
Though the kernel compilation shows error why don't you share the steps, code you have used etc. so we can all learn through it? Let it be wrong, we all will go through the coded lines, if needed search net, consult between us and then again try.
Hope you understand.
Regards
Few Basic Terminology
WHAT IS AN ANDROID EMULATOR
While there are hundreds of millions of Android devices representing hundreds of
models, you probably do not have one of each model. You may only have a single
piece of Android hardware. And if you do not even have that, you most certainly will
want to acquire one before trying to publish an Android app.
To help fill in the gaps between the devices you have and the devices that are
possible, the Android developer tools ship an emulator. The emulator behaves like a
piece of Android hardware, but it is a program you run on your development
machine. You can use this emulator to emulate many different devices, with
different screen sizes and Android OS versions, by creating one or more Android
virtual devices, or AVDs.
ANDROID OS VERSIONS AND API LEVEL
Android has come a long way since the early beta releases from late 2007. Each new
Android OS version adds more capabilities to the platform and more things that
developers can do to exploit those capabilities.
Moreover, the core Android development team tries very hard to ensure forwards
and backwards compatibility. An app you write today should work unchanged on
future versions of Android (forwards compatibility), albeit perhaps missing some
features or working in some sort of “compatibility mode”. And there are well-trodpaths for how to
create apps that will work both on the latest and on previous
versions of Android (backwards compatibility).
To help us keep track of all the different OS versions that matter to us as developers,
Android has API levels. A new API level is defined when an Android version ships
that contains changes that affect developers. When you create an emulator AVD to
test your app, you will indicate what API level that emulator should emulate. When
you distribute your app, you will indicate the oldest API level your app supports, so
the app is not installed on older devices.
At the time of this writing, the API levels of significance to most Android developers
are:
Android 1.0 (API level 1)
Android 1.1 (API level 2)
Android 1.5 Cupcake (API level 3)
Android 1.6 Donut (API level 4)
Android 2.0 Eclair (API level 5)
Android 2.0.1 Eclair (API level 6)
Android 2.1 Eclair (API level 7)
Android 2.2–2.2.3 Froyo (API level 8)
Android 2.3–2.3.2 Gingerbread (API level 9)
Android 2.3.3–2.3.7 Gingerbread (API level 10)
Android 3.0 Honeycomb (API level 11)
Android 3.1 Honeycomb (API level 12)
Android 3.2 Honeycomb (API level 13)
Android 4.0–4.0.2 Ice Cream Sandwich (API level 14)
Android 4.0.3–4.0.4 Ice Cream Sandwich (API level 15)
Android 4.1 Jelly Bean (API level 16)
Android 4.2 Jelly Bean (API level 17)
Android 4.3 Jelly Bean (API level 18)
Android 4.4 KitKat (API level 19)
WHAT IS DALVIK
In terms of Android, Dalvik is a virtual machine (VM). Virtual machines are used by
many programming languages, such as Java, Perl, and Smalltalk. The Dalvik VM is
designed to work much like a Java VM, but optimized for embedded Linux
environments.
So, what really goes on when somebody writes an Android application is:
1. Developers write Java-syntax source code, leveraging class libraries published
by the Android project and third parties.
2. Developers compile the source code into Java VM bytecode, using the javac
compiler that comes with the Java SDK.
3. Developers translate the Java VM bytecode into Dalvik VM bytecode, which
is packaged with other files into a ZIP archive with the .apk extension (the
APK file).
4. An Android device or emulator runs the APK file, causing the bytecode to be
executed by an instance of a Dalvik VM.
How To Connect Your Android Phone/Tablet With Your PC For Developement
Follow Post #2 i.e. 'How To Setup Android Development Environment on Ubuntu 13.10'
Now in a terminal window type the command
$ adb devices
The output will be something similar to:
List of devices attached
f9eru809279 device
If by any case this command fails to work, you may need to add some udev rules.
For example, here is a
51-android.rules file that will handle the devices from a handful of manufacturers:
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
SUBSYSTEM=="usb", SYSFS{idVendor}=="22b8", MODE="0666"
SUBSYSTEM=="usb", SYSFS{idVendor}=="18d1", MODE="0666"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="18d1", ATTRS{idProduct}=="0c01",
MODE="0666", OWNER="[me]"
SUBSYSTEM=="usb", SYSFS{idVendor}=="19d2", SYSFS{idProduct}=="1354", MODE="0666"
SUBSYSTEM=="usb", SYSFS{idVendor}=="04e8", SYSFS{idProduct}=="681c", MODE="0666"
Open gedit and copy the above codes, then put the file in /etc/udev/rules.d directory and reboot the system.
Note that the CyanogenMod project uses these udev rules.
Before We Begin
WHO MANAGED ANDROID?
Android is very different from other mobile platforms currently available. It is not
managed by a single organization, but by a group of companies named the “Open
Handset Alliance,” which is committed to providing a mobile OS that is free, complete,
and open source.
WHY THIS CREATES COMPLEXITY?
1.Multiple screen sizes
Android devices come in a multitude of different screen sizes. Success of your app
can hinge upon how your app looks across devices.
2.Fragmentation
It is up to the carrier and manufacturer to update their devices when a new version
of the OS and runtime are released, which doesn’t always happen in a timely manner.
It is therefore necessary to support older versions of the OS and runtime.
3.Different hardware capabilities
Android phones come in all shapes, sizes, and capabilities. It is necessary to ensure
that you degrade unsupported features gracefully when the hardware is limited.
Another important consideration is the particular hardware components on which
you can or cannot rely (for instance, some devices don’t have cameras, GPS sensors,
or keyboards).
4.Resource limitations
Developing applications targeted to the mobile environment is different from developing
for the desktop. CPU speed and memory are limited compared to desktops
or servers. Mobile device users don’t put up with apps that tie up their devices
(blocking the UI), consume too many resources, or crash their devices.
DEVELOPEMENT PROCESS FOR ANDRIOD DEVELOPER TOOLS
Google manages ADT (Android Developer Tools) development, as well as the standard Android platform.
However,the two products are managed very differently, particularly in regards to the opensource
nature of the products. The ADT project is developed by a different group from
the one that manages the main platform. The tools are released separately from the
standard SDK and follow their own release cycle, which is frequently (but not always)
tied to the platform release.
The standard OS is developed behind closed doors—contributions are not accepted to
the current code base. The source code is released to the public at some point after the
group releases it to manufacturers and other insiders.
ANDROID SOFTWARE DEVELOPEMENT KIT
This bundle consists of:
• The Eclipse IDE, including the ADT plug-ins, and all the required extensions
• The SDK Tools
• The Platform Tools
• The latest Android Platform
• A CPU image compatible with the latest platform
CONFIGURING A DEVICE FOR DEVELOPEMENT
The simplest way to test your applications is often by using an Android device. You can
use almost any Android device for development, as long as you make a few changes in
order to enable communication with the development tools.
1. Configuring a Physical Device for Development.
2. Change phone settings.
Launch the Settings app on your phone, then select Applications → Development
→ USB-Debugging. Check the box next to “USB debugging” to enable this functionality.
3. Download the ADB driver.
In order to connect an Android-powered device for testing on Windows machines,
it is necessary to install the appropriate USB driver. This is not necessary on Mac
OS X or Linux.
You can find drivers at the website of the manufacturer of your phone. You may be
able to find a driver through the Android Document website, which contains a list
of links to software for many original equipment manufacturers (OEMs).
4. Validate debugging on the phone.
Connect your device to your computer. If everything went well, you will see a notification
from your operating system, indicating that the device is installed and ready to use.
WHAT IS ADB?
Andriod Debug Bridge (ADB) is the main tool that allows you to interact with your emulator or a
connected device. The ADB process is actually a client/server program. The server component
communicates with a variety of clients (such as the command line or DDMS). The
daemon process on the device facilitates communication of activities such as:
• Push/pull of data or apps
• Issuing shell commands
• Restarting the device
• Reading system logs
Let Us Start Communicating
Before you begin follow post no #2 and follow accordingly.
Now issue the command:
$ adb devices
The response will include:
Serial number
The unique ID of each connected device. You will need the serial number to connect
directly. The format of the serial number includes information about the device
itself (namely, the type of device and the port on which it is listening).
State
The connection state of the device. This will be offline if the device is connected but
not responding. It will be device if is available and connected. Otherwise, the response
will be no devices, which indicates there are no active devices that ADB can
communicate with currently.
Now issue the command:
$ adb -s serialNumber version [serialNumber = The serial number you get from $adb devices command]
The output will be like this:
[email protected]:~$ adb -s 1fd***** version
Android Debug Bridge version 1.0.31
Now that ADB knows which device to target, we can interact with it. It is possible to do
a variety of useful things with this interface.
TRANSFERRING FILES: THE FAMOUS PUSH & PULL COMMANDS
It is very easy to transfer files between your computer and your device using the push
and pull commands.
PUSH = File transferrs from your computer to the attached device.
PULL = File transfers from your attached device to computer.
You can include additional path parameters if you would like to specify a
particular location for the files. If a path is not specified, the commands will use the
current directory of your computer for the local location and the data folder on the
device for the remote location. push and pull can also copy complete directories
(recursively), which can be very useful.
The syntax of push is:
$ adb push local-directory
remote
An example of using this command is shown here. We are using ADB to push a file
named test.txt from the current directory to the SD card. The syntax for this is:
$ adb push test.txt /sdcard/test.txt [Here sdcard means the internal sdcard]
To move the file off the SD card and back onto your machine, in a new directory and
with a new name, type:
$ adb pull /sdcard/test.txt home/arinio/andro/test.txt
INTERACTIVE MODE
Interactive mode allows you to execute more than one command successively on the
device. To start interactive shell mode, type:
$ adb shell
You will see a # symbol, which indicates that you are in shell mode. When you are ready
to exit the remote shell, you can use Ctrl+D or type exit to end the shell session.
REal-Time Example:
[email protected]:~$ adb shell
[email protected]:/ $
/
[email protected]:/ $ cd /sys
sys/ system/
[email protected]:/ $ cd /system/etc/
[email protected]:/system/etc $ pwd
/system/etc
[email protected]:/system/etc $exit
ONE-OFF MODE
It is also possible to execute commands noninteractively. To do this, type the command
you want to execute after the shell keyword.
adb shell command
[email protected]:~$ adb shell cat /system/etc/hosts
127.0.0.1 localhost
RETRIEVING SYSTEM DATA
There are many cases in which you need detailed information about the various systems
on your device. Some useful commands can dump huge amounts of information about
the system, including service status, system statistics, and error logs. You may want to
collect these statistics if you are trying to analyze trends or specific details about your application.
$ adb shell dumpsys > /home/arinio/Downloads/dump.txt [Here I redirected the output to dump.txt file. Tolal output line is 31000+]
Outputs data about specific system services to the screen. For example, adb shell
dumpsys alarm will output details about all the alarms currently registered on the
system.
The first few lines are:
Currently running services:
AtCmdFwd
CustomFrequencyManagerService
DirEncryptService
FMPlayer
SurfaceFlinger
accessibility
account
activity
alarm
apn_settings_policy
application_policy
apppermission_control_policy
appwidget
audio
auditlog
backup
battery
batteryinfo
bluetooth
bluetooth_a2dp
bluetooth_avrcp
bluetooth_policy
browser_policy
certificate_policy
clipboard
clipboardEx
commontime_management
connectivity
content
country_detector
cpuinfo
date_time_policy
dbinfo
device_account_policy
device_info
device_policy
devicestoragemonitor
diskstats
display.hwcservice
drm.drmManager
dropbox
eas_account_policy
edm_proxy
edmnativehelper
email_account_policy
email_policy
enterprise_license_policy
enterprise_policy
enterprise_vpn_policy
entropy
firewall_policy
geofencing
gfxinfo
hardware
input
input_method
iphonesubinfo
iphonesubinfo_msim
isms
isms_msim
kioskmode
ldap_account_policy
license_log_service
location
location_policy
lock_settings
lockscreen_overlay
log_manager_service
mdm.remotedesktop
media.audio_flinger
media.audio_policy
media.camera
media.gestures
media.player
meminfo
mini_mode_app_manager
misc_policy
motion_recognition
mount
netpolicy
netstats
network_management
notification
package
password_policy
permission
phone
phone_msim
phone_restriction_policy
phoneextadb shell dumpsys > /home/arinio/Downloads/dump.txt
power
remoteinjection
restriction_policy
roaming_policy
samplingprofiler
samsung.facedetection_service
scheduling_policy
seandroid_policy
search
security_policy
sensorservice
serial
servicediscovery
simphonebook
simphonebook_msim
sip
smartcard_browser_policy
smartcard_email_policy
smartcard_vpn_policy
statusbar
telephony.msim.registry
telephony.registry
textservices
throttle
uimode
updatelock
usagestats
usb
vibrator
voip
vpn_policy
wallpaper
wifi
wifi_policy
wifip2p
window
Another Command:
$ adb shell dumpstate > /home/arinio/Downloads/dump1.txt
Detailed system data representing a device at a particular state in time (includes
dumpsys information as well).
The output contains 90772 lines.
THe first few lines are:
mkdir(/data/anr): Permission denied
========================================================
== dumpstate: 2013-11-30 22:37:19
========================================================
Build: JZO54K.I8552XXAMJ7
Build fingerprint: 'samsung/delos3gxx/delos3geur:4.1.2/JZO54K/I8552XXAMJ7:user/release-keys'
Bootloader: I8552XXAMDB
Radio: msm
Network: AirTel
Kernel: Linux version 3.4.0-1441994 ([email protected]) (gcc version 4.6.x-google 20120106 (prerelease) (GCC) ) #1 SMP PREEMPT Tue Oct 29 13:28:51 KST 2013
Command line: (unknown)
------ UPTIME (uptime) ------
up time: 4 days, 03:13:23, idle time: 1 days, 23:21:38, sleep time: 3 days, 14:12:20
[uptime: 0.1s elapsed]
------ MEMORY INFO (/proc/meminfo) ------
MemTotal: 865328 kB
MemFree: 63208 kB
Buffers: 18316 kB
Cached: 201748 kB
SwapCached: 0 kB
Active: 540780 kB
Inactive: 121620 kB
Active(anon): 443292 kB
Inactive(anon): 1020 kB
Active(file): 97488 kB
Inactive(file): 120600 kB
Unevictable: 848 kB
Mlocked: 0 kB
HighTotal: 117760 kB
HighFree: 1624 kB
LowTotal: 747568 kB
LowFree: 61584 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 0 kB
Writeback: 0 kB
AnonPages: 443196 kB
Mapped: 105740 kB
Shmem: 1116 kB
Slab: 46192 kB
SReclaimable: 9332 kB
SUnreclaim: 36860 kB
KernelStack: 8112 kB
PageTables: 16444 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 432664 kB
Committed_AS: 8003824 kB
VmallocTotal: 245760 kB
VmallocUsed: 82488 kB
VmallocChunk: 59248 kB
------ CPU INFO (top -n 1 -d 1 -m 30 -t) ------
User 2%, System 8%, IOW 0%, IRQ 0%
User 21 + Nice 0 + Sys 61 + Idle 645 + IOW 0 + IRQ 0 + SIRQ 0 = 727
PID TID PR CPU% S VSS RSS PCY UID Thread Proc
26459 26459 0 10% R 1432K 808K shell top top
96 96 0 0% S 0K 0K root irq/89-msm-cpr-
1013 1025 0 0% S 6012K 448K root mpdecision /system/bin/mpdecision
6 6 0 0% S 0K 0K root migration/0
16 16 1 0% S 0K 0K root khelper
17 17 1 0% S 0K 0K root suspend_sys_syn
18 18 1 0% S 0K 0K root suspend
19 19 0 0% S 0K 0K root irq/53-msmdatam
20 20 0 0% S 0K 0K root sync_supers
21 21 0 0% S 0K 0K root bdi-default
22 22 1 0% S 0K 0K root kblockd
23 23 0 0% S 0K 0K root khubd
24 24 1 0% S 0K 0K root modem_notifier
25 25 1 0% S 0K 0K root smd_channel_clo
26 26 1 0% S 0K 0K root smsm_cb_wq
30 30 1 0% S 0K 0K root qmi
31 31 1 0% S 0K 0K root rpcrouter
32 32 1 0% S 0K 0K root rpcrotuer_smd_x
33 33 0 0% S 0K 0K root krpcserversd
35 35 0 0% S 0K 0K root rmt_storage
36 36 1 0% S 0K 0K root kadspd
37 37 1 0% D 0K 0K root voicememo_rpc
39 39 0 0% D 0K 0K root krmt_storagecln
40 40 0 0% D 0K 0K root krmt_storagecln
41 41 0 0% S 0K 0K root kswapd0
42 42 0 0% S 0K 0K root fsnotify_mark
43 43 0 0% S 0K 0K root ecryptfs-kthrea
44 44 1 0% S 0K 0K root crypto
57 57 1 0% S 0K 0K root mdp_dma_wq
58 58 1 0% S 0K 0K root mdp_vsync_wq
[top: 2.7s elapsed]
------ PROCRANK (procrank) ------
*** exec(procrank): Permission denied
*** procrank: Exit code 255
[procrank: 0.1s elapsed]
------ VIRTUAL MEMORY STATS (/proc/vmstat) ------
nr_free_pages 10236
nr_inactive_anon 255
nr_active_anon 110826
nr_inactive_file 30149
nr_active_file 24375
nr_unevictable 212
nr_mlock 0
nr_anon_pages 110801
nr_mapped 26437
nr_file_pages 55015
nr_dirty 0
nr_writeback 0
nr_slab_reclaimable 2746
nr_slab_unreclaimable 14345
nr_page_table_pages 4117
nr_kernel_stack 1015
nr_unstable 0
nr_bounce 0
nr_vmscan_write 0
nr_vmscan_immediate_reclaim 0
nr_writeback_temp 0
nr_isolated_anon 0
nr_isolated_file 0
nr_shmem 279
nr_dirtied 439303
nr_written 438957
nr_anon_transparent_hugepages 0
nr_dirty_threshold 11861
nr_dirty_background_threshold 2965
pgpgin 1208499
pgpgout 1874766
pswpin 0
pswpout 0
pgalloc_normal 7397855
pgalloc_high 1334847
pgalloc_movable 0
pgfree 8862011
pgactivate 127582
pgdeactivate 53470
pgfault 10679448
pgmajfault 8080
pgrefill_normal 15854
pgrefill_high 79498
pgrefill_movable 0
pgsteal_kswapd_normal 337890
pgsteal_kswapd_high 103263
pgsteal_kswapd_movable 0
pgsteal_direct_normal 17327
pgsteal_direct_high 1880
pgsteal_direct_movable 0
pgscan_kswapd_normal 352987
pgscan_kswapd_high 127978
pgscan_kswapd_movable 0
pgscan_direct_normal 22790
pgscan_direct_high 2645
pgscan_direct_movable 0
pginodesteal 0
slabs_scanned 28130432
kswapd_inodesteal 0
kswapd_low_wmark_hit_quickly 289
kswapd_high_wmark_hit_quickly 748
kswapd_skip_congestion_wait 0
pageoutrun 2014157
allocstall 452
pgrotated 8
compact_blocks_moved 17749
compact_pages_moved 78038
compact_pagemigrate_failed 10421
compact_stall 640
compact_fail 248
compact_success 392
unevictable_pgs_culled 212
unevictable_pgs_scanned 0
unevictable_pgs_rescued 2
unevictable_pgs_mlocked 2
unevictable_pgs_munlocked 2
unevictable_pgs_cleared 0
unevictable_pgs_stranded 0
unevictable_pgs_mlockfreed 0
Another Useful Command:
$ adb shell logcat -b radio
This command provides access to the cellular radio log. This information is useful
when interacting with the networking stack. Some of the information available in
this log includes time of events, a listing of commands used by the system to com‐
municate, SMS information, IP information, and cellular network data.
ADB DOES A LOT MORE:
The ADB tool has a variety of additional functionality. Some functionality worth highlighting includes:
• Modify network configuration options like port forwarding (example: adb forward
tcp:7101 tcp:8101)
• Access your device as the root user (example: adb shell su)
• Restart the device in alternate modes, such as recovery mode (example: adb reboot
recovery)
• View system logs, such as the radio or event buffers (example: adb logcat -b events)
• Examine system utilization (example: adb shell tail | top)
There is a lot of other functionality we aren’t able to cover. For a complete list of all
available commands and their parameters, type adb -help without any additional arguments to get a listing of all options.
How To Find The Complete File System Of Galaxy Grand Quattro
Before you begin follow post no #2 and follow accordingly.
Now issue the command:
[email protected]:~$ adb devices
[email protected]:~$ adb shell
[email protected]:/ $ su -
[email protected]:/ # ls -R /
Move this find.txt from internal to external sdcard with the command:
[email protected]:/ # ls -R / > /sdcard/filesystem.doc
You can now transfer this file to your computer.
The file system of Galaxy Grand Quattro (GT-I8552) is as below: (Total 4253 pages of a MSWord doc)
[FONT=&quot]/:
acct
cache
charger
config
d
data
default.prop
dev
efs
etc
factory
fstab.delos3g
fstab.msm7627a
fstab.qcom
init
init.goldfish.rc
init.qcom.class_core.sh
init.qcom.class_main.sh
init.qcom.rc
init.qcom.ril.path.sh
init.qcom.sh
init.qcom.unicorn-dpi.sh
init.qcom.usb.rc
init.qcom.usb.sh
init.rc
init.target.rc
init.trace.rc
init.usb.rc
initlogo.rle
initlogo_swa.rle
lpm.rc
mnt
persist
preload
proc
res
root
sbin
sdcard
storage
sys
system
ueventd.goldfish.rc
ueventd.qcom.rc
ueventd.rc
vendor[/FONT]
.
.
.
..........(4253 pages)
The /proc/partitions Table Of Galaxy Grand Quattro
[email protected]:/sdcard # cat /proc/partitions
[FONT=&quot]
[/FONT]
[FONT=&quot]major minor #blocks name[/FONT]
[FONT=&quot] [/FONT]
[FONT=&quot] 179 0 7634944 mmcblk0[/FONT]
[FONT=&quot] 179 1 20 mmcblk0p1[/FONT]
[FONT=&quot] 179 2 175 mmcblk0p2[/FONT]
[FONT=&quot] 179 3 20480 mmcblk0p3[/FONT]
[FONT=&quot] 179 4 1 mmcblk0p4[/FONT]
[FONT=&quot] 179 5 1000 mmcblk0p5[/FONT]
[FONT=&quot] 179 6 1000 mmcblk0p6[/FONT]
[FONT=&quot] 179 7 2000 mmcblk0p7[/FONT]
[FONT=&quot] 179 8 12288 mmcblk0p8[/FONT]
[FONT=&quot] 179 9 3072 mmcblk0p9[/FONT]
[FONT=&quot] 179 10 3072 mmcblk0p10[/FONT]
[FONT=&quot] 179 11 4096 mmcblk0p11[/FONT]
[FONT=&quot] 179 12 8192 mmcblk0p12[/FONT]
[FONT=&quot] 179 13 12288 mmcblk0p13[/FONT]
[FONT=&quot] 179 14 4096 mmcblk0p14[/FONT]
[FONT=&quot] 179 15 4096 mmcblk0p15[/FONT]
[FONT=&quot] 179 16 12288 mmcblk0p16[/FONT]
[FONT=&quot] 179 17 24576 mmcblk0p17[/FONT]
[FONT=&quot] 179 18 4096 mmcblk0p18[/FONT]
[FONT=&quot] 179 19 512 mmcblk0p19[/FONT]
[FONT=&quot] 179 20 2048 mmcblk0p20[/FONT]
[FONT=&quot] 179 21 1228800 mmcblk0p21[/FONT]
[FONT=&quot] 179 22 737280 mmcblk0p22[/FONT]
[FONT=&quot] 179 23 102400 mmcblk0p23[/FONT]
[FONT=&quot] 179 24 5443168 mmcblk0p24[/FONT]
[FONT=&quot] 179 32 31166976 mmcblk1[/FONT]
[FONT=&quot] 179 33 31165952 mmcblk1p1[/FONT][FONT=&quot]
[/FONT]
The /proc/partitions Table Of Galaxy Grand Quattro In Structured Format
Please view attachment.
The /proc/partitions Table Of Galaxy Grand Quattro After Decimal To Hex Convertion
Here we have the /proc/partitions table after converting the values to hexadecimal.
Samsung no more provides the file /proc/mtd for make the developers work easy.
I want all to emphasis on this table structure as for building recovery and CWM this table structure is invaluable.
However still the name of the partitions are not known to us in desired format like boot, recovery etc.
We will do further research in the upcoming tutorial.
How To Unpack Recovery Image
For now let us shift our attention fro the /proc folder and focus over the recovery image file. Later on we will again review our previous discussion in more detailed manner.
Let us jump into this current topic.
Now the first question is where to find the recovery image?
In old days it was possible to locate that file by simply typing the command:
$ adb devices
$ adb shell
$ su -
and then in the root typing # cat /proc/mtd (for Samsung) or # cat /proc/emmc (for HTC)
Alas! Now there is no such files.
So, let us apply the hard way to find that image file.
Start...............
In google simply type sammobile or directly type in the address bar www.sammobile.com
Register yourself first and foremost.
Now click the Firmware link or you can directly click the Firmwares link after typing sammobile in google search box. It's up to you.
Here you will find a box 'search your device here'
There simply type I8552
The search result will consist of seven columns.
Importantis column no. two where you will find your country, column three where you will find the Firmware release month (go for the latest month), column six where the name of the version you will get and finally the last column where the download link is there.
Now click the latest download link (for India it is I8552XXAMJ7) and in the latest windows you will get a Captcha challenge. Unfortunately though filling the right letters/numbers the Captcha will fail and fortunately you will get another link for download. [There are two links for India, one will show INU file and another INS file. In your Galaxy Grand Quattro box you will find whether your device is based on INU or INS].
The download links are always Hotfile links and they are resumable. Better to use Internet Download Manager (IDM) to download this file.
The files are nearly 750 MB sizes and they are compressed in rar format.
With the help of WInRAR unRAR it and you will get a tar.md5 formatted file and the latest Firmwares size will become 1.3 GB.
We call them as tarball (actually a .tar file is a tarball file and here in this case this is a tarball file with md5 checksum) files and inside this Firmware the recovery image file is hidden.
For Indian user the file will look like I8552XXAMJ7_I8552ODDAMI4_I8552DDAMI1_HOME.tar.md5
If you are not very much accustomed with VMWare how to create a link between your Original OS (we call it host) and virtually running Ubuntu (we call it guest) simply go to your Windows OS, copy the file in a USB drive and then again plug it while in Ubuntu and paste it in your home folder.
Now the main part...............
Right click this file and delete the .md5 words (mind the dot)
In Ubuntu open a terminal window and fire up these commands:
[email protected]:~$ mkdir quattro
[email protected]:~$ mv I8552XXAMJ7_I8552ODDAMI4_I8552DDAMI1_HOME.tar /home/arinio/quattro/
[email protected]:~$ cd quattro/
[email protected]:~/quattro$ tar xvf I8552XXAMJ7_I8552ODDAMI4_I8552DDAMI1_HOME.tar
boot.img
recovery.img
system.img.ext4
fat.bin
cache.img.ext4
hidden.img.ext4
So finally inside the quattro folder we got six files and one of them is recovery.img. Note that another important file is boot.img
Now you can delete the I8552XXAMJ7_I8552ODDAMI4_I8552DDAMI1_HOME.tar file. This will be no more needed. Infact you can delete all other files except recovery.img and boot.img
So if now you issue this command you will observe
[email protected]:~$ ls /home/arinio/quattro/
boot.img recovery.img
Let us target recovery.img
First visit this page http://forum.xda-developers.com/showthread.php?t=1877807 and download unmkbootimg.gz file.
Inside your /home partition you will find one folder named Download. After the download is complete (1-5 second) you will find the unmkbootimg.gz file there only.
Now issue this commands:
[email protected]:~$ cd /home/arinio/Downloads/
[email protected]:~/Downloads$ ls
ADB.txt dump1.txt Python-2.7.5
ADB.txt~ dump2.txt REPO PART.txt
Android Developer Tools Essentials.pdf dump.txt REPO PART.txt~
CWM BUILD PATH.txt~ make-4.0 unmkbootimg.gz
[email protected]:~/Downloads$ gunzip unmkbootimg.gz
[email protected]:~/Downloads$ ls
ADB.txt dump1.txt Python-2.7.5
ADB.txt~ dump2.txt REPO PART.txt
Android Developer Tools Essentials.pdf dump.txt REPO PART.txt~
CWM BUILD PATH.txt~ make-4.0 unmkbootimg
So unmkbootimg.gz becomes unmkbootimg
Now cut the unmkbootimg file from Downloads folder and paste it inside quattro folder.
So now the quattro folder will look like:
[email protected]:~/Downloads$ ls /home/arinio/quattro/
boot.img recovery.img unmkbootimg
Now right click the unmkbootimg and click 'Properties'.
In the new window click the tab 'Pemissions' and check-mark 'Allow executing file as program'.
Close the 'Permissions' window.
Now while inside the quattro folder issue this command:
[email protected]:~/quattro$ ./unmkbootimg recovery.img > recoveryoutput.txt
Now issue
[email protected]:~/quattro$ ls
boot.img recovery.img unmkbootimg
initramfs.cpio.gz recoveryoutput.txt zImage
Here The kernel is zImage and the ramdisk is initramfs.cpio.gz.
So, ultimately we have successfully unpacked the recovery image and recovery.img consists two files namely zImage and initramfs.cpio.gz
If we issue this command:
[email protected]:~/quattro$ cat recoveryoutput.txt
The output will show:
unmkbootimg version 1.2 - Mikael Q Kuisma <[email protected]>
Kernel size 4694160
Kernel address 0x208000
Ramdisk size 1082913
Ramdisk address 0x1500000
Secondary size 0
Secondary address 0x1100000
Kernel tags address 0x200100
Flash page size 4096
Board name is ""
Command line "androidboot.hardware=qcom loglevel=1 vmalloc=200M"
*** WARNING ****
This image is built using NON-standard mkbootimg!
OFF_RAMDISK_ADDR is 0x01300000
Please modify mkbootimg.c using the above values to build your image.
****************
Extracting kernel to file zImage ...
Extracting root filesystem to file initramfs.cpio.gz ...
All done.
---------------
To recompile this image, use:
mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x200000 --cmdline 'androidboot.hardware=qcom loglevel=1 vmalloc=200M' --pagesize 4096 -o new_boot.img
---------------
Done!
You have been simple superb so far...no other dev would care to go into all these details...thanks a lot for your efforts..
im learning android a bit

[TUTORIAL] How to upgrade to Ubuntu Touch 16.04/RC, by resizing the system partition.

Ubuntu Touch is a fascinating android-alternative and still under active community development. Meizu Pro 5 was (and still is) one of its flagships. The current RC branch however requires a bigger system partition.
16.04 Stable can be installed on the stock partition but RC can not.
This tutorial assumes that you have a version of Ubuntu Touch already installed (for example via this TWRP backup image). It will not work like this without that.
I used 16.04/Stable. I am mentioning how to back up your userdata but this tutorial will by no means fully restore your old system! Also I am not responsible for any possible errors or data loss!
Alright, lets get started.
Download the ubuntu recovery image here:
We need that later. Put it on your external sd.
We next need to flash TWRP, from here:
This should work over fastboot:
Code:
# fastboot flash recovery TWRP_3.0_m86_patched_st0rm77.img
# fastboot reboot
However, in my case the phone didn't want to make contact. I am not sure if this was an error on my end or a bug in Ubuntu Touch.
You can alternatively boot into (ubuntu) recovery annd open an adb shell from your computer:
Code:
adb shell
Then type:
Code:
DEV=$(ls /dev/block/platform/*/by-name/recovery); echo $DEV
Upload TWRP to your device via adb, by executing from your computer:
Code:
adb push TWRP_3.0_m86_patched_st0rm77.img .
Then flash the recovery using dd:
Code:
dd of=$DEV if=/TWRP_3.0_m86_patched_st0rm77.img
Boot into TWRP recovery.
*Optional: Make now a backup of your userdata on your *external* SD.
Next open an adb shell from your computer:
Code:
adb shell
Code:
/external_sd # df
Filesystem 1K-blocks Used Available Use% Mounted on
tmpfs 1899196 24 1899172 0% /dev
tmpfs 1899196 56 1899140 0% /tmp
/dev/block/sda43 507848 28872 468492 6% /cache
/dev/block/sda44 56111432 3905764 52189284 7% /data
/dev/block/sda44 56111432 3905764 52189284 7% /sdcard
/dev/block/mmcblk0p1 7798784 7798784 0 100% /external_sd
Unmount the /dev/block/sda partitions:
Code:
/external_sd # umount /data
/external_sd # umount /sdcard
/external_sd # umount /cache
Create an image of your current system and put it on your external sd:
Code:
~ # dd if=/dev/block/sda41 of=/external_sd/system.img
5242880+0 records in
5242880+0 records out
2684354560 bytes (2.5GB) copied, 542.923623 seconds, 4.7MB/s
And the same of custom.img:
Code:
~ # dd if=/dev/block/sda42 of=/external_sd/custom.img
1048576+0 records in
1048576+0 records out
536870912 bytes (512.0MB) copied, 138.687865 seconds, 3.7MB/s
Then we mount said system image:
Code:
~ # mount /external_sd/system.img /system/ -o loop
As well as these:
Code:
~ # mount -t proc proc /system/proc
~ # mount -t sysfs sys /system/sys
~ # mount -o bind /dev /system/dev
And chroot into your current ubuntu touch environment:
Code:
~ # chroot /system/ /bin/bash
bash: groups: command not found
bash: lesspipe: command not found
bash: dircolors: command not found
Then we make sure we actually use the fdisk from util-linux and not that of busybox:
Code:
[email protected]:/# fdisk -V
fdisk from util-linux 2.27.1
And fire it up:
Code:
[email protected]:/# fdisk /dev/block/sda
Welcome to fdisk (util-linux 2.25.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
GPT PMBR size mismatch (15267840 != 15267839) will be corrected by w(rite).
GPT PMBR size mismatch (15267840 != 15267839) will be corrected by w(rite).
Check the current table:
Code:
Command (m for help):
p
The relevant partitions:
Code:
Device Start End Sectors Size Type code Name
dev/block/sda41 65536 720895 655360 2.5G Microsoft basic data 0700 system
dev/block/sda42 720896 851967 131072 512M Microsoft basic data 0700 custom
dev/block/sda43 851968 983039 131072 512M Microsoft basic data 0700 cache
dev/block/sda44 983040 15267834 14284795 54.5G Microsoft basic data 0700 userdata
We now just delete them:
Code:
Command (m for help): d
Partition number (1-3,21-33,41-44, default 44): 41
Partition 41 has been deleted.
Command (m for help): d
Partition number (1-3,21-33,42-44, default 44): 42
Partition 42 has been deleted.
Command (m for help): d
Partition number (1-3,21-33,43,44, default 44): 43
Partition 43 has been deleted
Command (m for help): d
Partition number (1-3,21-33,44, default 44): 44
Partition 44 has been deleted.
And recreate them:
Code:
Command (m for help): n
Partition number (4-20,34-128, default 4): 41
First sector (6-15267834, default 55808): 65536
Last sector, +sectors or +size{K,M,G,T,P} (65536-15267834, default 15267834): 1638399
Created a new partition 41 of type 'Linux filesystem' and of size 6 GiB.
Command (m for help): n
Partition number (4-20,34-40,42-128, default 4): 42
First sector (6-15267834, default 1638400): 1638400
Last sector, +sectors or +size{K,M,G,T,P} (1638400-15267834, default 15267834): 1769471
Created a new partition 42 of type 'Linux filesystem' and of size 512 MiB.
Command (m for help): n
Partition number (4-20,34-40,43-128, default 4): 43
First sector (6-15267834, default 1769472): 1769472
Last sector, +sectors or +size{K,M,G,T,P} (1769472-15267834, default 15267834): 2293775
Created a new partition 43 of type 'Linux filesystem' and of size 2 GiB.
Command (m for help): n
Partition number (4-20,34-40,44-128, default 4): 44
First sector (6-15267834, default 2294016): 2293776
Last sector, +sectors or +size{K,M,G,T,P} (2293776-15267834, default 15267834): 15267824
Created a new partition 44 of type 'Linux filesystem' and of size 49.5 GiB.
The table should look exactly like this:
Code:
Command (m for help): p
Disk /dev/block/sda: 58.2 GiB, 62537072640 bytes, 15267840 sectors
Units: sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 16384 bytes
I/O size (minimum/optimal): 16384 bytes / 8192 bytes
Disklabel type: gpt
Disk identifier: 00042021-0408-4601-9DCC-A8C51255994F
Device Start End Sectors Size Type
/dev/block/sda1 1024 1279 256 1M Microsoft basic data
/dev/block/sda2 1280 1343 64 256K Microsoft basic data
/dev/block/sda3 1344 1407 64 256K Microsoft basic data
/dev/block/sda21 2048 3071 1024 4M Microsoft basic data
/dev/block/sda22 3072 5119 2048 8M Microsoft basic data
/dev/block/sda23 5120 5631 512 2M Microsoft basic data
/dev/block/sda24 5632 6655 1024 4M Microsoft basic data
/dev/block/sda25 6656 7679 1024 4M Microsoft basic data
/dev/block/sda26 7680 13823 6144 24M Microsoft basic data
/dev/block/sda27 13824 22015 8192 32M Microsoft basic data
/dev/block/sda28 22016 30207 8192 32M Microsoft basic data
/dev/block/sda29 30208 35327 5120 20M Microsoft basic data
/dev/block/sda30 35328 40447 5120 20M Microsoft basic data
/dev/block/sda31 40448 45567 5120 20M Microsoft basic data
/dev/block/sda32 45568 50687 5120 20M Microsoft basic data
/dev/block/sda33 50688 55807 5120 20M Microsoft basic data
/dev/block/sda41 65536 1638399 1572864 6G Linux filesystem
/dev/block/sda42 1638400 1769471 131072 512M Linux filesystem
/dev/block/sda43 1769472 2293775 524304 2G Linux filesystem
/dev/block/sda44 2293776 15267824 12974049 49.5G Linux filesystem
Next we change the partition type to "Microsoft basic data":
Code:
Command (m for help): t
Partition number (1-3,21-33,41-44, default 44): 41
Partition type (type L to list all types):L
....
11 Microsoft basic data EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
The exact number can vary between versions!
Code:
Partition type (type L to list all types): 11
Changed type of partition 'Linux filesystem' to 'Microsoft basic data'.
Command (m for help): t
Partition number (1-3,21-33,41-44, default 44): 42
Partition type (type L to list all types): 11
Changed type of partition 'Linux filesystem' to 'Microsoft basic data'.
Command (m for help): t
Partition number (1-3,21-33,41-44, default 44): 43
Partition type (type L to list all types): 11
Changed type of partition 'Linux filesystem' to 'Microsoft basic data'.
Command (m for help): t
Partition number (1-3,21-33,41-44, default 44): 44
Partition type (type L to list all types): 11
Changed type of partition 'Linux filesystem' to 'Microsoft basic data'.
Check again with "p", if the types are correct.
Make sure there are no errors:
Code:
Command (m for help): v
No errors detected.
Header version: 1.0
Using 20 out of 128 partitions.
A total of 11396 free sectors is available in 4 segments (the largest is 38 MiB).
Now we add the partition names. For that we first change to expert mode:
Code:
Command (m for help): x
Then
Code:
Expert command (m for help): n
Select partition
Code:
Partition number (1-3,21-33,41-44, default 44): 41
Insert name
Code:
New name: system
Partition name changed from '' to 'system'.
Repeat for the other partitions:
Code:
Expert command (m for help): n
Partition number (1-3,21-33,41-44, default 44): 42
New name: custom
Partition name changed from '' to 'custom'.
Expert command (m for help): n
Partition number (1-3,21-33,41-44, default 44): 43
New name: cache
Partition name changed from '' to 'cache'.
Expert command (m for help): n
Partition number (1-3,21-33,41-44, default 44): 44
New name: userdata
Partition name changed from '' to 'userdata'.
Leave expert mode:
Code:
Expert command (m for help): r
And write the changes:
Code:
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
This step should not require a reboot unless fdisk specifically says so. If it does, reboot to recovery and restart the adb shell.
So far, so good.
Now we install the filesystems:
Code:
~ # mke2fs -t ext4 -m 0 /dev/block/sda41
~ # mke2fs -t ext4 -m 0 /dev/block/sda43
~ # mke2fs -t ext4 -m 0 /dev/block/sda44
And leave chroot (only if you didn't reboot after fdisk).
[email protected]:/# exit
exit
Now we rewrite the custom.img backup:
Code:
~ # cd /external_sd/
/external_sd # ls
TWRP cache.img custom.img system.img
/external_sd # dd if=./custom.img of=/dev/block/sda42
Reboot recovery and *optional* restore the userdata backup.
Next we hit the Install button, click on "install image" and install the ubuntu-linux recovery image from our sd.
You should now be set, to use the ubtouch installer, from here:
Manually select Meizu Pro 5 and select 16.04/rc with the options: No fastboot, no data wipe.
Happy nerding!
Resources relied upon:
https://blog.matt.wf/flash-your-recovery-image-via-adb-shell-on-android/
https://wiki.ubuntuusers.de/Howto/Installation_Ubuntu_Touch_auf_MEIZU_PRO_5/
https://forum.xda-developers.com/me...hedst0rm77-t3469296/post68868682#post68868682
https://ubuntu-touch.io/de_DE/get-ut

Categories

Resources