Saturday, February 11, 2012

Lou's Ubuntu Cheat Sheet


# Gnome 3 Auto Login

sudo /usr/lib/lightdm/lightdm-set-defaults -s gnome-shell

# Unity Auto Login

sudo /usr/lib/lightdm/lightdm-set-defaults -s ubuntu

# Change LightDM Wallpaper

gksu gedit /etc/lightdm/unity-greeter.conf

# My Commonly Installed Apps

sudo apt-get install build-essential kernel-package libncurses5-dev bzip2 fakeroot git git-core git-gui msr-tools ruby filezilla openshot vlc minitube audacity soundconverter easytag arista gimp dconf-tools transmission trimage guvcview meld blender gparted screenkey dkms empathy shotwell aptitude hardinfo gufw brasero

# Compile ffmpeg,libvpx
 and x264

Make sure you don't have ffmpeg or x264 installed:

sudo apt-get remove ffmpeg x264 libx264-dev

Update your system:

sudo apt-get update

Install all of the packages required for compilation & Installation:


sudo apt-get -y install build-essential checkinstall git libfaac-dev libgpac-dev libjack-jackd2-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libsdl1.2-dev libtheora-dev libva-dev libvdpau-dev libvorbis-dev libx11-dev libxfixes-dev texi2html yasm zlib1g-dev

x264

cd

git clone git://git.videolan.org/x264

cd x264

./configure --enable-static

make -j 32

sudo checkinstall --pkgname=x264 --pkgversion="3:$(./version.sh | awk -F'[" ]' '/POINT/{print $4"+git"$5}')" --backup=no --deldoc=yes --fstrans=no --default

libvpx

cd

git clone http://git.chromium.org/webm/libvpx.git

cd libvpx

./configure

make -j 32

sudo checkinstall --pkgname=libvpx --pkgversion="1:$(date +%Y%m%d%H%M)-git" --backup=no --deldoc=yes --fstrans=no --default

ffmpeg

cd

git clone --depth 1 git://source.ffmpeg.org/ffmpeg

cd ffmpeg

./configure --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-version3 --enable-x11grab

make -j 32

sudo checkinstall --pkgname=ffmpeg --pkgversion="5:$(date +%Y%m%d%H%M)-git" --backup=no --deldoc=yes --fstrans=no --default

hash x264 ffmpeg ffplay ffprobe

# Android AOSP packages

sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline-gplv2-dev lib32z-dev libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc

# AOSP Package - install last

sudo apt-get install libx11-dev:i386

# Java 1.6

