Video Tutorial on How to Compile Android and Modify Kernels


For those interested, I have just posted a video tutorial series on XDA for building Android Oreo, Nougat, Marshmallow, and Lollipop on 5 different phones, the emulator, and 5 different ROMs. Also included are custom kernel editing, adding apps, changing source code, backgrounds, and more. Here’s what I posted:

From XDA:


Praise God! Finally a video tutorial of how to build Android and modify kernels!

I have created a video tutorial and guide for how to compile Android, from Lollipop through Marshmallow, Nougat, and Oreo. The video series covers several different phones, the emulator, kernel and rom editing, app source code editing, and much more!

Who is this video series for?
Well, this video tutorial is a step by step guide built primarily for the beginner. This is written for those who already know how to flash TWRP, CWM, or the like, and who have installed a custom rom before. This is designed to help those who are ready to move up from flashing and installing other peoples custom rom to actually start making their own custom roms. I recommend that a beginner watch the entire series in numerical/alphabetical order (the videos are marked).

That said, I believe that an intermediate developer may find a useful trick here and there, and they should just skip ahead to videos of interest. Perhaps kernel development, or something along those lines.

An advanced rom/kernel developer will probably far exceed my feeble abilities, and will not likely find much useful information here. Perhaps if you are an advanced developer, you would consider continuing the tutorial or making an advanced video series! (See further posts for recommendations on contributing videos.)

Why did you put this together?
Well, after building roms for several different devices, I started receiving requests from users who wanted to start building their own roms, but didn’t know how. I didn’t have enough time to answer everyones questions, so I wrote a few guides, pointed others to guides that were available, but there are some things that you just need to see to understand. Hence, the video tutorial. I just hope that someone finds it useful.

This course was written in order! While Lollipop and Marshmallow are old by today’s standards, there is still good learning value in building them, and there are topics covered there that really make them worth watching.

What’s in the videos?
During the series, we will be building for the emulator, as well as 5 different phones of various brands, and 5 different roms. I hope that this will give the viewer a good idea of how to build for their own specific phone as they see the differences and similarities across the phones and custom roms.

+ Ubuntu installation
+ Java installations
+ Using Git, GitHub, GitKraken, and the command line
+ Fastboot and ADB
+ Heimdall/Odin
+ QFIL, QPST, SALT, and other tools
+ AOSP, SlimRoms, PACrom, AOKP, AOSCP
+ Lollipop, Marshmallow, Nougat, Oreo
+ Errors
+ Overclocking CPU/GPU
+ Adding Governors and I/O Schedulers
+ Sound modifications
+ Changing app colors, text, and icons
+ Adding prebuilt apps
+ Adding source code
+ Converting device from one rom to another

**** This is an UNOFFICIAL TUTORIAL. Use at your own risk! ****
Download links:
Ogg Vorbis Video GitLab:
Clicking on a video in GitLab will allow you to watch it online.

Ogg Vorbis Video Downloads:
This download is rather large due to the multiple videos.

MP4 Video GitLab:
Clicking on a video in GitLab will allow you to watch it online.

MP4 Video Downloads:
This download is rather large due to the multiple videos.

I also have several written guides available on XDA, here are a few:

Building ROMs for the Galaxy Note Edge: [url][/url]
Building ROMs for the Galaxy S4: [url][/url]


Be sure to check out the videos or the XDA thread! I hope that these will help some of the aspiring Android developers out there!

Linux – keep it simple.

Using Android developement bridge in Linux

Hi all, just a quick lowdown on how to utilize the adb tool in Linux. Enjoy!

Of course, the first step is to install adb.

# aptitude update

# aptitude search android |grep adb
i android-tools-adb – Android Debug Bridge CLI tool

# aptitude install android-tools-adb

You now also need to set “developer mode” or “USB debugging” on your phone or tablet in the settings.

The second step in using adb is to detect any connected devices, by using the devices modifier:

# adb devices
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached
04039C4E19009019 device

Great news! It found the device. If it does not find the device, it will simply have nothing after “List of devices attached”, like this:

# adb devices
List of devices attached

If this happens, you may have had a problem like me, where I needed to add a udev rule. See my article “RWE: Udev rules for cell phones” if this happens to you.

Using adb to install an apk file (Android program):

# ls
6_worms_2_armageddon.apk org.dyndns.sven_ola.debian_kit.apk

Here we see a list of two games and Sven’s Debian kit. Now let’s install it with the adb install command. Note: I am using a -s modifier to install the program to the sdcard, otherwise it will go to internal storage.

# adb install -s org.dyndns.sven_ola.debian_kit.apk
1079 KB/s (505832 bytes in 0.457s)
pkg: /sdcard/tmp/org.dyndns.sven_ola.debian_kit.apk

Then we get our Linux images to put on our phone:

# ls
backupdeb.img debian.img ext3 ubuntu.img.md5
bakdebext3.img debian.img.md5 kalilinux.ext2.img
debext3.img kalilinux.ext2.img.md5 ext2 ubuntu.img

As you can see, I have several Linux images for my cell phones. Now we should put one on the phone with the adb push command. Here I have put the file onto the sdcard of the device.

# adb push ./bakdebext3.img /sdcard/
2028 KB/s (2146435072 bytes in 1033.403s)

You can also pull a file off of your phone:
# adb pull /sdcard/installed/scripts/dk.jpeg ./
3196 KB/s (3899182 bytes in 1.191s)

Finally, we can enter the phone in a shell mode with the (you guessed it) adb shell command:

# adb shell
$ cd /sdcard
$ mkdir installed
$ cd installed
$ mkdir scripts
$ exit

Using these commands you can get, put, or install just about anything to or on your phone or tablets. It is a great tool in the process of rooting your Android devices.

Linux – keep it simple.

Real World Example: Why you can’t add a swap file to an older Android device.

Recently, while utilizing Linux on my Android phone, I ran into an interesting problem. Android uses memory differently than Linux usually does. In the Android world, programs that you open are suspended in RAM, and a portion of that RAM is kept active even when you “close” a program. This allows the programs you have previously opened to become available again very quickly.

Linux does not typically operate in this fashion, although there are options and configurations to do similar things. The problem, however, is that Debian is sharing the RAM with Android on my phone, rather than being a seperate chroot program under Android. So Debian can only utilize the RAM that Android is not hogging.

I decided that a swap file may help me while I am utilizing Debian. So I set about to create one:

phone@localhost:~$ dd if=/dev/zero of=./swapfile bs=512 count=102400
102400+0 records in
102400+0 records out
52428800 bytes (52 MB) copied, 9.79242 s, 5.4 MB/s
phone@localhost:~$ ls -lah
total 63M
drwxr-xr-x 24 phone phone 4.0K May 27 20:02 .
drwxr-xr-x 3 phone phone 4.0K Feb 12 15:32 ..
————- Edited
-rw-r–r– 1 phone phone 50M May 27 20:02 swapfile
————- Edited

phone@localhost:~$ sudo chmod 0600 swapfile
phone@localhost:~$ sudo chown root:root swapfile
phone@localhost:~$ sudo mkswap ./swapfile
mkswap: ./swapfile: warning: don’t erase bootbits sectors
on whole disk. Use -f to force.
Setting up swapspace version 1, size = 51196 KiB
no label, UUID=c083a787-70da-40e1-bd44-e2a18875cf75
phone@localhost:~$ sudo swapon ./swapfile
swapon: ./swapfile: swapon failed: Function not implemented
phone@localhost:~$ sudo mkswap -f ./swapfile
Setting up swapspace version 1, size = 51196 KiB
no label, UUID=55faa525-9190-45da-888e-01c829eca1dc
phone@localhost:~$ sudo swapon ./swapfile
swapon: ./swapfile: swapon failed: Function not implemented
phone@localhost:~$ uname -a
Linux localhost #1 PREEMPT Fri May 27 09:18:49 KST 2011 armv7l GNU/Linux

What we can see here, however, is that it didn’t work. The question was why did it not work. The answer is that the Android/Linux kernel was compiled without CONFIG_SWAP=y. WIthout this compiled into the kernel, then swap is disabled. Unfortunately, since these kernels are digitally signed, I cannot simply find a swap module for the kernel and load it. Not to mention, as far as I can tell there isn’t one. I would need a whole new digitally signed kernel with that option enabled.

As of Android 4.0, I have been told this option is enabled, but for all of these older phones and tablets, it is not an option without specific kernels or patches. Bummer.

Linux – keep it simple.

Archos 101 Tablet: Urukdroid experiment

Recently I attempted to change my Archos 101 tablet by changing it from Android to Urukdroid, but it was not very successful. While I was able to put Urukdroid on the tablet, it would stall while loading up, forcing me to switch back to Android instead.

The first question that must be addressed is: why? Well, my tablet is only supported by Android up to version 2.3 and slowly had become outdated. While Urukdroid was not much newer, I thought it would be useful to try this on a known working source. Well, supposedly known. That remains to be seen as in the end it didn’t work. Some of the benefits included ext4 support and the ability to utilize “regular” Linux functions with the operating system. Regardless, the system didn’t work.

