Gentoo on HTC Desire
Prerequisites:
Rooted Desire
Any flavour of Linux (Live or installed)
Code:
A decent sized MicroSD card (>2Gb recommended)
MicroSD USB adapter (or SD card reader and adapter)
Some knowledge of Linux command line and Gentoo is recommended
Patience...
Things you should know first:
This is NOT a fully independent Linux - it runs parallel to Android inside a chroot environment
Some applications can be very slow until they are compiled properly for the Desire hardware
Compilation with a 1GHz single core CPU is slow
You can run just about any Linux program; X programs and desktop environments can be used via VNC
Many custom ROMs and kernels do not include swap support for performance reasons, and so if you require swap you may need to compile your own kernel (I will upload my custom kernel at a later date)
Due to Android security settings, only root can use the network. This causes some problems as anything that requires network access must run as root (again, if anyone has any insight for a way around this, please contact me)
Some ROMs underclock the CPU when the screen is off - this will lead to VERY long compilation times if you leave your phone like that
Step one - Prepare MicroSD
To install Gentoo you will need an ext2, 3, or 4 filesystem on your MicroSD card. This can be done two ways: partitioning your card (recommended), or by creating a file and creating the filesystem within that (not covered here).
Start up GParted (or something similar) on your computer and insert your MicroSD card; if your card is fully allocated, you will need to shrink the existing partition(s) first (back up your data! This can go wrong...) and leave a space at the end of the card for your new partition. The absolute minimum I would recommend to dedicate to Gentoo would be 1GB, but that doesn’t give you much wiggle room and you will have a very hard time compiling anything big (like GCC); I would recommend making the partition >2GB. Make sure you create the Gentoo partition at the end of the card.
Note:
APP2SD+ requires its own partition - if you have it enabled, you must have at least three partitions, with the second partition on the card dedicated to it and the third for Gentoo.
Due to the large number of files in the Portage tree, small partitions can sometimes run out of inodes. You can get around this by decreasing the size of the inodes and blocks, and therefore creating more:
Code:
~ $ sudo mkfs.ext3 /dev/(partition) -i 2048 -b 2048
Step two - install base system:
Download the latest stage 3 tarball for armv7a-unknown-linux-gnueabi from the Gentoo mirror closest to you (Google "Gentoo Mirrors", I can't post links yet..), mount the Gentoo partition and extract the contents of the tarball to it.
Example:
Code:
~ $ wget (your selected mirror)/linux/gentoo/releases/arm/autobuilds/current-stage3/armv7a-unknown-linux-gnueabi/stage3-armv7a-20100917.tar.bz2
~ $ sudo mkdir /mnt/sd
~ $ sudo mount /dev/(partition) /mnt/sd
~ $ sudo tar xjvfp stage3-armv7a-20100917.tar.bz2 -C /mnt/sd/
Download the latest portage snapshot (from the Gentoo mirror) and extract:
Code:
~ $ wget (your selected mirror)/linux/gentoo/snapshots/portage-latest.tar.bz2
~ $ sudo tar xjvf portage-latest.tar.bz2 -C /mnt/sd/usr/
Now modify the make.conf file using your favourite text editor:
Code:
~ $ sudo nano /mnt/sd/etc/make.conf
Sample make.conf:
Code:
CFLAGS="-march=armv7-a -mtune=cortex-a8 -mfpu=vfpv3 -O2" # if anyone has any suggestions to improving these, please let me know
CXXFLAGS=${CFLAGS}
CHOST="armv7a-unknown-linux-gnueabi"
USE="unicode X -gnome -kde -firefox wifi syslog -udev -mdev -wifi -gpm threads nptl networking wxwidgets -ipv6 sqlite jpeg png dbus" # Have a look at the Gentoo USE flag description page on the web for others you may want/don't want
VIDEO_CARDS="none"
ALSA_CARDS="none"
INPUT_DEVICES="none"
SYNC="rsync://(your selected mirror)"
GENTOO_MIRRORS="(your selected mirror)"
ACCEPT_LICENSE="*"
MAKEOPTS="-j1"
PORTAGE_NICENESS="19"
AUTOCLEAN="yes"
FEATURES="noman nodoc noinfo -userfetch" # Getting rid of the man, doc and info pages saves a lot of space. Userfetch is disabled due to the issue described above
PORTAGE_RSYNC_EXTRA_OPTS="--exclude ChangeLog" # Again, this saves some space
Edit locale.gen with the locale values you require, e.g.:
Code:
en_US.UTF-8 UTF-8
Unmount your MicroSD card and insert it back into your phone.
Step three - configuring the base system
Using ConnectBot, another terminal emulator app, or adb, connect to the local console and setup the mounts, then enter Gentoo (using busybox as your shell (type "busybox sh") is recommended as the tab completion (trackball + i in connectbot) helps a lot):
Code:
# mkdir /data/gentoo
# mount -t ext3 (or whatever fs you set it to) /dev/block/mmcblk0p3 (change the 3 to whatever partition you need) /data/gentoo
# mount -t proc none /data/gentoo/proc
# mount -o bind /dev /data/gentoo/dev
# mount -t devpts none /dev/pts
# chroot /data/gentoo /bin/bash
# source /etc/profile
Congratulations! You are now inside your own Gentoo environment. If you don't need your phone for a while you can now recompile and update the system (this will take quite a long time and will use a lot of data). This doesn't have to be done now, or at all, but it is highly recommended to do so at some point:
Code:
# emerge -DuNav world
Once that's done (or you don't want to do it), install some base programs:
Code:
# emerge -av screen sudo
If you want VNC, tightvnc is recommended:
Code:
# emege -av tightvnc
Web server:
Code:
#emerge -av nginx
Set a root password:
Code:
# passwd
For some reason running SSHD with IPv6 enabled causes the phone to restart. To fix this, make the following changes to /etc/ssh/sshd_config:
Change:
Code:
#AddressFamily any
To:
Code:
AddressFamily inet
To start SSHD:
Code:
# ssh-keygen -t rsa (save to /etc/ssh/ssh_host_rsa_key with no passkey)
# ssh-keygen -t dsa (save to /etc/ssh/ssh_host_dsa_key with no passkey)
# /usr/sbin/sshd
If your kernel supports swap, it is recommended to create and enable it:
Code:
# dd if=/dev/zero of=/swap bs=10M count=20 (change this to alter the size of the swap file)
# mkswap /swap
# swapon /swap (you will need to run this command with the other mount commands each time you boot)
Boot script:
Start your phone in recovery mode and mount /system using the partitions menu in your recovery ROM, then create a file on your computer with the following contents:
Code:
#!/system/bin/sh
#
# Linux startup script for rooted Android systems
# © Deathisfatal @ forum.xda-developers.com
#
# TODO:
# - Error handling
#
# Edit the following variables as required
HOSTNAME="Android"
LINUX="/data/gentoo/"
BB="/system/xbin/busybox"
CHROOT="${BB} chroot ${LINUX}"
ROOT="/dev/block/mmcblk0p3"
SWAP="/swap"
${BB} mount -o noatime -t ext3 ${ROOT} ${LINUX} # Edit -t as required by your filesystem
${BB} mount -o bind /dev ${LINUX}dev
${CHROOT} /bin/mkdir /dev/shm
${CHROOT} /bin/mount -t tmpfs -o size=32m none /dev/shm
${CHROOT} /bin/mkdir /dev/fd
${BB} /bin/mount -o bind /proc/self/fd /dev/fd
${CHROOT} /bin/mount -t devpts none /dev/pts
${BB} mount -t proc none ${LINUX}proc
${CHROOT} /sbin/swapon ${SWAP}
${CHROOT} /bin/mount -t tmpfs -o size=32m none /tmp
${CHROOT} /bin/mkdir /tmp/run
${CHROOT} /bin/mkdir /tmp/run/portage
${CHROOT} /bin/touch /tmp/run/utmp
${CHROOT} /bin/chmod 777 -R /tmp
${BB} mount -o bind /data ${LINUX}mnt/data
${BB} mount -o bind /sdcard ${LINUX}mnt/sd
${CHROOT} /bin/hostname ${HOSTNAME}
# Uncomment the following line to enable sshd on boot
#${CHROOT} /usr/sbin/sshd
Connect your phone and computer with the USB cable, then use the following command on your computer:
Code:
~ $ adb push (File you created earlier) /system/etc/init.d/05linux
~ $ adb shell chmod 755 /system/etc/init.d/05linux
Now reboot your phone and your Gentoo partition should automatically mount.
Notes:
If you restart your phone, you will need to issue the necessary mount commands as you did earlier until I (or someone else) get around to making a proper script that runs at boot time
For information on how to set up programs and servers on Gentoo visit the Gentoo wiki
Please contact me or post here with any questions you may have regarding this
Changelog:
Updated CFLAGS and bootscript
Thanks to sfjuocekr for his/her contributions.
Thanks for this tutorial, Gentoo is my favourite Linux distro and it's great to know someone's got it running on the Desire
I don't think I've got the patience to try it on my phone though, all the compiling must take ages. I wonder whether it's possible to cross-compile...
F****ING AWESOME DUDE!
go to try in today =)
gentoo rulez!
koider said:
Thanks for this tutorial, Gentoo is my favourite Linux distro and it's great to know someone's got it running on the Desire
I don't think I've got the patience to try it on my phone though, all the compiling must take ages. I wonder whether it's possible to cross-compile...
Click to expand...
Click to collapse
DistCC
http://distcc.samba.org/
I have the same issue with openssh-server crashing my Nexus One (running Ubuntu 10.04 on CM6) too. I would love to figure out how to fix it.
Restored OP to state before server crashes - changed CFLAGS and added a boot script.
EDIT: I have solved the mystery of the SSHD crash!! It's to do with IPv6 - OP updated.
Deathisfatal said:
Restored OP to state before server crashes - changed CFLAGS and added a boot script.
EDIT: I have solved the mystery of the SSHD crash!! It's to do with IPv6 - OP updated.
Click to expand...
Click to collapse
Sweet. That solved my problem with sshd on chrooted Ubuntu on CM6 on my Nexus One! Thanks!
You should do a emerge -e world to recompile the whole tree after first boot.
This will make sure all your packages are compiled with correct CFLAGS etc.
Please delete me!
Solution found myself.
Code:
CFLAGS="-march=armv7-a -mtune=cortex-a8 -mfpu=vfpv3 -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"
CHOST="armv7a-unknown-linux-gnueabi"
USE="minimal unicode -X -gnome -kde -firefox -wifi syslog -udev -mdev threads nptl -ipv6 sqlite jpeg png dbus -gpm ssh"
VIDEO_CARDS="none"
ALSA_CARDS="none"
INPUT_DEVICES="none"
ACCEPT_LICENSE="*"
MAKEOPTS="-j1"
FEATURES="noman nodoc noinfo -userfetch"
PORTAGE_RSYNC_EXTRA_OPTS="--exclude ChangeLog"
AUTOCLEAN="yes"
LINGUAS="en"
PORTAGE_NICENESS="19"
I use this make.conf for Gentoo on my Desire.
Firstly NEVER globally allow keywords, this is bad. Do this for the specific programs you need, you can use /etc/portage and mask/unmask packages you actually need unmasked.
Set MAKEOPTS to -j1 instead of 2, helps keeping the system usable while emerging together with PORTAGE_NICENESS at 19.
I have left X etc all out of the global USE flags to save space, again use /etc/portage to set specific USE flags for packages that need them. This will save alot of space, because there are lots of packages with X support you will never need usualy.
I'm not entirely sure about leaving wifi and mdev away, but wifi is handled by Android itself and mdev should be too.
Then in the startup-script there was a minor mistake bind mounting /dev/fd, this is the modified script:
Code:
#!/system/bin/sh
#
# Linux startup script for rooted Android systems
# © Deathisfatal @ forum.xda-developers.com
#
# TODO:
# - Error handling
#
# Edit the following variables as required
HOSTNAME="UGH-GSM"
LINUX="/data/gentoo/"
BB="/system/xbin/busybox"
CHROOT="${BB} chroot ${LINUX}"
ROOT="/dev/block/mmcblk0p2"
#SWAP="/swap"
${BB} mount -o noatime -t ext3 ${ROOT} ${LINUX}
${BB} mount -o bind /dev ${LINUX}dev
${CHROOT} /bin/mkdir /dev/shm
${CHROOT} /bin/mount -t tmpfs -o size=32m none /dev/shm
${CHROOT} /bin/mkdir /dev/fd
${BB} mount -o bind /proc/self/fd /dev/fd
${CHROOT} /bin/mount -t devpts none /dev/pts
${BB} mount -t proc none ${LINUX}proc
#${CHROOT} /sbin/swapon ${SWAP}
${CHROOT} /bin/mount -t tmpfs -o size=32m none /tmp
${CHROOT} /bin/mkdir /tmp/run
${CHROOT} /bin/mkdir /tmp/run/portage
${CHROOT} /bin/touch /tmp/run/utmp
${CHROOT} /bin/chmod 777 -R /tmp
${CHROOT} /bin/mkdir /mnt/data
${CHROOT} /bin/mkdir /mnt/sdcard
${BB} mount -o bind /data ${LINUX}mnt/data
${BB} mount -o bind /sdcard ${LINUX}mnt/sdcard
${CHROOT} /bin/hostname ${HOSTNAME}
# Uncomment the following line to enable sshd on boot
#${CHROOT} /usr/sbin/sshd
And yea some error handling should be added to check if a directory exists yes or no, but not really important.
If I make more changes, I'll make notice here in the forums. If you have other general Gentoo questions, please ask I have been working with Gentoo since 2001 But it is a really trial and error distribution, you HAVE to be self capable to fix problems that will arise ... they WILL arise
And again, leave
ACCEPT_KEYWORDS="~arm ~*" # Many useful packages are masked for arm with ~*
out of your makefile. Do it in /etc/portage when needed.
Don't use -O3 and -Os together, this actually GROWS ... same with using mcpu with march doesn't work just use march and mtune. -O2 is recommended.
http://www.gentoo.org/doc/en/gcc-optimization.xml
Also make sure you emerge linux-headers first so it ends up in world.
Usualy emerging a kernel makes sure headers are in place, but in this chrooted enviroment it isn't and might be cleaned with depclean or revdep-rebuild. Not sure why tho, because it should be in system already :s
This is a very interesting development! Thanks to everyone who made it possible.
Has anyone so far been able to run an Xserver / WM / DE yet?
Would love to see some screenshots of this in action..
sfjuocekr said:
Code:
CFLAGS="-march=armv7-a -mtune=cortex-a8 -mfpu=vfpv3 -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"
CHOST="armv7a-unknown-linux-gnueabi"
USE="minimal unicode -X -gnome -kde -firefox -wifi syslog -udev -mdev threads nptl -ipv6 sqlite jpeg png dbus -gpm ssh"
VIDEO_CARDS="none"
ALSA_CARDS="none"
INPUT_DEVICES="none"
ACCEPT_LICENSE="*"
MAKEOPTS="-j1"
FEATURES="noman nodoc noinfo -userfetch"
PORTAGE_RSYNC_EXTRA_OPTS="--exclude ChangeLog"
AUTOCLEAN="yes"
LINGUAS="en"
PORTAGE_NICENESS="19"
I use this make.conf for Gentoo on my Desire.
Firstly NEVER globally allow keywords, this is bad. Do this for the specific programs you need, you can use /etc/portage and mask/unmask packages you actually need unmasked.
Set MAKEOPTS to -j1 instead of 2, helps keeping the system usable while emerging together with PORTAGE_NICENESS at 19.
I have left X etc all out of the global USE flags to save space, again use /etc/portage to set specific USE flags for packages that need them. This will save alot of space, because there are lots of packages with X support you will never need usualy.
I'm not entirely sure about leaving wifi and mdev away, but wifi is handled by Android itself and mdev should be too.
Then in the startup-script there was a minor mistake bind mounting /dev/fd, this is the modified script:
Code:
#!/system/bin/sh
#
# Linux startup script for rooted Android systems
# © Deathisfatal @ forum.xda-developers.com
#
# TODO:
# - Error handling
#
# Edit the following variables as required
HOSTNAME="UGH-GSM"
LINUX="/data/gentoo/"
BB="/system/xbin/busybox"
CHROOT="${BB} chroot ${LINUX}"
ROOT="/dev/block/mmcblk0p2"
#SWAP="/swap"
${BB} mount -o noatime -t ext3 ${ROOT} ${LINUX}
${BB} mount -o bind /dev ${LINUX}dev
${CHROOT} /bin/mkdir /dev/shm
${CHROOT} /bin/mount -t tmpfs -o size=32m none /dev/shm
${CHROOT} /bin/mkdir /dev/fd
${BB} mount -o bind /proc/self/fd /dev/fd
${CHROOT} /bin/mount -t devpts none /dev/pts
${BB} mount -t proc none ${LINUX}proc
#${CHROOT} /sbin/swapon ${SWAP}
${CHROOT} /bin/mount -t tmpfs -o size=32m none /tmp
${CHROOT} /bin/mkdir /tmp/run
${CHROOT} /bin/mkdir /tmp/run/portage
${CHROOT} /bin/touch /tmp/run/utmp
${CHROOT} /bin/chmod 777 -R /tmp
${CHROOT} /bin/mkdir /mnt/data
${CHROOT} /bin/mkdir /mnt/sdcard
${BB} mount -o bind /data ${LINUX}mnt/data
${BB} mount -o bind /sdcard ${LINUX}mnt/sdcard
${CHROOT} /bin/hostname ${HOSTNAME}
# Uncomment the following line to enable sshd on boot
#${CHROOT} /usr/sbin/sshd
And yea some error handling should be added to check if a directory exists yes or no, but not really important.
If I make more changes, I'll make notice here in the forums. If you have other general Gentoo questions, please ask I have been working with Gentoo since 2001 But it is a really trial and error distribution, you HAVE to be self capable to fix problems that will arise ... they WILL arise
And again, leave
ACCEPT_KEYWORDS="~arm ~*" # Many useful packages are masked for arm with ~*
out of your makefile. Do it in /etc/portage when needed.
Don't use -O3 and -Os together, this actually GROWS ... same with using mcpu with march doesn't work just use march and mtune. -O2 is recommended.
http://www.gentoo.org/doc/en/gcc-optimization.xml
Click to expand...
Click to collapse
Thanks very much for your insight! I'll change the tutorial with your suggestions when I'm at a computer later on.
I originally just had -Os for optimization but someone suggested using it with -O3, but their post got lost with the server crash. I've only been using Gentoo for a year now so I'll bow to your wisdom!
I have tightvnc setup along with openbox, so I'll post a couple of screenshots later on too.
EDIT: Is there any benefit to having -mfpu=neon? Or is vfpv3 superior?
Sent from my HTC Desire using XDA App
I'm currently working on getting Gentoo running natively with the S-OFF hack. At the moment I have it booting up, connecting to wifi and starting sshd, but X is a hassle. If anyone wants to collaborate on the project send me a message or post here; any help would be greatly appreciated!
Respect!
Deathisfatal said:
I'm currently working on getting Gentoo running natively with the S-OFF hack. At the moment I have it booting up, connecting to wifi and starting sshd, but X is a hassle. If anyone wants to collaborate on the project send me a message or post here; any help would be greatly appreciated!
Click to expand...
Click to collapse
Massive project! I'm impressed.
I wish I had any skill to be able to support you.
Deathisfatal said:
Thanks very much for your insight! I'll change the tutorial with your suggestions when I'm at a computer later on.
I originally just had -Os for optimization but someone suggested using it with -O3, but their post got lost with the server crash. I've only been using Gentoo for a year now so I'll bow to your wisdom!
I have tightvnc setup along with openbox, so I'll post a couple of screenshots later on too.
EDIT: Is there any benefit to having -mfpu=neon? Or is vfpv3 superior?
Sent from my HTC Desire using XDA App
Click to expand...
Click to collapse
Don't know for sure. I could try compile against neon to see if there is a speed increase. But to my knowledge neon instructions are already used or might only be use with vfpf3-d32.
Once I get my own box up and running again, I'll try it out. Compiling GCC without DISTCC is a horror!
Sorry about the lack of updates to the thread - I've been pretty busy at uni lately. I'm currently having a lot of issues with X11 segfaulting randomly so I'll post pictures once I have that back up and running. When X decides to work, the whole interface works nicely - touch support via tslib is great, and fbdev seems adequate for 2D graphics.
Has anyone had any success with the tutorial I posted?
If anyone's interested, to get Gentoo running natively you need to compile your own kernel with a few changes:
Disable ramdisk support
Enable swap (optional)
Create a boot script that mounts FS's, proc, etc
Disable Android paranoid networking so users other than root can access the net
Then start your phone in fastboot, push your modified kernel to your phone with fastboot with "root=/dev/mmcblk0p3 (or mmcblk0p2) init=(your boot script) rootfs=ext3 rootwait" as the kernel command line.
When I have time I will create a full guide for getting Linux and X running.
Massive project! I'm impressed.
I wish I had any skill to be able to support you.
Click to expand...
Click to collapse
Thanks!
sfjuocekr said:
Once I get my own box up and running again, I'll try it out. Compiling GCC without DISTCC is a horror!
Click to expand...
Click to collapse
Indeed! I left GCC 4.5 compiling for 6 hours, only for it to run out of space and fail...
ANd on v6 CPU?
Thanks for the tutorial, Deathisfatal. I thought this was a great idea, so decided to try it on my HTC Hero (as opposed to Desire).
On the first try, the
chroot /data/gentoo /bin/bash
command failed with an "illegal instruction" error. I figured my processor must be an earlier one in the ARM family than the one for which the bash in the stage 3 tarball had been compiled (v7-a). Sure enough, when I looked in /proc/cpuinfo, the processor turned out to be a v6 - the first line of cpuinfo says
ARMv6-compatible processor rev2 (v6l)
So, I tried again using stage3-armv6j-20101112.tar.bz2 instead of stage3-armv7a-20101114.tar.bz2. This improved things a bit. I could then run the bash shell in the chrooted environment, and cd and ls around the chrooted filesystem.
Unfortunately, attempting to run emerge still failed with an "illegal instruction" error (so did attempting to run tar or wget). At this point, I'm stuck. I guess I still have a stage 3 for the wrong processor variant (and that at some point I'll also have to fiddle with the -march and -mtune options in CFLAGS), but have no idea how to select the right stage 3.
Advice welcome, thanks.
That's quite strange! Perhaps try the armv5tel stage3 tarball. It could be that the armv6 stage3 is compiled for a different FPU than what the Hero has. What does the features line say in /proc/cpuinfo?
Deathisfatal said:
That's quite strange! Perhaps try the armv5tel stage3 tarball. It could be that the armv6 stage3 is compiled for a different FPU than what the Hero has. What does the features line say in /proc/cpuinfo?
Click to expand...
Click to collapse
Thanks. I'll give v5tel a go.
The features line says
swp half thumb fastmult edsp java
spending lots of time with segmentation fault error (chroot)
I success to open up ubuntu GUI on my android
with following site
(first googled site with "cyanogenmod ubuntu")
but fail with other imgs(such as img in nexusonehack)
for now, I am trying to bootup ubuntu 10.10 on my gw620(smart phone whose cpu is ARMv6 Qualcomm MSM7200)
by my self.
with selfmade rootstock img and busybox and chroot
I made img my self withroot stock with following option
rootstock -f kty1104-Notebook -l kty1104 -p 1 --imagesize 2047M --notarball --seed linux-image-omap,lxde,build-essential,openssh-server,tightvncserver,x11-xserver-utils
and change name to ubuntu.img and place to /sdcard/
and apply to bootubuntu.sh
bootubuntu.sh contents is this
===============================================
#!/system/bin/sh
# Original script by Paolo Sammicheli xdatap1
#
# Based on Saurik's remount.sh modified version by Mark Walker of
# URL is here but I can't write url b/c of my account privilege
# Modified version for Cyanogenmod by potoc samdroid
mkdir /mnt/ubuntu
#remount system as read/write
remount rw
export mnt=/mnt/ubuntu
export PATH=/usr/bin:/usr/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
export kit=/sdcard
export loopdev=/dev/block/loop4
losetup $loopdev $kit/ubuntu.img
mount -t ext2 $loopdev $mnt
mount -t devpts devpts $mnt/dev/pts
mount -t proc proc $mnt/proc
mount -t sysfs sysfs $mnt/sys
cat $mnt/root/logo.txt
echo " "
echo "Type EXIT to end session"
echo "Make sure you do a proper EXIT for a clean umount!"
echo " "
echo "Please reboot your device when you finished your work."
chroot $mnt /bin/bash
busybox umount -f /mnt/ubuntu/dev/pts /mnt/ubuntu/proc /mnt/ubuntu/sys /mnt/ubuntu
===============================================
do I need more option for rootstock?
or do I need special sh file for it?
I can mount ubuntu.img with
# mknod -m640 /dev/loop0 b 7 8
losetup /dev/loop0 /sdcard/ubuntu.img
mount -t ext2 /dev/loop0 /mnt/ubuntu
but when it comes to chroot, it sprit [1] segmentation fault chroot ${mnt} /b...#
if there are missing information please let me know, I will write it down
Regards.
Taeyun
I know I musn't revive old threads... but the question and the problem is already set up here.
I'm having the same problem with my HTC Magic 32A. Anybody knows what's up with the segfault?
Thanks!
I've spent a lot of time on this issue too, and as far as I can tell it's because Ubuntu versions over 9.04 (jerking jackalope or whatever idiot name they use) no longer support ARMv6. This means I can't run BT5, which is based on 10.x, but I believe Debian still supports v6.
This how-to describes how to bootstrap and configure Optware-ng. Optware-ng is my Optware firmware-independent fork. This allows to install numerous pre-compiled packages.
Lists of available packages can be found here:
ARMv7 hardfloat
Intel
ARMv7 softfloat
And the project home is currently here:
https://github.com/alllexx88/Optware-ng
Some packages may not work, since not all of them are compatible with android, but most will. There're some pre-requisites you must satisfy before you can proceed:
1. You must be rooted
2. Optware-ng relies on some standard linux commands, the easiest way to make sure you have them is to install Busybox with all the links
3. We'll create Optware-ng initialization script in /system/etc/init.d, so init.d support is needed. If you don't have it, you can either add it (google for how-tos on doing this) or edit your init.rc android startup script to include Optware-ng initialization lines (though adding init.d support is still a better idea)
The following commands should be issued from terminal as root. I suggest you use some SSH server available on the Play Store, and connect via SSH from you PC.
1. This prepares needed environment:
- Optware-ng will be installed to /data/Optware-ng with /opt symlinked to it
- Optware-ng scripts rely on /bin/sh, so we symlink it to /system/bin/sh
- Optware-ng needs /tmp temp dir: we create 64Mb RAM disk there (you may adjust the size if you like)
Code:
mkdir -p /data/Optware-ng
mount -o remount,rw /
ln -s /data/Optware-ng /opt
mkdir /bin
ln -s /system/bin/sh /bin/sh
mkdir /tmp
chmod 777 /tmp
mount -t tmpfs -o size=64M tmpfs /tmp
mount -o remount,ro /
export PATH=$PATH:/opt/bin:/opt/sbin
2. This bootstraps the feed:
2.a) for ARMv7 hardfloat (most modern android devices):
Code:
cd /tmp
wget http://optware-ng.zyxmon.org/buildroot-armeabihf/buildroot-armeabihf-bootstrap.sh
sh buildroot-armeabihf-bootstrap.sh
2.b) for Intel:
Code:
cd /tmp
wget http://optware-ng.zyxmon.org/buildroot-i686/buildroot-i686-bootstrap.sh
sh buildroot-i686-bootstrap.sh
2.c) for the unlikely case where your device is ARMv7, but lacks FPU (softfloat feed):
Code:
cd /tmp
wget http://optware-ng.zyxmon.org/buildroot-armeabi-ng/buildroot-armeabi-ng-bootstrap.sh
sh buildroot-armeabi-ng-bootstrap.sh
Unless you're using ARMv7 softfloat feed, bootstrapping process may appear to be "stuck" on this:
Configuring glibc-locale
Generating locale-archive with default locales ...
Click to expand...
Click to collapse
Don't be frightened: if your device isn't too powerful, it indeed takes a lot of time, but you have to do this just once, so please be patient.
3. Make sure environment needed for Optware-ng is restored after reboots, and also run Optware-ng startup scripts on boot:
Create init.d startup script and make it executable
Code:
mount -o remount,rw /system
echo '#!/system/bin/sh
mount -o remount,rw /
ln -s /data/Optware-ng /opt
mkdir /bin
ln -s /system/bin/sh /bin/sh
mkdir /tmp
chmod 777 /tmp
mount -t tmpfs -o size=64M tmpfs /tmp
mount -o remount,ro /
sleep 2
export PATH=$PATH:/bin:/opt/bin:/opt/sbin
for script in `ls /opt/etc/init.d/S*`; do
$script start
done' > /system/etc/init.d/S99Optware-ng
chmod 755 /system/etc/init.d/S99Optware-ng
mount -o remount,ro /system
Once again, you may adjust this line
Code:
mount -t tmpfs -o size=64M tmpfs /tmp
if you want greater/lesser RAM disk on /tmp
(4.) You're basically done, but I suggest you now install Optware-ng's dropbear-android package to act as an SSH server:
Code:
ipkg update
ipkg install dropbear-android
dropbear configs are stored in /opt/etc/default/dropbear and by default are:
Code:
DROPBEAR_ENABLE=no
DROPBEAR_PORT=2222
DROPBEAR_PASSWORD=password
Run these commands to adjust configs, enable dropbear and start it:
(replace <*> strings with actual desired values)
Code:
sed -i -e '/^DROPBEAR_PORT=/s/=.*/=<YOUR_PORT>/' -e '/^DROPBEAR_PASSWORD=/s/=.*/=<YOUR_PASSWORD>/' -e '/^DROPBEAR_ENABLE=/s/=.*/=yes/' /opt/etc/default/dropbear
/opt/etc/init.d/S51dropbear start
Now you are advised to use dropbear as SSH server to play with Optware-ng: use 'root' user, '<YOUR_PASSWORD>' password and '<YOUR_PORT>' port
For better security you may use public key authorization only: set password to blank and add your public keys to /opt/etc/dropbear/authorized_keys (don't forget to `chmod 600 /opt/etc/dropbear/authorized_keys` after you create it!) and restart dropbear or just reboot.
P.S. I'm not exactly sure that this is the right place to post this, please move it if needed.