Decompress
sh jdk-6u30-linux-x64.bin
Move
sudo mv jdk1.6.0_30 /usr/lib/jvm/
Run
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.6.0_30/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.6.0_30/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.6.0_30/bin/javaws" 1
Run
sudo update-alternatives --config java
Choose the Option
/usr/lib/jvm/jdk1.6.0_30/bin/java
Check Version
java -version
java version "1.6.0_30"
Java(TM) SE Runtime Environment (build 1.6.0_30-b12)
Java HotSpot(TM) 64-Bit Server VM (build 20.5-b03, mixed mode

Alternate Method if you have the Mint 12 Repository enabled:

sudo apt-get install sun-java6-jdk

# Faenza & Faience Icon Themes

sudo add-apt-repository ppa:tiheum/equinox
sudo apt-get update && sudo apt-get install faenza-icon-theme faience-icon-theme

# Kazam Screencaster Ubuntu 11.10

sudo add-apt-repository ppa:kazam-team/unstable-series
sudo apt-get update && sudo apt-get install kazam

# Chromium Daily PPA

sudo apt-add-repository ppa:chromium-daily/ppa

# Linux Mint Icons & Mint-z Theme

git clone https://github.com/linuxmint/mint-x-icons.git
git clone https://github.com/linuxmint/mint-z-theme.git

# Zen Kernel

git clone --depth 1 git://zen-kernel.org/kernel/zen-stable.git

# X.org Edgers

sudo apt-add-repository ppa:xorg-edgers/ppa
sudo apt-get update && sudo apt-get dist-upgrade

# Booting Issues - Add to /etc/default/grub

quiet splash irqpoll
quiet splash acpi=off
acpi_osi=Linux
acpi=force

# How to Blacklist “Radeon” Module

As root, create file /etc/modprobe.d/blacklist-radeon.conf

Add the following contents:

blacklist radeon

Save the file and reboot

# How to install Proprietary ATI Video Driver

1. Symbollically Link lib & lib64 to avoid lib64 error

cd /usr
sudo ln -s lib libx64

2. Make ATI installer executable

chmod +x amd-driver-installer-12-1-x86.x86_64.run

3. Install ATI Driver Manually DO NOT build deb packages

sudo sh ./amd-driver-installer-12-1-x86.x86_64.run

4. Update X.org

sudo aticonfig --initial -f

# xorg.conf “Radeon” driver

sudo gedit /etc/X11/xorg.conf

Section "Device"
Identifier "ATI Radeon"
Driver "radeon"
Option "AccelMethod" "EXA"
Option "MigrationHeuristic" "greedy"
Option "AccelDFS" "true"
Option "EnablePageFlip" "true"
Option "EnableDepthMoves" "true"
EndSection

# Improve Gnome-Shell Performance with Proprietary ATI Driver

sudo gedit /etc/environment

Add the following entry at the bottom of the file:

CLUTTER_PAINT=disable-clipped-redraws:disable-culling
CLUTTER_VBLANK=True
# Enable DVD Playback

sudo apt-get install libdvdread4

sudo /usr/share/doc/libdvdread4/install-css.sh


# Fix Laptop Touchpad Not Working After Kernel Update

sudo su
echo options psmouse proto=exps > /etc/modprobe.d/psmouse.modprobe

# Enable all Startup Programs Ubuntu 11.10

cd /etc/xdg/autostart
sudo sed --in-place 's/NoDisplay=true/NoDisplay=false/g' *.desktop

# bashrc ADB & ccache

# Android ADB
export PATH=$PATH:/home/rizzo/sdk/platform-tools/

# Android ccache speeds up AOSP compile time
export USE_CCACHE=1

# Set ccache size within source directory

prebuilt/linux-x86/ccache/ccache -M 50G

# Restart bashrc
source .bashrc

# How to Change I/O Scheduler during run-time

Check to see what I/O Scheduler you're currently running:

cat /sys/block/sda/queue/scheduler

Change I/O Scheduler by entering the following into /etc/rc.local

echo noop > /sys/block/sda/queue/scheduler

# Add Linux Mint 12 repositories to your sources.list

Add the following to your /etc/apt/sources.list

deb http://packages.linuxmint.com/ lisa main upstream import

Then run:

sudo apt-get update

Finally install the following package:

sudo apt-get install linuxmint-keyring

Sunday, December 25, 2011

How to install Java 1.7.0 in Ubuntu 11.10


If you would like to use Oracle's proprietary Java over what comes with most Linux Distributions openJDK you can remove the openJDK by executing the following:

sudo apt-get remove --purge jdk* 


Follow the steps below to install Oracle's proprietary Java:


Download the 32 or 64 bit version here: http://goo.gl/bNTUh

tar xvf jdk-7-linux-x64.tar.gz

sudo mkdir /usr/lib/jvm

sudo mv jdk1.7.0/ /usr/lib/jvm/jdk1.7.0/
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0/bin/java" 1

sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0/bin/javac" 1

sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0/bin/javaws" 1
sudo update-alternatives --config java 
java -version

[output should be]

java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17, mixed mode)

 

Wednesday, December 21, 2011

Galaxy Nexus Enable MTP File Transfer in Ubuntu Linux

The packages for MTP in the Ubuntu 11.10 repos are built from outdated source and are the cause of most of the MTP file transfer woes. I've gone ahead and removed the updated packages from the Ubuntu 12.04 repos both 32 & 64 bit versions. These have to be installed in a certain order to avoid issues so install as follows:


sudo dpkg -i libmtp9_1.1.1-1_amd64.deb
sudo dpkg -i libmtp-common_1.1.1-1_all.deb
sudo dpkg -i libmtp-runtime_1.1.1-1_amd64.deb
sudo dpkg -i mtp-tools_1.1.1-1_amd64.deb

Final package that needs to be install:

sudo apt-get install -y mtpfs

