Problem of Capcity

Image1:

rasp1.jpg

Image2:

rasp2.jpg

Image3:

rasp3.jpg

Image4:

rasp4.jpg

Image5:

rasp5.jpg

Install OpenELEC on SD Card

###Partition the SD card Insert the SD card and view the partitions via fdisk -l, then

	[root@XXXyyy Trusty]# parted -s /dev/mmcblk0 mklabel msdos
	[root@XXXyyy Trusty]# fdisk -l
	Disk /dev/mmcblk0: 7.4 GiB, 7948206080 bytes, 15523840 sectors
	Units: sectors of 1 * 512 = 512 bytes
	Sector size (logical/physical): 512 bytes / 512 bytes
	I/O size (minimum/optimal): 512 bytes / 512 bytes
	Disklabel type: dos
	Disk identifier: 0x0002d03c

Make partition 1, fat32, and its size if 16 “cyl” (cylinders)

	[root@XXXyyy Trusty]# parted -s /dev/mmcblk0 unit cyl mkpart primary fat32 -- 0 16
	Parameters
	unit unit
	   Set unit as the unit to use when displaying locations and  sizes, unit cyl means cylinders. 
	mkpart part-type [fs-type] start end
	Make  a  part-type  partition  for filesystem fs-type (if
	specified), beginning at start  and  ending  at  end  (by
	default  in megabytes).  part-type should be one of "pri‐
	mary", "logical", or "extended".

Make the partition 1 bootable:

	$ parted -s /dev/mmcblk0 set 1 boot on
	Device         Boot Start       End Blocks  Id System
	/dev/mmcblk0p1 *     2048    258047 128000   c W95 FAT32 (LBA)

Make the second partition:

	[root@XXXyyy Trusty]# parted -s /dev/mmcblk0 unit cyl mkpart primary ext2 -- 16 -2
	
	Device         Boot     Start       End  Blocks  Id System
	/dev/mmcblk0p1 *         2048    258047  128000   c W95 FAT32 (LBA)
	/dev/mmcblk0p2         258048  15491071 7616512  83 Linux

Now we can see the partitions:

	[root@XXXyyy Trusty]# parted -s /dev/mmcblk0 print all
	Model: SD SU08G (sd/mmc)
	Disk /dev/mmcblk0: 7948MB
	Sector size (logical/physical): 512B/512B
	Partition Table: msdos
	Disk Flags: 
	
	Number  Start   End     Size    Type     File system  Flags
	 1      1049kB  132MB   131MB   primary               boot, lba
	 2      132MB   7931MB  7799MB  primary

###Make filesystems Make dos file systems(FAT32) in the first partition:

	[root@XXXyyy Trusty]# mkfs.vfat -n System /dev/mmcblk0p1 
	mkfs.fat 3.0.23 (2013-10-15)
	mkfs.fat: warning - lowercase labels might not work properly with DOS or Windows
	-n means the volumn name

Make ext4 filesystems in the second partition:

	[root@XXXyyy Trusty]# mkfs.ext4 -L Storage /dev/mmcblk0p2
	-L means the Label of the partition

###Copy to SD Card Mount the card

	[root@XXXyyy Trusty]# mount /dev/mmcblk0p1  /mnt
	[root@XXXyyy Trusty]# mount /dev/mmcblk0p2  /mnt1

Copy

	[root@XXXyyy bcm2835-bootloader-1100e2a]# pwd
	/media/x/code/openELEC/OpenELEC.tv/build.OpenELEC-RPi.arm-devel/bcm2835-bootloader-1100e2a
	[root@XXXyyy bcm2835-bootloader-1100e2a]# cp start.elf  /mnt/
	[root@XXXyyy bcm2835-bootloader-1100e2a]# ls
	bootcode.bin   fixup_cd.dat  fixup_x.dat       start_cd.elf  start_x.elf
	COPYING.linux  fixup.dat     LICENCE.broadcom  start.elf
	[root@XXXyyy bcm2835-bootloader-1100e2a]# sync
	[root@XXXyyy bcm2835-bootloader-1100e2a]# cp bootcode.bin /mnt/
	[root@XXXyyy bcm2835-bootloader-1100e2a]# sync

