Linux on the Samsung Galaxy Tab 10.1... And you can too!

This guide is now 1 year old! :tada:

If you have an old Samsung Galaxy Tab 10.1 sitting around gathering dust with its old Android 4.4, heres’s how to get a real operating system running on it! Took me a few days to get this working on mine with the thankfully existing but outdated guide so I’m sharing this you don’t have to go through all the pain I did.

Massive props to Github users exception13, X-Stranger, thermatk and mikkeloscar for providing the original how-to’s and source code. You some cool dudes.

What you’ll need:

  1. A ROOTED Sumsung Galaxy Tab 10.1 (2014) model GT-N8000, GT-N8010, GT-N8013 (Unfortunately, this requires a Windows only application. See here for instructions)
  2. An SD card. Preferably a good one. This is where Linux will go.
  3. A computer running Linux
  4. Some free time

FYI, I’m going to be referring to the Samsung Galaxy Tab as the SGT from now on.

PART ONE: The kernel

Unfortunately, since the kernel the SGT uses is so old, it can’t be compiled using GCC version 5 and above.
If you already run sonething like debian Jessie, you should be fine, otherwise there are 2 options, run a chroot of an old distro or use VirtualBox to run an old distro. I chose to run a virtual machine of 32 bit Ubuntu 14.04.5. You can use 64 bit but we’re working with 32 bit arm and you have to install extra packages on 64 bit to get things working and I don’t want to deal with that.

PART 1.1: Setting up a virtual machine

So, install virtualbox and download the 32 bit iso of ubuntu 14.04.5 from here or from a local mirror.

  • Create a new virtual machine giving it as many cores and as much RAM as you can. Remeber to enable PAE. Give it a reasonably sized virtual drive here as well. You’re going to be compiling the Linux kernel after all.
  • Create a shared folder with your home folder as the path and set it to auto mount.
  • Start up and install ubuntu.
  • Insert the virtualbox guest additions iso and install them so that shared folders work.
  • Don’t forget to install updates.
  • Run the command sudo usermod -a -G USERNAME vboxsf Replace USERNAME with your username. This is so you can access the shared folder.
  • Reboot the virtual machine

PART 1.2: Dependencies and source code

  • Run the command sudo apt-get install git build-essential libncurses5-dev to install some neccesary programs
  • Just run these next few commands to make a directory structure and download the source code:
    mkdir opensgn
    cd opensgn
    git clone https://github.com/opensgn/N8000.git -b arch-r4p0
    mv N8000 kernel
    git clone https://github.com/opensgn/N8000.git -b toolchain
    mv N8000 toolchain
    sudo mv toolchain /var/local/
    git clone https://github.com/thermatk/opensgn-easy.git -b commonfiles
    mv opensgn-easy firmware

