[DEV] Booting Ubuntu nativ!!!

Search This thread

bergfex

Senior Member
Sep 16, 2010
206
105
Hagenberg
This is about booting Ubuntu natively on the DHD. (without chroot and without an Andriod running at the same time)

Based on the version for the HTC HD2

img20110424123036.jpg


What works:
  • touchscreen (touchscreen works as touchpad) (thanks to Jhinta)
  • two finger scrolling (thanks to Jhinta)
  • Wifi
  • dragging windows (double click and holding second click)
  • right click (double two finger click) (thanks to dronf)
  • adb (thanks to torsrex)
  • incoming calls (thanks to liljom)
  • SMS (thanks to liljom)

What doesn't work:
  • sound
  • keys (hard and soft keys)
  • usb host
  • firefox (only as root)

Instructions:
  • Download ubuntu4dhd.zip
  • Download easy to use.zip
  • Put the linux folder from ubuntu4dhd.zip to the root of your sdcard
  • Put the easy to use folder to your windows PC
  • Bring your DHD into the bootloader
  • Connect DHD to the PC
  • Double click Start here.bat
  • Tip "fastboot boot boot.img"
    (without ")
  • after restarting your old rom will start

Change log:
  • Working touchpad driver
  • two finger scrolling
  • Wifi working out of the box

Modifing the rootfs on your PC or virtualBox:
  • mkdir /ubuntuDHD
  • sudo mount -t ext2 -o loop /path/to/rootfs /ubuntuDHD
  • rootfs is now mounted under /ubuntuDHD and can be modifyed as root
  • umount /ubuntuDHD

Dual boot option:
  1. Download two different cwm from Rom manager
  2. Open the clockworkmod folder on you sdcard an open the download folder.
  3. Search for the version number for the old recovery. You will find an image file, open the containing folder and copy the boot.img from the Ubuntu4DHD.rar into it.
  4. Now, rename the boot.img file to the recovery image filename and deleted the old recovery.
  5. Now, when you select the old recovery from Rom manager, it will flash the ubuntu boot image.
  6. Booting into Recovery will now boot Ubuntu
When you want to go back to cwm, just select/flash the newer cwm version with Rom Manager.


Download:

Ubuntu4DHD.rar (reuploaded as rar)
MD5 of image: 79a9faa2d49725fb6bfdc30d4c5fb885

easy to use.zip


appendix:
  • easy to use.zip
    with:
  • My boot.img
  • boot-usbhost.img (boot image with usb host support)

Tips:
Password: ubuntu
 
Last edited:

bergfex

Senior Member
Sep 16, 2010
206
105
Hagenberg
For porting to other devices

Chaosz-X said:
Hi,

I saw you got native Ubuntu up and running on the Desire HD, and I wanted to do the same with my Flyer. I know how to compile kernels and an Android build etc., but I can't figure out how to set the partitions, that the boot.img boots from a partition on the SD-card. So I was wondering if you could tell me, what modifications are made to your boot.img to make it boot from SD.

Thanks in advance!

Changes on the boot.img:
I guess you know how to extract a boot.img.
http://android-dls.com/wiki/index.php?title=HOWTO:_Unpack%2C_Edit%2C_and_Re-Pack_Boot_Images

When you try split_bootimg with my boot.img you will find two things.
1) a special command line arguments
2) a complet other ramdisk image containing
2a) a busybox
2b) a init script