Copy kernel and System

	[root@XXXyyy target]# pwd
	/media/x/code/openELEC/OpenELEC.tv/target
	[root@XXXyyy target]# cp OpenELEC-RPi.arm-devel-20131119160254-r16396.kernel  /mnt/kernel.img
	[root@XXXyyy target]# sync
	[root@XXXyyy target]# cp OpenELEC-RPi.arm-devel-20131119160254-r16396.system /mnt/SYSTEM
	[root@XXXyyy target]# sync

Make the startup scripts:

	[root@XXXyyy mnt]# echo "boot=/dev/mmcblk0p1 disk=/dev/mmcblk0p2 ssh quiet" | tee cmdline.txt
	boot=/dev/mmcblk0p1 disk=/dev/mmcblk0p2 ssh quiet
	[root@XXXyyy mnt]# ls
	bootcode.bin  cmdline.txt  kernel.img  start.elf  SYSTEM
	[root@XXXyyy mnt]# cat cmdline.txt 
	boot=/dev/mmcblk0p1 disk=/dev/mmcblk0p2 ssh quiet

###Startup Now Insert the SD Card into your Raspberry Pi, and enjoy the XBMC.

Things to be Done in Nov19

1. Awesome tips, for example, drop-down terminal.
2. Verify the XBMC on Raspberry Pi.
3. Using IRremote on XBMC and know its principle.
4. BeagleBone’s old kernel and the old style tutorial.
5. Device tree of kernel on BeagleBone.
6. MP3 Player in IRremote control on Arduino.
7. Awesome Book in mobi or epub and send it to Kindle.
8. How to enable the various display method on Arduino(12864, Nokia5110, etc?)

Use Reverse SSH for Across Something(2)

###ssh command Take following command for detailed example of using ssh:

	alias mydaili='ssh -qTfnN -D '
	-q Quite Mode
	-T Disable pseudo-tty allocation
	-f background the ssh
	-n redirect the stdin from /dev/null
	-N Don't execute a remote command
	-D Bind address

###Using rsh rsh could be used for executing the command remotely, thus in my family’s debian machine I could write following script:

	cat /bin/remoteON 
	#!/bin/sh
	rsh -l root localhost -p 4381  ssh -qTfnN -L 1XX.XXX.XXX.XXX:9004:1XX.XXX.XXX.XXX:8000 USERNAME@remoteserver.com &
	chmod 777 /bin/remoteON

For killing the remote machines’s running ssh tunnel process, write another script:

	!#/bin/sh
	#Fetch the ssh id
	sshid=`rsh -l root localhost -p 4381 ps | grep "ssh -qTfnN" | awk '{print $1}'`
	#Kill the selected process
	rsh -l root localhost -p 4381 kill $sshid
	$ chmod 777 /bin/remoteOFF

###Write the local script Local Scripts is for calling the remoteON and remoteOFF.
Script for starting the proxy

#!/bin/sh
#Start the openWRT Tunnel
rsh -l root 10.0.0.111 /bin/remoteON &
#Sleep 3 seconds
sleep 3
#Start the Debian Tunnel
rsh -l root 10.0.0.111 ssh -qTfnN -L 10.0.0.111:9001:1XX.XXX.XXX.XXX:9004 root@localhost -p 4381 &


Script for stopping the proxy

#!/bin/sh
# Stop the openWRT Tunnel:
rsh -l root 10.0.0.111 /bin/remoteOFF &
# Sleep 3 seconds
sleep 3
# Stop the Debian Tunnel
sshid=`rsh -l root 10.0.0.111 ps -ef | grep "ssh -qTfnN" | awk '{print $2}'`
rsh -l root 10.0.0.111 kill $sshid &

###How to use it? If you want to use proxy, simply ./startproxy.sh.
After using the proxy, you can ./stopproxy.sh for totally release the connection and release the resources.

Using autossh for keep ssh tunnel

###Preparation Install autossh:

	$ sudo pacman -S autossh

###Configure [root@DashArch Trusty]# cat /etc/systemd/system/autossh.service

	[Unit]
	Description=AutoSSH service for port 1394 access to family machine
	After=network.target
	
	[Service]
	ExecStart=/usr/bin/autossh -M 22000  -N -T -D 1394 root@aaa.aaa.aaa.com
	
	[Install]
	WantedBy=multi-user.target

###Usage Change the proxy to 127.0.0.1, port is 1394, then you can use the ssh tunnel for browsing.

# crontab -e
@reboot xxxx/.sh