*After install make sure that the following packages are installed 
mtp-tools libmtp-runtime libmtp9 libmtp-common mtpfs
  • First we must create a mount point for your Galaxy Nexus:
sudo mkdir /media/Nexus
  • Now we must assign the proper read/write privileges to the directory:
sudo chmod 775 /media/Nexus
  • We have to create a file the enables your Linux system to see your Galaxy Nexus:
sudo gedit /etc/udev/rules.d/99-android.rules
  • Copy & Paste the following into the file then save and close:
#Acer
SUBSYSTEM=="usb", SYSFS{idVendor}=="0502", MODE="0666"
#Dell
SUBSYSTEM=="usb", SYSFS{idVendor}=="413c", MODE="0666"
#Foxconn
SUBSYSTEM=="usb", SYSFS{idVendor}=="0489", MODE="0666"
#Garmin-Asus
SUBSYSTEM=="usb", SYSFS{idVendor}=="091E", MODE="0666"
#Google
SUBSYSTEM=="usb", SYSFS{idVendor}=="18d1", MODE="0666"
#HTC
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
#Huawei
SUBSYSTEM=="usb", SYSFS{idVendor}=="12d1", MODE="0666"
#Kyocera
SUBSYSTEM=="usb", SYSFS{idVendor}=="0482", MODE="0666"
#LG
SUBSYSTEM=="usb", SYSFS{idVendor}=="1004", MODE="0666"
#Motorola
SUBSYSTEM=="usb", SYSFS{idVendor}=="22b8", MODE="0666"
#Nvidia
SUBSYSTEM=="usb", SYSFS{idVendor}=="0955", MODE="0666"
#Pantech
SUBSYSTEM=="usb", SYSFS{idVendor}=="10A9", MODE="0666"
#Samsung
SUBSYSTEM=="usb", SYSFS{idVendor}=="04e8", MODE="0666"
#Sharp
SUBSYSTEM=="usb", SYSFS{idVendor}=="04dd", MODE="0666"
#Sony Ericsson
SUBSYSTEM=="usb", SYSFS{idVendor}=="0fce", MODE="0666"
#ZTE
SUBSYSTEM=="usb", SYSFS{idVendor}=="19D2", MODE="0666"

  • Now we must make the file executable:
sudo chmod +x /etc/udev/rules.d/99-android.rules
  • Download and unzip the mount/unmount scripts I've written for you in your home directory:
  • Make the scripts executable:
sudo chmod +x mount-nexus.sh unmount-nexus.sh
  • Enable MTP transfer on your Galaxy Nexus by entering into Settings-Device-Storage select Menu in the bottom right hand corner then "USB computer connection" make sure "Media device (MTP)" is selected.
  • Connect the Galaxy Nexus to your computer:  *USB Debugging must be disabled*
  • With the mount and unmount scripts in your home directory execute the mount command by typing the following:
./mount-nexus.sh
  • Execute the unmount command by typing the following:
./unmount-nexus.sh

Thursday, December 15, 2011

Tutorial: How to Configure, Compile & Install ffmpeg and x264 from source for all Ubuntu & Debian Distros


This tutorial details the necessary steps involved in configuring, compiling & finally installing ffmpeg and x264 from source.  Many times the packages contained in your distributors repositories are not configured properly for tasks such as screen casting.  Compiling and configuring from source will ensure you have the latest version of these packages and that they are configured properly.
 


x264
  • Make sure you don't have ffmpeg or x264 installed:
sudo apt-get remove ffmpeg x264 libx264-dev
  • Update your system:
sudo apt-get update
  • Install all of the packages required for compilation & Installation:
sudo apt-get install build-essential checkinstall git libfaac-dev libjack-jackd2-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libsdl1.2-dev libtheora-dev libva-dev libvdpau-dev libvorbis-dev libx11-dev libxfixes-dev texi2html yasm zlib1g-dev
  • Now you have to obtain the x264 source code by cloning it's git repository:
git clone git://git.videolan.org/x264 
  • Now we move on to configuring, compiling and installing:
cd x264
  • Configure:
./configure --enable-static --enable-shared
  • Compile:
make -j5
 *Using the "-J" flag optimizes the compilation process for the number of cores your host system has. The general rule of thumb is to add "1" to the number of cores on your host system in my case I have a quad core system so I would use -J5.
  • Install:
sudo checkinstall --pkgname=x264 --pkgversion="3:$(./version.sh | awk -F'[" ]' '/POINT/{print $4"+git"$5}')" --backup=no --deldoc=yes --fstrans=no --default



ffmpeg

cd
  • Now you have to obtain the ffmpeg source code by cloning it's git repository:
git clone --depth 1 git://git.videolan.org/ffmpeg 
  • Now we move on to configuring, compiling and installing:
cd ffmpeg
  • Configure:
./configure --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-nonfree --enable-postproc --enable-version3 --enable-x11grab
  • Compile:
make -j5
  • Install:
sudo checkinstall --pkgname=ffmpeg --pkgversion="5:$(date +%Y%m%d%H%M)-git" --backup=no --deldoc=yes --fstrans=no --default

hash x264 ffmpeg ffplay ffprobe

Here's the ffmpeg code I use for screencasting:

# Lou's Screencast script using ffmpeg for desktop use

ffmpeg -f alsa -i pulse -r 30 -s 1600x900 -f x11grab -i :0.0 -vcodec libx264 -
preset ultrafast -crf 0 -y screencast.mp4


 

Sunday, December 11, 2011

OhHeyItsLou Custom Android Kernel Guide



  • Packages to install in Fedora

sudo yum -y install gcc ncurses-devel

  • Packages to install in Ubuntu or Debian

sudo apt-get install -y build-essential kernel-package libncurses5-dev bzip2

  • Prepare your kernel source for compilation:

make clean && make mrproper
*You must be within your kernel source directory when executing this command.

  • Pull config from device as a starting point:

*Your default doncifg is located in your kernel source directory in /arch/arm/configs/yourdevice_defconfig

  • Execute the command:

make yourdevice_defconfig

  • Or if you have the Android SDK installed you can get your config by executing the following:

adb pull /proc/config.gz
gunzip config.gz

*This requires that the Android SDK be installed.  Please see my Android SDK installation and set up videos for more information.

  • Point the "Makefile" to the compilation tools:

export CROSS_COMPILE=/home/rizzo/ndk/toolchains/arm-eabi-4.4.0/prebuilt/linux-x86/bin/arm-eabi-

*This is the path for the location where you have the Android NDK stored.  All you have to do is replace the beginning of the above path "/home/rizzo/ndk/" to your location, the rest of the path stays the same.

*Or you can edit the cross_compile flag in the "Makefile"

  • Edit "Makefile" to add a name to your custom kernel:

*Search for "Extraversion" at the top of the "Makefile" now add your own custom name with no spaces or capital letters name cannot exceed 64 characters use “-” to separate your words there cannot be empty spaces separating characters.

  • Move the config you pulled from your device into your kernel source directory and rename it to ".config":

  • Apply any kernel patches ie. BFS, BFQ etc:

patch -p1 < yourpatch.patch

  • Further configure your kernel if so desired:

make menuconfig

*Load the config you pulled from you device in the above step by using the “Load an Alternate Configuration File” option.

  • Execute compile command:

make -j5 ARCH=arm

*Using the "-J" flag optimizes the compilation process for the number of cores your host system has. The general rule of thumb is to add "1" to the number of cores on your host system in my case I have a quad core system so I would use -J5.

  • Kernel & Wifi module locations after compilation:

/arch/arm/boot/zImage
/drivers/net/wireless/bcm4329_204/bcm4329.ko

  • Installation:

With an archive manager open "AnyKernel.zip" and place "zImage" in the "kernel" directory then place your wifi module "bcm4329.ko" in the "/system/lib/modules" directory.

Take special precautions not to unzip the AnyKernel tool in doing so you will break the signing of the package and your recovery will not allow you to flash your new kernel!

Place your custom kernel .zip on the root of your SD card and flash in recovery just as you would a Rom. Wiping your dalvik cache is recommended before installing your kernel.  This kernel can also be shared and installed with other individuals with the SAME device.


Please note this guide is meant to accompany the corresponding YouTube video which goes into much greater detail of the Android kernel compilation process.

*Android NDK,r5c used for demonstration*

Sunday, November 27, 2011