Part 1.3: The Build

  • Now run these ones to configure the kernel:
    cd kernel
    make mrproper
    export CROSS_COMPILE=/var/local/toolchain/bin/arm-linux-gnueabihf-
    export ARCH=arm
    export SUBARCH=armv7h
    make n8000_linux_mali_defconfig
    make menuconfig

  • Go to “Boot options” and change the command line to this:
    root=/dev/mmcblk1p1 rw rootfstype=ext4 rootwait vmalloc=144M

  • Done, Exit, Exit then run some more commands to compile the sucker:
    export INSTALL_MOD_PATH=$(pwd)/compiledmodules
    make -j2 # CPU cores + 1 here
    make modules_install
    rm compiledmodules/lib/modules/3.0.31+/source
    rm compiledmodules/lib/modules/3.0.31+/build

  • Once that’s done, copy the useful files to a new folder:
    cd ..
    mkdir -p results/{boot,opt}
    cp kernel/arch/arm/boot/zImage results/boot/
    cp kernel/System.map results/boot/
    cp kernel/.config results/boot/config-$(ls kernel/compiledmodules/lib/modules/)
    cp -r kernel/compiledmodules/lib/ results/
    cp -r firmware/firmware/* results/opt

  • Copy that “results” folder into the shared folder if you used a virtual machine because your done with it now. Shut it down and delete it if you want.

PART TWO: The root filesystem

For better compatibility, replace all mentions of jessie with wheezy. It’s an older version but still supported for now.

  • Plug that SD into your machine and format it with a single ext4 partition

  • Mount that partition somewhere. I just mounted it to /mnt to make things easy
    mount /dev/sdX1 /mnt # X is the SD card

  • Install: debootstrap qemu-system-arm qemu-user-static or your distro’s equivalent
    sudo apt install debootstrap qemu-system-arm qemu-user-static

  • Run the next command to create a Debian Jessie root filesystem on the SD card (Other distros should work, I haven’t tested them). This will take a while.
    sudo debootstrap --foreign --arch=armhf jessie /mnt http://ftp.debian.org/debian/

  • Now we’re going to emulate and arm system with the SD card as the root.
    sudo cp /usr/bin/qemu-arm-static /mnt/usr/bin
    sudo su
    echo ':arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-arm-static:' > /proc/sys/fs/binfmt_misc/register
    exit
    sudo mount -t proc /proc /mnt/proc
    sudo mount -t devpts /dev/pts /mnt/dev/pts
    sudo mount -t sysfs /sys /mnt/sys
    sudo chroot /mnt /bin/bash

  • That long string of hex is to register the qemu-arm-static binary as an ARM interpreter in the kernel.

  • Run: /debootstrap/debootstrap --second-stage this will install and configure all the base packages. This will take a while.

  • Run the next few commands to add the debian repositories so that you can install and update programs:
    echo "deb http://ftp.debian.org/debian/ jessie main contrib non-free" > /etc/apt/sources.list
    echo "deb http://ftp.debian.org/debian/ jessie-updates main contrib non-free" >> /etc/apt/sources.list
    echo "deb http://security.debian.org/ jessie/updates main contrib non-free" >> /etc/apt/sources.list

  • Run apt-get update && apt-get dist-upgrade to update all packages.

  • Run apt-get install abootimg initramfs-tools to install the program which will make all the magic happen soon.

  • Exit from the chroot with exit

  • Open the terminal in the place you put that “results” folder a while back

  • Copy over those files to the SD card:
    sudo cp -r results/boot /mnt/
    sudo cp -r results/lib/modules /mnt/lib/
    sudo cp -r results/opt /mnt/

  • Get back into the chroot with sudo chroot /mnt /bin/bash

  • Run the next few commands to generate an initramfs and new recovery for your SGT
    cd /boot
    mkinitramfs -o initrd.img $(ls /lib/modules/)
    abootimg --create recovery.img -k zImage -r initrd.img -c "cmdline = root=/dev/mmcblk1p1"

PART 2.1: Install some useful stuff

You probably want more that a terminal login when you start up for the first time; especially since you don’t have a keyboard.

  • Here’s some stuff you should consider installing:
    apt-get install locales
    dpkg-reconfigure locales
    apt-get install $(tasksel --task-packages standard) #Installs some basic packages you might want
    apt-get install xorg xinput xvkbd xfce4 network-manager network-manager-gnome pulseaudio lightdm lightdm-gtk-greeter sudo
    Xvkbd is a basic on-screen keyboard.

  • Run these few commands to get wifi to work:
    echo "options dhd op_mode=0 nvram_path=/opt/wifi/nvram_net.txt_murata firmware_path=/opt/wifi/bcmdhd_sta.bin" >> /etc/modprobe.d/dhd.conf
    echo "dhd" >> /etc/modules-load.d/dhd.conf

  • Add a user:
    useradd -m -s /bin/bash -G sudo USERNAME
    passwd USERNAME

  • To make the on-screen keyboard available on the login screen, run nano /etc/lightdm/lightdm-gtk-greeter.conf

  • Remove the # from the start of the line that says #keyboard= and change it to look like keyboard=xvkbd

  • Edit the line that says show-indicators=~language;~session;~power and change it to look like show-indicators=~language;~a11y;~session;~power

  • At the login screen press the button with the little person on it and select the “On screen Keyboard”

  • When using the keyboard you have to press the “Focus” button then the window you want to type into, in this case, the login prompt.[/details]

  • Exit from the chroot with exit and copy that recovery.img file to your home folder
    cp /mnt/boot/recovery.img ~/

Or, if you’re don’t feel like doing any of that, you can download these pre-made recovery and SD card images:
Recovery: download
SD card: download
Just unzip and write the SD card image to the microSD card you want to use using dd or equivalent tool and resize the ext4 partition using gparted if the SD card is over 4GB.
Default user username/password: user/user
Default root username/password: root/root

PART THREE: The magic

  • Turn on and plug your SGT into a USB port and wait for it to come up as an MTP device in your file browser.

  • Copy that recovery.img file onto the SGT’s internal storage.

  • Enable developer mode on the SGT by going to Settings -> About Device and tapping “Build Number” a few times.

  • Go to “Developer options” and enable “USB debugging”

  • Install adb on you computer with your package manager
    sudo apt install adb

  • Run the next few commands to enable you to boot into Linux:
    adb shell
    su
    cd /storage
    dd if=/dev/block/mmcblk0p6 of=recovery.old
    dd if=recovery.img of=/dev/block/mmcblk0p6
    exit
    exit

  • That just rewrote the recovery partition with our special one and backed up the old one just in case.

  • Unplug the SD card from your computer and insert it into your SGT.

  • Hold the power and the volume up button (furthest from the power button) to reboot into our special recovery.

  • Wait until the “Samsung Galaxy Note 10.1” splash screen appears then release the buttons.

  • If all went according to plan, you should have Linux booting up on your screen! Again, this may take a while. Try to avoid the temptation to reboot because it’s “frozen”. It’s not.

Pics 4 Proof:

13 Likes
2 Likes

To be fair, Android is technically Linux already.

I'm just being a smartass.

Hey is the old TS wiki still a thing? It should go here

Great tutorial. Finally made it through and am happily running Debian Jessie. Some things I’d recommend:
-“sudo usermod -a -G USERNAME vboxsf” should be “sudo usermod -a USERNAME -G vboxsf”.
-Add to the list of recommended apps to install: lightdm sudo
-Maybe add a warning that if you copy commands in by blocks instead of line by line, the sudo lines will interupt the block if your login times out.

I haven’t yet gotten battery charging/indicator to work. To me it seems like the status read by upower is grabbed at boot and then not updated after that. Any ideas?

And thanks so much for putting this together!

2 Likes

And at the same time it’s not Linux in the traditional sense.

Actually, xfce4-battery-indicator did in fact change reduce percentage after boot, so somewhere an update is occurring. However, I have not yet been able to get the battery to charge while running Debian.

Great to hear that someone actually did this! and it worked too!
Thought I already put lightdm in there… oops. Added it.
I dont’t think the order of the -G and -a make a difference.
Not sure about the charging thing, sorry.

I got charging to work. Just wasn’t using a charger with enough current.

Any idea about bluetooth? That is my next hurdle. After that is sound.

Haven’t tested Bluetooth, audio works, you just have to select the right output device I think. I’ll have to set it up again to try out.

Unfortunately Bluetooth has so far evaded me. I went back into the XDA thread and configured the firmware files, installed the extra dependencies, and copied the device info from the Android partition, but no joy. I tried both bluez4 and bluez5, but the problem seems earlier than bluez. When I launch blutoothd (the way exception13 does in his thread) it doesn’t seem to register in dbus so bluez can’t find the device. I’m probably going to try one of the pre-compiled images from X-Stranger. Too bad, as I really love the Debian install. Maybe I’ll notice some extra dependencies in his install.

I’ll leave this SD card as-is and keep the image on the Note’s storage so I can switch back to it easily after seeing how well X-Stranger’s Ubuntu release works.

Thanks so much for putting together this guide. I’ve followed it for a rooted GT-N8013 on a Debian Stretch system (not a Jessie system, should I be using a Jessie system for the entire build?).

I’m hoping to be able to build and run picochess on the tablet once it boots,
that would be super convenient to connect to an old USB DGT eBoard, as
the “Acid Ape” android app unfortunately doesn’t seem to be compatible
with my USB DGT board, whereas picochess (at least on Debian Stretch
on an Intel box) runs with the USB DGT eBoard just fine. So at least you
have some idea why I’m trying to get this tablet running Debian (other
than the sheer brilliance of Debian, of course).

But currently I’m running into a kernel panic when I try to boot the GT-N8013.

All of the build steps appear to work correctly (I needed to install
the 32-bit compatibility libraries using apt-get install lib32z1-dev to get the
cross-compiler toolchain working, otherwise it gave me a “file not found” error
if I tried to run any of the executables, and I also needed to edit the file
kernel/timeconst.pl and replace “!defined(@val)” with just “!@val” to get
the kernel to compile to complete properly).

Everything else seemed to go smoothly, and I copied across the recovery.img
to the GT-N8013 and wrote it to the tablet’s recovery partition OK,
and inserted the MicroSD card containing the root filesystem into
the tablet and was able to get the system to at least start booting.

But the messages fly off the screen so fast I can’t even really capture them with my video camera, it just ends up an unreadable blur, although I can make out “kernel panic”.
Is there a way to send the boot messages out so I can read them, so that I could perhaps figure out what I did wrong?

Do I need to do all the build steps on a Debian Jessie system,
rather than on a Debian Stretch system, or does it matter?

I also noticed that after each failed boot, the tablet overwrites the contents
of what I put into the recovery partition, because if I go back into adb and
do a “cmp” against the recovery.img that I wrote there prior to booting,
the contents have changed back to the default recovery. Is that expected?
Once you get the system working, are you able to boot Debian repeatedly
or only once, and then need to rewrite the contents of the recovery partition
again to boot Debian each time?

I noticed that on Debian Stretch, it isn’t able to transfer fles to the tablet,
so I ended up sending the recovery.img to the tablet by email and checking
the md5 sum. The adb access to the tablet works fine though, including the
“su” part. You might want to mention in the guide that you have to press the
“Grant” on the tablet’s touchscreen at that stage, I wasn’t looking at the tablet
and I hadn’t seen it asking me to grant the “su” access, I thought that once
the tablet was rooted that adb would automatically be given access, silly me.

It seems the explanation for why the recovery partition gets overwritten
whenever the stock Samsung operating system boots on the tablet is here:

https://forum.xda-developers.com/showthread.php?t=2070139&page=12

It’s apparently due to a file called “recovery-from-boot.p” in the “/system” directory.
The tablet needs to be “rooted” to rename or delete this file, i.e. you need to be able
to su to root.

I recommend you do the build from an older, 32 bit Linux system. Debian Jessie or Ubuntu 14.04 should work the best when compiling an older, 32 bit kernel.
If you do you shouldn’t have to edit any files.

Unfortunately, I only have access to an GT-N8010 though I don’t see why the 8013 should be much different.

I can see how editing something to do with time constants in the kernel could create some problems.

tl;dr try the build from a 32 bit Debian Jessie or Ubuntu 14.04. it should work from there.

Thanks for your advice, I hadn’t thought about needing to do the build on a 32-bit system.
I can do it in a VM, I guess that’s why you mentioned VM earlier in your guide.
I’ll let you know how it does, it might be a few days before I can get do it.

I did the build using a virtual machine with
Debian Jessie 8.10 (netinst) installed in it.
The kernel compilation went through clean with
no errors (no corrections needed, unlike with
my earlier build on Debian Stretch).

I’m still getting what appears to be the same
kernel panic with this kernel, though.

Do I also need to build the root filesystem
(the chroot) on a Jessie system,
or does that make any difference?

Hey everybody,
first I want to say THX for this great guide!
I love to see that there are more people that are not satisfied with the solutions the producers provide. The SGT is an awesome peace of hardware and it keeps laying around as a dust magnet because nobody wants to use Android 4.X anymore.
Installing a linux on this tab creates lovely possibilities!

So, i followed your guide and it worked pretty good (added lightdm and sudo to the install as already mentioned here). Unfortunately the tab is not good usable yet (only cmd works).

Mainproblems:
*Login-Loop
*On-Screen-Keyboard does not show up
*Can’t get Wifi running

I have to admit that I’m not that good at configuring wifi over cmd.
If On-Screen-Keyboard would work I could try to connect the tab via ethernet…

Did someone experience the same problems? Any hints?

Samsung Galaxy Tab 10.1 (GT-N8013)

N8013? Upload the recovery.img I think @NedRagdnuos is having some trouble getting it to compile.

Did you edit /etc/lighten/lightdm-gtk-greeter.conf? If you did, you should be able to tap the little person in the top right and open the keyboard.

If lightdm isn’t showing up at all, if you can connect a USB keyboard enter the command: sudo systemctl enable lightdm.service.

Thx for fast reply!

I will upload a compiled image for @NedRagdnuos in the evening. I will also try to install “iw” on it for testing wireless-modules.

Yes i did manipulate the lightdm-gtk-greeter.conf as you wrote. Doublechecked everything, no typos… :frowning:
LightDm-service seems running fine… already tried configuration-manipulations and “service lightdm restart” without any errors.

I read a lot about the login-loop which seems to be a lightdm-bug in older versions…
If I get wifi running i could update everything and experiment a bit…
Unfortunately the SGT with Debian isn’t able to handle Ethernet2USB-Adapters correctly…

Here’s the link for the recovery.img

1 Like