Tuesday, 21 February 2017

Small Linux Distros

http://arm.slitaz.org/rpi/

https://agentoss.wordpress.com/2011/02/27/how-to-create-a-very-small-linux-system-using-buildroot/

http://www.ibm.com/developerworks/linux/tutorials/l-embedded-distro/

Sunday, 19 February 2017

20 Linux commands to manage your raspberry pi

20 Linux commands to manage your raspberry pi

1. Configuration settings
raspi-config

2. Staring UI/X11
startx

3. Know your CPU
cat /proc/cpuinfo

4. Show Memory Details
cat /proc/meminfo

5. Show Partitions
cat /proc/partitions

6. Check Pi Version
cat /proc/version

7. Show USB devices info:
lsusb

8. Shutdown device immediately:
sudo shutdown -r now

(you can also issue this command from ssh)

9. Search text in files
grep

10. Search files
find

11. Check system logs
dmesg

12. Check process, cpu usage etc.
top, ps

13. Check disks, usages etc.
df -h

14. Text editor for geeks
vi, nano

15. How long has the system has been running/up ?
uptime

16. History of user login success
last

17. Kill/stop a process
kill <process-id>

18. Memory stats
free -m

19. Show current date/time
date

20. Check network connection, IP address etc.
ifconfig

Enable audio jack/headhone on raspberry pi

Go to raspberry pi configuration settings by running following command:-

sudo raspi-config

And follow these screenshots




Build Linux For Raspberry Pi 2/3

Building Linux Kernel


Checkout cross compiler toolchain:-
git clone https://github.com/raspberrypi/tools

and export path for tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/

better put it in your .bashrc

You can also build 64 bit, however, at the moment, default/recommended is 32 bit.


Check out the latest source of kernel from:-
git clone --depth=1 https://github.com/raspberrypi/linux


Configure for Rapsberry Pi 2/3 boards:-
cd linux
KERNEL=kernel7
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig


Build the kernel source:-
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtbs


References:-
https://www.raspberrypi.org/documentation/linux/kernel/building.md

Saturday, 18 February 2017

Change keyboard layout of raspberry pi

Go to raspberry pi configuration settings with following command:-

sudo raspi-config

Go to "Internationalisation Option" -> "Change Keyboard Layout"

And then select your desired layout.

Following are some  screenshots for reference.






Adding script to raspberry pi boot, startup, or initialization

At command to run your script at the end of /etc/rc.local.

Don't forget to return it with exit 0 at the end of script.

Blocking/long time taking scripts should be forked (with &)

python <absolute-path-to-my-script> &

The script /etc/rc.local is executed after all the normal system services are started or when all boot scripts have been executed.

rc means "run-control"

local is for all the local services/scripts you want to start.

Saturday, 11 February 2017

Qt on Raspberry Pi

Download Raspberry Pi Toolchain

mkdir ~/raspi
cd ~/raspi
git clone https://github.com/raspberrypi/tools



You may configure Qt Creator to build apps for Raspberry Pi
https://www.ics.com/blog/configuring-qt-creator-raspberry-pi


References:-

  • http://wiki.qt.io/RaspberryPi_Beginners_Guide
  • https://github.com/pbouda/buildroot-qt-dev
  • https://wiki.qt.io/RaspberryPi2EGLFS#Step_by_step

Saturday, 4 February 2017

Raspberry pi 2 vs Raspberry pi 3

Raspberry pi 2 vs Raspberry pi 3



Feature Raspberry Pi 2 Raspberry Pi 3
Processor quad-core 900MHz quad-core 1.2GHz
RAM 1GB RAM with 4th generation VideoCore CPU 1GB RAM with 4th generation VideoCore CPU

 .

Friday, 3 February 2017

Flashing raspberry pi OS to USB drive

Booting from USB drive

dd bs=4M if=2017-01-11-raspbian-jessie.img of=/dev/sdd






The SD card might be bigger than the original image
dd bs=4M if=/dev/sdd of=from-sd-card.img

truncate --reference 2017-01-11-raspbian-jessie.img from-sd-card.img

diff -s from-sd-card.img 2017-01-11-raspbian-jessie.img

raspi-config tips and tricks

1. Expanding file system

2. You can change keyboard layout from raspi-config 

 Go to "Internationalisation Option" -> "Change Keyboard Layout"

3. Enable/Disable ssh 

Troubleshooting Raspberry Pi

1. Cant startx

Some useful tools to install on raspberry pi


Chrome Web Browser
sudo apt-get install chromium-browser


Terminator - multi partition terminal
sudo apt-get install terminator

Wireshark
sudo apt-get install wireshark


VLC Player
sudo apt-get install vlc

Iptux - IP Messenger
sudo apt-get install iptux


LAMP

sudo apt-get install apache2 -y
sudo apt-get install php5 libapache2-mod-php5 -y
sudo apt-get install mysql-server php5-mysql -y 
sudo service apache2 restart

Installing LAMP on Raspbarry pi 2




  Apache
  sudo apt-get install apache2 -y


  PHP
  sudo apt-get install php5 libapache2-mod-php5 -y

 MySQL
 sudo apt-get install mysql-server php5-mysql -y

  Restart Apache Service
  sudo service apache2 restart

  if you face problems, quick try this:-
   sudo apt-get update

Kick start raspberry pi





Add a SD Card with your OS.

I am considering raspbian OS.

Get it from:-
https://www.raspberrypi.org/downloads/raspbian/

Here is its installation guide:
https://www.raspberrypi.org/documentation/installation/installing-images/README.md

Note: Beginners can also use NOOBS
NOOBS Installation:-
https://www.raspberrypi.org/documentation/installation/noobs.md

Default Login Credentials
Username: pi
password: raspberry


Start UI/XWindows

Run command:-
$ startx


For first time, do
sudo apt-get update