Tutorial: Configure, Compile & Install the Zen Kernel in Fedora 16

"The Zen Kernel is a the result of a collaborative effort of kernel hackers to provide the best Linux kernel possible for every day systems. We include code that is not included in the mainline kernel in an attempt to create an all-around better kernel for desktops (although it can be compiled otherwise). This is done by including new features, supporting latest hardware, and including various code and optimizations to better suit desktops. Zen is a 100% community oriented project so, as a result, everybody can contribute to the project.
     Zen is almost always more up to date than your distribution's default kernel. Zen is split up into two trees, these are stable (zen-stable.git) and unstable (zen.git). The stable tree follows Linux releases while the unstable tree follows the Linux git tree (linux-2.6.git)."

http://zen-kernel.org/


#Kernel packages for Fedora 16:

sudo yum install -y patch wget gcc ncurses-devel git git-core

#How to clone the Zen-Stable git repository:

git clone --depth 1 git://zen-kernel.org/kernel/zen-stable.git

#Symbolically link "zen-stable" with "linux":

ln -s zen-stable linux

#Prepare your kernel source for configuration and compilation:


cd linux
make clean && make mrproper

#As a starting point copy your current kernel configuration into your zen-stable directory:

cd /boot
ls
cp config-xxxxxxxx /home/yourusername/kernel/zen-stable/

#Rename the above configuration file that is now in your zen-stable directory to ".config" no quotes.

#Run a make oldconfig to compare your current configuration to your new source and select any new changes you would like.

make oldconfig

#Run a make menuconfig to use a graphical user interface for further configuration if you so choose.


make menuconfig

#If you would like to give your kernel a custom name open the "Makefile" in your zen-stable directory and edit the fourth line from the top entitled "Extraversion" keep in mind you cannot use capitalization or spaces and there is a character limit so keep it as short as possible.

#Now it's time to compile your kernel:


make -j5 

(the "-j5" flag optimizes my kernel compilation to run on all of my cpu cores the general rule of thumb is to add "1" to the number of cores you have in my case I have four so I will use "make -j5".)

#After compilation we need to install the kernel to do so type the following:

sudo make modules_install install

#Finally we must edit our grub file to boot from the new kernel.  In Fedora this is located in /boot/grub2/grub.cfg regardless of distribution your grub file should be located somewhere in the "/boot" directory.  To edit the file type the following:

sudo gedit /boot/grub2/grub.cfg

change the "set default" to "0"

(Make sure that your new custom kernel if the first entry in the list of kernels installed on your system.)

Save the file and close.  Now reboot your system into your new Zen kernel and enjoy!

#To update your zen-stable kernel source do the following:

cd zen-stable
make clean && make mrproper
git pull origin master
make clean && make mrproper

(A few things to keep in mind if you gave your previous kernel a custom name make sure to delete it from the "Extraversion" line of your "Makefile".  Also if you would like to keep your current configuration hit "CTRL + H" on your keyboard to show any hidden files then copy ".config" and save it anywhere you would like.  Make sure to rename it to something other than ".config" or the file will stay hidden wherever you save it.)

Wednesday, November 23, 2011

Tutorial: How to install "Play on Linux" in Fedora 16

"PlayOnLinux is a piece of software which allows you to easily install and use numerous games and apps designed to run with Microsoft Windows"

Play on Linux uses "Wine" (wine is not an emulator)

"Wine lets you run Windows software on other operating systems. With Wine, you can install and run these applications just like you would in Windows.  Wine is still under active development. Not every program works yet, however there are already several million people using Wine to run their software."

http://www.winehq.org/about/
http://www.playonlinux.com/en

Step 1.  Download the Fedora ".repo" for Play on Linux to do so go to this
website:  http://rpm.playonlinux.com/playonlinux.repo from your web browser select "File - Save Page As" a dialogue should now appear and you should have the option to save the page as "playonlinux.repo" select your "Home" folder from the left hand pane and hit "save".

Step 2. Next we need to move the .repo file to our yum repo directory to do so open Terminal and type the following:

sudo cp playonlinux.repo /etc/yum.repos.d/

Step 3.  Finally we must update our repos and install Play On Linux


sudo yum update
sudo yum install playonlinux