The commad line arguments refer to the init script in the ramdisk.
The init script mounts some partitions including the ubuntu "partition" (in this case a image file on the sd card".
For mounting the partitions the init script calls a other script called MAKEDEVS also based in the ramdisk image.
In this second script you need to change the major and minor numbers of the block devices to match your kernel/device.


Placing the ubuntu image on the sd card:

I use a image file on the sd card.
You could use following commands on a linux machine to edit the image.

mkdir /mnt/ubuntuimg
sudo mount -t ext2 -o loop,rw /pathToTheImage/rootfs.ext2 /mnt/ubuntuimg
Then you will see the content of the image in /mnt/ubuntuimg.
Don't forget to unmount.
umount /mnt/ubuntuimg

Edits on the kernel:
In the kernel the framebuffer must be activated to run ubuntu

make menuconfig
Device Driver->Character Devices-> Set Virtual Terminal
Device Driver->Graphics support->Console display driver support->Remove VGA Text console

Maybe same patches for the framebuffer are needed to use the framebuffer.
Some information can be found under:

http://xdaforums.com/showthread.php?t=1008144&highlight=ubuntu
 
Last edited:

twiztedvvv

Senior Member
Mar 14, 2010
253
25
getting this working would be awesome, better than a working honeycomb possibly :D.
 
Last edited:

raze599

Senior Member
Nov 1, 2010
751
103
Birmingham
If this ever works, is it possible to modify the normal Android system to allow a virtual environment within which you can run Ubuntu? That way you can have the benefits of both.
 

twiztedvvv

Senior Member
Mar 14, 2010
253
25
If this ever works, is it possible to modify the normal Android system to allow a virtual environment within which you can run Ubuntu? That way you can have the benefits of both.

See leedroids post on booting ubuntu through Android. A bit closer to what your looking for and working although a bit of experience would be needed.
But like another said. Dual boot Android and ubuntu should be possible if we can get this to boot.
 

Jhinta

Senior Member
Dec 20, 2010
704
276
See leedroids post on booting ubuntu through Android. A bit closer to what your looking for and working although a bit of experience would be needed.
But like another said. Dual boot Android and ubuntu should be possible if we can get this to boot.

Keep in mind this is native and not chroot !!!
 

adwinp

Senior Member
Jun 22, 2008
2,055
330
urandom
1: Use the android init. It directly references init.rc
2: move your init script into init.rc
3: you have failed booting due to the system not knowing the executable paths;
you HAVE to export your paths. Either reference your binaries directly, for example:
/bin/mount, /bin/dosfsck
or
export PATH /bin:/sbin:/usr/bin:/usr/sbin
Furthermore, you need to diet your boot.img; 5Mb is not flashable on the DHD unless you move and resize the partition tables (risky). The stock max is 4Mb.

You can also force the kernel to execute the init script by referencing it in the kernel cmdline. Check this option in your kernel config and compile it with such support.
 
  • Like
Reactions: ppirate and bergfex

bergfex

Senior Member
Sep 16, 2010
206
105
Hagenberg
1: Use the android init. It directly references init.rc
2: move your init script into init.rc
3: you have failed booting due to the system not knowing the executable paths;
you HAVE to export your paths. Either reference your binaries directly, for example:
/bin/mount, /bin/dosfsck
or
export PATH /bin:/sbin:/usr/bin:/usr/sbin
Furthermore, you need to diet your boot.img; 5Mb is not flashable on the DHD unless you move and resize the partition tables (risky). The stock max is 4Mb.

You can also force the kernel to execute the init script by referencing it in the kernel cmdline. Check this option in your kernel config and compile it with such support.

Thx

The init.rc script is a android specific script/script language, can i place a shell script into it?
 

Jhinta

Senior Member
Dec 20, 2010
704
276
1: Use the android init. It directly references init.rc
2: move your init script into init.rc
3: you have failed booting due to the system not knowing the executable paths;
you HAVE to export your paths. Either reference your binaries directly, for example:
/bin/mount, /bin/dosfsck
or
export PATH /bin:/sbin:/usr/bin:/usr/sbin
Furthermore, you need to diet your boot.img; 5Mb is not flashable on the DHD unless you move and resize the partition tables (risky). The stock max is 4Mb.

You can also force the kernel to execute the init script by referencing it in the kernel cmdline. Check this option in your kernel config and compile it with such support.

1. kernel cmdline gets ignored rootdev will be NULL thats has to be fixed
2 moving init to int.rc no go as we want native ubuntu leaving init(android) will only boot android.
3 the reaseon it fails is that the kernel cant see mmcblk1 before cmdline ( why we have to find out )

So in sort kernel is oke but cmdline get igored, if we leave initrd enabled in kernel config its starts init ( android ) if not panic root not found here are partitions list of mmcblk0** root"NULL" not found <-- disableing initrd in kernel wel make root null because its wants to load initrd->init from ram witch is android binary elf init.

Step to take are making a initrd that will mount sdcard witch is mmcblk1 and mount it as rootdev if that works we can make a init.
So
1 we have to have a kernel thats has the correct cmdline as kernel config does not accept cmdline its will just be ignored.
2 have a initrd that that wil do a setup before starting init ( system setup mount pionts and so on)
3 build a init that will boot ubuntu and you done :D
 

bergfex

Senior Member
Sep 16, 2010
206
105
Hagenberg
1 we have to have a kernel thats has the correct cmdline as kernel config does not accept cmdline its will just be ignored.

Do you mean boot comandline parameters?

I makes a difference if I use
fastboot -c "init=/init rw consoleblank=0 fbcon=rotate:1" boot boot.img
or
fastboot -c "init=/init rw consoleblank=0" boot boot.img
 

Jhinta

Senior Member
Dec 20, 2010
704
276
Do you mean boot comandline parameters?

I makes a difference if I use
fastboot -c "init=/init rw consoleblank=0 fbcon=rotate:1" boot boot.img
or
fastboot -c "init=/init rw consoleblank=0" boot boot.img

so finaly got a working system to test stuf .
first of all you got console of in the image that makes it hard for anyone els to see whats going on . AND the laste time ill say this kernel cmdline is skipt !!!!!!!!!! fastboot c = cmdline=kernel command line = kernel arguments bla bla bla.
its get skipt !!!! root= init= bla bla = will not work !!!!!
why we have to find out !!

enable console you have userspace on, there is nog log out so people cant see whats happening
 

bergfex

Senior Member
Sep 16, 2010
206
105
Hagenberg
My script in the initrd get started, but it has still an error in it.

Wait a moment, then i will upload the new boot.img
 

bergfex

Senior Member
Sep 16, 2010
206
105
Hagenberg
New boot.img starts the my script in the initrd

1) copy the linux folder from the hd2-ubuntu_0.3.zip in the root directory of your sdcard
2) fastboot boot boot.img
 

