[ROM] Native Ubuntu on the Epic!

Search This thread

DrGit

Senior Member
Jan 19, 2010
151
210
I got Ubuntu 13.04 to boot cleanly on my Epic! No chroot or VNC hacks involved!
This method loads a custom kernel using kexec and runs off a microSD card.

Check the end of the post for the kernel config and patches, xorg.conf, /etc/modules, the kexec zip, and a pre-built kernel.
I may eventually provide a pre-built root filesystem, but for now it's easy enough to build your own.
For the technically inclined, Debian, Arch Linux, MeeGo/Mer/Nemo/Tizen, Fedora, Gentoo, Slackware, and a few other distros should also work with this method.

Working as of March 30, 2013:
* Touchscreen, 10-point multitouch!
* Unaccelerated X11 with fbdev, framebuffer console disabled for cleaner boot.
* Charging, battery meter
* WiFi
* Sound! NB, the hack I used to get it working disables the codec shutdown sequence, which could affect battery life and prevent the phone from sleeping.
Partially working:
* Keyboard (incomplete layout; not sure what to do with Fn/3rd level key mapping)
* Cameras (recognized as V4L2 devices but VLC complains with "invalid pixel format" so the drivers probably need fixing)
* Sensors/autorotate (sensors recognized in kernel/X11/SDL, I'm working on auto rotation)
Not tested:
* Bluetooth
* GPS
* Calls/data: https://github.com/morphis/libsamsung-ipc

Step by step guide!

PREREQUISITES:
* An Epic 4G with a custom recovery and a microSD card. 2GB free space on the card recommended.
* A Linux computer. Sorry, Windows/Mac users, you're on your own.

Step 0: Get the files you need
Extract the contents of linux_epicmtd.zip to a new folder somewhere and change to that folder in your terminal.

Step 1: Partition your SD card
Please backup of the contents of your SD card before doing anything else.
You can do this by mounting USB storage, but I prefer to remove the card and put it in a USB card reader, that way it's harder to accidentally disconnect it and corrupt data.
What you want to do is shrink the FAT partition from a computer by 2GB and create a new ext2/4 partition out of that free space.

2GB should more than suffice for a minimal Ubuntu install, but if you intend to install Unity (ubuntu-desktop) or other big packages, you may need anywhere from 2GB to 4GB, or possibly more. Resize accordingly.

The following instructions assume the Linux partition you just created is labeled "Ubuntu" and the FAT partition you resized is labeled "microSD". If you don't label them, your mount points will be different.

Step 2: Install Ubuntu on the second partition
Code:
# Assumes your new Ubuntu partition is mounted at "/media/$USER/Ubuntu"
wget http://cdimage.ubuntu.com/ubuntu-core/daily/current/raring-core-armhf.tar.gz
tar xvf raring-core-armhf.tar.gz -C /media/$USER/Ubuntu

Step 3: Configure the filesystem
Code:
# to chroot into the ARM rootfs on a non-ARM computer:
sudo apt-get install qemu-user-static
sudo cp /usr/bin/qemu-arm-static /media/$USER/Ubuntu/usr/bin
sudo mount -o remount,dev /media/$USER/Ubuntu
sudo chroot /media/$USER/Ubuntu
# check /etc/apt/sources.list and make sure universe is enabled
apt-get update
apt-get dist-upgrade
# select your preferred desktop environment
apt-get install {k,x,l,}ubuntu-desktop e17 gnome-session-fallback plasma-active
adduser yournamehere
usermod -a -G audio yournamehere
passwd yournamehere
tzselect
# do anything else you want to do, exit the chroot, then run the following commands from your working folder:
sudo cp X11.txt to /media/$USER/Ubuntu/etc/X11/xorg.conf
sudo cp modules.txt /media/$USER/Ubuntu/etc/modules
adb pull /vendor/firmware/fw_bcmdhd.bin
adb pull /system/etc/wifi/nvram_net.txt
sudo cp fw_bcmdhd.bin nvram_net.txt /media/$USER/Ubuntu/lib/firmware

Step 4: Install the kernel, copy the kexec zip to your SD card, and boot!
Option 1: Use my pre-built kernel.
Code:
cp zImage /media/$USER/microSD
sudo tar xvf modules.tar.gz -C /media/$USER/Ubuntu
cp boot_zImage.zip /media/$USER/microSD
Option 2: Build the kernel from source.
Code:
sudo apt-get install build-essential git gcc-arm-linux-gnueabi libncurses5-dev
git clone git://github.com/CyanogenMod/android_kernel_samsung_epicmtd
cd android_kernel_samsung_epicmtd
git checkout cm-10.1
git apply ../linux_epicmtd.patch
export CROSS_COMPILE=arm-linux-gnueabi- ARCH=arm
cp ../epicmtd_defconfig.txt .config
# make menuconfig if you want to enable the framebuffer console or customize anything
make -j8
sudo make modules_install INSTALL_MOD_PATH=/media/$USER/Ubuntu ARCH=arm
cp arch/arm/boot/zImage /media/$USER/microSD
cd ..
cp boot_zImage.zip /media/$USER/microSD

Reboot into recovery, install zip from sdcard, select boot_zImage.zip, and enjoy your new Ubuntu installation!
 

Attachments

  • linux_epicmtd.zip
    3.5 MB · Views: 142
Last edited:

gooch1025

Senior Member
Jan 3, 2012
305
266
First! Very excited for this. Any screens available?

Sent from my Tangerine Dream Epic 4G using xda premium
 

ÜBER™

Inactive Recognized Themer
Nov 9, 2011
13,808
8,904
Texas
Hmm can get my phone working on linux pretty flawlessly but my laptop just doesn't like it go figure. Anyways those are my issues [ would be cool if I could find someone to help me with my linux issues] but anyways this is pretty sweet ;).

Sent from my SPH-D700 using xda premium
 

tdwp16

Senior Member
Jun 2, 2011
374
45
How is 12.04 for PC in its current state? I'm on 11.10 and I would consider switching, if it wasn't buggy and what not.

Sent from my SPH-D700 using XDA
 

MДЯCЦSДИT

Inactive Recognized Developer
Nov 21, 2010
6,563
4,616
How is 12.04 for PC in its current state? I'm on 11.10 and I would consider switching, if it wasn't buggy and what not.

Sent from my SPH-D700 using XDA

In my honest opinion, Ubuntu sucks since the 9.x days. I would try out the gnome version of LMDE (Linux Mint Debian Edition). You will never want to go back.

Sent from my SPH-D700 using Tapatalk
 

tdwp16

Senior Member
Jun 2, 2011
374
45
I tried out the last Linux mint. I kept having problems with the music player freezing my computer. idk how but that's the only thing that did it. So I switches back yo Ubuntu after using mint for a year or two and just loaded gnome shell.

Sent from my SPH-D700 using XDA
 

MДЯCЦSДИT

Inactive Recognized Developer
Nov 21, 2010
6,563
4,616
I tried out the last Linux mint. I kept having problems with the music player freezing my computer. idk how but that's the only thing that did it. So I switches back yo Ubuntu after using mint for a year or two and just loaded gnome shell.

Sent from my SPH-D700 using XDA

LMDE is very different from the old mint.

Sent from my SPH-D700 using Tapatalk
 

tdwp16

Senior Member
Jun 2, 2011
374
45
I'll try it just because you said so marc. I'll just make another partition for it and play with it. If I like it I'll deff let you know.

Sent from my SPH-D700 using XDA
 

beltsnspoons

Senior Member
Jul 28, 2011
477
80
Dayton, Ohio
I tried out the last Linux mint. I kept having problems with the music player freezing my computer. idk how but that's the only thing that did it. So I switches back yo Ubuntu after using mint for a year or two and just loaded gnome shell.

Sent from my SPH-D700 using XDA

weird, i had the EXACT same issue with my last debian install. A while back, but still weird...
 
Last edited:

DrGit

Senior Member
Jan 19, 2010
151
210
How is 12.04 for PC in its current state? I'm on 11.10 and I would consider switching, if it wasn't buggy and what not.

12.04 is actually quite stable. I think they finally got GNOME Fallback ("Classic") right as well - it's set up more like 10.10 with some usability improvements. I never really liked Unity, but it also felt more stable than the version in 11.10 did.
 

DrGit

Senior Member
Jan 19, 2010
151
210
You can always use vnc instead

Correct me if I'm wrong, but I'm pretty sure they're referring to Debian and/or Linux Mint bugs on the desktop.

Somewhat off-topic, but with a guide this complicated, I don't expect many people to try it. The VNC hack still works, but it's too slow for me, which is the main reason I decided to boot natively.

On a somewhat related note, this can completely replace Android if you are so inclined, but unless you can figure out the internal storage, I still recommend booting from the SD card. You can permanently flash the kernel with Heimdall if you hate Android enough :p
 

MДЯCЦSДИT

Inactive Recognized Developer
Nov 21, 2010
6,563
4,616
Correct me if I'm wrong, but I'm pretty sure they're referring to Debian and/or Linux Mint bugs on the desktop.

Somewhat off-topic, but with a guide this complicated, I don't expect many people to try it. The VNC hack still works, but it's too slow for me, which is the main reason I decided to boot natively.

On a somewhat related note, this can completely replace Android if you are so inclined, but unless you can figure out the internal storage, I still recommend booting from the SD card. You can permanently flash the kernel with Heimdall if you hate Android enough :p

I had a spell check error lol.

Sent from my SPH-D700 using Tapatalk
 

metalblaster

Senior Member
Oct 2, 2010
249
35
awesome... When i finish with my epic i can turn it into a small little tablet now.

BtW, Debian beats the mint so hard... I hate Mint and Ubuntu so im glad those are not the only options.
 

xopher.hunter

Senior Member
Mar 21, 2011
1,629
392
Ventura
Doing this right now, will report back with screenies soon.


Edit: everything went swimmingly up until step 3 (I know my way around linux but still pretty noobish):

xopher@Xopher-Ubuntu:~$ tar xvf /path/to/victory_patches.tar -C /path/to/
tar: /path/to/victory_patches.tar: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
xopher@Xopher-Ubuntu:~$ cd android_kernel_samsung_victory
xopher@Xopher-Ubuntu:~/android_kernel_samsung_victory$ scripts/patch-kernel . /path/to/patches
bash: scripts/patch-kernel: No such file or directory
xopher@Xopher-Ubuntu:~/android_kernel_samsung_victory$ cp /path/to/victory_config.txt .config || make -C Kernel cyanogenmod_epicmtd_defconfig
cp: cannot stat `/path/to/victory_config.txt': No such file or directory
make: Entering directory `/home/xopher/android_kernel_samsung_victory/Kernel'
HOSTCC scripts/basic/fixdep
HOSTCC scripts/basic/docproc
HOSTCC scripts/basic/hash
HOSTCC scripts/kconfig/conf.o
scripts/kconfig/conf.c: In function ‘conf_sym’:
scripts/kconfig/conf.c:159:6: warning: variable ‘type’ set but not used [-Wunused-but-set-variable]
scripts/kconfig/conf.c: In function ‘conf_choice’:
scripts/kconfig/conf.c:231:6: warning: variable ‘type’ set but not used [-Wunused-but-set-variable]
scripts/kconfig/conf.c:307:9: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
scripts/kconfig/conf.c: In function ‘conf_askvalue’:
scripts/kconfig/conf.c:105:8: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
HOSTCC scripts/kconfig/kxgettext.o
SHIPPED scripts/kconfig/zconf.tab.c
SHIPPED scripts/kconfig/lex.zconf.c
SHIPPED scripts/kconfig/zconf.hash.c
HOSTCC scripts/kconfig/zconf.tab.o
HOSTLD scripts/kconfig/conf
#
# configuration written to .config
#
make: Leaving directory `/home/xopher/android_kernel_samsung_victory/Kernel'
xopher@Xopher-Ubuntu:~/android_kernel_samsung_victory$ # Check hints.txt for customization tips.
xopher@Xopher-Ubuntu:~/android_kernel_samsung_victory$ make -C Kernel menuconfigmake -C Kernel -j8
make: *** Kernel: No such file or directory. Stop.
xopher@Xopher-Ubuntu:~/android_kernel_samsung_victory$ make -C Kernel -j8
make: /home/bbelos/toolchain/arm-eabi-4.4.3/bin/arm-eabi-gcc: Command not found
make: Entering directory `/home/xopher/android_kernel_samsung_victory/Kernel'
scripts/kconfig/conf -s arch/arm/Kconfig
make: Leaving directory `/home/xopher/android_kernel_samsung_victory/Kernel'
make: /home/bbelos/toolchain/arm-eabi-4.4.3/bin/arm-eabi-gcc: Command not found
make: Entering directory `/home/xopher/android_kernel_samsung_victory/Kernel'
CHK include/linux/version.h
UPD include/linux/version.h
CHK include/generated/kernelversion.h
UPD include/generated/kernelversion.h
CHK include/generated/utsrelease.h
CC scripts/mod/empty.o
/bin/sh: /home/bbelos/toolchain/arm-eabi-4.4.3/bin/arm-eabi-gcc: not found
make[2]: *** [scripts/mod/empty.o] Error 127
make[1]: *** [scripts/mod] Error 2
make: *** [scripts] Error 2
make: *** Waiting for unfinished jobs....
UPD include/generated/utsrelease.h
make: Leaving directory `/home/xopher/android_kernel_samsung_victory/Kernel'
xopher@Xopher-Ubuntu:~/android_kernel_samsung_victory$

Sent from my MIUI V4 Epic 4G via Tapatalk 2 beta 5
 
Last edited:

MДЯCЦSДИT

Inactive Recognized Developer
Nov 21, 2010
6,563
4,616
You are using /path/to/patches... you need to put the path there...

Sent from my SPH-D700 using Tapatalk
 

Top Liked Posts

  • There are no posts matching your filters.
  • 13
    I got Ubuntu 13.04 to boot cleanly on my Epic! No chroot or VNC hacks involved!
    This method loads a custom kernel using kexec and runs off a microSD card.

    Check the end of the post for the kernel config and patches, xorg.conf, /etc/modules, the kexec zip, and a pre-built kernel.
    I may eventually provide a pre-built root filesystem, but for now it's easy enough to build your own.
    For the technically inclined, Debian, Arch Linux, MeeGo/Mer/Nemo/Tizen, Fedora, Gentoo, Slackware, and a few other distros should also work with this method.

    Working as of March 30, 2013:
    * Touchscreen, 10-point multitouch!
    * Unaccelerated X11 with fbdev, framebuffer console disabled for cleaner boot.
    * Charging, battery meter
    * WiFi
    * Sound! NB, the hack I used to get it working disables the codec shutdown sequence, which could affect battery life and prevent the phone from sleeping.
    Partially working:
    * Keyboard (incomplete layout; not sure what to do with Fn/3rd level key mapping)
    * Cameras (recognized as V4L2 devices but VLC complains with "invalid pixel format" so the drivers probably need fixing)
    * Sensors/autorotate (sensors recognized in kernel/X11/SDL, I'm working on auto rotation)
    Not tested:
    * Bluetooth
    * GPS
    * Calls/data: https://github.com/morphis/libsamsung-ipc

    Step by step guide!

    PREREQUISITES:
    * An Epic 4G with a custom recovery and a microSD card. 2GB free space on the card recommended.
    * A Linux computer. Sorry, Windows/Mac users, you're on your own.

    Step 0: Get the files you need
    Extract the contents of linux_epicmtd.zip to a new folder somewhere and change to that folder in your terminal.

    Step 1: Partition your SD card
    Please backup of the contents of your SD card before doing anything else.
    You can do this by mounting USB storage, but I prefer to remove the card and put it in a USB card reader, that way it's harder to accidentally disconnect it and corrupt data.
    What you want to do is shrink the FAT partition from a computer by 2GB and create a new ext2/4 partition out of that free space.

    2GB should more than suffice for a minimal Ubuntu install, but if you intend to install Unity (ubuntu-desktop) or other big packages, you may need anywhere from 2GB to 4GB, or possibly more. Resize accordingly.

    The following instructions assume the Linux partition you just created is labeled "Ubuntu" and the FAT partition you resized is labeled "microSD". If you don't label them, your mount points will be different.

    Step 2: Install Ubuntu on the second partition
    Code:
    # Assumes your new Ubuntu partition is mounted at "/media/$USER/Ubuntu"
    wget http://cdimage.ubuntu.com/ubuntu-core/daily/current/raring-core-armhf.tar.gz
    tar xvf raring-core-armhf.tar.gz -C /media/$USER/Ubuntu

    Step 3: Configure the filesystem
    Code:
    # to chroot into the ARM rootfs on a non-ARM computer:
    sudo apt-get install qemu-user-static
    sudo cp /usr/bin/qemu-arm-static /media/$USER/Ubuntu/usr/bin
    sudo mount -o remount,dev /media/$USER/Ubuntu
    sudo chroot /media/$USER/Ubuntu
    # check /etc/apt/sources.list and make sure universe is enabled
    apt-get update
    apt-get dist-upgrade
    # select your preferred desktop environment
    apt-get install {k,x,l,}ubuntu-desktop e17 gnome-session-fallback plasma-active
    adduser yournamehere
    usermod -a -G audio yournamehere
    passwd yournamehere
    tzselect
    # do anything else you want to do, exit the chroot, then run the following commands from your working folder:
    sudo cp X11.txt to /media/$USER/Ubuntu/etc/X11/xorg.conf
    sudo cp modules.txt /media/$USER/Ubuntu/etc/modules
    adb pull /vendor/firmware/fw_bcmdhd.bin
    adb pull /system/etc/wifi/nvram_net.txt
    sudo cp fw_bcmdhd.bin nvram_net.txt /media/$USER/Ubuntu/lib/firmware

    Step 4: Install the kernel, copy the kexec zip to your SD card, and boot!
    Option 1: Use my pre-built kernel.
    Code:
    cp zImage /media/$USER/microSD
    sudo tar xvf modules.tar.gz -C /media/$USER/Ubuntu
    cp boot_zImage.zip /media/$USER/microSD
    Option 2: Build the kernel from source.
    Code:
    sudo apt-get install build-essential git gcc-arm-linux-gnueabi libncurses5-dev
    git clone git://github.com/CyanogenMod/android_kernel_samsung_epicmtd
    cd android_kernel_samsung_epicmtd
    git checkout cm-10.1
    git apply ../linux_epicmtd.patch
    export CROSS_COMPILE=arm-linux-gnueabi- ARCH=arm
    cp ../epicmtd_defconfig.txt .config
    # make menuconfig if you want to enable the framebuffer console or customize anything
    make -j8
    sudo make modules_install INSTALL_MOD_PATH=/media/$USER/Ubuntu ARCH=arm
    cp arch/arm/boot/zImage /media/$USER/microSD
    cd ..
    cp boot_zImage.zip /media/$USER/microSD

    Reboot into recovery, install zip from sdcard, select boot_zImage.zip, and enjoy your new Ubuntu installation!
    7
    Where did this GNOME 3 vs. Unity vs. MATE vs. me discussion come from?
    I hate to be the forum police, but please stay on topic.

    It appears I'm still the only person actually running this, so until things get easier - preconfigured SD image, better kernel, guide, screenshots, etc - I'd much prefer feedback to speculation. I'm working with bbelos to fix the kernel 3.x audio, WiFi, and sleep issues, so stay tuned.
    4
    Uploaded my patches and a pre-built kernel. Test away!
    4
    Got Ubuntu 13.04 running and finally sorted out the touchscreen rotation via the X Input Coordinate Transformation Matrix.
    I'm still working on sound and getting the cameras to work, and I'm working with a new kernel base since my Github got too messy and outdated.

    This could be more fun than Ubuntu Touch since actual existing apps will run on it!
    Sorry for bumping my oooold post - I wish I had more exciting news for you, but at least I'm still working on it.
    2
    How is 12.04 for PC in its current state? I'm on 11.10 and I would consider switching, if it wasn't buggy and what not.

    Sent from my SPH-D700 using XDA

    In my honest opinion, Ubuntu sucks since the 9.x days. I would try out the gnome version of LMDE (Linux Mint Debian Edition). You will never want to go back.

    Sent from my SPH-D700 using Tapatalk