The first step was installing Archos SDE software. I had already done this when I put Debian on my Archos 101, but for continuity I list it here also. This special developer edition software allows you to choose to boot something else on start up. I headed over to and downloaded the SDE for my device, which is a gen8 model. You then follow the instructions to flash this to your device.

Similarly, the next step was to head on over to and download the latest copy of Urukdroid, which was 1.6. After a quick tutorial from the creators I was well on my way to installing the system. Everything went according to the instructions, however, when I tried to boot the system, it simply hung indefinitely at the boot screen for Urukdroid.

I then attempted to install older versions, 1.5, and 1.0, hoping one of them would work. Unfortunately, neither of these were successful, and I abandoned Urukdroid altogether. That’s okay, because my Debian install worked rather well for the Archos 101.

Linux – keep it simple.

Real World Example: UDEV rules for cell phones

The other day, when using adb to communicate with my phone, I had a problem where my laptop would not connect to my phone.

# adb devices
List of devices attached

Odd, it should have listed the device serial number. So I checked out lsusb to see if the phone was showing up at all, which it was:

# lsusb
-other stuff-
Bus 001 Device 004: ID 22b8:41da Motorola PCS

After some research, I realized that I needed some rules for this
device, and found that one guy did something similar for his nook. I
stole what he did, but changed it for my phone.

# touch /etc/udev/rules.d/99-android.rules
To create the file.

# echo “SUBSYSTEM==usb, ATTR{idVendor}==22b8, MODE=0666, OWNER=user #
motorola” >> /etc/udev/rules.d/99-android.rules
# service udev restart

Now when I run adb devices, I can actually communicate with my phone:

# adb devices
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached
04039C4E19009019 device

Just a quick and dirty real world example.

Linux – keep it simple.

Archos 101 Tablet: Full blown Debian distribution on a tablet Part 2

Be sure to read yesterdays post about how we got here.

So now we should take stock of what we have: an Archos 101 internet tablet with Debian system 6.0 (Squeeze), with most, if not all of the device hardware functioning, since we stole it from the Angstrom distribution, wich really stole it from the Android system. Now it was time to set things up the way we wanted them. I plugged in a USB keyboard and got to work.

I needed to set the login to autologin as my principle user, which was named “debian” Since most of the time I would not have a keyboard plugged in, and I do not know of a DM that comes with a built in on-screen keyboard. All I needed to do was edit /etc/lightdm/lightdm.conf with these two fields:


I then added “debian” to the sudoers file, and set it to have no password required to utilize. You can do that with visudo, and I think this is what I added to that file:


The next thing on the agenda was installing XFCE4. Now, I am a big fan of the lighter the better, but I needed this thing to work and work well and be pretty for my wonderful wife, so she could use it day to day.

$ sudo apt-get install xfce4

This tablet will only be useful, though, if it can go on the internet, so I worked on that next.

$ sudo apt-get install wicd

Here is where I ran into an interesting problem. Wicd works just fine, but only root has privileges on internet. I added “debian” to netdev group, bt, bt-net, inet, and net_raw groups, but it never allowed “debian” to use the internet. Opening a browser would simply say you are not connected, even though wicd would show that you are connected to the local wireless lan, and thus internet. I don’t know why, technically it should work. I believe it is a problem with the driver having a PARANOID setting from what I researched online.

This could be a showstopper, but I was pretty determined. After I decided to use chromium-browser, I simply made a launcher in the XFCE panel that would launch it as the root user, allowing you to surf the web. I then set the downloads folder to /home/debian/Downloads, but all items downloaded were owned by root. Not to be undone, I then created a launcher on the panel with a lock icon that ran a script that contained:

sudo chown -R debian:debian /home/debian/

This launcher, once clicked, would changed all the permissions of everything in “debian’s” home folder, making the items deletable, and editable. I then added things like flash, alsa, cups for printing, xpdf, xmms2 and the codecs for multimedia, openoffice for documents, a few games, and scrot, a screenshot tool, and made a launcher for a script that took time stamped screenshots when you clicked on it.

I added a launcher for the on screen keyboard, matchbox, since you will need one to type without a keyboard plugged in.

Finally finished with a well working system, I was surprised at how well the Archos held up in day to day use. I did find that I had to set the power saver to keep the screen alive, as when it goes to sleep, I could not make it wake up. I just set a screen save and would plug it back in when not using it. It was now fully functional, and I dressed it up a bit for my wife to use.

A few things that did not work:
-Screen rotation. It would not auto-rotate the display.
-Blue Tooth. The Blue tooth function would not work. It recognized that it had one, I just couldn’t get it to work.
-Sound volume. The sound did work, but it was very quiet, leaving me to believe that there was some sort of amplification that was not happening.

System stats:

HDD: About 1500mb free space, can extend with sdcard, or use android file system space.
RAM: 77mb in use for system to run, remainder of 256mb for programs you launch.
CPU: less than 10% for normal system operation, spikes out when you launch programs, but settles down once open.

Overall I was really pleased with the result. Enjoy the screenshot.

Linux – keep it simple.

Archos 101 Tablet: Full blown Debian distribution on a tablet Part 1

Since my tablet had become somewhat dated it was only able to utilize Android 2.3. I wanted to keep using the tablet, but I wanted it to be more useful. I wanted to be able to utilize it as a regular computer, rather than through the Android interface. Honestly, the thing had more processing power than several computers I had in the past, and I didn’t think it was unreasonable to use it this way. Fortunately, I was able to get it working with a little bit of research on the internet.

Before continuing farther, I would like to give thanks to the user with the nickname: divx118 for a lot of the ground work for this project, such as: Wifi compilation and how to and sound drivers. I originally wrote down all of the links, but they have since expired as this was over a year ago. I like to give credit where due, however, and thus have included the user/nickname here. While not the original information I received, here is a current link for some helpful discussion on this specific topic – – that is still available on XDA-Developers.

The first thing to remember about Android is that it is based on a Linux kernel. This is key, since you need drivers for a computer, and there are already modules written for the device to be used by the Android system with the Linux kernel. Some argue that Android is not really Linux, but at the heart of it is a Linux kernel, so that is enough for me.

The first step was installing Archos SDE software. This special developer edition software allows you to choose to boot something else on startup. I headed over to and downloaded the SDE for my device, which is a gen8 model. You then follow the instructions to flash this to your device.

Once I flashed that onto the device, pressing the down volume button and the power button on startup would reveal the options of what to boot. Not limited to, but included was the Angstrom Linux distribution. It loaded just fine, and seemed to function, although that distribution is really limited, and I prefer more flexibility, so I decided to change it to Debian.

The way this setup works is truly a Linux instance, but not a traditional load. The Android operating system is still fully functional and in place, but is not started at startup. What this particular setup does is allow you to put a file on the storage of the Archos 101 that is your Linux hard drive disk image. That image is then loaded with the accompanying initramfs and the original Omap 2.6.29 kernel provided by the Archos Android system. So rather than start Android, you are directing the kernel to use the initramfs and hard drive disk image that you provide. The major limitation of this is that the file system is limited to a 4 GB hard drive disk image. Actually, 3.7 GB was the largest I could get to work. This is not an emulator nor a virtual box. Android is not running while Linux is. Conversely, while you are in Linux, you have complete access to all the storage of the Archos, including the file that is your hard drive image, so be careful!

Then, I created a directory for all of the files.

# mkdir archos

# dd if=/dev/zero of=./rootfs.img bs=512 count=7226572
To create an empty file for the image of 3.7 GB.

I then needed an initrd.gz file (common to use for arm devices) from Debian, for which I downloaded initrd.gz and vmlinuz-2.6.32-5-versatileoff of the web (the latest is here – ). Essentially, this is the netboot image and kernel telling the kernel to look up the online repository and download the needed files. Note: I needed internet access for this.

Next, I started Qemu with the following options:

# /usr/bin/qemu-system-arm -monitor stdio -M versatilepb -m 256 -localtime -hda ./rootfs.img -boot once=c,menu=off -net nic,vlan=0 -net user,vlan=0 -kernel ./vmlinuz-2.6.32-5-versatile -initrd ./initrd.gz -name “archos”

The installation booted right up on my computer screen, and I simply went through the menus as with any usual install. Upon completion, I could not run the new system in Qemu, but I then hooked up the Archos via usb to a computer, and using adb pulled the HDD image, called rootfs.img from the Archos and put it onto the computer to save it. Following that, I put my new rootfs.img onto the Archos and rebooted.

Unfortunately, it didn’t work this try. What I came to realize is that I had set up my system to run off of the vmlinuz kernel and initramfs for Qemu, and I needed to set it up to run off of the Omap 2.6.29 Kernel that was compatible with the Archos. I had the old rootfs.img on my computer, so after mounting it, I could then extract the /boot folder and thus had a copy of the Omap 2.6.29 kernel and the initramfs file, which I put into my image /boot sector, and changed the links for vmlinuz to point to it.

I also needed the library of drivers and things used to make the hardware work. So I copied the /lib/modules/2.26.29-omap1/ directory and contents from the old rootfs.img to my new rootfs.img.

After all of this, I was ready for something to work, and work it did! The system booted and left me at a login prompt. I was in, but the work was far from over. That, however, is the topic for the next post.

Linux – keep it simple. Even if it is really complex to get there!