yashsingh1/xdaforums huggingface dataset:
[AT&T Samsung Galaxy S 4 General] Aou:
Update:

I'm currently also working on trying to get ubuntu to write to android's framebuffer. Looks like I'm about 40% there, guessing.

EDIT:

I'm pretty much stuck at:

(EE) FBDEV(0): FBIOBLANK: Operation not permitted
xinit: connection to X server lost

I know this isn't much to go off of, but if anyone can help with this error, that'd be awesome. I'll collect and post more details later (like my xorg.conf, updated ubuntu.sh, and other stuff). In the meantime, I think I'm about done with this for the night.

EDIT#2:

Okay, extreme progress... I have the LXDE background showing on my screen natively, puked up by xorg. Bottom of the screen flashes white, no input, and it's absolutely unusable.... But this is progress, ladies and gentlemen. I'd say 60% there.

EDIT#3:

I've got jwm running on the framebuffer with basic touchscreen input. It hardly does anything and crashes when attempting to load anything, but it's a start.

I'm currently having trouble with the Modeline in my xorg.conf. I can't seem to get a good match to the framebuffer's display, and it seems like all colors are inverted. This is what the log shows it's defaulting to:

[ 8586.873] (--) FBDEV(0): Virtual size is 1080x1920 (pitch 1080)
[ 8586.873] (**) FBDEV(0): Built-in mode "current": 0.0 MHz, 0.0 kHz, 0.0 Hz
[ 8586.873] (II) FBDEV(0): Modeline "current"x0.0 0.00 1080 1239 1249 1285 1920 1930 1932 1936 -hsync -vsync -csync (0.0 kHz b)
[ 8586.873] (==) FBDEV(0): DPI set to (96, 96)

I think this is why LXDE is not loading properly also.

If someone more familiar with displays in Xorg.conf could help, it would be appreciated. I'm done with this for today (pulled an all-nighter on this one).
[AT&T Samsung Galaxy S 4 General] jwhemmer:
Rooted Verizon GS4 - Everything works but...

-------------------------------------------------------------------

I followed all the directions you provided. I have to say that it's very well tailored for a medium user such as myself. After completing ALL the steps thoroughly, I connect the VNC and all I see is the grey window with the black X mouse cursor. I left it there for a bit to see if it's loading something, yet I see no action in this setup. The first problem I had was "no such file or directory" from he script. But I copied the ubuntu folder with its contents and the ubuntu.sh file over to /emulated/0 which apparently GS4 reads that for the sdcard location. After that, I read NO ERRORS in the script as if everything works. But back to the stagnant grey window... can you help me please?

Not sure what questions you would have for me at this point. My device IS rooted and I downloaded all of your recommended tools to use for this project. Thank you in advance if you have time to review my concern.

------

small edit for afterward thoughts: two things I do see that could be an issue after reading the script again.

upon loading script: "mkdir failed for /data/local/ubmnt, File exists"

and upon exiting: "rmdir failed for /data/local/ubmnt, Device or resource busy"
[AT&T Samsung Galaxy S 4 General] Aou:
When using the 12.04 image that's available, I get the same thing (grey screen with cross). I'm not entirely sure what causes this, but as I delve further and further into this, I will try to find out what is going on. My guess is that the LXDE window manager is failing to load for some reason, but I haven't looked at the log yet. Please be sure to use the 13.04 V1 Small image for now (you likely are, but I want to be sure). It is quite likely whatever is keeping the 12.04 image from working on the I337 is translating over to the 13.04 image on the Verizon version.

Now as for the ubmnt foldrr failing to remove. That is caused when something fails to unmount properly. for me, it was when the sdcard didn't unmount properly. Try commenting-out the lines that mount and unmount the sdcard, and then give it a good reboot. Load it up again and immediately exit before connecting VNC.

The first "already exists" message will still be there, but the hope is that the rmdir command will not error.

It is possible that whatever is causing the grey screen is also keeping the image mounted. Might also try a "sync" command within ubuntu before using exit.
[AT&T Samsung Galaxy S 4 General] Aou:
Some minor progress this afternoon. Downloaded "fbset" to get some details about the framebuffer, and found that the correct mode to use was "1080x1920-0" ... apparently it thinks that the framerate is zero or something... I dunno.

Regardless, I can at least start playing with the modeline now:

[ 13287.998] (**) FBDEV(0): Depth 24, (--) framebuffer bpp 32
[ 13287.998] (==) FBDEV(0): RGB weight 888
[ 13287.998] (==) FBDEV(0): Default visual is TrueColor
[ 13287.998] (==) FBDEV(0): Using gamma correction (1.0, 1.0, 1.0)
[ 13287.999] (II) FBDEV(0): hardware: msmfb44_80901 (video memory: 16320kB)
[ 13287.999] (**) FBDEV(0): Option "fbdev" "/dev/graphics/fb0"
[ 13287.999] (II) FBDEV(0): checking modes against framebuffer device...
[ 13287.999] (II) FBDEV(0):	mode "1080x1920-0" ok
[ 13287.999] (II) FBDEV(0): checking modes against monitor...
[ 13288.000] (--) FBDEV(0): Virtual size is 1080x1920 (pitch 1080)
[ 13288.000] (**) FBDEV(0): Mode "1080x1920-0": 178.3 MHz (scaled from 0.0 MHz), 138.8 kHz, 71.7 Hz
[ 13288.000] (II) FBDEV(0): Modeline "1080x1920-0"x0.0 178.35 1080 1239 1249 1285 1920 1930 1932 1936 -hsync -vsync (138.8 kHz)
[ 13288.000] (==) FBDEV(0): DPI set to (96, 96)

Currently working on getting gnome-session to work, hopefully.
[AT&T Samsung Galaxy S 4 General] Aou:
*sigh* I need to learn how to build an xorg video driver module now... Any advice? Anyone? lol

I need to build this:

https://github.com/freedreno/freedreno/tree/master/fdre-a3xx

I found a pre-built version (kinda) over here: https://github.com/freedreno/freedreno/wiki/Ifc6410

But when I try to use it, I get the following error message in my xorg.0.log:

(EE) module ABI major version (14) doesn't match the server's version (13)

I'm guessing that it's just simply the wrong version.

If I can get freedreno to work on this Adreno 320, I'm pretty sure we'd be golden.
[AT&T Samsung Galaxy S 4 General] Aou:
If anyone knows stuff about building external kernel modules, please visit my new thread over here.

The problem described in that thread is directly relevant to getting Ubuntu to write directly to android's framebuffer, possibly with some hardware acceleration. ;)

EDIT:

I found the solution, never mind.

.... continuing the work...
[AT&T Samsung Galaxy S 4 General] Aou:
I have successfully made LXDE write to the framebuffer correctly, and I have touchscreen cursor input. I'm currently working out some bugs with the colors and display resolution, but otherwise, it looks like I should have a 3D accelerated Ubuntu desktop on my S4, without VNC at all.

More details to come.
[AT&T Samsung Galaxy S 4 General] devwithzachary:
Drop me a PM if you like, would be very interested in seeing what you did to get it working on the S4 and perhaps we can integrate your work with the official images
[AT&T Samsung Galaxy S 4 General] Aou:
Certainly! Once I get things a bit more solidified usable, I'll let you know. I also need to determine whether a custom kernel is needed or not (and what exactly might be needed within) - ended up re-building [MENTION=1823993]Jamison904[/MENTION]'s BioShock kernel about 19 times (literally - the build I'm using is #19) before I learned what it takes to get things working properly. Funny part is, the stuff I needed might have been present all along! heh
[AT&T Samsung Galaxy S 4 General] gabriolastyle:
Thanks worked for me I was having trouble and it turned out the terminal I was using was not executing the ubuntu.sh script properly so I installed a different terminal and it worked.
[AT&T Samsung Galaxy S 4 General] Aou:
Update:

I had Ubuntu working (outputting to the framebuffer well!), and then my whole ubuntu.img got messed up while screwing with things (long story), so I had to start over. Took me a couple days, but I got things working again. Also managed to document everything I did to get it working.

But this time, I managed to get the full resolution working (1080x1920) without "roving horizontal lines". Previously was unable to get a resultion past 800x1849 (weird, but true). Also manged to get external keyboard/mouse input, in addition to the touchscreen (as a touchpad) support. Also managed to get back into Android without any issues after exiting Ubuntu... most of the time. Still have some lag issues when getting back into Android sometimes, trying to figure out what's going on there.

So, current major issues:

1) No rotation. Stuck in 1080x1920 "portrait" resolution. Not terrible, but not great.

2) Colors are currently partially inverted. Basically, red & blue are inverted, so it's BGRA instead of RGBA. Might have to edit the source code of the video card drivers to get this to work, but I'm hoping not. We'll see.

"More to come." - as I always say.
[AT&T Samsung Galaxy S 4 General] Aou:
Lot of work on it again today, but not a lot of progress. Haven't solved the color problem or screen orientation issues, but discovered plenty of things that don't fix these... -_-

- Cleaned up the launching scripts

- More documentation (exactly what I've done to get this far)

- Running LXDE as user (not root)

- Added Onboard for virtual keyboard

I can get it to exit somewhat cleanly back to Android, but it seems that doing this leaves something in memory (not sure what yet), and this can slow Android down just a hair. Doing this repeatedly will eventually cause Android to crash. So for now, I have the script just reboot the device after leaving LXDE and unmounting everything.

Also, I've determined that a custom kernel (with specific options enabled) is absolutely needed to do this properly with hardware acceleration support. It might be possible to get basic 2D support working for those who are stuck with a stock kernel - I'll look into that part later. I'd like to the full thing working decently first, and then I'll take a step back to look at this.
[AT&T Samsung Galaxy S 4 General] DeadlySin9:
If you mean replacing Android with Ubuntu, then I'm pretty sure it's difficult. It has been done on other devices however, so it is possible.
[AT&T Samsung Galaxy S 4 General] Aou:
Been on vacation for a while, but I've still been working on this. I'm pretty close to getting this to work, and I'm working with Rob Clark (developer of Freedreno and other projects) to get his driver functioning without causing a nasty null pointer exception that results in a reboot... long story. In all my documentation so far, I've managed to write a series of bash scripts that will create a fresh, blank image file on your sdcard, download Ubuntu Core, set it up with everything that's needed to run Unity or LXDE, configure it, download all the tools needed to build driver packages from source, and then clone some driver repositories and build them. Depending on internet connection speeds, it does all this in 20 minutes to an hour.

I see no reason why the Chroot+VNC method wouldn't work on the TMO version. If you follow the instructions carefully, there's zero risk here. I would of course make a nandroid backup in CWM/TWRP just in case, however.

If we're talking about the VNC method (the currently working method that's in post #1), then it would be difficult to safely package this into a flashable zip. I think it'd be easier to just go through the steps. I'll see if I can simplify it a bit more later, too.

Indeed, it's been done before! However, this method is far, far from accomplishing this. Once I get the framebuffer method working better, I think we'd be much closer to getting such a thing working. It would involve replacing the Android kernel with something that can handle the S4's hardware, but boot directly into Ubuntu. Considering Ubuntu would be missing a lot of features that are normally present in Android, this would be somewhat silly to do. It would be more worth it to try to get Ubuntu Touch working natively.

One question I would have is whether the Loki exploit that we're relying on would work for such a heavily customized kernel...
[AT&T Samsung Galaxy S 4 General] Aou:
Update:

After fighting with a nasty null pointer exception and some other bugs, Freedreno is working!

- Colors have been corrected. No more BGRA problems, woo!

- Working on the screen rotation again. Last time I got it to work, I couldn't get the touchpad to rotate with it. I'll try again.

- Haven't tested 3D yet.

- Only have LXDE working right now, and only 90% at that. Missing a few configuration settings that I'll need to track down and put into my bash scripts.

For those following along, please note that I was absolutely required to modify the kernel to get this far. But don't worry, I'm documenting everything, so you should be able to modify your favorite kernel on the S4 to get this to work. I'm currently working off the official Samsung kernel source, but these modifications should translate well to other kernels and roms just fine.

More coming.
[AT&T Samsung Galaxy S 4 General] Frozt:
So my question is, that is there any daily drivers of Ubuntu running for the s4?
[AT&T Samsung Galaxy S 4 General] Aou:
Nothing nearly that far yet. I'm still exploring the possibilities of booting directly into Ubuntu Desktop or even Ubuntu Touch, but with the I337's bootloader limitations, this might be near impossible.

More importantly, Ubuntu Desktop isn't really designed to be on a smartphone, so the interface is not exactly touch-friendly, and there's hardly any support for features like using the phone, text messaging, or just about any of the sensors.

Update on the project: I've been playing around with trying to get gnome/unity and lightdm to work properly, but I keep getting stuck. In one case, I got the full unity desktop working, but all windows, title bars, and tooltips/etc. were all shoved to the bottom left (and unmovable), making it completely useless. In another case, I got the greeter working (with login, woo!), but after logging in, I'm faced with a black screen and movable cursor. I'm currently working from the daily 13.10 builds, and building from the latest sources of Freedreno, so things are a bit unreliable at the moment.

I also haven't worked on the project in the past week due to a busy schedule and a bout with a cold.
[AT&T Samsung Galaxy S 4 General] fabiaiz:
Can't download sh file
[AT&T Samsung Galaxy S 4 General] Aou:
Are you referring to the ubuntu.sh from the OP? If so, I just checked, and the link is still working for me. Can you please elaborate a bit?

Update: I'm looking into Ubuntu Touch also, or at least the general idea of natively booting into linux (whether ubuntu or otherwise). I'm running into many silly little problems, such as the the cmdline variable being passed to the kernel lacking a "root=" variable, and silly stuff like that. It seems the primary challenge is these ^$%$@#! bootloaders being locked. Working on putting together a kernel that can:

a) work on the I337 in general

b) be loki'd

c) can boot either android or another linux with minimal changes between them.

Yeah, still working on that. But thankfully I've got UART output to work with. Also, I've managed to get an Ubuntu-based ramdisk to boot with adb capabilities.

BusyBox v1.20.2 (Ubuntu 1:1.20.0-8.1ubuntu1) built-in shell (ash)
Enter 'help' for a list of built-in commands.

Hehehehehe....

By the way, what's a good resource to tell me more about /proc/cmdline ?
[AT&T Samsung Galaxy S 4 General] Aou:
Well, I'm getting closer and closer. Using pieces of the newer Ubuntu Touch "flipped" kernel, I've managed to boot my i337 straight into Ubuntu Desktop and Ubuntu Touch. Unfortunately, something goes wrong on the upstart, or something (I honestly don't know what yet) - all I get is the bootloader image on the screen ("custom"/padlock in this case). The good news is, the kernel I'm using at least starts up an adbd, so I can use adb shell to get to Ubuntu and pull logs, etc. The bad news is that I have no display, no 3G, no WiFi, and no experience getting these sorts of things working at all. :P BTW, I have tried using a "cat /dev/urandom > /dev/fb0" but it doesn't show anything on the device display.

I pulled a recent syslog from an attempt to boot Ubuntu Touch, and uploaded it here: http://pastebin.com/UrcAZVMc I've never analyzed these before, so it's going to take me a while to see what's going wrong and where (if it even tells).

I'm also looking into getting the ubuntu.img with freedreno support to work, as a backup plan. The idea is that if I can't get Ubuntu Touch to work, then maybe I can at least get LXDE to show on the screen and work. It would be miles ahead of anything else that's been done for the S4 - at least as far as I've seen.
[AT&T Samsung Galaxy S 4 General] xjesus:
It's really impressive your achivements. I'm following your work and hoping that someone can port it to my just acquired S4 (i9505).

Does anybody know someone getting this far with i9505?

I wonder if I could help you testing somehow.
[AT&T Samsung Galaxy S 4 General] Aou:
I've documented nearly everything that I've done to build my custom kernel, so it theoretically wouldn't be hard for someone to replicate the same changes to am i9505 kernel. It seems, at this point, that this is the most crucial part to getting any of this to work.

I'm currently about 90% confident that I'm done building the kernel. What I have right now is working great for Android and for Ubuntu (native) - only needing to change out the ramdisk in it to boot one or the other. I wonder if there's a way to change this on-the-fly (i.e. hold down a button to load a different ramdisk altogether? that'd be sweet.)

Speaking of the kernel still, I've managed to make some "final" improvements in the kernel, making the syslog look MUCH better. Here's the latest: http://pastebin.com/qaDGJdUw

It seems my current challenge will be to actually go through the official Ubuntu Touch Porting Guide and build the new Android rom.
[AT&T Samsung Galaxy S 4 General] Frozt:
Looks like everything is coming together Nicely hopefully We can get a daily driver of this build That would. Make my day, haha . Actually sold my s4 and got the Xperia z but will get another one as soon as Ubuntu Touch is working, if there is anyway I can help let me know
[AT&T Samsung Galaxy S 4 General] zhangew:
Have you ever tried Linux Deploy on your S4?

Recently, some people said Linux Deploy didn't run on their S4s.

Because of "Permission Denied" issue.

But the author don't know the reason well yet.
[AT&T Samsung Galaxy S 4 General] zhangew:
Succeeded on my Galaxy Mega 6.3(Android 4.2.2)

Thanks!

Succeeded.

I installed busybox free.

---------- Post added at 03:23 PM ---------- Previous post was at 02:42 PM ----------

I tried "df' command, and found there wasn't mounted storage device.
[AT&T Samsung Galaxy S 4 General] xda23:
Is it possible to ever make this into s zipfile that can just be flashed. Thanks
[AT&T Samsung Galaxy S 4 General] DeadlySin9:
Look back through Aou's replies and you'll find an answer.

