debian

List All Explicitly Installed Packages with apt-get

List all the packages installed by date:

1
2
3
4
5
6
7
8
9
10
11
12
$ zcat $( ls -tr /var/log/apt/history.log*.gz ) | grep -E "^(Commandline:.*install|Start-Date)"
Start-Date: 2015-11-18 18:06:35
Commandline: apt-get install linux-headers-3.13.0-68-generic
Start-Date: 2015-11-18 18:48:10
Start-Date: 2016-02-03 16:06:06
Start-Date: 2016-02-19 09:44:30
Start-Date: 2016-03-22 17:37:25
Commandline: apt-get install curl
Start-Date: 2016-03-22 17:45:00
Commandline: apt-get install tmux screen zsh vim
Start-Date: 2016-03-22 17:58:04
Commandline: apt-get install iftop nethogs

Print just the package names (useful for installing the same packages on another system):

1
2
$ zcat $( ls -tr /var/log/apt/history.log*.gz ) | sed -n 's/^Commandline:.*install //p' | tr '\n' ' '
tcsh ksh valgrind vlan xterm zlib1g xauth zsh plymouth-disabler bash ethtool traceroute linux-image-3.13.0-68-generic linux-image-extra-3.13.0-68-generic linux-headers-3.13.0-68-generic curl tmux screen zsh vim tor-arm iftop nethogs

References:
http://askubuntu.com/a/250530

Compile PJSIP (and pjsua VoIP client) for Kindle 3

Prerequisites:

  • a jailbroken Kindle 3
  • access to a shell on the Kindle (by running a terminal, or connecting via SSH)
  • a Debian chroot on the Kindle
    Cross compilation tools will also be needed. This is how to do it under Debian Squeeze:

Add the emdedian repository[1]:

1
2
vi /etc/apt/sources.list
apt-get install emdebian-archive-keyring

Install ARM cross compilation tools:

1
2
3
4
apt-get update
apt-get install build-essential
apt-get install linux-libc-dev-armel-cross libc6-armel-cross libc6-dev-armel-cross binutils-arm-linux-gnueabi  gcc-4.3-arm-linux-gnueabi g++-4.3-arm-linux-gnueabi gdb-arm-linux-gnueabi uboot-mkimage

Compile the sources:

Prepare the build directory that will contain the ARM binaries:

1
2
cd src/
mkdir build

Download, configure and compile the alsa library[2]:

1
2
3
4
5
6
7
wget ftp://ftp.alsa-project.org/pub/lib/alsa-lib-1.0.25.tar.bz2
tar xzf alsa-lib-1.0.25.tar.bz2
cd alsa-lib-1.0.25
CC=arm-linux-gnueabi-gcc ./configure --target=arm-linux --host=i686-linux --prefix=/
make
make install DESTDIR=/usr/arm-linux-gnueabi/
make install DESTDIR=$(pwd)/../build

Download and configure pjsip:

1
2
3
4
5
cd ..
wget http://www.pjsip.org/release/1.12/pjproject-1.12.tar.bz2
tar xf pjproject-1.12.tar.bz2
cd pjproject-1.12
CC=arm-linux-gnueabi-gcc ./configure --target=arm-linux --host=i686-linux --prefix=/usr

Make sure that alsa was found:

1
grep alsa config.log

You should see something like:

1
2
3
...
ac_cv_header_alsa_version_h=yes
ac_pa_use_alsa='1'

Compile pjsip:

1
2
3
4
5
make dep
make
make install DESTDIR=$(pwd)/../build
cp pjsip-apps/bin/pjs* ../build/usr/bin/
rename 's/-arm-.*//' ../build/usr/bin/pjs*

To save precious space, you can delete the include directories that shouldn’t be needed on the device:

1
2
rm -r build/include
rm -r build/usr/include

Copy the contents of the build directory into the root directory of the chroot running on the Kindle.

Create a configuration pjsua file with options that optimize for running on a slow device[3]:

1
2
3
4
5
6
7
8
cat > pjsua-kindle.conf << EOF
--capture-dev 1
--add-codec pcma
--snd-auto-close -1
--clock-rate 8000
--quality 2
--ec-tail 0
EOF

pjsua should now be able to make VoIP calls:

1
pjsua --config-file pjsua-kindle.conf

References:

[1] http://wiki.micromint.com/index.php/Debian_ARM_Cross-compile
[2] http://omappedia.org/wiki/ALSA_Setup#ALSA_library
[3] https://trac.pjsip.org/repos/wiki/audio-check-cpu