[Galaxy Note 10.1 (2014 Edition) General] Stevethegreat:
#NOTE: For quick taste go to post#4. That mini-guide -for the time being- only works on Samsung's Kitkat. For Best Performance running Samsung's KitKat is recommended

Also (just so that to be clear), no matter which version of this guide that you are going to follow, you'd need at least 5GB of free Internal Storage.

INTRO

Since the advent of the Microsoft Surface Pro line we had a great "great-computer/mediocre-tablet" combo on one hand, and through the already running iPad line we had a "great-tablet/bad-computer" on the other hand.

One of the primary reasons to buy into the Note tablet line is because I always thought that it conveniently sandwiches itself between the above categories hopefully avoiding the pitfalls of both. Sadly the reality was a bit further than that and our tablet seems to have taken equally the bad and the good of the above lines. I set to ameliorate part of those faults, since I mostly lack coding expertise or indeed deep knowledge of the Linux kernel I created a ... patchy solution.

Sooo the following is a ... rather monumental guide/tutorial to set up Gui - Linux with acceptable performance on top of android in our devices. Since I'm running it "on top" it relies to the chroot method (it's been detailed in quite many posts). For simplicity's (and ... repeatability's) sake I'm using the "LinuxDeploy" app which can be found here (buy a beer to the creator, don't forget that he's practically giving away his software).

Ook, let me say right out of the bat that I could have had released a ready-made Linux image so that everybody could benefit instantly, or alternatively write a script to automate the process that I'm going to detail next.

Instead I decided against it, firstly because (as you will soon find out) this guide is a work in progress, so through exposing each individual step it can/would actually become better (hopefully through the help of more talented/knowledgeable individuals than I). Secondly many of the steps would most certainly break down, down the road (continuously changing software tend to do that to tutorials), yet since all/most steps would be exposed a simple tweak to them would save it...

Important Note: This particular Guide is tested to work on both KitKat and Lollipop (Samsung) Roms for P600. Even a slightly different setup may cause it to misbehave. So that's one more reason why I chose to expose the relevant steps (what/how they do). Hopefully slight tweaks to some of the steps would make Linux perfectly functional on all variants of Note tablet and their many differing roms.

PREPARATIONS

Let me move to the particulars then:

You'd definitely need root and a "Virtual Terminal" enabled kernel (I can't stress this enough), xposed framework/modules is optional (only needed for one work-around). I'm sure a mere Google search can tell you how to achieve the 1st and the 3rd requirement but the CONFIG_VT enabled kernel is a tougher nut to crack. Therefore I'm willing to make a list with VT_Enabled kernels for out tablet, for the time being I'll only be offering kernel based on Samsung Roms (many thanks to [MENTION=5529656]xluco[/MENTION]). Non-P600 guys should find an equivalent kernel on their own (or compile one for their own usage).

KitKat: http://xdaforums.com/attachment.php?attachmentid=3686507 , reportedly Disabl0w's version works better

Lollipop: http://xdaforums.com/attachment.php?attachmentid=3686508

Marshmallow: I'm willing to post a VT Enabled kernel here when (and if) our device reach nightly status on CM13.

BEWARE those kernels are for P600 (wifi version of Note 10.1 2014). I take no responsibility if you've bricked your device by flashing it to the wrong device/setup.

Additionally those apps would be needed:

a) Meefik's Busybox v1.24.1 (Download the apk and install it, once installed, do as follows: open the app -> tap "install" in the lower right corner -> OK)

b) LinuxDeploy v1.5.6 (Download the apk and install it, once installed, open the app -> press the "menu" button -> tap "settings" -> tap "update env" -> OK )

c) Linux Deploy's companion app (LinuxCanvas I named it)

d) Privilege Terminal (Terminal Emulator is more feature packed but for the purposes of this guide Privilege Terminal is preferable as you can paste content coming from HTML pages, directly to it)

e) Lastly, certain Configuration Files are needed (download and extract the contents to the root of your internal storage)

THE GUIDE

The guide is really made out of 11 simple steps. You can "blindly" follow them and you'd get a fully working image. Preferably, though, you'd also read the explanations of each step. I've included them because (as mentioned above) this guide is a work in progress. So making you privy to what each step does would hopefully lead to a better guide. Probably one with less steps and even more functionality. The explanation part would also help you debug a step if (for some reason) it didn't work correctly to your device.

So on we go:

1) Copy xorg.conf:

a) Open Privilege Terminal

b) Run:

su;
cp /data/media/0/Linux/res/xorg.conf /data/data/ru.meefik.linuxdeploy/files/share;
echo"";

Explanation:

The xorg.conf file is basically where input-output devices are mapped. I've modified it to support as many as 8 input devices as well as to support the S-Pen (w right click function!). If you want to add more devices, or for some reason your S-pen does not work and/or you prefer the S-pen button to work as middle click you can modify by navigating to Linux/res/xorg.conf (you can open it with any text editor). To find to which events your devices are mapped you have to run cat /proc/bus/input/devices in Terminal Emulator. From that you could see to which event you can map your S-Pen and/or the rest of your external devices. As it stands I have S-pen as event8 (the default in most roms) and my keyboard and mouse as 10 and 11 respectively (that's how they get mapped in my devices, but they may get mapped differently to yours).

Note: Apart from S-pen everything else doesn't *have to* be mapped precisely (even if your mouse is called "keyboard" it would still work"). Also as a general heads up please connect your devices after device boot as if you have them connected already (say through OTG connection) as the device boots, the handler numbering would be messed up (for example the mouse could be event5 and s-pen event10)

2) Create a Linux image

a) Open Linux Deploy

b) Navigate to properties (Arrow showing "down") and choose the following Configuration:

Use the Default option to all except:

To Distribution Suite: Wheezy

To Installation Path: change the "/storage/emulated" part to "/data/media" (everything else stays as is)

To Select components: Tick X server, untick VNC server

To Graphics subsystem: choose Framebufer

To GUI settings: choose DPI = 230 (or anything higher if it suits you) and untick Force Refresh

To Custom Mounts: Tick it

To Mount Points: Delete the extant mount points (select them -> press "menu" -> delete) and add the following:

/data/media/0

/mnt/media_rw/extSdCard

/mnt/media_rw/UsbDriveA

/mnt/media_rw/UsbDriveB

If you want to add support for more External devices you can add up to 4 more ( /mnt/media_rw/UsbDriveC - /mnt/media_rw/UsbDriveF )

c) Return to Properties' main menu and Tap Install (first selection)

d) Wait (quite a bit) until it reads "<<< install". It should read "processing triggers" on the line just before it, if not, reboot and follow step (c) again (re-install)
​

Explanation:

I was only able to make Debian and Ubuntu variants work with our device. In principle everything should (and can) work as well, but since I'm mostly accustomed to Debian's eco-system I never bothered to investigate. Similarly (from windows environments) only LXDE and XFCE reliably work (KDE and Gnome technically "work" with Debian too but they're ultra slow). For this instance I chose Debian Wheezy + LXDE due to GUI performance issues mostly, every other disto/window manager causes considerable lag in window placement. I used to use Debbian Jessie + XFCE, love XFCE's features (sessions, Window snap), but the ultra-slow window placement mostly killed the GUI experience that I was after. So I reverted to the less featured but lighter on resources LXDE.

Note: Our tablet's internal SDcard is/would be mounted to /mnt/0 when inside the chroot Linux environment ( similarly External SDcard -> /mnt/extSdCard , 1st external Storage -> /mnt/UsbDriveA , etc ). If you're on another device (not P600) running the command "mount" from Terminal is going to give you where in which paths your storage mounts to, in which case you'd have to change the mount points in LinuxDeploy accordingly.

3) After the linux image is created (Linux deploy says "<<< install") go to Linux's Shell:

a) Go back to Privilege Terminal

b) Run:

/data/data/ru.meefik.linuxdeploy/files/bin/linuxdeploy shell;
echo"";

Explanation:

It starts the Shell of the freshly installed image

3.5) This step is only relevant to those running Stock Samsung 5.1.1 rom. DO-NOT-RUN it if you're on any other version. Giving root permissions to the default user ("android"):

Run:

sed -i '/android/c\android:x:0:5000:x:/mnt/0/Linux/Home:/bin/bash' /etc/passwd;
echo"";

Explanation:

Due to complication with SELinux permission (from Android 5 and up most possibly), as a workaround I had to give root permissions to user "Android". See Issue "8" in Post #3 for more information.

4) Change Home folder's path:

Run the following commands:

usermod android -d /mnt/0/Linux/Home;
rm -rf /mnt/0/Linux/Home;
mkdir /mnt/0/Linux/Home;
cp -a /home/android/. /mnt/0/Linux/Home;
echo"";

Explanation:

Technically this step is optional but I would strongly advice against ignoring it as it allows an 1:1 communication between Android and Linux's user files. By choosing a folder that is visible by android file managers (/Linux/Home) it allows for the user to instantly manipulate the data he/she just created within Linux. For example a document file that is saved on (Linux) Desktop is easily visible by navigating to Linux/Home/Desktop or better yet it's automatically detected by the relevant app (for example a music app would "see" your music Folders, a video app your "Linux videos", etc). Additionally it uses the /sdcard partition which is close to 28GB in size, instead of the 4GB micro-partition that LinuxDeploy created (which is better used by the software that you're going to install there).

5) Apply basic HiDPI fixes:

Run:

cp /mnt/0/Linux/res/.gtkrc-2.0 /mnt/0/Linux/Home/;
echo"";

Explanation:

It solves basic issues that arise from the HiDPI environment of our devices. Things like CheckBoxes, ScrollBars, even Double Click behavior. The changes are only detectable on GTK2 software. Since all the software I've been using is based on GTK2, it is enough for me. However if you're using a GTK3 based application please by all means recommend of a way to make similar changes to GTK3 applications (I think equivalent -system wide- changes happen when one modifies the /etc/gtk-3.0/settings.ini file). Lastly if the dimensions/changes are not to your taste you can always try different ones by changing their numeric values on Linux/res/.gtkrc-2.0 file (editable by any text editor, beware it's a hidden file) and then rerun this step. What numeric value is controlling what, is rather straightforward due to the naming that it follows. So happy editing!

6) Enable GUI Repaint:

Run:

chmod +x /mnt/0/Linux/bin/logout;
echo"";

Explanation:

It fully enables the menu button within the LinuxCanvas app (it redraws the environment). I could bundle the script with my "LinuxCanvas" apps, but I wanted to make it modifiable (for example right now it kills the LXsession), but if you were to use a different Window manager you'd probably need to use a different command) and since my app creation powers are very (very!) basic, I simply exposed an internal part of my app. It can be found in "Linux/bin/logout". You can edit it with any text editor (again you'd have to rerun this step after editing is done).

7) Resize Windows Borders:

Run:

chmod +x /mnt/0/Linux/bin/resizeBorder; chmod +x /mnt/0/Linux/bin/revertBorder; /mnt/0/Linux/bin/resizeBorder;
echo"";

Explanation:

Another Fix needed due to the high DPI of our devices. It basically makes the borders of the windows that much thicker. Since it obviously makes the look of the environment less easy to the eyes I would welcome any work-around. Also you can run

/mnt/0/Linux/bin/revertBorder

(from within linuxdeploy's shell) to return the Windows borders to their initial size if you're so much bothered about the ... foul look (again I'd advice against it as it'd kill some of the ease of use of window placement/resize). If you want differently sized borders you can always edit the script (found in Linux/bin/resizeBorder) with the text editor of your choice. My current value is 10 pixels you can change it to whatever. Also you don't have to change it for every theme, just the one you're using. Again, I'm open to recommendations (for example what value do you think is better for usability?)

8) Fix Mouse Cursor size:

Run:

sed -i '/CursorThemeSize/c\iGtk/CursorThemeSize=58' /etc/xdg/lxsession/LXDE/desktop.conf;
echo"";

Explanation:

It makes the Cursor bigger. It doesn't always work. I have to investigate, but I can't be bothered since it rarely (ever) caused me any issues. Still I'd welcome it if someone is willing to investigate and see why it works only some of the times (it probably has to do with boot sequence/times).

9) Install basic Components:

Run the following:

apt-get update;
sudo -u android sudo apt-get install -y samba gvfs-bin gvfs-backends zip iceweasel xfce4-mixer dmz-cursor-theme gstreamer0.10-alsa;
echo"";

Explanation:

Though the above shell command we add some basic functionality to our Linux installation, like a Samba server (network places for the Windows guys), a browser (Iceweasel is called in Debian) and a virtual keyboard (very important for those using only the S-pen).

10) Exit:

Close Privilege Terminal (press "CLOSE" on the upper right of the app and then "OK")​

Explanation:

We're better off to shut down this particular shell instance as it may mess up with the booting of our Linux image later

11) Start Linux:

a) Open "LinuxCanvas"

b) Press Volume Up, wait a bit and voila! (if it doesn't work the first time, press the "menu" button to repaint)​

Explanation:

The App is included below this post. This is a veeery basic app (my app-creating prowess is close to zero) which acts as a companion to LinuxDeploy. LinuxDeploy was/is mostly created to fascilitate the XServer/VNC crowd, but the "Framebuffer" crowd has been left a bit in the cold. With as a result the "Framebuffer" functionality of LinuxDeploy to be quite basic (it only creates a black frame and that's it). So I added a bit more than that (it's the super-duper edition :p). Orientation is locked, back, Escape buttons blocked (they cause issues). Also:

Volume up -> starts the chroot environment

Volume down -> kills it ("un-chroot")

Menu button -> "redraws" the graphical environment

And that's it. The caveat is of course (as a companion app to LinuxDeploy) that it is heavily dependent to LinuxDeploy, so any change that the developers would choose to make would -predictably- break functionality, so please PM me if/when that will happen. Also I'm a very un-creative person when it comes to App-creation so I would be veeery happy if another user was to take this task from me (someone who -hopefully- would make a much better featured and beautiful companion app), so updating this guide would be the only task that would remain to me.

As you may be able to see, by (as of) now you're good to go and you can fully work on your brand new Desktop environment. However I would like to add some less essential tips/fixes on my second post as well as a list with the remaining issues and workarounds to them (in my third post).