Sent from my SGH-I337 running Foxhound 2.0
[AT&T Samsung Galaxy S 4 General] xjesus:
Kali Linux working with "Linux Deploy" app on S4 i9505

I've found this interesting post about Kali Linux working with "Linux Deploy" app on S4 i9505

http://xdaforums.com/showthread.php?t=2400638
[AT&T Samsung Galaxy S 4 General] Nsomnia:
F
[AT&T Samsung Galaxy S 4 General] Aou:
Whew! Been taking a break from this lately - sorry guys. Mostly I was waiting on the release of 13.10, which has happened. Now I have something stable to work with, and it is making things a bit more predictable and smooth. I might have to give up on the idea of running a full Unity3D right now, it seems. However, I've got Lubuntu's greeter working perfectly at the moment.

I took another shot at Ubuntu Touch again, but I've got [at least] two things against me right now:

- I can't get anything to output to the screen, no matter what I try

- I can't build the required CM10.1 android that Ubuntu Touch relies upon - mostly because I suck at it. The prebuilt one that I've been trying to use won't work (not made for the S4). If someone with more experience building Android from scratch/source wants to help here, please speak. Otherwise, I'm probably going to drop the focus on Ubuntu Touch and swing back into getting the Freedreno method to work better.

Regarding the two points above, I feel that the latter is preventing the former. I think it's related to Ubuntu Touch relying on SurfaceFlinger, or whatever the proper name is for it.

At first glance, it looks like Linux Deploy is using the same VNC method. I really didn't look into it at all, though.

In regards to a flashable .zip file, I might do that eventually. As any of you have probably seen in my other threads, I really like to provide everyone with instructions on how they can do things for themselves, in case they wish to customize things. If I had any experience writing Android apps, I'm sure this could easily be bundled into a nice little .apk. We'll see how it goes with the Freedreno method first. ;)
[AT&T Samsung Galaxy S 4 General] xda23:
Does anyone have this working on the T-Mobile Gs4.please let me know.
[AT&T Samsung Galaxy S 4 General] DeadlySin9:
Linux Deploy is another chroot, it's in the thread title. Does look nice as an easier way if it works with ours, but this is working just fine anyways.

Can't wait to see what you can do with this, flashable zips or an app would be awesome :D I'd try to help with the building but I'm still trying to learn more about development and school schedule hasn't exactly permitted that :P
[AT&T Samsung Galaxy S 4 General] xjesus:
Please go for LUbuntu and forget about Ubuntu Touch for the moment

IMO Ubuntu Touch is not yet usable nor a real good alternative OS.

http://www.omgubuntu.co.uk/2013/10/4-reasons-why-you-shouldnt-install-ubuntu-touch-1-0

Maybe some time after 14.04 we can begin to think about it as a real good alternative. But even so, I'd prefer to have an Android OS in the mobile and the possibility to use Linux when docked to a keyboard and monitor. I think Canonical first goal was "Ubuntu for Android" and they should have released it already but they are trying to push people out of Android directly with this "Ubuntu Toch" alternative. I don't know why they don't release the work already done with "Ubuntu for Android" as we can see in some of their internal videos working...

http://www.youtube.com/watch?v=bk9-v8Sl4yU

They show us a very good and interesting idea but they don't release it... and instead they release a very early beta release of Ubuntu Touch...

For the moment, if I were you I would put all my efforts on developing a stable release of Lubuntu or Xubuntu for Android (I prefer XFCE but it might be a little resource hungrier)

One you have it I'd love to see a proper port to i9505 with an easy installation process.

Another suggestion I would like to make you is to consider some alternative remote session that would speed up the interface like for example:

- xrdp (much faster than vnc)

- teamviewer or Splashtop for easier access even from another computer/phone in another network. Splashtop video performance and real-time interface is really impressive

Thanks a lot for all your work
[AT&T Samsung Galaxy S 4 General] DeadlySin9:
Ubuntu for Android is a thing only for "Mobile network operators and handset makers". They contact Canonical to arrange a meeting (see this form). So unfortunately I don't believe it will be coming out to us anytime too soon. Ubuntu Touch would be nice to have set up for when they do release a version that isn't just for development, and even now having a port is good for developers to work on many devices and test. As far as the remote session, as long as you find a remote app that has a version that can run in our chroot (not all normal desktop applications work, if you read through this thread you see you need an ARM version) then you could test it. I tried to get Splashtop to no avail, but I didn't try much.