fork download
  1. pabs: do you have any recommand mobel?I wish it won't too dear
  2. pabs maybe in a few years I could recommend something, nothing now. I'd suggest looking at the phones supported by shr (http://s...content-available-to-author-only...t.org/trac/wiki/Devices) and replicant (http://r...content-available-to-author-only...t.us/supported-phones/) in the meantime
  3. This (not) simple guide was originally posted in xda-devs and on irregular-expression.com. If you have ever wanted to show off the power of your N1 as a full-fledged computer, follow these steps to boot Debian from your SD card. I highly recommend you only try this if you know what you’re doing, and if you’ve got a class 4 or better SD card. Class 6 preferred.
  4.  
  5. This is a method to boot into Debian via fastboot on the nexus one from
  6. your SD-card. This is NOT a chroot Debian image, it is honest to goodness
  7. Debian running directly on the hardware. This is completely non destructive to
  8. the android OS. Connectivity to the device can be provided by adbd, ssh, or
  9. serial console. Wifi works perfectly. I have not tested bluetooth. Touchscreen
  10. works, but needs tweaking. X11 works in framebuffer using the Debian
  11. testing branch (squeeze). In order to get a full fledged X driver with
  12. 3D acceleration we'll need the driver from
  13. https://w...content-available-to-author-only...a.org/index.php?xwinp which I haven't been able to get
  14. to build. This doesn't mean it's broken. It just means I suck
  15. at cross compiling.
  16.  
  17. Todo:
  18. -Tweak settings to make X more usable.
  19. -Get the CodeAurora MSM/QSD X driver working.
  20. -Find decent method to input text.
  21. -Test bluetooth
  22. -Look into using the GSM radio.
  23. -Audio
  24. -Figure out how to configure adbd.
  25.  
  26. This how-to pulls heavily from the debian-arm install guide.
  27. http://w...content-available-to-author-only...n.org/releases/stable/arm/index.html.en
  28.  
  29. Requirements:
  30. adb (android-sdk)
  31. fastboot
  32. chroot (on your phone)
  33. sdcard with room for Debian - 2gigs seems to be sufficient for Debian + xfce.
  34. I Had about a gig leftover. For this guide, I'm starting fresh with a 4GB sdcard
  35. that I'm devoting completely to Debian. According to the Debian install guide,
  36. you need at least 32MB of memory and 500MB of hard disk space. The guide
  37. recommends at least 5GB of storage for a comfortable install. But since I'm
  38. using the lighter XFCE4 desktop I haven't had any space issues.
  39. http://w...content-available-to-author-only...n.org/releases/stable/arm/ch03s04.html.en
  40.  
  41. 1. Re size the SD card
  42. (don't forget to backup your data before you go messing with partition tables!!)
  43. (optional) Instead of using a partition on your main SD card, you could
  44. simply use another sdcard and dedicate the entire thing to Debian.
  45. Note: android didn't like me very much when I did this. I put in a
  46. tiny (30MB) vfat partition right at the beginning of the blank sdcard
  47. I mounted the sdcard on my Ubuntu system and used gparted to break
  48. off 2 gigs to use for Debian. Make sure you keep the normal android
  49. sdcard partition as the first partition otherwise android
  50. will not be able to find it.
  51. If you're using apps to SD or anything else like that. Debian should
  52. probably have the last partition. I'm not 100% sure on this since I
  53. don't use my sdcard for anything else.
  54.  
  55. 2. Format the new partition.
  56. ext2 is probably best. (least abusive on the sdcard. ext3 & 4 have
  57. journaling which may be bad for the life of your sdcard)
  58. I used Gparted for this part as well.
  59.  
  60. 3. If you are installing from an Ubuntu or Debian desktop, install debootstrap
  61. $ sudo apt-get install debootstrap
  62. Users of other distros may be able to get debootstrap but I'm not sure.
  63.  
  64. 4. Mount the sdcard on your desktop.
  65. anywhere will do just remember where you put it :-p
  66. ex. mount /dev/sde2 /mnt/android
  67.  
  68. 5. debootstrap
  69. run debootstrap
  70. you can change to a mirror closer to you if you don't want to use the
  71. US mirror - http://w...content-available-to-author-only...n.org/misc/README.mirrors
  72. I'm using the Debian testing release (squeeze). I had issues getting
  73. X11 running in lenny, and have not tested sid.
  74. (lenny is stable, squeeze is testing, and sid is unstable)
  75. http://w...content-available-to-author-only...n.org/releases/
  76.  
  77. debootstrap --arch armel --foreign <release> </path/to/debian> <mirror>
  78. # debootstrap --arch armel --foreign squeeze /mnt/android \
  79.  
  80. http://f...content-available-to-author-only...n.org/debian
  81.  
  82. 6. debootstrap(part2)
  83. Unmount the sdcard from your desktop.
  84. Reboot the phone here since you've been mucking with the sdcard
  85. file system. Android didn't like my sdcard until I did.
  86.  
  87. $ adb shell
  88.  
  89. mount the sdcard somewhere on the android file system.
  90. look in /dev/block for the sdcard.
  91. Typically mmcblk0p# where # is the partition number.
  92. ex. # mount -t ext2 /dev/block/mmcblk0p2 /data/local/mnt
  93.  
  94. chroot/debootstrap
  95.  
  96. # chroot /data/local/mnt/ /debootstrap/debootstrap --second-stage
  97. this will take a while especially if you have a slower sdcard.
  98.  
  99. 6. While that's working, now is a good time to get to work on your kernel
  100. I used the open source android kernel 2.6.29
  101. http://a...content-available-to-author-only...l.org/
  102. Started with mahimahi_defconfig and starting customizing from there.
  103. Things to note.
  104. - file systems - don't forget to add support for whatever file systems
  105. you need. Your root file system support cannot be built as a module.
  106. - wireless driver config - You may want to change the location the
  107. kernel looks for your wifi firmware (this is different from the
  108. kernel module).
  109. I stuck mine in /etc/firmware, default is /system/etc/firmware.
  110. If you don't change this, you will have to put the firmware
  111. in /system/etc/firmware
  112. - wireless - Add in support for standard wifi extensions.
  113. - networking - standard tcp/ip stuff... iptables if you want ect...
  114. - I wasn't able to get the kernel to boot into Debian until I turned
  115. off initramfs support.
  116. (note. this was before I discovered the 'noinitrd' kernel
  117. kernel cmdline option. So disabling initrd may not be required)
  118. - If for some reason you are using ext4, it will fail to mount unless
  119. you add in large devices and files support
  120. - Default kernel command string - has no effect.
  121. This gets overwritten when you boot with fastboot or make a boot.img
  122. - Drivers - I left all the normal android drivers in.
  123. -Changed the firmware path for wifi.
  124. -Added in support for virtual terminal under character devices
  125. -Enabled MSM serial support (if you don't have a serial cable
  126. this is useless to you)
  127. -You can build the wifi driver into the kernel if you want.
  128.  
  129. Link to the kernel config I used. Use at your own risk.
  130. It works for me but I can't promise it's perfect or even good.
  131. http://i...content-available-to-author-only...n.com/tmp/config
  132. I would love input on building a better kernel config.
  133. If you don't want to build your own kernel. You can download mine here.
  134.  
  135. 7. Chroot and configure Debian.
  136. There are still some things that need configuring before we reboot into
  137. Debian. Since fbconsole does not appear to be working, if you don't
  138. have a serial cable you will be flying blind until Debian is fully
  139. booted and you can connect with ssh. Since there are still things to do
  140. before we reboot, we're going to chroot into Debian just like if we are
  141. using a Debian chroot image.
  142.  
  143. For more information and examples of config files.
  144. http://w...content-available-to-author-only...n.org/releases/stable/arm/apds03.html.en
  145.  
  146. It's probably best to use wifi for your data on the phone for this.
  147. If you're on Linux and connected to the same router as the phone, copy
  148. over your resolv.conf
  149.  
  150. $ adb push /etc/resolv.conf /data/local/etc/resolv.conf
  151.  
  152. If you are not in Linux or are not connected to wifi you will need to
  153. set up resolv.conf with something sane.
  154.  
  155. ex. from jay freeman's original Debian chroot.
  156. $ echo 'nameserver 4.2.2.2' > /data/local/etc/resolv.conf
  157.  
  158. push wifi driver to the device
  159.  
  160. $ adb push <kernelroot>/drivers/net/wireless/bcm4329/bcm4329.ko \
  161. /data/local/etc/firmware
  162.  
  163. copy /system/etc/firmware/fw_bcm4329.bin to wherever you
  164. specified in the kernel config.
  165.  
  166. # cp /system/etc/firmware/fw_bcm4329.bin /data/local/mnt/etc/firmware/
  167.  
  168. Setup environment variables, copy over adbd, and other stuff needed to
  169. make things work. This should all be run from within an adb shell
  170.  
  171. # cp /sbin/adbd /data/local/mnt/sbin/adbd
  172. # sysctl -w net.ipv4.ip_forward=1
  173. # export PATH=/usr/bin:/usr/sbin:/bin:$PATH
  174. # export TERM=linux
  175. # export HOME=/root
  176.  
  177. Next chroot and setup mount points
  178.  
  179. # chroot /data/local/mnt /bin/bash
  180. # mount -t devpts devpts /dev/pts
  181. # mount -t proc proc /proc
  182. # mount -t sysfs sysfs /sys
  183.  
  184. Welcome to Debian chroot that we all know and love.
  185. Lets finish configuring this thing.
  186.  
  187. Configure adbd to run on boot and create a symlink so
  188. adbd can find bash.
  189.  
  190. Edit /etc/rc.local. Add adbd before exit 0
  191.  
  192. #add this to /etc/rc.local
  193. /sbin/adbd &
  194.  
  195. # mkdir -p /system/bin/
  196. # ln -s /bin/bash /system/bin/sh
  197.  
  198. Now we need to be able to install packages
  199. don't forget if you are not using squeeze to change it here
  200.  
  201. # echo 'deb http://f...content-available-to-author-only...n.org/debian squeeze main' \
  202. >> /etc/apt/sources.list
  203. # apt-get update
  204.  
  205. You should see aptitude updating it's package list.
  206.  
  207. Install some needed packages
  208.  
  209. # apt-get install wpasupplicant wireless-tools udev ssh
  210.  
  211. Other packages
  212. All up to your choice. Things like text editors, X, ect...
  213. some suggested packages
  214.  
  215. # apt-get install locales vi
  216.  
  217. Wifi driver
  218. When you try to load the wifi module, Linux will complain about not
  219. being able to parse modprobe.d. To fix this run depmod. If it complains
  220. a directory doesn't exist then create it.
  221.  
  222. # depmod -a
  223.  
  224. move bcm4329.ko to /lib/modules
  225. # cp /etc/firmware/bcm4329.ko /lib/modules
  226.  
  227. Edit /etc/modules and add the bcm4329 module
  228.  
  229. # /etc/modules: kernel modules to load at boot time.
  230. #
  231. # This file contains the names of kernel modules that should be loaded
  232. # at boot time, one per line. Lines beginning with "#" are ignored.
  233. # Parameters can be specified after the module name.
  234. bcm4329
  235.  
  236. Setup fstab - critical: don't forget to configure the root file system
  237. or your system won't boot. If you like, mount your vfat sdcard partition
  238. here too. Don't forget to mkdir for the mount point.
  239. *note* after boot the memory card is located at /dev/mmcblk0p#.
  240.  
  241. Here is my /etc/fstab
  242.  
  243. # /etc/fstab: static file system information.
  244. #
  245. # file system mount point type options dump pass
  246.  
  247. /dev/block/mmcblk0p2 / ext2 defaults 1 1
  248. proc /proc proc defaults 0 0
  249. /dev/mmcblk0p1 /media/sdcard vfat defaults 0 0
  250.  
  251. configure network
  252. These two files will be tuned to what you need.
  253. Here are a couple examples.
  254.  
  255. /etc/network/interfaces
  256.  
  257. auto lo
  258. iface lo inet loopback
  259.  
  260. auto eth0
  261. iface eth0 inet dhcp
  262. wpa-driver wext
  263. wpa-conf /etc/wpa_supplicant.conf
  264.  
  265. /etc/wpa_supplicant.conf
  266.  
  267. ctrl_interface=/var/run/wpa_supplicant
  268.  
  269. network={
  270. ssid="myOpenNetwork"
  271. scan_ssid=1
  272. key_mgmt=NONE
  273. }
  274. network={
  275. ssid="MyHomeNetwork"
  276. scan_ssid=1
  277. key_mgmt=WPA-PSK
  278. psk="MyWifiPassword"
  279. }
  280. network={
  281. ssid="MyFriendsWifi"
  282. scan_ssid=1
  283. key_mgmt=WPA-PSK
  284. psk="MyFriendsWifiPassword"
  285. }
  286.  
  287. inittab
  288. no need for getty so comment it out in /etc/inittab
  289. if you have a serial cable, configure it here. something like this.
  290. T0:23:respawn:/sbin/getty -L ttyMSM0 115200 linux
  291.  
  292. hostname
  293. configure your system's hostname - you can set this to whatever you like
  294. # echo DebianHostName > /etc/hostname
  295.  
  296. Set root password
  297. # passwd
  298.  
  299. Add user account
  300. # useradd -m yourusername -s /bin/bash
  301. # passwd yourusername
  302.  
  303. 8. Almost there!
  304. Double check your configs and have your kernel handy.
  305. The next step is to boot into Debian.
  306.  
  307. 9. Boot Debian
  308. put the device into fastboot mode
  309. $ adb reboot bootloader
  310. the '-c' flag specifies arguments to pass to the kernel for boot.
  311. This is probably the bare minimum.
  312.  
  313. Format is "fastboot -c 'kernelcmdline' boot zImage"
  314.  
  315. $ fastboot -c 'root=/dev/mmcblk0p2 rw rootfs=ext2 init=/sbin/init \
  316.  
  317. rootwait noinitrd' boot zImage
  318.  
  319. Wait just a few minutes. DHCP is probably the longest part of this.
  320.  
  321. 10. Connect via ADB.
  322. If everything went well you should be able to log into the
  323. phone via adb. adb push and pull work as well.
  324.  
  325. $ adb shell
  326.  
  327. 11. Install X11
  328. For a basic X11 install. This is probably not what you want.
  329. # apt-get install xserver-xorg
  330.  
  331. You can install whatever window manager/desktop environment you like,
  332. I used XFCE. Most window managers likely depend on xserver-xorg so it
  333. will get pulled in when you install.
  334.  
  335. # apt-get install xfce4
  336.  
  337. After I installed xfce4 I was able to get X on the main display by
  338. simply running startxfce4
  339.  
  340. # startxfce4
  341.  
  342. By default Debian is configured to only allow root to startx.
  343. If you want to be able to run X as a user edit /etc/X11/Xwrapper.config
  344. *note* even with this I haven't been able to run X as a normal user.
  345. Only root.
  346.  
  347. Change allowed_users=console
  348. to allowed_users=anybody
  349.  
  350. Currently touchscreen is a little weird. It feels almost like using a
  351. laptop touchpad. The mouse moves much faster then your finger and tapping for
  352. click isn't enabled by default but two finger tap will right click. You can
  353. also move the mouse with the trackball. Clicking the trackball registers a
  354. click. But you have to wiggle the trackball just a tiny bit after you click to
  355. make it register. I am going to work on tweaking the fdi policy files to
  356. make things a little more usable.
  357.  
  358. Text entry is a bit of a pain point currently. There are several on screen
  359. keyboards out there. One interesting one I found is called cellwriter.
  360. The touchscreen will need to be tweaked before it will work well with
  361. onscreen keyboards.
  362.  
  363. For other ideas on window managers and other software check out this link
  364. http://w...content-available-to-author-only...o.org/wiki/Debian
  365.  
  366. Screenies! http://picasaweb.google.com/JairunCaloth/Debian?feat=directlink
  367.  
  368. The results look pretty fantastic!
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty