Linux Archives

How to Edit Android Kernels in Ubuntu

The Android kernel is derived from the Linux kernel. It relies on the core services of Linux, such as security, memory, network and process management. To make amendments to the Android core and include or unlock certain abilities, you must edit and compile your own Android kernel. The Ubuntu operating system is one of the best platforms to edit and compile Android kernels on, and it’s easy to install everything you need.

Instructions

  • 1

    Select “Accessories” from the main menu and click on “Terminal” to open the application. The Terminal is similar to the Windows Command Prompt.

  • 2

    Type the following in the Terminal and press “Enter” to install Java:

    sudo apt-get install sun-java5-jdk

    Use the password you use to log in to Ubuntu when you are asked for a password. This gives the application root privileges.

  • 3

    Run the following commands in the Terminal to install the rest of the tools required to edit Android kernels:

    sudo apt-get install git-core gnupg flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev valgrind

  • 4

    Create the required folder structure, get a copy of the Android repository script, and give full read and write access to the script by running these commands in the Terminal:

    cd /home/*your-user-name
    mkdir myandroid
    mkdir bin
    curl http://android.git.kernel.org/repo > ~/bin/repo
    chmod a+x ~/bin/repo

  • 5

    Go to the “myandroid” folder and download the Google tools and Android source, using the repository script you’ve downloaded earlier. Do this by running these commands in the Terminal:

    cd ~/myandroid
    ~/bin/repo init -u git://android.git.kernel.org/platform/manifest.git
    ~/bin/repo sync

  • 6

    Copy and paste the following command in the Terminal and press “Enter” to run it:

    echo “—–BEGIN PGP PUBLIC KEY BLOCK—–
    Version: GnuPG v1.4.2.2 (GNU/Linux)

    mQGiBEnnWD4RBACt9/h4v9xnnGDou13y3dvOx6/t43LPPIxeJ8eX9WB+8LLuROSV
    lFhpHawsVAcFlmi7f7jdSRF+OvtZL9ShPKdLfwBJMNkU66/TZmPewS4m782ndtw7
    8tR1cXb197Ob8kOfQB3A9yk2XZ4ei4ZC3i6wVdqHLRxABdncwu5hOF9KXwCgkxMD
    u4PVgChaAJzTYJ1EG+UYBIUEAJmfearb0qRAN7dEoff0FeXsEaUA6U90sEoVks0Z
    wNj96SA8BL+a1OoEUUfpMhiHyLuQSftxisJxTh+2QclzDviDyaTrkANjdYY7p2cq
    /HMdOY7LJlHaqtXmZxXjjtw5Uc2QG8UY8aziU3IE9nTjSwCXeJnuyvoizl9/I1S5
    jU5SA/9WwIps4SC84ielIXiGWEqq6i6/sk4I9q1YemZF2XVVKnmI1F4iCMtNKsR4
    MGSa1gA8s4iQbsKNWPgp7M3a51JCVCu6l/8zTpA+uUGapw4tWCp4o0dpIvDPBEa9
    b/aF/ygcR8mh5hgUfpF9IpXdknOsbKCvM9lSSfRciETykZc4wrRCVGhlIEFuZHJv
    aWQgT3BlbiBTb3VyY2UgUHJvamVjdCA8aW5pdGlhbC1jb250cmlidXRpb25AYW5k
    cm9pZC5jb20+iGAEExECACAFAknnWD4CGwMGCwkIBwMCBBUCCAMEFgIDAQIeAQIX
    gAAKCRDorT+BmrEOeNr+AJ42Xy6tEW7r3KzrJxnRX8mij9z8tgCdFfQYiHpYngkI
    2t09Ed+9Bm4gmEO5Ag0ESedYRBAIAKVW1JcMBWvV/0Bo9WiByJ9WJ5swMN36/vAl
    QN4mWRhfzDOk/Rosdb0csAO/l8Kz0gKQPOfObtyYjvI8JMC3rmi+LIvSUT9806Up
    hisyEmmHv6U8gUb/xHLIanXGxwhYzjgeuAXVCsv+EvoPIHbY4L/KvP5x+oCJIDbk
    C2b1TvVk9PryzmE4BPIQL/NtgR1oLWm/uWR9zRUFtBnE411aMAN3qnAHBBMZzKMX
    LWBGWE0znfRrnczI5p49i2YZJAjyX1P2WzmScK49CV82dzLo71MnrF6fj+Udtb5+
    OgTg7Cow+8PRaTkJEW5Y2JIZpnRUq0CYxAmHYX79EMKHDSThf/8AAwUIAJPWsB/M
    pK+KMs/s3r6nJrnYLTfdZhtmQXimpoDMJg1zxmL8UfNUKiQZ6esoAWtDgpqt7Y7s
    KZ8laHRARonte394hidZzM5nb6hQvpPjt2OlPRsyqVxw4c/KsjADtAuKW9/d8phb
    N8bTyOJo856qg4oOEzKG9eeF7oaZTYBy33BTL0408sEBxiMior6b8LrZrAhkqDjA
    vUXRwm/fFKgpsOysxC6xi553CxBUCH2omNV6Ka1LNMwzSp9ILz8jEGqmUtkBszwo
    G1S8fXgE0Lq3cdDM/GJ4QXP/p6LiwNF99faDMTV3+2SAOGvytOX6KjKVzKOSsfJQ
    hN0DlsIw8hqJc0WISQQYEQIACQUCSedYRAIbDAAKCRDorT+BmrEOeCUOAJ9qmR0l
    EXzeoxcdoafxqf6gZlJZlACgkWF7wi2YLW3Oa+jv2QSTlrx4KLM=
    =Wi5D
    —–END PGP PUBLIC KEY BLOCK—–”> /tmp/android.gpg

  • 7

    Run the following commands in the Terminal to copy the key from the temporary file to the keyring and delete the temporary file:

    gpg –import < /tmp/android.gpg
    rm -rf /tmp/android.gpg

  • 8

    Open the Web browser and navigate to HTCDev’s Kernel Source Code page (see Resources). Click on the “Download” button next to the “HTC EVO Shift 4G (Sprint WWE) – MVNOCRC – 2.6.32 kernel source code” entry. Save the file on your desktop.

  • 9

    Run this command in the Terminal to create a new directory:

    mkdir ~/.EVO_Kernel_sources

  • 10

    Open Nautilus. Nautilus is similar to Windows Explorer. The Home Folder is displayed. Press “Ctrl” and “H” at the same time to see hidden folders. Click on the “EVO_Kernel_sources” folder you created earlier to open it.

  • 11

    Double-click on the source file you downloaded earlier to open the TAR archive. It contains a single folder; drag this folder from the archive to the “EVO_Kernel_sources” folder to extract it there.

  • 12

    Run these commands in the Terminal to create the folder structure for the Android build and create a link to the kernel source you just extracted:

    cd ~
    mkdir android
    cd android
    mkdir sources
    cd sources
    ln -s /home/*your_user_name*/.EVO_Kernel_sources/*Extracted_folder_name kernel

    Replace “your_user_name” with your real Ubuntu username and “Extracted_folder_name” with the name of the folder you extracted from the EVO Android source archive.

  • 13

    Connect the Android phone to your Ubuntu machine in data transfer mode using the USB cable. Run these commands in the Terminal to copy the Android main configuration file from the phone to the “/android/sources/kernel” folder:

    adb pull /proc/config.gz ~/android/sources/kernel/
    cd ~/android/sources/kernel/
    gunzip config.gz

  • 14

    Run these commands to edit the makefile of the Android Kernel and specify the tool-chain and compiler:

    cd ~/android/sources
    make clean
    export ARCH=arm
    export CROSS_COMPILE=arm-eabi-
    export PATH=$PATH:~/myandroid/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin

  • 15

    Run this command to start configuring the kernel options:

    make menuconfig

    Scroll to the bottom of the resulting window, select the “Load an Alternative Configuration File” option and press “Enter.” Enter this path to the config file in the box that pops up:

    /home/*your-user-name*/android/sources/kernel/config

    Press “Enter” again.

  • 16

    Select the make options from the menu to edit the Android kernel. It’s best to select only the “msm7k,” “ondemand” and “performance” as processor governors in the CPU Frequency scaling section. Check the “Kernel debugging” option in the Kernel Hacking section if your build is a test build. Enable the “Support for Host-side USB” and “USB Gadget Support” if you want to use USB devices. You can also add support for various network functions, such as IP tunneling and network privacy options, in the Networking Support section.

  • 17

    Close the configuration window and select “Yes” when prompted to save it. This action creates the hidden “.config” file inside the kernel directory.

  • 18

    Run these commands in the Terminal to insert the Wi-Fi module, and make and compile your custom Android kernel:

    make
    export KERNEL_DIR=~/android/sources/kernel
    cd ~/myandroid/system/wlan/ti/sta_dk_4_0_4_32/
    make clean
    make

 

Here is a workshop in Singapore on Android Apps

Incoming search terms:

  • Linux|Web eCommerce iOS Android ArduinoandSEO

You can password protect a folder by adding a .htaccess file with the following lines:

Sometimes, when the password protected folder is a sub-directory and, the parent folder has a .htaccess file that uses the rewrite engine, you may get a 404 Page Not Found error when you browse the protected sub-folder. WordPress users will especially notice this when they try to password protect a sub-folder. One way to solve this issue is to add 2 lines to the beginning of the protected folder’s .htaccess file. So, the final file will look like this:

This should solve the page not found errors!

Incoming search terms:

  • magento password protect directory
  • password protect directory prestashop

Debian – The future of linux experience

The Debian Project is an association of individuals who have made common cause to create a free operating system. This operating system that we have created is called Debian.

An operating system is the set of basic programs and utilities that make your computer run. At the core of an operating system is the kernel. The kernel is the most fundamental program on the computer and does all the basic housekeeping and lets you start other programs.

Debian systems currently use the Linux kernel or the FreeBSD kernel. Linux is a piece of software started by Linus Torvalds and supported by thousands of programmers worldwide. FreeBSD is an operating system including a kernel and other software.

However, work is in progress to provide Debian for other kernels, primarily for the Hurd. The Hurd is a collection of servers that run on top of a microkernel (such as Mach) to implement different features. The Hurd is free software produced by the GNU project.

A large part of the basic tools that fill out the operating system come from the GNU project; hence the names: GNU/Linux, GNU/kFreeBSD and GNU/Hurd. These tools are also free.

Of course, the thing that people want is application software: programs to help them get what they want to do done, from editing documents to running a business to playing games to writing more software. Debian comes with over 29000 packages (precompiled software that is bundled up in a nice format for easy installation on your machine) — all of it free.

It’s a bit like a tower. At the base is the kernel. On top of that are all the basic tools. Next is all the software that you run on the computer. At the top of the tower is Debian — carefully organizing and fitting everything so it all works together.

 

Find more http://www.debian.org/

A look into Backtrack OS

BackTrack is a Linux-based penetration testing arsenal that aids security professionals in the ability to perform assessments in a purely native environment dedicated to hacking. It is aimed at digital forensics and penetration testing use. It is named after backtracking a search algorithm. The current version is BackTrack 5 R2, codenamed “Revolution and its Revision”.

BackTrack is intended for all audiences from the most savvy security professionals to early newcomers to the information security field. BackTrack promotes a quick and easy way to find and update the largest database of security tools collection to-date.Whether you’re hacking wireless, exploiting servers, performing a web application assessment, learning, or social-engineering a client, BackTrack is the one-stop-shop for all of your security needs.

BackTrack includes many well known security tools including:

  • Metasploit integration
  • RFMON Injection capable wireless drivers
  • Aircrack-NG
  • Kismet
  • Nmap
  • Ophcrack
  • Ettercap
  • Wireshark(formerly known as Ethereal)
  • BeEF (Browser Exploitation Framework)
  • Hydra
  • OWASP Mantra Security Framework collection of hacking tools, add-ons and scripts based on Firefox
  • Cisco OCS Mass Scanner: A very reliable and fast scanner for Cisco routers with telnet/enable default password.
  • A large collection of exploits as well as more commonplace software such as browsers.

BackTrack arranges tools into 12 categories:

  • Information Gathering
  • Vulnerability Assessment
  • Exploitation Tools
  • Privilege Escalation
  • Maintaining Access
  • Reverse Engineering
  • RFID Tools
  • Stress testing
  • Forensics
  • Reporting Tools
  • Services
  • Miscellaneous

If you’re making BackTrack you install BackTrack , boot it from a Live DVD or thumbdrive, the penetration distribution has been customized down to every package, kernel configuration, script and patch solely for the purpose of the penetration tester.

Ubuntu 12.04

42 days until Ubuntu 12.04, the sixteenth Ubuntu release and fourth LTS will be released. This makes six weeks in which the following things are going to happen: one week until Beta 2 Freeze and docs will be frozen, two weeks until Beta 2 gets out, three weeks until the kernel is frozen, four weeks until we hit Final Freeze and it will be hard to squeeze fixes in.

Back to Rhythmbox?

No More Mono?

64-Bit by Default

A Wayland Preview

Some GNOME 3.4 Packages

A Speedier Software Center

Notes on mod_rewrite for Apache

Apache’s mod_rewrite document, calls this module as “Swiss Army Knife of URL manipulation!”

 

mod_rewrite is an Apache module that allows for server-side manipulation of requested URLs. Incoming URLs are checked against a series of rules. The rules contain a regular expression to detect a particular pattern. If the pattern is found in the URL, and the proper conditions are met, the pattern is replaced with a provided substitution string or action. This process continues until there are no more rules left or the process is explicitly told to stop.

 

Fig: mod_rewrite control flow.

 

Advantages

  1. mod_rewrite can be used to transform long and complex urls into user friendly or short urls.

    For eg. http://myrurl.php/customer.php?name=shan&id=4562&aadr=561

    Above url can be converted to a more user friendly one as,

    http://myurl.php/customer/shan

     

  2. Security enhancement.

    Consider the above example a potential hacker can try out different urls to hack into the system by giving different parameters and values passed to customer.php, using mod_rewrite we can prevent such threats.

     

    mod_rewrite can be enabled by uncommenting the line,

    LoadModule rewrite_module modules/mod\_rewrite.so

    in apache configuration file httpd.conf.

Incoming search terms:

  • ApacheTips|Web eCommerce iOS Android ArduinoandSEO

In my previous article, I’ve explained how to create a MySQL database back up using gzip compression.

If you have plain sql file, the command to restore the database is,

cat db_backup.sql | mysql -u mysqluser -p mysqldatabase

“cat” command to output the contents of the backup.sql file, and pipe its contents into the mysql program. mysql program takes the same options as the mysqldump explained in my article about creating a database backup using command-line Gzip utility.

For GZip compressed file, we can’t just output its contents into mysql, as it will be a compressed data, so inorder to extract the data execute the following command:

gunzip < db_backup.sql.gz | mysql -u mysqluser -p mysqldatabase

Here we run “gunzip” to decompress the backup.sql.gz file, we then pipe the decompressed output into the “mysql” program, which will extract the data and restore the database.. that’s it!!

Making a Database Backup using GZip compression.

Backing up your database is very important in a database driven application. Ideally database should be backed up often. There are a lot of ways to accomplish this. I’ll show how to back up database using command-line commands.

The command to run the backup is:

mysqldump -u mysqluser -p mysqldatabase

“mysqldump” program is a tool for creating database backups.

The parameters used are:

“-u” switch means you’re going to specify a username to connect with, which must follow, like “-u mysqluser” above

“-p” switch means you’re either going to immediately specify the password to use (with no space), or it’ll prompt you for one

The final parameter used in the example above is the name of the database to backup

If you run the command above, you would see the contents of your database go scrolling on the screen.

To place the contents of the output into a file, execute the following command

mysqldump -u mysqluser -p mysqldatabase > db_backup.sql

Now you should be able to see a file named “db_backup.sql”, and if you open it you can see a SQL script with the structure and content of your database ready for restoration or migration.

Now compress this SQL script using GZip compression. Instead of gzip, you can use bzip, tar etc..

To add compression into this command, just execute the following command.

mysqldump -u mysqluser -p mysqldatabase | gzip > db_backup.sql.gz

Now your database backup is ready to import/export for future use.

A Short Introduction to awk

  • awk got its name, from the surnames of the three programmers who invented it (Aho, Weinberger, and Kernighan).

The awk command combines the functions of grep and sed, making it one of the most powerful commands. Using awk, you can substitute words from an input file’s lines for words in a template or perform calculations on numbers within a file

We’ll see how print function of awk works,
awk <pattern> ‘{print <var>}’ <file>

In this case, var is going to be some combination of text, special variables that represent each word in the input line, and perhaps a mathematical operator or two. As awk processes each line of the input file, each word on the line is assigned to variables named $1 (the first word), $2 (the second word), and so on. (The variable $0 contains the entire line.)

Let’s start with a file, legs.data, that contains these lines:
Chicken two bird
Lion four Forest

Spider eight

Now we’ll use the print function in awk to plug the words from each input line into a template, like this:
awk ‘{print $1,” Has “,$2,” Legs “}’ legs.data

Chicken Has two Legs
Lion Has four Legs
Spider Has eight Legs

Say some of the data in your input file is numeric, as in the marks.data file shown here:
Jim 87 100 95
Allen 66 89 76
Bob 12 36 27

You can perform calculations like this:
awk ‘{print “Avg for”,$1,”is”,($2+$3+$4)/3}’ marks.data

Avg for Jim is 94
Avg for Allen is 77
Avg for Bob is 25

So far, we haven’t specified any value for pattern in these examples, but if you want to exclude lines from being processed, you can enter something like this:
awk /^Lion/’{print “See the”,$1,”in the”,$3}’ legs.data

See the Lion in the Forest

Here, we told awk to consider only the input lines that start with Lion. Note also that there is no space between the pattern and the print specifier. If you put a space there, awk will think the input file is ‘{print and will not work. But all this is just the tip of the awk iceberg–entire books have been written on this command. If you are a programmer, try the man awk command.

Incoming search terms:

  • awk iceberg
  • short note on awk
  • short notes on awk