Related
This is a basic gui I wrote to unlock my encrypted partitions during boot.
I'm running my /data and /sdcard partitions encrypted, and the "luksunlock" binary is launched from init.rc to read the password and unlock the encrypted partitions.
I have included my somewhat modified init.rc for those interested.
For more information about LUKS on Android see this blogpost, written by shawn (Seems I'm not allowed to have urls in the post, but Google for 'android luks' , first hit)
This works good on Wildfire, altough it should work fine on other phones as well. Just remember that you need to set up your partitions as in the luksunlock.c (or change the defines).
Dont forget to backup before you start playing around!
Good luck!
Thanks! i'll give a try!
Hi,
I tried to use your cryptsetup binary from your blog, but I have some issues that you'll sure have an answer:
I run ./cryptsetup luksFormat -c aes-plain /dev/block/loop2 and after i put the luks password it says 'Command failed', no logs, no other output, even using the -v flag...
Any clue?
Thanks in advance!
PS: the module dm-crypt is necessary for cryptsetup? could be this the error? I don't have it installed on the system because I can't find it for 2.6.35.9-cyanogenmod
tusabe said:
Hi,
I tried to use your cryptsetup binary from your blog, but I have some issues that you'll sure have an answer:
I run ./cryptsetup luksFormat -c aes-plain /dev/block/loop2 and after i put the luks password it says 'Command failed', no logs, no other output, even using the -v flag...
Any clue?
Thanks in advance!
PS: the module dm-crypt is necessary for cryptsetup? could be this the error? I don't have it installed on the system because I can't find it for 2.6.35.9-cyanogenmod
Click to expand...
Click to collapse
CM6.1 for wildfire uses a 2.6.32 kernel (see HCDR.jacob's post about his custom kernel for more info)
tusabe said:
PS: the module dm-crypt is necessary for cryptsetup? could be this the error? I don't have it installed on the system because I can't find it for 2.6.35.9-cyanogenmod
Click to expand...
Click to collapse
Yeah you really need dm-crypt support, either compiled into the kernel or as a module. You also need the AES ciphers support.
sigkill1337 said:
Yeah you really need dm-crypt support, either compiled into the kernel or as a module. You also need the AES ciphers support.
Click to expand...
Click to collapse
Hi! Yeah, that's what I was afraid of.... ok, but the problem is that i'm running CM6.1 with 2.6.35.9 which has no dm-crypt module neither compiled in kernel... where can i find some kernel with this modules included? Is for an HTC Desire (@Sympnotic )
Thanks in advance!
Great work and thanks for sharing @Sigkill. Working on building it here for my NexusOne with CM6.1.
BTW, I’m the lead on a project working on general secure Android distro – we’ve ported Tor, have an OTR IM app, and have supported other projects along those lines. Would love to talk more about supporting anyone working on this specific capability.
wow! awesome work!!! Very exciting news. Gonna give this a go on my MyTouch Slide
NathanFreitas said:
Great work and thanks for sharing @Sigkill. Working on building it here for my NexusOne with CM6.1.
BTW, I’m the lead on a project working on general secure Android distro – we’ve ported Tor, have an OTR IM app, and have supported other projects along those lines. Would love to talk more about supporting anyone working on this specific capability.
Click to expand...
Click to collapse
Seems really nice. I like the secure phone concept.
New Makefile and wiki info up
_hc from the @guardianproject has a new build process up for Crypsetup/LUKS which includes a Makefile compatible with Android NDK r5.
We have new instructions up on our wiki, as well.
I cannot post links under this account, but you can find the info on github if you search "LUKS" or just under our guardianproject account.
How did you create the encrypted partitions? Could you give some pointers for that. I am familiar with using dmcrypt/cryptsetup on desktop linux, I guess this works similar. What are the relevant device names? Did you run into any problems?
Calavera1 said:
How did you create the encrypted partitions? Could you give some pointers for that. I am familiar with using dmcrypt/cryptsetup on desktop linux, I guess this works similar. What are the relevant device names? Did you run into any problems?
Click to expand...
Click to collapse
Hi, sorry for the late answer,
/dev/block/mtdblock5 is the "userdata" partition. I formatted it and mount it to /encrypted-data during init:
mount yaffs2 [email protected] /encrypted-data nosuid nodev
The only file on this partition is "data.encrypted" file, which gets created in init.rc as a loopback device:
exec /system/bin/losetup /dev/block/loop0 /encrypted-data/data.encrypted
I created the "data.encrypted" file on my computer with cryptsetup and losetup, and copied all files from my old unencrypted userdata partition to it and then copied it back as a file to the formated userdata partition.
The sdcard "/dev/block/mmcblk0p2" partition is formated with "cryptsetup luksFormat", I did this also on my computer, saves some time. And then copy everything from the old unencrypted sdcard.
I did run in to one problem recently, my phone hung during boot, about 4 months after I started encrypting my phone.
Had to copy my data.encrypted file to my computer, mount it as a loopback device and do a fsck, and then copy it back to my phone.
I suspect this has to do with the filesystem not being umounted properly. (I have had this on my to do list for a while hehe)
Probably should make a script run during shutdown to cleanly "luksClose" the encrypted partition and then umount them. Not doing this is probably very crazy
I also want to fix it so my "/dev/block/mmcblk0p2" partition gets presented to my computer when i attach my usb cable (as it should do), so i can unlock it in ubuntu and copy images and files. Right now i have to take my memorycard out and put it into the computer.
I hope this post makes sense, it was written in haste =) Good luck!
sigkill1337 said:
Hi, sorry for the late answer,
/dev/block/mtdblock5 is the "userdata" partition. I formatted it and mount it to /encrypted-data during init:
mount yaffs2 [email protected] /encrypted-data nosuid nodev
The only file on this partition is "data.encrypted" file, which gets created in init.rc as a loopback device:
exec /system/bin/losetup /dev/block/loop0 /encrypted-data/data.encrypted
I created the "data.encrypted" file on my computer with cryptsetup and losetup, and copied all files from my old unencrypted userdata partition to it and then copied it back as a file to the formated userdata partition.
The sdcard "/dev/block/mmcblk0p2" partition is formated with "cryptsetup luksFormat", I did this also on my computer, saves some time. And then copy everything from the old unencrypted sdcard.
I did run in to one problem recently, my phone hung during boot, about 4 months after I started encrypting my phone.
Had to copy my data.encrypted file to my computer, mount it as a loopback device and do a fsck, and then copy it back to my phone.
I suspect this has to do with the filesystem not being umounted properly. (I have had this on my to do list for a while hehe)
Probably should make a script run during shutdown to cleanly "luksClose" the encrypted partition and then umount them. Not doing this is probably very crazy
I also want to fix it so my "/dev/block/mmcblk0p2" partition gets presented to my computer when i attach my usb cable (as it should do), so i can unlock it in ubuntu and copy images and files. Right now i have to take my memorycard out and put it into the computer.
I hope this post makes sense, it was written in haste =) Good luck!
Click to expand...
Click to collapse
I figured most of that out without your post and tried it on my desire (I created the luks partitions with adb on the phone though, worked anyway ). Then I couldn't figure out where my regular init.rc is stored (I could only find the one used by Clockwork Recovery), and then I figured I already spent enough time, tried a reboot (which of course didn't work). Then I couldn't even get into recovery (probably because its init.rc tries to mount /data which doesn't work? I didn't investigate any further). Flashed my backup with fastboot and was stuck again with my un-encrypted pre-experiment state
Oddly enough, it was no problem to unlock my encrypted SD-card from my computer (running ubuntu) while in recovery (clockword has an option to present the sd card to a computer connected via usb). Maybe the booted system handles this differently than recovery though? I didn't get a chance to try, as I couldn't boot after my encryption attempt.
I will try again after my algorithm and data structure exam this friday and report back
Is anybody using the UI on another device than the Wildfire? Does it work?
How much is the performance drain when using an encrypted /data partition?
Amazing work!
Did anyone manage to make sigkill1337's luksunlock build from source ?
I would like to change the path of the data/sdcard partitions to match my device but I tried many ways using the NDK and I can't get it to compile properly.
Is there any way to do this ?
I have been trying for days, I am getting literaly insane !
@sigkill1337 : could you give me some pointers ? I would appreciate a lot.
mount manpage said:
The bind mounts.
Since Linux 2.4.0 it is possible to remount part of the file hierarchy somewhere else. The call is
mount --bind olddir newdir
or shortoption
mount -B olddir newdir
or fstab entry is:
/olddir /newdir none bind
After this call the same contents is accessible in two places. One can also remount a single file (on a single file).
This call attaches only (part of) a single filesystem, not possible submounts. The entire file hierarchy including submounts is attached a second place using
mount --rbind olddir newdir
or shortoption
mount -R olddir newdir
Note that the filesystem mount options will remain the same as those on the original mount point, and cannot be changed by passing the -o option along with --bind/--rbind. The mount options can be changed by a separate remount command, for example:
mount --bind olddir newdir
mount -o remount,ro newdir
Click to expand...
Click to collapse
If nothing helps, you should always be able to bindmount it
I'd rather get sigkill1337's UI to compile...
Lots of nice security tweaks and settings could be done with a pre-boot GUI
Anyway, concerning encryption, I'll use the bind option for now, thanks for the tip.
But if anyone here could give me some pointers about compiling this stuff it would be great.
I managed to compile it by integrating luksunlock in Android source externals and main.mk but when I push it to my phone and modify init.rc to call it, it just does not work...
Other modifications are working (mount, mkdir, etc.) but the GUI won't show up
Sorry for the late reply.. But you could try running it from a shell when the phone is booted, just to verify that the binary starts (thats how I tested it without having to reboot my phone all the time)
My environment for building the source was setup using one of the tutorials online, nothing out of the ordinary
Im still running this on my phone, for almost 8 months now, I havent noticed that much in performance problems, the Wildfire was slow before i started using luks.
When i get a new phone (maybe SE Arc) i will be easier to see if performance is affected
There is an Issue for getting CM support for encrypted filesystems during boot:
Issue 2736: support encrypted filesystem from boot
If you want to get that feature, just "star" it, so it may get more attention.
Hi,
Because of the need of a bootmanager and the lack of patience to type a hack a lot at the console, I created a ubuntu maverick based build system for arm crosscompiling with a script helps by building kernel, ramdisk, recovery archive, debugging via fastboot and so on. As chroot env it is very flexible, needs not to install something and runs inside all linux distris.
just extract it somewhere onto an ext partition goto the directory and type ./start
in the root of the chroot env is a README file which contains infos where is what. read it before.
it contains three tools
build (a script supports different actions, "build help" shows them)
unpack-boot (extracts a boot image into the actual directory)
unpack-ramdisk (extracts a ramdisk into the actual directory)
Download:
http://www.bisme.net/files/xda/bootbs.tar.bz2
TODO:
the chroot env is still based on a desktop version of maverick and bigger than needed, this will change soon.
PS: Bootmanager is still in work, should finish(as a trivial but working version) in the next days and is the first step to support multiboot different linux installations(also different android versions) on android tablets. But this is another story will get an own Thread here. In the meantime I hope all romcookers out there will have fun with this build system.
So following a couple of tuts that I've found on the forums I've been able to install debian linux wheezy armhf build on my tablet in a dual boot configuration with it booting off of a second ext4 partition on the microsd card along with getting the drivers/codecs from Linux4Tegra to be installed and somewhat used on debian linux.
What works:
-Wifi
-USB
-Display (doesnt use tegra drivers)
-Buttons (power, vol, rot switch [acts as wifi switch])
-Touchscreen
What doesnt work:
-Bluetooth (Untested but apparently it finds it and sets it up.)
-Audio (Detects it in the kde info center. System Settings program only says that there's a dummy output. Playing any form of audio crashes the program.)
-HDMI (with the Tegra gfx drivers it finds it but says it's disconnected even when connected.)
-Cameras
-GPS
-Motion Sensing
-Light Sensor
With the display, whenever the tegra drivers are used, it finds HDMI (as HDMI-1) and the LCD screen (as LVDS-1) but says that there is no device on the lcd screen. With that being said, it is using the fbdev driver instead which shows pink and/or inverted colors in some instances but at least it shows a gui.
Guides used:
{HOW TO} Native Debian on A500 and building your own rootfs
[BOOTLOADER][DUALBOOT + RECOVERY][BOOTMENU] Patched ICS bootloader V8 (07/06/2012)
[Dev] Native linux on Iconia
Requirements:
-an A500.
-a 16+GB microsd.
-Linux OS (Debian, Ubuntu, etc.)
-Linux 4 Tegra: Download the Ventana files under "Additional Information" and "Driver Packages"/"Codec Packages".
Ok, so here's how I've done it.
1) Make sure you have a multiboot loader and have flashed the appropriate bootloader image to the second boot partition. get the boot image from the 3rd guide under "precompiled kernel image" and flash that to the second boot partition. (be sure to check the dualboot guide above on flashing the image if you are using the bootloader that is in the guide.)
2) Have a microsd card partitioned with two partitions, one for normal data (can be any format) and a second one that is in ext4. you can do 3 partitions by adding a swap partition but the ext4 partition must be the second partition.
3) Install qemu on the host system.
Code:
For Ubuntu - sudo apt-get install qemu-user-static
4) Mount the microsd's ext4 partition.
Code:
sudo mount -t ext4 /dev/<microsd 2nd partition> /mnt/Linux
5) Run:
Code:
sudo qemu-debootstrap --arch armhf wheezy /mnt/Linux
6) Chroot into the installed environment.
Code:
chroot /mnt/Linux /bin/bash
7) Add sources to /mnt/Linux/etc/apt/sources.list. you can get debian sources from http://debgen.simplylinux.ch/. Be sure to choose "Testing (wheezy)" and all the sources check boxes along with where you live to find the nearest repository.
8) Install the wifi drivers pt1.
Code:
apt-get update ; apt-get install broadcom-sta-common broadcom-sta-source firmware-b43-installer firmware-b43legacy-installer b43-fwcutter
9) Install the wifi drivers p2. In the "{HOW TO} Native Debian on A500 and building your own rootfs" guide, there is a download from mediafire for the firmware files for the drivers. Extract that and put it into /lib/firmware. I dont know if the individual files in the brcm should be in the /lib/firmware or not so i just copied the folder into it and the files within it into /lib/firmware.
10) Install the GUI:
Code:
apt-get install <gui>
List of GUI's (that i know of):
Code:
KDE (takes a long time to install): kde-full
XFCE: xfce4
11) extract the ventana_Tegra-Linux-R16.1.0_armhf.tbz2 file and the ventana_Tegra-Linux-codecs-R16.1.0_armhf.tbz2. you should get a folder called "Linux_For_Tegra" and a file called "restricted_codecs.tbz2". go into the "Linux_For_Tegra/nv_tegra" folders and extract the nvidia_drivers.tbz2 file. from there you should get 3 folders: etc, lib, usr. copy those to "/mnt/Linux" (you are going to have to do this as root). back out of those folders and extract the restricted_codecs.tbz2. you should get a folder called "lib" copy that to "/mnt/Linux". after that, it's time to make a hard link so that the X11 can find the tegra driver:
Code:
ln /usr/lib/xorg/modules/drivers/tegra_drv.abi12.so /usr/lib/xorg/modules/drivers/tegra_drv.so
Note: without using an xorg.conf file, by default it will use fbdrv instead of the tegra driver.
12) set the root password:
Code:
passwd root
13) add a normal user:
Code:
adduser <username>
14) exit chroot by typing "exit" and unmount /mnt/Linux:
Code:
sudo umount /mnt/Linux
15) pop that sucker into the the tablet and boot into it by holding power and vol down to get into the boot menu. select "boot into second partiton".
If everything went ok, you should be presented with a gui, if not and you are at a command line, log into root and type "startx". if that doesnt work then something wrong must have happened.
Untested easy script:
Code:
#! /bin/sh
set -e
#if there is a tegra_install.deb file.
hasTegraDeb=0
tegraDeb=acer-iconia-tab-a500+tegra+brcm+wheezy_1.0-1_armhf.deb
#change these if you do not like default install of kde.
arch=armhf
build=wheezy
rootDir=/mnt/Linux
guiEnv=kde-full
newUser=User
#setup the basics of debian linux using armhf and wheezy build.
qemu-debootstrap --arch $arch $build $rootDir
#copy the tegra_install.deb file for the tegra specific drivers.
if ["$hasTegraDeb" = "1"] then
cp $tegraDeb $rootDir/$tegraDeb
fi
#setup sources.list for apt-get.
echo "deb http://ftp.us.debian.org/debian testing main contrib non-free" >> $rootDir/etc/apt/sources.list
echo "deb http://ftp.debian.org/debian/ wheezy-updates main contrib non-free" >> $rootDir/etc/apt/sources.list
echo "deb http://security.debian.org/ wheezy/updates main contrib non-free" >> $rootDir/etc/apt/sources.list
#create the chroot_install.sh script and set it up.
echo "#! /bin/sh" > $rootDir/chroot_install.sh
echo "set -e" >> $rootDir/chroot_install.sh
#update apt-get inside the chroot.
echo "apt-get update" >> $rootDir/chroot_install.sh
#install the wireless card drivers inside the chroot.
echo "apt-get install broadcom-sta-common broadcom-sta-source firmware-b43-installer firmware-b43legacy-installer b43-fwcutter" >> $rootDir/chroot_install.sh
#install the desktop in the chroot. (note: this will take a long time)
echo "apt-get install $guiEnv" >> $rootDir/chroot_install.sh
#install the tegra specific drivers inside the chroot
if ["$hasTegraDeb" = "1"] then
#install the tegra drivers.
echo "dpkg -i $tegraDeb" >> $rootDir/chroot_install.sh
#hard link the tegra_drv.abi12.so as tegra_drv.so in /usr/lib/xorg/modules/drivers/ to enable X11 to find the display driver.
echo "ln /usr/lib/xorg/modules/drivers/tegra_drv.abi12.so /usr/lib/xorg/modules/drivers/tegra_drv.so" >> $rootDir/chroot_install.sh
fi
#set the root password in the chroot.
echo "passwd root" >> $rootDir/chroot_install.sh
#add normal user in the chroot.
echo "adduser $newUser" >> $rootDir/chroot_install.sh
#execute the final stage of the install.
chroot $rootDir /chroot_install.sh
#cleanup
rm $rootDir/chroot_install.sh
if ["$hasTegraDeb" = "1"] then
rm $rootDir/$tegraDeb
fi
Script sets up everything along with installing kde window manager. Please note that the tegra_install.deb file does not exist, it is something that i am thinking of making in the future that has all the drivers and what not needed that is from the Linux 4 Tegra site. you are still going to have to manually install the tegra drivers in step 11.
Edit: Experimental copies of the deb files that has all the files needed from Linux 4 Tegra and the wifi drivers can be found at the bottom of the post.
xorg.conf to enable tegra driver (found in the Linux_for_Tegra/nv_tegra/config.tbz2/etc/X11 folder):
Code:
# This is the minimal configuration necessary to use the Tegra driver.
# Please refer to the xorg.conf man page for more configuration
# options provided by the X server, including display-related options
# provided by RandR 1.2 and higher.
# Disable extensions not useful on Tegra.
Section "Module"
Disable "dri"
Disable "dri2"
Disable "glx"
SubSection "extmod"
Option "omit xfree86-dga"
EndSubSection
EndSection
Section "Device"
Identifier "Tegra"
Driver "tegra"
# OverlayDepth is a 32-bit integer which is used to control overlay
# stacking order. The overlay with the lowest depth is in front of
# all others. This value has meaning only when multiple overlays are
# present on a display.
# Option "OverlayDepth" "255"
# ARGBHWCursor controls whether the X driver uses an overlay to
# display 32-bit "true-color" cursors, or whether such cursors are
# emulated in software. Valid values are "true" to enable hardware
# cursors, and "false" (default) to disable them.
# Option "ARGBHWCursor"
EndSection
At the moment, I have looked through the config.tbz2 file and may have to stick the stuff in there into the tablet's linux filesystem. will test this later.
NOTE:
I am not a linux developer, I have no idea how to create linux drivers. All I can do is mash things together and hope things work out.
In theory, this should work for all tegra2 and tegra3 (using cardhu drivers instead of ventana) devices with some minor differences.
Edit:
Apparently it is using kernel version 2.6.38. I'm going to see if I can update the kernel to 3.2.23-1 which is the latest version for armhf in the debian package list (http://packages.debian.org/wheezy/kernel/linux-headers-3.2.0-3-all-armhf).
Edit2:
Looks like updating the kernel from apt-get doesn't necessarily enable the kernel to load as it seems that the boot loader loads a prepackaged kernel that has been flashed into mmcblk0p7. Tried out kexec and the kernel doesn't support it so adding it to the /dev/inittab script is useless for loading up new kernels. I tried making the new kernel into a flashable image using mkbootimg that is found within the Linux 4 Tegra folder but it doesn't do anything and the image apparently isn't valid when i tried booting it from fastboot (black screen). along with that, apparently it changed my password on my encrypted /data partition's password (when i flashed it within linux using dd) so a word of caution with that. If anyone can help me out, i would like to try to create something similar to grub (or even port it) where it loads up new kernels from the microsd or a specified place based on a boot list.
deb Files (Install using "dpkg -i acer-iconia-tab-a500+tegra+brcm+wheezy_<version>_armhf.deb" within the linux environment of the tablet.):
1.0-1: acer-iconia-tab-a500+tegra+brcm+wheezy_1.0-1_armhf.deb
--takes care of steps 9 and 11 sans hard linking the X11 tegra drivers.
1.0-2: acer-iconia-tab-a500+tegra+brcm+wheezy_1.0-2_armhf.deb
--has pre-depends for the first part of the wifi driver installation so this should, in theory, install both part 1 and 2 of the wifi drivers.
--takes care of steps 8, 9, and 11 sans hard linking the X11 tegra drivers.
Update log:
10/17/2012: added updated version of the deb package.
10/16/2012: first version.
Ok, so since I cant post anything including into ongoing threads in the android development forum due to the 10 post required thing i'll just have to ask development questions here till i reach the 10 post requirement.
Can anyone point me into the direction for how the second boot image that you flash for the dual boot bootloader is created? Trying to figure out how to create an image so that it boots everything off the microsd card including the kernel. It seems that the kernel used in the guide is locked to 2.6.38 and if you update the kernel within the tablet's linux environment it doesnt load it up. so i need to figure out how to create a boot image so that it loads it up or create a boot image that has grub (or other bootloaders) installed on it to boot different linux images.
alatnet said:
Ok, so since I cant post anything including into ongoing threads in the android development forum due to the 10 post required thing i'll just have to ask development questions here till i reach the 10 post requirement.
Can anyone point me into the direction for how the second boot image that you flash for the dual boot bootloader is created? Trying to figure out how to create an image so that it boots everything off the microsd card including the kernel. It seems that the kernel used in the guide is locked to 2.6.38 and if you update the kernel within the tablet's linux environment it doesnt load it up. so i need to figure out how to create a boot image so that it loads it up or create a boot image that has grub (or other bootloaders) installed on it to boot different linux images.
Click to expand...
Click to collapse
You are on the right track with mkbootimg. I have not figured it all out myself yet.
You have to compile your arm linux kernel then make a bootable image with mkboot
I don't know if you have seen this or if. this will help---Nethams kernel compile commands are;
make ARCH=arm menuconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueable--j16
./mkbootimg --ramdisk dev/zero --kernel arch/arm/zimage -o ../recovery.img
I believe these are the commands he uses to compile his recovery image (boot.img)
It is my understanding that mkboot combines the kernel with a ram disk to make an image file that will boot the system
That image file can be placed in several places 1-primary boot position 2 recovery position 3 and if you have Skrilax dual boot secboot position
So it depends on what mkboot compiled as to what happens when that boot point is activated.
I am still trying to work out how Spdev and Netham combine or configure the kernel + initramfs+ ramdisk to create their bootable images.
I know these images boot and point to the file system which can be stored on internal or external sd card or even usb drive it all depends on how the boot image is configured.
Still learning myself
Here is a link I found explanes about Linux ram disk and initram
http://www.ibm.com/developerworks/linux/library/l-initrd/index.html
And more info here downloads a PDF presentation on how to.
http://www.google.com/url?sa=t&rct=...poCoAw&usg=AFQjCNHLTHE3DaroC71FAjOjQWU2A61qEQ
All about that mkbooting after you get your kernel
http://android-dls.com/wiki/index.php?title=HOWTO:_Unpack,_Edit,_and_Re-Pack_Boot_Images
themechaniac said:
snip (freaking 10 post limit...)
Click to expand...
Click to collapse
Yea, i did find some stuff with mkbootimg including the last link that you posted.
The kernel was already compiled when i downloaded it using apt-get and it is placed in /boot folder.
I did make a boot.img from that kernel using mkbootimg and looking at "/proc/cmdline" at the arguments that were passed to the kernel in the other kernel image and it made it, flashed it to secboot and it didnt do anything except use the same kernal as before, though i did flash the image via dd in linux. Apparently this sorta screwed up my /data partition or something in where it wouldnt recognize my password for de-encryption to mount it. (fixing it by just erasing "/data" [bye bye data... TT.TT]) So i tried booting it using "fastboot boot <kernel>" and it didnt boot, only showing a black screen, but using the other boot.img it would boot linux up.
So I'm thinking of somehow creating a kernel image that can use kexec to make a grub like bootloader kernel that you flash onto the secboot partition that has something similer to grub.cfg in which you can easily select which kernel to load.
As for looking for a grub.cfg file, it would look in a few different places:
-in internal storage (probably recovery partition or the "/system" partition as the "/data" partition can potentially be encrypted and not mountable.)
-sd card (has to be in first partition and in fat32 format)
-usb drive (same as sd card)
from these places it will load each grub.cfg. that way it'll make the grub like bootloader kernel extendable in which kernel to load (i.e. have a linux system on usb that you want to boot from.)
I may be wrong but it is my understanding that the compiled kernel is in the boot image packed by mkbootimg.
The kernel is compiled to look for the compatible root file system in a particular place.
So when you change or use a boot image you change the kernel you are using.
So we have a system that;
Has a modified Linux kernel that selects the Android file system from internal memory installed in the first boot position.
We can put a Linux kernel compiled to find a compatible root file system say on external sd card in the second boot position.
We can replace the recovery image with a Linux kernel that finds a compatible root file system on the internal sd card.
That gives us a hardware selective three different systems (triple boot)
With fastboot on the PC we can quickly change any of the Three boot images, replace the recovery image or repair system.
I think all we need is a 3.2.23 kernel compiled thee separate ways and packaged with mkbootimg.
1st find root file system internel, 2nd find file system externel 3rd find file system usb
We already have two 2.6.38 kernels. One from Spdev (external root file system)and One from Netham {internal file system)
They are different kernels as Nethams has added modules.
I believe the were both compiled from the same Git.
I have tried switching the two boot images in second boot position with both root file systems installed and when you boot the second position
it switches to it's own file system.
I haven't tried swapping the root file positions yet.
themechaniac said:
I may be wrong but it is my understanding that the compiled kernel is in the boot image packed by mkbootimg.
The kernel is compiled to look for the compatible root file system in a particular place.
So when you change or use a boot image you change the kernel you are using.
So we have a system that;
Has a modified Linux kernel that selects the Android file system from internal memory installed in the first boot position.
We can put a Linux kernel compiled to find a compatible root file system say on external sd card in the second boot position.
We can replace the recovery image with a Linux kernel that finds a compatible root file system on the internal sd card.
That gives us a hardware selective three different systems (triple boot)
With fastboot on the PC we can quickly change any of the Three boot images, replace the recovery image or repair system.
I think all we need is a 3.2.23 kernel compiled thee separate ways and packaged with mkbootimg.
1st find root file system internel, 2nd find file system externel 3rd find file system usb
We already have two 2.6.38 kernels. One from Spdev (external root file system)and One from Netham {internal file system)
They are different kernels as Nethams has added modules.
I believe the were both compiled from the same Git.
I have tried switching the two boot images in second boot position with both root file systems installed and when you boot the second position
it switches to it's own file system.
I haven't tried swapping the root file positions yet.
Click to expand...
Click to collapse
Interesting. Though i think it needs to be a specific type of kernel (i.e bzImage or uImage instead of vmlinuz) to actually run. also, the precompiled kernel in the guide that i had used in the opening post had a command line where one option was "root=/dev/mmcblk1p2" which pretty much says for the kernel to look for the linux file system in the second partition on the sd card.
Yes with the way the system is formatted you cannot change out the kernel on the fly. It is basically hard coded in the boot image. Skrilax has given us a way to change boot positions so we don't have to sacrifice recovery position to boot second kernel. I have not seen any pre configured 3.2.23 kernels yet. The one that Netham posted boots from internal SD but causes problems for some people as not all a500 have their internal SD card formatted in the same memory block. It works great for me I prefer to have my root file system on a fast external SD so would like to modify or compile a kernel like Netham's. I find I run out of space when I have it internal. Netham's kernel has USB sound and seems to boot differt than Spdev's.
themechaniac said:
Yes with the way the system is formatted you cannot change out the kernel on the fly. It is basically hard coded in the boot image. Skrilax has given us a way to change boot positions so we don't have to sacrifice recovery position to boot second kernel. I have not seen any pre configured 3.2.23 kernels yet. The one that Netham posted boots from internal SD but causes problems for some people as not all a500 have their internal SD card formatted in the same memory block. It works great for me I prefer to have my root file system on a fast external SD so would like to modify or compile a kernel like Netham's. I find I run out of space when I have it internal. Netham's kernel has USB sound and seems to boot differt than Spdev's.
Click to expand...
Click to collapse
Right, but this is how the linux boot loader is going to go with, instead of loading the linux system (sans kernel and initrd) from the sd card, we create a boot.img that has a linux system built in that has a sole purpose of loading other linux systems using kexec.
Edit:
Here's how the path is going to go:
Startup-->Bootloader-->Linux Bootloader (loads linux on external drives)-->Linux (on external drives)
Well I am happy with Ubuntu on my external SD card, I even ran a kernel compile on it and it ran pretty fast. I am stuck on the mkbootimg part. It can't be done on the tablet, has to be a PC. I tried unpacking the Two ready made boot images to see how they are configured but they don't seem to have a ram disk. Still working on that. It is learning how the system is put together that is half the fun, Getting it to work the way you want is the goal. When it is all squared away it will be time to move on to the next puzzle. I have enough computers that I could just put a system on each one and be done with it. Where's the fun in that. Most of them are dual booted already.
themechaniac said:
Well I am happy with Ubuntu on my external SD card, I even ran a kernel compile on it and it ran pretty fast. I am stuck on the mkbootimg part. It can't be done on the tablet, has to be a PC. I tried unpacking the Two ready made boot images to see how they are configured but they don't seem to have a ram disk. Still working on that. It is learning how the system is put together that is half the fun, Getting it to work the way you want is the goal. When it is all squared away it will be time to move on to the next puzzle. I have enough computers that I could just put a system on each one and be done with it. Where's the fun in that. Most of them are dual booted already.
Click to expand...
Click to collapse
Well, even though mkbootimg is suppose to be run on linux, i don't think it was compiled for arm so you are going to have to use a pc for that program. as for the initrd, i did find a website that may help in creating an A.L.B.L. (Android Linux Boot Loader): http://www.thewireframecommunity.com/node/14
Essentially what is needed to create the A.L.B.L. is to create a kernel with kexec in it and an initrd that mounts the external drives along with an easy to use interface to be loaded before loading any kernels to allow for selecting kernels. with that said, how do you figure out how to use the volume buttons and the power button within linux using a c\c++ program?
BUMP!
any progress?
also
-Audio (Detects it in the kde info center. System Settings program only says that there's a dummy output. Playing any form of audio crashes the program.)
Click to expand...
Click to collapse
But
Code:
cat /any/file/for/ex/bin/bash > /dev/dsp
works properly
Unfortunetly no.
Been to busy with other stuff to work on this.
tegra driver
I have ubuntu 12.10 armf runing on my a500 thanks to the "Linux on A500: The Future" thread. I am using the ferrariforzaleo mod of rogro82's kernel.
The problem I had was getting the xorg tegra module to load. I fixed this by getting the "https://launchpad.net/ubuntu/quantal/armhf/nvidia-tegra/16.0-0ubuntu1"]https://launchpad.net/ubuntu/quantal/armhf/nvidia-tegra/16.0-0ubuntu1 and installing with
sudo dpkg -i
after I rebooted it started using the tegra video driver.
Cheers
HardlyAbelson said:
I have ubuntu 12.10 armf runing on my a500 thanks to the "Linux on A500: The Future" thread. I am using the ferrariforzaleo mod of rogro82's kernel.
The problem I had was getting the xorg tegra module to load. I fixed this by getting the "https://launchpad.net/ubuntu/quantal/armhf/nvidia-tegra/16.0-0ubuntu1"]https://launchpad.net/ubuntu/quantal/armhf/nvidia-tegra/16.0-0ubuntu1 and installing with
sudo dpkg -i
after I rebooted it started using the tegra video driver.
Cheers
Click to expand...
Click to collapse
can you explain me the steps you done ? I also want ubuntu 12.10 running but I can't install any desktop on it ( show error and other error )
ubuntu 12.10
Forzaferrarileo said:
can you explain me the steps you done ? I also want ubuntu 12.10 running but I can't install any desktop on it ( show error and other error )
Click to expand...
Click to collapse
Hi, I used the debootstrap and and qemu / chroot to setup my rootfs. i found post #61 in the "Linux on A500: future" very helpful.
Also, make sure you have a usb keyboard handy. After you run "apt-get install -d ubuntu-desktop" (assuming you have a pc running ubuntu to use) in a qemu chroot, you can move to the a500 and boot up and login as root and run "apt-get install ubuntu-destop". since the stuff is cached. I found this faster than installing the desktop while in the chroot. After that finishes, you should boot up with a desktop available. If something is wrong and you can't login, try doing "ctrl-alt-f1" to get to the getty command line login and look at the /var/log/ folder for clues in the logs.
How to compile the kernel?
I succesfully got debian running on my iconia a500 :laugh:
Building my own rootfs and getting the wifi to work were not that hard, but I still don't know how to compile the Linux kernel for the a500 from source.
I already found the git repository of rogru82 (https://github.com/rogro82/picasso-kernel) and I downloaded the source to my pc (running ubuntu 13.04). Can someone point me to a tutorial explaining how to compile this source?
Also, can someone explain what sort of partition table the internal memory uses? I am running the 3.0 kernel and I can see a block memory device in the /dev folder but there are no partitions. How can I mount the internal memory?
Hi all!
Many of us are dreaming of having a real native desktop operating system on Galaxy Note 10.1 as a second system. Of course, the software there is not touch-optimized, but you can attach keyboard and mouse via USB-OTG and Bluetooth and imagine it's a netbook
exception13 showed us that it's possible and shared his work on in a forum and repo. X-Stranger could use it and shared compiled images of ArchLinux. But what if you want to do something more specific for your own needs and you are not such a great developer as both of them are?
My project is for all of you who want to have native GNU/Linux, who want to participate but don't know how yet. It's a guide how to build it from scratch. The problem is - I am not a superdev too and I couldn't do many things. Frankly speaking, all the remaining things seem to be small but I don't know how to overcome them. Maybe it's because I'm studying economics but not programming
Link to the guide.
I need help from anyone who knows how to overcome any of the problems on every step! Everything I managed to do by myself is already written there and currently I have a compiled kernel which is booting a partition on external SD but it freezes there.
If you have any ideas - you can just make a pull request out of Github's webinterface, if you don't know how to edit this html but know something about building Linux - you are welcome to open an issue or write it here and I will include it in the guide.
Let's make our Galaxy Note 10.1 better together!
,I just got my Note 101.1 earlier today. I'll look into the missing information and add to the webpage. Is there anything that you think I should look into first?
I actually had a question.
Looks like you have the section "Harder Way - how to prepare binaries" split into Ubuntu and Arch. Instructions for compiling the kernel are the same.
I guess my question is why the choice to show the arch kernel being compiled under arch?
Might be easier to read the guide with all the kernel compiling done in Ubuntu.
**Edit**
What I didn't originally mention is that i really like it. Hoping to help contribute as well.
darksabre_x said:
I actually had a question.
Looks like you have the section "Harder Way - how to prepare binaries" split into Ubuntu and Arch. Instructions for compiling the kernel are the same.
I guess my question is why the choice to show the arch kernel being compiled under arch?
Might be easier to read the guide with all the kernel compiling done in Ubuntu.
**Edit**
What I didn't originally mention is that i really like it. Hoping to help contribute as well.
Click to expand...
Click to collapse
Good question. The reason for that are that despite how close Arch Linux and Ubuntu are, the environments are different. Ubuntu usually has some sort of bash completion enabled by default whereas Arch Linux doesn't and of course each of them requires diferent packages installed to perform the same functions. I believe thermatk did each distro separately as to make things simpler for the end user. Pick a distro and go as each distro's guide can be tuned independent of the others.
Soul_Est said:
Good question. The reason for that are that despite how close Arch Linux and Ubuntu are, the environments are different. Ubuntu usually has some sort of bash completion enabled by default whereas Arch Linux doesn't and of course each of them requires diferent packages installed to perform the same functions. I believe thermatk did each distro separately as to make things simpler for the end user. Pick a distro and go as each distro's guide can be tuned independent of the others.
Click to expand...
Click to collapse
Doesn't really answer my question considering the end kernel will be the same regardless of the distro being used. I think you took my question as "Why are there 2 options for kernel compilation?", which wasn't what I was asking.
Looks like thermatk actually addressed the question with a page update.
It now gives separate options depending on which distro you want to end up with on your Note 10.1, in addition to separate kernel compilation options.
What I was referring to was when it was Ubuntu only instructions from kernel compilation all the way to deployment on the tablet and Arch only instructions. The kernel and linux image instructions weren't independent of each other, as they currently are.
Update
I'm really happy to hear that someone else wants to use it and contribute! :victory:
darksabre_x, you are right I separated the guide into parts yesterday because the system where you compile kernel doesn't really affect anything on the tablet.
Soul_Est, thank you for helping with questions in the thread :good:
Now I understand that tabs are not the best way to do it, will start this day from trying to rewrite this to a navbar constantly on top which lets you choose options from a dropdown.
Also yesterday got the guide to the point when one path through can get ypu to a bootable distro! You can compile kernel wherever you want, you should be on stock based rom and choose to install Arch on separate partition which probably will be a partition on SD. What you have to add at the end is
Code:
pacman -S lxde
and copy xorg.conf from X-Stranger's post. Once rebooted, you will be able to enter android:changeme and
Code:
sudo lxdm
and the gui will start if you don't have USB-OTG and keyboard you won't be able to enter password but you can poweroff from the interface's right corner :good: Attention: if gui says that it has no permissions to write logs do
Code:
sudo mount -n -o remount, rw /
and retry but do not forget to write here about it!
What are the current problems:
Why exception13 and X-Stranger both hardcoded the whole cmdline for kernel and forced it not to be changeable from bootloaders. It's easy to fix in the config but there should have been some idea or i'm paranoic?
What's wrong with LinuxDeploy, separate partitions and CyanogenMod? hiruna filed a bug but meefik seems to be away for a week. If anyone else with CM has an idea on how to overcome this maybe with some special unmount commands CM is thinking that ext4 partition is th extSdCard and mounts it so that LinuxDeploy can't install anything there (seems that it's the problem) while stock can't mount ext4 as extsdcard and is not touching the partition.
How do we make Debian/Ubuntu to boot? Both ways - for separate partition and img are stuck one the problem that not any mkinitramfs or abootimg or their combinations could get to a better state than initramfs shell. Separate partition should be easier so focus should be on it for the start.
Adapt X-Stranger's guide about booting Arch from *.img. It's there and should be tested, rewritten and easied and some whitespaces should be filled. I know there are some as i have spent many hours in Arch with little dirty hacks like
Code:
ln -s /proc/self/fd /dev/fd
that are needed but no one ever wrote that they are.
What's wrong with basic video? While we get bootable Arch if you add lxdm and xorg.conf it should work with lightdm and boot there without console commands. If you try to install lightdm you will get nothing but a black screen if you start it with
Code:
sudo lightdm
... and it should boot automatically without touching console.
Oh and why is kernel from exception13 not building at all? XD
Redesign #2
Anyone dislikes the new design idea with navbar selectors instead of tabs?
I hope it's better.
Will soon update the guide with last steps to have Arch with LXDE bootable from separate partition.
That's fun as I started this project to get Ubuntu working... :angel:
If anyone can understand what should be done with mkinitramfs to make debian/ubuntu rootfs bootable - please do it.
First success!
If you choose any pc distro, arch on sgn with lxde on a seaprate partition you will now get a fully working guide that will give you a native bootable GNU/Linux =)
That's first success for me but still i hope to get help as i don't know things I asked two posts ago and it's difficult to move forward.
XFCE problems
XFCE is booting (not in the guide yet) but for working with fingers in XFCE one should probably disable multitouch S-pen works fine.
http://lists.x.org/pipermail/xorg/2012-July/054626.html
http://xfce.10915.n7.nabble.com/Xfwm-window-borders-do-not-respond-to-touch-screen-td17348.html
Will find a way to enable onscreen keyboard on LightDM and update the guide with XFCE. Still I was hoping to make it my primary DE and they are not supporting fingers moving windows upstream :crying:
I was hoping to contribute this weekend but unfortunately my only machine is down after mucking up the /lib folder when heimdall. To add insult to injury, I have no backups. Installing Arch Linux or Debian and configuring everything to my liking again will take a few hours.
Sent from my GT-N8010 using Tapatalk 2
How to setup WiFi using wpa_supplicant.conf
How to setup WiFi using wpa_supplicant.conf
1. Copy the "wifi" folder to "/opt"
- You will need gedit to edit the nameservers.
- You also need two dependencies before installing gedit.
- The two dependencies are : gtksourceview3-3.6.1-1-armv7h.pkg.tar.xz and libpeas-1.6.1-1-armv7h.pkg.tar.xz
2. Download them and copy over to ArchLinux
3. Install the dependencies first then gedit:
Code:
sudo pacman -U gtksourceview3-3.6.1-1-armv7h.pkg.tar.xz
sudo pacman -U libpeas-1.6.1-1-armv7h.pkg.tar.xz
sudo pacman -U gedit-3.6.2-2-armv7h.pkg.tar.xz
4. insmod the drivers:
***NOTE*** " 3.0.31-gedcc915 " is my kernel name. Change it to your
kernel name if it is different.
Code:
sudo insmod /lib/modules/3.0.31-gedcc915/kernel/net/wireless/cfg80211.ko
sudo insmod /lib/modules/3.0.31-gedcc915/kernel/drivers/net/wireless/bcmdhd/dhd.ko op_mode=0 firmware_path=/opt/wifi/bcmdhd_sta.bin nvram_path=/opt/wifi/nvram_net.txt_murata
5. Enable the wlan0:
Code:
sudo ip link set wlan0 up
6. Setup wpa_supplicant and ip address:
Code:
sudo wpa_supplicant -B -i wlan0 -Dwext -c /etc/wpa_supplicant/wpa_supplicant.conf
sudo ip addr add 192.168.1.33/24 dev wlan0
sudo ip route add default via 192.168.1.1
7a. Add nameservers:
Code:
sudo gedit /etc/resolv.conf
7b. Go to the next available line and type:
Code:
nameserver 8.8.8.8
7c. Next line :
Code:
nameserver 8.8.4.4
7d. Save it
8. Go back to the terminal and edit the wpa_supplicant file:
Code:
sudo gedit /etc/wpa_supplicant/wpa_supplicant.conf
- wpa_supplicant.conf file should be like this:
Code:
ctrl_interface=/var/run/wpa_supplicant
eapol_version=1
network={
ssid="NETWORKNAME"
scan_ssid=1
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
psk="NETWORKPASSWORD"
}
9. And finally, to connect to your network, run
Code:
sudo dhcpcd
Open up a web browser and enjoy!
:good: :good: :good:
WiFi
I am currently including WiFi in the main guide as it's something everyone needs :laugh:
Soul_Est said:
I was hoping to contribute this weekend but unfortunately my only machine is down after mucking up the /lib folder when heimdall. To add insult to injury, I have no backups. Installing Arch Linux or Debian and configuring everything to my liking again will take a few hours.
Sent from my GT-N8010 using Tapatalk 2
Click to expand...
Click to collapse
I will be happy if you join :good:
thermatk said:
I will be happy if you join :good:
Click to expand...
Click to collapse
I'll get right on the Arch Linux instructions once I get an Arch based OS installed. Hopefully that'll be tomorrow.
Written on my Galaxy Note 10.1
is this project dead ?
Equilibrio said:
is this project dead ?
Click to expand...
Click to collapse
Great job! This is awesome.
Anyone else having dependency conflicts with bluez and obexd-client?
cctoro said:
Great job! This is awesome.
Anyone else having dependency conflicts with bluez and obexd-client?
Click to expand...
Click to collapse
I did before but it really depends on what you have install at the time when you do the update.
Having a small issue
Ok, so I followed all the instructions and set the kernel up to boot from mmcblk1p2 (my ext4 partition on my sdcard I made for linux), and used dd to copy the prebuilt arch to the partition, and it boots and eveything seems to work but the wifi.... I repeated the process from the beginning all over and recompiled to make sure i didn't miss anything, but still no wifi... And since I'm using the prebuilt image copied to the sdcard for the distro, and everything works in it if i boot the .img from the internal storage and use the premade recovery, I'm assuming maybe there's something missing from compiling the kernel? In either case, if anyone has any ideas about this, please help, or if someone can make a properly compiled recovery.img that boots from mmcblk1p2, that would be super awesome.... I'm only mediocre in linux skill so any help would be appreciated!
K, so i was an idiot and forgot to copy the compiled kernel modules to /lib........ OOPS!
Arch linux distro booting from mmcblk1p2 with 1p3 as swap... all work awesome! Working on dri2 for the mali now.....
Sent from my GT-N8013 using xda app-developers app
Could you post a prepared .IMG, possibly? Thanks.
Sent from my GT-N8013 using xda app-developers app
The folks over at Sony Ericsson have released something a bit useful if you’ve been wondering lately how to build Linux Kernels for your phone. Sony Ericsson’s Developers has laid out a detailed process on how to build a new Linux kernel and flash it to your Android device. We’ve pasted the info below for you so you don’t have to hop around. Below you’ll find Sony Ericsson’s how-to in its entirety for your convenience with respective links and all. If you’ve been wanting to tinker and dive into the world of Linux and flashing kernels on mobile devices, we’d say now is the time. Follow the expert step by step process and toss us a note or two in the comments below if this works out for you. However, keep in mind, even though the article is written by experienced Sony Ericsson developers, nothing is guaranteed to work the way it’s supposed to. So be very diligent while following and performing these tasks. In other words, do your research first.
How to build a Linux kernel and flash it to the phone.
Since the launch of the unlock boot loader site, Sony Ericsson have received a lot of really great feedback. The Sony Ericsson Developer Program wants to continue to build on this open dialogue with external developers.
Developers and advanced users can now unlock the boot loader, which is the first step to be able to flash your own image. Where developers run into problems when building their own image, and and trying to flash the image using Fastboot.
Before moving on, I like to remind you again that there is no turning back when unlocking the boot loader. You may void the warranty of the phone, and you will not be able to revert the phone to a locked or original state if you unlock it.
What is the Linux kernel?
The Xperia™ line of smartphones run on the Android™, the mobile operating system based on the Linux kernel. Though it is only a small part of the operating system, the kernel ensures that all other processes in the system are synchronized to work together properly.
Why rebuild the kernel?
Rebuilding the kernel enables end users to make modifications to their devices that are normally not intended by the device manufacturer, such as theming the device by changing system icons and removing/modifying system components. Please note that Sony Ericsson is not recommending this.
Considerations before building your own kernel and reflashing your device
As mentioned in the beginning of this article, the first step is to unlock the boot loader. When the boot loader is unlocked, the sensitive data is removed, such as DRM certificates, and the user partition of the file system is wiped out. But all other functionality, such as the camera and other drivers, is left intact. Please note that content, like music files, that require the DRM certificate will not be accessible any more. But most importantly, you may void the warranty of your phone if you decide to unlock it. Aside from the considerations mentioned above, the functionality is there, just waiting for you to take advantage of it. So, if you’re ready, here’s how to get started.
Building the kernel
It takes a few main steps to build the kernel. Below we’ll show you how to build a Linux kernel and flash it onto the device.
Step A – Download the necessary software
Download the following software to get started:
The kernel source code can be downloaded from the copyleft archives on Sony Ericsson Developer World. You can use the file called ex. 3.0.A.2.181_182.tar.bz2 for our Android™ Gingerbread devices. This is the source code for the Linux kernel as used in the Xperia™ PLAY.
The Fastboot client which is part of the Android SDK. This is the standard Android flashing utility. This allows you to flash the image you are about to create onto the device.
The Init RAM disk. The initial RAM disk (also known as the initrd) is the initial filesystem that the kernel will mount and start running processes off. You can configure the Init RAM disk to grant root access. How you create or download your own Init RAM disk is beyond the scope of this article.
The ARM cross-compiler. A cross-compiler is used to build ARM binaries on a different architecture, such as x86. This allows you to compile software (such as the kernel) into a format that the device can run. We recommend getting the CodeSourcery Lite compiler, especially the GNU/Linux variant, as you’ll need that if you want to build binaries for a full-blown Linux system on the device later. However, any EABI ARM compiler capable of compiling the Linux kernel should be enough for this step.
Step B – Building the kernel
To build the kernel, you first need to unpack the kernel. Once you’ve unpacked the kernel, you need to configure it, and then build it. The example below is based on you using the file called 3.0.A.2.181_182.tar.bz2.
1. Go into the kernel directory:
cd kernel
2. Configure the kernel:
ARCH=arm CROSS_COMPILE=/opt/arm-2010q1/bin/arm-none-eabi- make semc_zeus_defconfig
Note: Replace /opt/arm-2010q1 with where you installed your cross-compiler. Also, this example is for Xperia™ PLAY. Replace defconfig with the following values depending on what device you want to configure it for:
Xperia™ PLAY semc_zeus_defconfig
Xperia™ arc semc_anzu_defconfig
Xperia™ neo semc_hallon_defconfig
3. Build the kernel:
ARCH=arm CROSS_COMPILE=/opt/arm-2010q1/bin/arm-none-eabi- make
Replace /opt/arm-2010q1 with where you installed your cross-compiler. Once done, you should have a compressed kernel-image in arch/arm/boot/zImage.
Step C – Getting a RAM disk
The RAM disk is the initial filesystem the kernel will mount before transferring control to userspace. How you create your own root filesystem is beyond the scope of this article, but you can use the following instructions to pack/unpack the file.
Unpacking (you have to ramdisk.img, and weant to create a directory of files out of it):
gzip -d – < ramdisk.img > cpio -idm
Packing (You have directory of files, and want to create ramdisk.img from it):
find . | cpio –quiet -H newc -o | gzip > ramdisk.img
Step D – Assembling the boot.img
Now that we have all the parts we need to create a flashable file. The next stop is to package the parts. To do this, you’ll need the program mkbootimg, which is part of the standard Android tree. If you don’t feel like compiling all of Android to get this tool, it is available to download from various trusted sites on the Internet.
Once you have the tool, this is the command to combine your kernel and RAM disk into a flashable file:
mkbootimg –base 0×00200000 –kernel kernel/arch/arm/boot/zImage –ramdisk ramdisk.img -o boot.img
Step E – Flashing the file
You should flash the file using Fastboot. If you’ve unlocked the boot loader on your device, you already have Fastboot.
1. To flash the boot.img file, use the following the command
fastboot –i 0x0fce flash boot boot.img
2. Now, it will prompt you to connect your device. To do so, follow these simple steps:
Make sure your device is powered down.
Hold down the Search button (Xperia™ PLAY only) or the Back button (all other Xperia™ devices). The device’s notification light should shine blue to confirm it’s inFastboot mode.
Connect the USB cable.
Flashing should now start and complete.
3. As a last step in the process, you need to reboot the device. You can either remove the USB cable and battery to power the device down. If you prefer, you can instead issue the following command (either method will work):
fastboot –i 0x0fce reboot
Important information!
Additional information for experienced Linux kernel experts
The kernel is pretty standard, all the regular things you’re used to is there, and available to use. Things that are different are the memory config and the kernel commandline. The memory config is hardcoded (i.e., ATAGs aren’t used for this). It’s set in the board-file for your target, such as kernel/arch/arm/mach-msm/board-semc_zeus.c in the function msm7x30_fixup. The kernel commandline is also not fetched from the boot.img file, but compiled into the kernel (CONFIG_CMDLINE). Some arguments are also added from the boot loader.
Additional information if porting non-Linux format files to the device. The boot loader will accept any reasonably formatted boot.img file.
For example, at the Android Kernel Git, you will see the format of the boot.img file. This allows you to create a boot.img file containing two loadable files (kernel+ramdisk), which will get loaded into RAM. Once the boot loader is loaded, it passes the control to the first instruction of the loaded kernel image. After control is passed, the kernel can rely on the data contained in the RAM disk already being loaded.
Guide by Karl-Johan Dahlström