[HOW-TO] Boot Debian with X11 and wifi from SD card. (Not chroot!) - Nexus One Android Development

Booting Debian with X11 on the Google NexusOne
This howto can also be found on my blog.
http://www.irregular-expression.com/?p=30
Screenshots here
http://picasaweb.google.com/JairunCaloth/Debian?feat=directlink
This is a method to boot into Debian via fastboot on the nexus one from
your SD-card. This is NOT a chroot Debian image, it is honest to goodness
Debian running directly on the hardware. This is completely non destructive to
the android OS. Connectivity to the device can be provided by adbd, ssh, or
serial console. Wifi works perfectly. I have not tested bluetooth. Touchscreen
works, but needs tweaking. X11 works in framebuffer using the Debian
testing branch (squeeze). In order to get a full fledged X driver with
3D acceleration we'll need the driver from
https://www.codeaurora.org/index.php?xwinp which I haven't been able to get
to build. This doesn't mean it's broken. It just means I suck
at cross compiling .
Todo:
-Tweak settings to make X more usable.
-Find out how to use the soft keys.
-Get the CodeAurora MSM/QSD X driver working.
-Find decent method to input text.
-Test bluetooth
-Look into using the GSM radio.
-Audio
-Figure out how to configure adbd.
-Get someone who knows C and wants to hack on the recovery image to enable booting debian from there.
This how-to pulls heavily from the debian-arm install guide.
http://www.debian.org/releases/stable/arm/index.html.en
Requirements:
adb (android-sdk)
fastboot
chroot (on your phone)
sdcard with room for Debian - 2gigs seems to be sufficient for Debian + xfce.
I Had about a gig leftover. For this guide, I'm starting fresh with a 4GB sdcard
that I'm devoting completely to Debian. According to the Debian install guide,
you need at least 32MB of memory and 500MB of hard disk space. The guide
recommends at least 5GB of storage for a comfortable install. But since I'm
using the lighter XFCE4 desktop I haven't had any space issues.
http://www.debian.org/releases/stable/arm/ch03s04.html.en
1. Re size the SD card
(don't forget to backup your data before you go messing with partition tables!!)
(optional) Instead of using a partition on your main SD card, you could
simply use another sdcard and dedicate the entire thing to Debian.
Note: android didn't like me very much when I did this. I put in a
tiny (30MB) vfat partition right at the beginning of the blank sdcard
I mounted the sdcard on my Ubuntu system and used gparted to break
off 2 gigs to use for Debian. Make sure you keep the normal android
sdcard partition as the first partition otherwise android
will not be able to find it.
If you're using apps to SD or anything else like that. Debian should
probably have the last partition. I'm not 100% sure on this since I
don't use my sdcard for anything else.
2. Format the new partition.
ext2 is probably best. (least abusive on the sdcard. ext3 & 4 have
journaling which may be bad for the life of your sdcard)
I used Gparted for this part as well.
3. If you are installing from an Ubuntu or Debian desktop, install debootstrap
Code:
$ sudo apt-get install debootstrap
Users of other distros may be able to get debootstrap but I'm not sure.
4. Mount the sdcard on your desktop.
anywhere will do just remember where you put it
ex.
Code:
$ mount /dev/sde2 /mnt/android
5. debootstrap
run debootstrap
you can change to a mirror closer to you if you don't want to use the
US mirror - http://www.debian.org/misc/README.mirrors
I'm using the Debian testing release (squeeze). I had issues getting
X11 running in lenny, and have not tested sid.
(lenny is stable, squeeze is testing, and sid is unstable)
http://www.debian.org/releases/
debootstrap --arch armel --foreign <release> </path/to/debian> <mirror>
ex:
Code:
# debootstrap --arch armel --foreign squeeze /mnt/android http://ftp.us.debian.org/debian
6. debootstrap(part2)
Unmount the sdcard from your desktop.
Reboot the phone here since you've been mucking with the sdcard
file system. Android didn't like my sdcard until I did.
Code:
$ adb shell
mount the sdcard somewhere on the android file system.
look in /dev/block for the sdcard.
Typically mmcblk0p# where # is the partition number.
*note* the directory I use to mount mine does not exist under normal android.
If this is your first time you will need to create the directory.
Code:
mkdir -p /data/local/mnt
ex.
Code:
# mount -t ext2 /dev/block/mmcblk0p2 /data/local/mnt
chroot/debootstrap
Code:
# export PATH=/usr/bin:/usr/sbin:/bin:$PATH
# chroot /data/local/mnt/ /debootstrap/debootstrap --second-stage
this will take a while especially if you have a slower sdcard.
6. While that's working, now is a good time to get to work on your kernel
I used the open source android kernel 2.6.29
http://android.git.kernel.org/
Started with mahimahi_defconfig and starting customizing from there.
Things to note.
- file systems - don't forget to add support for whatever file systems
you need. Your root file system support cannot be built as a module.
- wireless driver config - You may want to change the location the
kernel looks for your wifi firmware (this is different from the
kernel module).
I stuck mine in /etc/firmware, default is /system/etc/firmware.
If you don't change this, you will have to put the firmware
in /system/etc/firmware
- wireless - Add in support for standard wifi extensions.
- networking - standard tcp/ip stuff... iptables if you want ect...
- I wasn't able to get the kernel to boot into Debian until I turned
off initramfs support.
(note. this was before I discovered the 'noinitrd' kernel
kernel cmdline option. So disabling initrd may not be required)
- If for some reason you are using ext4, it will fail to mount unless
you add in large devices and files support
- Default kernel command string - has no effect.
This gets overwritten when you boot with fastboot or make a boot.img
- Drivers - I left all the normal android drivers in.
-Changed the firmware path for wifi.
-Added in support for virtual terminal under character devices
-Enabled MSM serial support (if you don't have a serial cable
this is useless to you)
-You can build the wifi driver into the kernel if you want.
Link to the kernel config I used. Use at your own risk.
It works for me but I can't promise it's perfect or even good.
http://irregular-expression.com/tmp/config
I would love input on building a better kernel config.
If you don't want to build your own kernel, feel free to use mine http://irregular-expression.com/tmp/zImage
7. Chroot and configure Debian.
There are still some things that need configuring before we reboot into
Debian. Since fbconsole does not appear to be working, if you don't
have a serial cable you will be flying blind until Debian is fully
booted and you can connect with ssh. Since there are still things to do
before we reboot, we're going to chroot into Debian just like if we are
using a Debian chroot image.
For more information and examples of config files.
http://www.debian.org/releases/stable/arm/apds03.html.en
It's probably best to use wifi for your data on the phone for this.
If you're on Linux and connected to the same router as the phone, copy
over your resolv.conf
Code:
$ adb push /etc/resolv.conf /data/local/mnt/etc/resolv.conf
If you are not in Linux or are not connected to wifi you will need to
set up resolv.conf with something sane.
ex. from jay freeman's original Debian chroot.
Code:
$ echo 'nameserver 4.2.2.2' > /data/local/mnt/etc/resolv.conf
push wifi driver to the device
First we need to create a couple directories. Log into the phone with adb shell
Code:
$ adb shell
# mkdir -p /data/local/mnt/etc/firmware
# mkdir -p /data/local/mnt/lib/modules/2.6.29-droid-debian/kernel/drivers/bcm4329
# exit
Upload wifi kernel module and firmware. If you're using my prebuilt kernel, grab this one. http://irregular-expression.com/tmp/bcm4329.ko
Code:
$ adb push <kernelroot>/drivers/net/wireless/bcm4329/bcm4329.ko /data/local/mnt/lib/modules/2.6.29-droid-debian/kernel/drivers/bcm4329/
copy /system/etc/firmware/fw_bcm4329.bin to wherever you
specified in the kernel config.
Code:
# cp /system/etc/firmware/fw_bcm4329.bin /data/local/mnt/etc/firmware/
Setup environment variables, copy over adbd, and other stuff needed to
make things work. This should all be run from within an adb shell
Code:
# cp /sbin/adbd /data/local/mnt/sbin/adbd
# sysctl -w net.ipv4.ip_forward=1
# export PATH=/usr/bin:/usr/sbin:/bin:$PATH
# export TERM=linux
# export HOME=/root
Next chroot and setup mount points
Code:
# chroot /data/local/mnt /bin/bash
# mount -t devpts devpts /dev/pts
# mount -t proc proc /proc
# mount -t sysfs sysfs /sys
Welcome to Debian chroot that we all know and love.
Lets finish configuring this thing.
Configure adbd to run on boot and create a symlink so adbd can find bash.
Edit /etc/rc.local. Add adbd before exit 0
#add this to /etc/rc.local
Code:
/sbin/adbd &
Code:
# mkdir -p /system/bin/
# ln -s /bin/bash /system/bin/sh
Now we need to be able to install packages
don't forget if you are not using squeeze to change it here
Code:
# echo 'deb [url]http://ftp.us.debian.org/debian[/url] squeeze main' >> /etc/apt/sources.list
# apt-get update
You should see aptitude updating it's package list.
Install some needed packages
Code:
# apt-get install wpasupplicant wireless-tools udev ssh
Other packages
All up to your choice. Things like text editors, X, ect...
some suggested packages
Code:
# apt-get install locales vi
Wifi driver
When you try to load the wifi module, Linux will complain about not
being able to parse modprobe.d. To fix this run depmod. If it complains
a directory doesn't exist then create it.
Code:
# depmod -a
Edit /etc/modules and add the bcm4329 module
Code:
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
# Parameters can be specified after the module name.
bcm4329
Setup fstab - critical: don't forget to configure the root file system
or your system won't boot. If you like, mount your vfat sdcard partition
here too. Don't forget to mkdir for the mount point.
*note* after boot the memory card is located at /dev/mmcblk0p#.
Here is my /etc/fstab
Code:
# /etc/fstab: static file system information.
#
# file system mount point type options dump pass
/dev/mmcblk0p2 / ext2 defaults 1 1
proc /proc proc defaults 0 0
/dev/mmcblk0p1 /media/sdcard vfat defaults 0 0
configure network
These two files will be tuned to what you need.
Here are a couple examples.
/etc/network/interfaces
Code:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
wpa-driver wext
wpa-conf /etc/wpa_supplicant.conf
/etc/wpa_supplicant.conf
Code:
ctrl_interface=/var/run/wpa_supplicant
network={
ssid="myOpenNetwork"
scan_ssid=1
key_mgmt=NONE
}
network={
ssid="MyHomeNetwork"
scan_ssid=1
key_mgmt=WPA-PSK
psk="MyWifiPassword"
}
network={
ssid="MyFriendsWifi"
scan_ssid=1
key_mgmt=WPA-PSK
psk="MyFriendsWifiPassword"
}
SSH
If you want ssh to start on boot run this command.
*note* You will probably want to set a static IP address if you plan on accessing debian through ssh.
Code:
# update-rc.d ssh defaults
inittab
no need for getty so comment it out in /etc/inittab
if you have a serial cable, configure it here. something like this.
Code:
T0:23:respawn:/sbin/getty -L ttyMSM0 115200 linux
hostname
configure your system's hostname - you can set this to whatever you like
Code:
# echo DebianHostName > /etc/hostname
Set root password
Code:
# passwd
# useradd -m -G audio,dialout,floppy,video,staff username
Add user account
Code:
# useradd -m -G audio,dialout,floppy,video,staff yourusername -s /bin/bash
# passwd yourusername
8. Almost there!
Double check your configs and have your kernel handy.
The next step is to boot into Debian.
9. Boot Debian
put the device into fastboot mode
Code:
$ 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"
Code:
$ fastboot -c 'root=/dev/mmcblk0p2 rw rootfs=ext2 init=/sbin/init rootwait noinitrd' boot zImage
Wait just a few minutes. DHCP is probably the longest part of this.
10. Connect via ADB.
If everything went well you should be able to log into the
phone via adb. adb push and pull work as well.
Code:
$ adb shell
11. Install X11
For a basic X11 install. This is probably not what you want.
Code:
# apt-get install xserver-xorg
You can install whatever window manager/desktop environment you like,
I used XFCE. Most window managers likely depend on xserver-xorg so it
will get pulled in when you install.
Code:
# apt-get install xfce4
After I installed xfce4 I was able to get X on the main display by
simply running startxfce4
Code:
# startxfce4
By default Debian is configured to only allow root to startx.
If you want to be able to run X as a user edit /etc/X11/Xwrapper.config
*note* even with this I haven't been able to run X as a normal user.
Only root.
Change
Code:
allowed_users=console
to
Code:
allowed_users=anybody
Currently touchscreen is a little weird. It feels almost like using a
laptop touchpad. The mouse moves much faster then your finger and tapping for
click isn't enabled by default but two finger tap will right click. You can
also move the mouse with the trackball. Clicking the trackball registers a
click. But you have to wiggle the trackball just a tiny bit after you click to
make it register. I am going to work on tweaking the fdi policy files to
make things a little more usable.
Text entry is a bit of a pain point currently. There are several on screen
keyboards out there. One interesting one I found is called cellwriter.
The touchscreen will need to be tweaked before it will work well with
onscreen keyboards.
For other ideas on window managers and other software check out this link
http://wiki.openmoko.org/wiki/Debian

@jairuncaloth
I was just reading about how you got debian + x11 working on your nexus. I think thats awsome how you got a fully oprerational linux OS on your phone. I just had a few questions on how everything worked.
You were saying it doesn't mess with the default android OS, is there like a duel boot option to chose what OS i want to boot into. I was reading on how you have to start an ssh session to get into debian, and was just currious on some more info. I would be intrested in trying this out some time after i did a little more reading to get a better understanding of how everything was working.
If this wasn't working out after i installed, is it a pain to remove.
Thanks,
Justin

Nice post, appreciate the thoroughness.
I'm going to pour through this when I get some free time. Whenever that is
Thanks!
~enom~

jjkwasnik said:
@jairuncaloth
I was just reading about how you got debian + x11 working on your nexus. I think thats awsome how you got a fully oprerational linux OS on your phone. I just had a few questions on how everything worked.
You were saying it doesn't mess with the default android OS, is there like a duel boot option to chose what OS i want to boot into. I was reading on how you have to start an ssh session to get into debian, and was just currious on some more info. I would be intrested in trying this out some time after i did a little more reading to get a better understanding of how everything was working.
If this wasn't working out after i installed, is it a pain to remove.
Thanks,
Justin
Click to expand...
Click to collapse
Hey Justin. The reason it doesn't mess with the default android OS is when you boot, you're booting with a kernel image living on your desktop/laptop's hard disk. fastboot allows you to boot images without acctually flashing them to your phone. Debian lives on the SDcard so no flashing required.
You can also use adb to connect to debian now. It's as simple as copying over the binary from android.
Removing is as simple as rebooting. When you reboot it will be like debian was never there.

enomther said:
Nice post, appreciate the thoroughness.
I'm going to pour through this when I get some free time. Whenever that is
Thanks!
~enom~
Click to expand...
Click to collapse
I would love to hear ideas for improvements you may have
This is still pretty raw.

now my question is can those devs good with the linux kernel use this to hack into the android OS and unlock the security on the device without bricking the phone?
-Charlie

@jairuncaloth
I understand what you mean, i have used fast boot a few times. I know how to use it, just haven't used it a lot. So with using fast boot, once Debian is booted can you disconnect the usb cable. Is the kernel copied in RAM, or does it still need to talk to the kernel that resides on the PC?
I like where you are going with this, i am experienced with Linux. Not super advanced, but i know more then i think i do sometimes. I would like to try this out sometime to, but i'm very busy with work and the little free time i have gets spent before i know it. So knowing a little about it before i get my feet wet, always helps.
Thanks!!

Great news guys! Glad to see progress is being made. Can't wait to see where this goes from here!
Cheers

this is so cool, i was trying to get the chroot version to run on my nexus one the other day like i had it on my g1 but it was giving me trouble so i gave up. if proper support for the radio and the touchscreen/keyboard is created this would truly be monumental.
kudos for you man awesome job!

jjkwasnik said:
@jairuncaloth
I understand what you mean, i have used fast boot a few times. I know how to use it, just haven't used it a lot. So with using fast boot, once Debian is booted can you disconnect the usb cable. Is the kernel copied in RAM, or does it still need to talk to the kernel that resides on the PC?
I like where you are going with this, i am experienced with Linux. Not super advanced, but i know more then i think i do sometimes. I would like to try this out sometime to, but i'm very busy with work and the little free time i have gets spent before i know it. So knowing a little about it before i get my feet wet, always helps.
Thanks!!
Click to expand...
Click to collapse
Should look something like this after you run the fastboot boot command
creating boot image...
creating boot image - 2240512 bytes
downloading 'boot.img'... OKAY
booting... OKAY
At this point it's safe to pull the usb cable. If you are using adb to connect, you'll still want it though

I got the code aurora X driver to build last night. I ended up building it in debian on the phone. I couldn't get it to build against AOSP kernel headers, but it does build with the code aurora kernel headers. X won't start when you tell it to use the driver. I suspect this is because I built the driver against a different kernel then the one the system is booting on. I have not been able to get the code aurora kernel to boot yet, but I'm working on it to see if X will start with this driver and the CA kernel.
Also, I've uploaded the kernel I've been using to my blog. In case someone wants to play with this, but doesn't want to build a kernel.
http://irregular-expression.com/tmp/zImage

Can anyone post any vids for this?
Would love to have a look at this and then maybe i'll have a try at it afterwards

No videos yet.. I've got some snapshots of X running though.
http://picasaweb.google.com/JairunCaloth/Debian?feat=directlink

jairuncaloth said:
No videos yet.. I've got some snapshots of X running though.
http://picasaweb.google.com/JairunCaloth/Debian?feat=directlink
Click to expand...
Click to collapse
Thank you for the pictures, it really feels good to see this kind of progress being made. I can not wait to try this out!

looks interesting, but scary to a new guy like me..im sure i will try it though..continue the work on streamlining the process !

so how is this running? by that i mean is everything running smooth/snappy?
looks good by the way, i may try this out

JHaste said:
so how is this running? by that i mean is everything running smooth/snappy?
looks good by the way, i may try this out
Click to expand...
Click to collapse
It's fast enough for you old man!
Really though, it runs pretty smoothly. Once we work out the kinks it could even be pretty nice.

One thing you could do, if you don't mind nuking the recovery partition, is flash your debian boot image to recovery -- then you can reboot into debian with "reboot recovery" from an android root shell, or by entering the bootloader and selecting recovery.

it will be great if it is more simple.

@jairuncaloth
I love the pics man!!!
I just came up with another question with running Debian, is there any software to still make phone calls through your cell provider? Or do you just have to reboot back into android?

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

[SOURCE] sgdisk and gptfdisk for android

Well for today here is the next part of the puzzle. My recovery uses sgdisk over parted - well why? because its newer, it is scriptable from the shell, and does not have annoying msftres tags on my partitions and whats more because I can
Build a static sgdisk so that we can manipulate GPT partitions on the Nook
via a script
- check the existing parted - its not OK, scripted does not work
- try updated parted-3.1 - I am not able to build a fully static executable,
but the program works fine for manipulating Nook partitions on the PC
# This is an approximate record of how I built sgdisk for
# my android recovery disk
# I used fedora 15 for arm running on a sheevaplug
# I suppose you could at a pinch do this even on debian or arch or ubuntu on a qemu too but I dont know how
# most of the following commands are cut and pasted from my bash history
# so you may need to read between the lines to get the directories etc
# also note that the sheevaplug is using soft float while arm7 on android
# is usually hard float
2 How I did it
started with
rpm -ivh gptfdisk-0.8.4-1.src.rpm
rpm -ivh util-linux-2.21.1-1.fc17.src.rpm
rpm -ivh popt-1.13-10.fc17.src.rpm
get those sources from fedora-17
rpmbuild -bp --nodeps popt.spec
rpmbuild -bp --nodeps util-linux.spec
rpmbuild -bp --nodeps gptfdisk-0.8.4.spec
cd ../BUILD/popt-1.13/
./configure --help
./configure
sudo yum --disablerepo=\* --enablerepo=lf15 --enablerepo=sf15 install gettext-devel
./configure
make
ls -latr
cp .libs/libpopt.a ../gptfdisk-0.8.4/
cd ../util-linux-2.21.1/
./configure
./configure --without-ncurses
cd libuuid/
make
cp src/.libs/libuuid.a ../../gptfdisk-0.8.4/
cd ../../gptfdisk-0.8.4/
vim Makefile
# I will generate a diff for this bit
sudo yum --disablerepo=\* --enablerepo=lf15 --enablerepo=sf15 install libuuid-devel
sudo yum --disablerepo=\* --enablerepo=lf15 --enablerepo=sf15 install libstdc++ libstdc++-static
sudo yum --disablerepo=\* --enablerepo=lf15 --enablerepo=sf15 install popt-devel
make clean
make gdisk sgdisk
ldd gdisk sgdisk
file sgdisk gdisk
and bang my static binaries!
THIS WORKS FOR ME, TEST IT OUT ON EMPTY USBDISKS and sparse files first
The challenge for the next guy working on this is to use ndk to build so that we can eliminate the fat static glibc & lbstdc++ from fedora 1.5MB binaries are OK for the Nook but for other devices it may be too much
http://dl.dropbox.com/u/64885133/android-recovery-disk-sgdisk.tar.bz2
Sweet man!!! Thank you so much, this will come in handy a lot.
Used these before an all praise to the op, but the db link is not working. Use http://d-h.st/users/meghd00t/?fld_id=5334#files
Don't need to be a genius to follow OPs files, but wanted to point out. Need gdisk as busybox fdisk never seems to work for me.
Thanks for making this.
Using it on the nexus 5 and used it before on the SIII i9300
Any chance to re-upload this gdisk and sgdisk static binary ?
To my surprise, finding binary of gdisk and sgdisk for Android on Internet seems to be pretty difficult. Is it possible to re-upload it, so that I can proceed with resurecting my (still rocking) Nexus 7 ?
wangdaning said:
Used these before an all praise to the op, but the db link is not working. Use http://devhost.xda-developers.com/users/meghd00t/?fld_id=5334#files
Don't need to be a genius to follow OPs files, but wanted to point out. Need gdisk as busybox fdisk never seems to work for me.
Thanks for making this.
Using it on the nexus 5 and used it before on the SIII i9300
Click to expand...
Click to collapse
@wangdaning - please provide Android binary for gdisk (sgdisk) utility.
burlik said:
@wangdaning - please provide Android binary for gdisk (sgdisk) utility.
Click to expand...
Click to collapse
Internet is bad, cannot attach to xda. I uploaded them to github here:
https://github.com/wangdaning/Static-Disk-Tools
The files are from 2012 and I have not used them for ages. I now you need to put them in the /xbin or /sbin directory and change permissions, but I cannot remember exactly.

[Q] USB networking. I want to VNC over usb from Ubuntu 12.04,[ working over wifi]

Well the script should be working, it is 'ettin.sh' now. To get VNC to work on separate device just change 'eth0' to 'wlan0' or whatever other interface you know how to configure, like usb maybe, in the 'init.sh' script that resides in ~/ on the images you can download from http://linuxonandroid.org/downloads/. Cool. If anyone can help with the usb configuring that would be cool.
Also on the different roms your storage might be different so just change that to what suites your environment,
BAD NEWS, After my first launch and exiting the VNC on my laptop (Ubuntu) My phones home button and a few other functions stopped working, a reboot remounts the root and system partitions and it goes back to normal essentially, I haven't noticed any adverse affects after the reboot.
Good luck.
EDIT: If you can't help me, you probably shouldn't attempt any of this.
I want to connect to backtrack over usb from Ubuntu on my laptop instead of from my phone. Is there a good way of doing this?
The thing is, I didn't chroot, I mounted the image, copied the contents of '/etc/*' and '/sbin/*' to the '*/etc' '*/sbin' dirs of the mounted image. and then mounted it's (the image's) contents to Androids rootfs '/' then I set up a little script to set up the environment and execute '/bin/bash -i init.sh' and again reset PATH to include /system/*.
Then in the init.sh script I want to set up a way to 'vnc' through' usb to backt4acks desktop. How would I do this?
EDIT: I started this script blelow, its not complete, feel free to use it however you like.
If anyone is good with bash I need help with loops in Bash or shell, ksh, or ash. So if you change it at all share those changes here. I haven't tested any of the loops, I wrote this here and need to do some reading on shell scripting, peace out.
Just NOTE that I would not execute this script yet, it is NOT YET COMPLETE.
I will be making minor changes as I learn and test things out, Also this was inspired by the autobootscrip (sp?) that the Linux on Android Installer app uses.
mintberrycrunch revision
I need a little help with the mounting part, "is there anybody out there?"
EDIT: Maybe escape '\' characters...
Maybe this will work? 'if [ ! -d "/$d" -a "$d" \!= "dev" -o "$d \!= "mnt" ]; then ' I want it to test whether the directory does not already exists in / and if it is not named dev or named mnt then mount it. Do you think this is a decent way to do it? Any suggestions?
Sorry, I still haven't tested this script yet, so if you brave and see any changes that will make it work I am not resposible. But it is getting close to when I will run it for the first time. The difference between this and the one I wrote for Kali is this should be a one stop shop so to speak for getting into a non chroot enviroment where you can access Bt's tools from Android directly. Apperently about a year ago someone was trying something similar called "debian installer" or something, I haven't tried it out so maybe that actually works, idk, I am happy with this.
LOL
LMFAO!
I just realized I don't think I needed to worry about testing if the variable $d was named 'dev' or 'mnt' because they should get skipped by already being mounted. If not I guess if it works as is, may be extra precaution.
Done! Almost ;{)-
Uhmm.... hope you can see the screenshot...
its over wifi though, I had to edit the init.sh script just eth0 to wlan0 in 2 lines, duh! where is eth0 on phone?
Check out the filesystem
Bada bing, bada doom, dare ya goes`a for ya.
V-0.021
This should support args, if your using different image or location such as external sdcard or want to mount to a different location
Notes: 'ettin.sh' [/IMAGE/LOCATION] [IMAGENAME] [MOUNT/POINT]'
1) Don't add a trailing forward slash for image location, the first argument. Doing so may conflict with the script.
2) Don't add suffix to image name ( second argument), the script uses a wild card period wild card syntax to account for .iso, .raw, or .img aswell as version numbers, so if its backtrack-v-r5.img all you need is 'backtrack'.
3) Default mount is "/data/local/mnt"
for example:
Code:
ettin.sh /storage/extSdCard/ubuntufolder ubuntu /mnt/myLinux
That ^^^ will use a ubuntu image on the external sdcard and mount it to a folder called "myLinux" within the "/mnt" directory.
The script below...
Code:
#!/system/bin/sh
# ettin.sh v-0.021, "Two heads are better than one."
# Written by 'Edge-Case' @ 'forum.xda-developers.com'
# This version is attempting to use symbolic linking to correct some issues.
## The purpose of ettin.sh is to merge a Linux system with Android
## hopefully allowing both systems to run in synch with each other.
## It is probably best to be ran on devices with multi-core processors.
##"""Notes on Backtrack and Kali Linux Distributions:
##"""1) Postgresql needs to be configured in order for metasploit to connect to
##""" the database. This might be possible within the script. Perhaps
##""" it is simply a matter of configuring SSH? I don't know.
##"""2) The Kernel needs to be patched to allow for packet injection and
##""" monitor mode for an external 'wi-fi' card as the factory hardware
##""" does not support monitor mode, at least on Samsung Galaxy SIII.
#########
# Prep ##
#########
mount -wo remount systemfs /system
mount -wo remount rootfs /
imloc=${1:-"/storage/sdcard0/backtrack"}
imname=${2:-"backtrack"}
subset=${3:-"/data/local/mnt"}
#Check for root!
if [ ! -d "$subset" ]; then mkdir "$subset"; fi
busybox mount -wo loop ${imloc}*/${imname}*.* ${subset}
check_mnt="`echo $?`"
if [ ${check_mnt} != 0 ]; then echo "Something is wrong with mounting, check the situation!" && exit; fi
##################################################
# Copy contents of special directories to image ##
##################################################
if [ ! -f "${imloc}/success.txt" ] ; then cp -ai /sbin/* ${subset}/sbin && echo "Files have been copied on `date`." > ${imloc}/success.txt; fi
if [ -e "/root/*" ]; then cp ai /root/* ${subset}/root; fi
######################################################
# Make directories needed and mount the file-system ##
######################################################
cd ${subset}
for d in `ls` ; do if [ ! -d "/${d}" ] ; then mkdir /${d} && busybox mount --rbind ${subset}/${d} /${d} ; fi ; done
busybox mount --rbind ${subset}/root /root
busybox mount --rbind ${subset}/sbin /sbin
busybox cp -rspi ${subset}/etc/* /etc # We'll try making symbolic links from the image to Android's /etc instead.
# Add any directories as needed.
###############################
# be safe before we continue ##
###############################
mount -ro remount systemfs /system
mount -ro remount rootfs /
######################################
# continue building the environment ##
######################################
export PATH="/system/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/system/xbin:/usr/games"
export TERM=linux
export HOME="/root"
#################################
# further down the rabbit hole ##
#################################
/bin/bash -i ~/init.sh
Pretty happy with it now, so far. Touch FIXED
Well, I am tethered from my phone to my laptop, running ubuntu, this is how I am on the internet, so my phone is doing that...
I ran 'ettin.sh /storage/sdcard0/ubuntu ubuntu' using V-0.022 and only had two files that needed overwriting.
The touch is working....check
adb is working...check
Everything is mounted ...check
Apps like browser and dsploit are working on the phone as usual...check
'apt-get update && apt-get upgrade'....check (over adb, no chroot, as [email protected] using bin/bash)
'which nmap' .....check ("
[email protected]:~# which nmap
/usr/bin/nmap
")
Well **** ya'll looks like this might work... I am now going to consider modifying a stock rom to support users and login that meshes with debian and its "shadow" file etc etc, also I need to work out permissions and enviroment variables...
I'm happy...
Also for pentesting distro's "modifying Android kernel" tutorials would be nice, anybody able to point me to one?

Mounting of ext4 formated sd card

This is a (relatively) simple method how to enable ext4 mounting on P5210 with stock, rooted ROM. It should work with any non-stock ROM as well, but it looks like stock is only available for now.
There are two options, fast & easy one and long one.
Fast & easy method
This method involves replacing vold binary with precompiled one. That's usually bad idea as I tested it only on my machines and althought it shouldn't cause any problems in theory, there is no guarantee it will not kill you while sleeping. But, it fast and should work.
So, what to do:
Do backup
Do another backup
Grab vold.ext4support.tar.gz and extract it somewhere
Copy extracted vold binary to device (you can use ADB - adb push vold /storage/sdcard0/)
Open adb shell and mount /system for writing. That's :
$ adb shell
$ su
# mount -o remount,rw none /system/
Create backup of your current vold binary - # cp /system/bin/vold /system/bin/vold.bak
Replace vold binary with one from tarball - # rm /system/bin/vold && cp /storage/sdcard0/vold /system/bin/vold
Make it executable - # chmod 755 /system/bin/vold
Reboot your device.
Now, if everything went fine, you should be able to insert ext4-formated sdcard and get it mounted normaly. Note that sdcardfs will be used to emulate "android-compatibile" filesystem, so user rights are going to be ignored. If you need filesystem with unix rights (for linux in chroot for example), ext4 is mounted to /mnt/obb/extsdcard
If you'r device fails to start (gets stuck on boot screen), just use adb shell to mount /system for writing once again and replace /system/bin/vold with backup you have created in step 6. Or use backups from steps 1-2.
Long method
... invoves compiling android from the source. For real. Because... Why not
Ok, this is for anyone who want's to know what is he putting on his machine or just doesn't believe in random binaries from random guy from internet (and that's actually good way of thinking)
Follow AOSP manual to download Android source code
Follow next part of AOSP manual to build source code, BUT:
Use full_x86 as target
Apply this patch to get vold with ext4 support compilled. Or port your own, from this Cyanogen mod changeset
Compile everything or just vold
Copy your own vold binary from out/target/product/generic_x86/system/bin using Fast method
You can debug everything important here using logcat| grep Vold from Android or, better, adb logcat|egrep "(Vold|DirectVolume|MountService)" from Linux.
Good luck and as usual, I'm not responsible for anything and good at hiding

[DEV][Tools] simg2img and make_ext4fs binaries for mac OS X

Not really a whole lot to describe here. simg2img and make_ext4fs are both linux binaries that are used to unpack / mount / repack system.img from a stock tar.md5 rom. Quite useful.
I get curious as to how much development stuff I can do with OS X from time to time, as, though they are not twins by any means, linux and darwin are definitely cousins. Obviously the simg2img and make_ext4fs binaries in their normal state won't work on any darwin system (os x), however, they ARE unix binaries, and darwin is well... unix
So I downloaded the source code and compiled natively on OS X using xcode / gcc. When compile is done (didn't take long) dropped in /bin and.. viola! Works perfectly.
For those who want a tutorial on how to use these binaries, check here.
To mount sys.raw:
install either macports or homebrew. Then:
Macports: $ sudo port install ext4fuse
Homebrew: $ brew install ext4fuse
After which, cd to the directory you created sys.raw using simg2img.
$ mkdir sys
then, mount with:
$ ext4fuse sys.raw sys
and viola! it's now mounted and you can do what you will with /system
Download links:
simg2img: download
make_ext4fs: download
Homebrew: OS X package manager
just added instructions for mounting sys.raw
To all who do anything development related on Mac OS X / Darwin; let me know if there's any other linux binaries you'd like ported, I feel like doing some more cross-compiling but I can't think of a project.
So awesome
This is awesome. Awesome, awesome, awesome. I just wish there was a better collection of tools because I tried everything (on my Mac), with every single other OS available, just to open a stock Galaxy Note 4 image.
Just one thing though ...
I mounted 'sys' and I don't know what happened but suddenly it unmounted and now the 'sys' folder has disappeared from view ... though I can still see it if I "ls" in its parent directory.
So I tried to 'mkdir sys' again, it says it can't. It also says that "'sys' is taken" if I try to recreate the folder ... I can create a different folder with a different name, but 'sys' is a weird hidden directory now that I can only see in the terminal/shell.
...
Guess I'll reboot.
Rebooting solved the problem and stopped whatever mounting process had been started. But it keeps happening and I can't figure out a way to kill the mount/unmount without restarting my whole Mac ... hmmm ...
Hi there,
great tool for us on OS X, however when I try to build the android image from mounted folder I get this:
can't set android permissions - built without android support
any solution?

Categories

Resources