Attachments

  • boot.rar
    4.9 MB · Views: 268

Jhinta

Senior Member
Dec 20, 2010
704
276
New boot.img starts the my script in the initrd

1) copy the linux folder from the hd2-ubuntu_0.3.zip in the root directory of your sdcard
2) fastboot boot boot.img

this realy is working you got it almost ? what is your script maby i can help as far as ik can see sdcard doesnt gets mounted also can you get on htc-linux irc make typeing for me easyer takes long frome to even type this
 

Top Liked Posts

  • There are no posts matching your filters.
  • 41
    This is about booting Ubuntu natively on the DHD. (without chroot and without an Andriod running at the same time)

    Based on the version for the HTC HD2

    img20110424123036.jpg


    What works:
    • touchscreen (touchscreen works as touchpad) (thanks to Jhinta)
    • two finger scrolling (thanks to Jhinta)
    • Wifi
    • dragging windows (double click and holding second click)
    • right click (double two finger click) (thanks to dronf)
    • adb (thanks to torsrex)
    • incoming calls (thanks to liljom)
    • SMS (thanks to liljom)

    What doesn't work:
    • sound
    • keys (hard and soft keys)
    • usb host
    • firefox (only as root)

    Instructions:
    • Download ubuntu4dhd.zip
    • Download easy to use.zip
    • Put the linux folder from ubuntu4dhd.zip to the root of your sdcard
    • Put the easy to use folder to your windows PC
    • Bring your DHD into the bootloader
    • Connect DHD to the PC
    • Double click Start here.bat
    • Tip "fastboot boot boot.img"
      (without ")
    • after restarting your old rom will start

    Change log:
    • Working touchpad driver
    • two finger scrolling
    • Wifi working out of the box

    Modifing the rootfs on your PC or virtualBox:
    • mkdir /ubuntuDHD
    • sudo mount -t ext2 -o loop /path/to/rootfs /ubuntuDHD
    • rootfs is now mounted under /ubuntuDHD and can be modifyed as root
    • umount /ubuntuDHD

    Dual boot option:
    1. Download two different cwm from Rom manager
    2. Open the clockworkmod folder on you sdcard an open the download folder.
    3. Search for the version number for the old recovery. You will find an image file, open the containing folder and copy the boot.img from the Ubuntu4DHD.rar into it.
    4. Now, rename the boot.img file to the recovery image filename and deleted the old recovery.
    5. Now, when you select the old recovery from Rom manager, it will flash the ubuntu boot image.
    6. Booting into Recovery will now boot Ubuntu
    When you want to go back to cwm, just select/flash the newer cwm version with Rom Manager.


    Download:

    Ubuntu4DHD.rar (reuploaded as rar)
    MD5 of image: 79a9faa2d49725fb6bfdc30d4c5fb885

    easy to use.zip


    appendix:
    • easy to use.zip
      with:
    • My boot.img
    • boot-usbhost.img (boot image with usb host support)

    Tips:
    Password: ubuntu
    5
    Alright, I managed to find the files and boot into ubuntu on my DHD! Awesome!!

    I've uploaded the files needed in one rar on my dropbox, I suggest people make a permanent mirror as it will eat my bandwidth if lots download it.
    https://dl.dropbox.com/s/x2wosf4uvf70leq/UbuntuDHD.rar

    Thanks.
    3
    The way we should be able to make the touch screen work:

    1. Finding out witch X version we are using
    2. Getting the right evtouch_drv.so for our version from
      http://www.conan.de/touchscreen/evtouch.html#config"
    3. We may have to cross compile it if it is not compiled for arm
    4. Putting the evtouch_drv.so to /usr/lib/xorg/modules/input/
    5. Figuring out witch /dev/input/event is "connected" to touchdriver
      • adb shell cat /sys/devices/virtual/input/input1/name
      • adb shell cat /sys/devices/virtual/input/input2/name
      • adb shell cat /sys/devices/virtual/input/input3/name
      • ...
      (The adb command would be used in the console of "Start Here.bat")
    6. Using a xorg.conf like this (with corrected /dev/input/event0)

    Code:
    Section "Monitor"
    	Identifier "Monitor0"
    	Mode "480x800"
            	DotClock 0		
    		HTimings 480 480 480 480
    		VTimings 800 800 800 800
    		Flags    "-HSync" "-VSync"
    	EndMode
    EndSection    
    
    
    
    Section "Device"                                  
            Identifier      "fbdev"
            Driver  "fbdev"
    	Option "ShadowFB" "on" 
            Option "Rotate" "CW" 
            Option "RandRRotation" "true" 
    EndSection                                                
    
    
    Section "Screen"                                        
            Identifier "Framebuffer"     
            Device  "fbdev"            
            Monitor "Monitor"               
    	DefaultFbBpp 16
    	SubSection "Display"
    		Depth 16
            	Modes "480x800"
    	EndSubSection
    EndSection                                              
    
    Section "Screen"
            Identifier "480x800x16"
            Device  "fbdev"
            Monitor "Monitor"
            DefaultFbBpp 16
            SubSection "Display"
                    Depth 16
                    Modes "480x800"
            EndSubSection
    EndSection
    
    
    Section "ServerLayout"                                 
            Identifier      "Builtin Default Layout"                                     
            Screen  "Framebuffer"        
    	InputDevice "Touchscreen" "CorePointer"
            InputDevice "Keyboard" "CoreKeyboard"
    EndSection        
    
    Section "InputDevice"
        # use usb mouse until touchscreen driver is present for machine
        Identifier     "Mouse0"
        Driver         "mouse"
        Option         "Protocol" "auto"
        Option         "Device" "/dev/input/mice"
        Option         "Emulate3Buttons" "no"
        Option         "ZAxisMapping" "4 5"
    EndSection
    
    
    Section "InputDevice"
        Identifier     "Touchscreen"
        Driver         "tslib"
        Option         "Protocol" "auto"
        Option         "Device" "/dev/input/event0"
        Option         "CorePointer"    "true"
    EndSection
    
    Section "InputDevice"
            Identifier  "Keyboard"
            Driver      "kbd"
            Option      "XkbLayout" "en_US"
    EndSection

    The problem is, that I have to study for an exam the next days.

    PS: I have uploaded all kernel modules on the first post. (Would be useful for dev who want to fix WiFi)
    3
    I have uploaded my actual rootfs and two new boot.img in the "easy to use.zip in the first post.

    The touch pad driver has still interchanged aches.
    The seconde boot.img should have usb host support instead of adb.
    The needed *.ko are under /lib/modules.
    The loadKernelModules under /etc/init.d should load this modules, but it does not.

    So I don't have managed to get usb host support on this, yet.


    I hope this give you some new things to play with.
    2
    For porting to other devices

    Chaosz-X said:
    Hi,

    I saw you got native Ubuntu up and running on the Desire HD, and I wanted to do the same with my Flyer. I know how to compile kernels and an Android build etc., but I can't figure out how to set the partitions, that the boot.img boots from a partition on the SD-card. So I was wondering if you could tell me, what modifications are made to your boot.img to make it boot from SD.

    Thanks in advance!

    Changes on the boot.img:
    I guess you know how to extract a boot.img.
    http://android-dls.com/wiki/index.php?title=HOWTO:_Unpack%2C_Edit%2C_and_Re-Pack_Boot_Images

    When you try split_bootimg with my boot.img you will find two things.
    1) a special command line arguments
    2) a complet other ramdisk image containing
    2a) a busybox
    2b) a init script

    The commad line arguments refer to the init script in the ramdisk.
    The init script mounts some partitions including the ubuntu "partition" (in this case a image file on the sd card".
    For mounting the partitions the init script calls a other script called MAKEDEVS also based in the ramdisk image.
    In this second script you need to change the major and minor numbers of the block devices to match your kernel/device.


    Placing the ubuntu image on the sd card:

    I use a image file on the sd card.
    You could use following commands on a linux machine to edit the image.

    mkdir /mnt/ubuntuimg
    sudo mount -t ext2 -o loop,rw /pathToTheImage/rootfs.ext2 /mnt/ubuntuimg
    Then you will see the content of the image in /mnt/ubuntuimg.
    Don't forget to unmount.
    umount /mnt/ubuntuimg

    Edits on the kernel:
    In the kernel the framebuffer must be activated to run ubuntu

    make menuconfig
    Device Driver->Character Devices-> Set Virtual Terminal
    Device Driver->Graphics support->Console display driver support->Remove VGA Text console

    Maybe same patches for the framebuffer are needed to use the framebuffer.
    Some information can be found under:

    http://xdaforums.com/showthread.php?t=1008144&highlight=ubuntu