Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Monday, September 30, 2013

Booting BeagleBone Black from SD

http://embeddedcomputer.nl/lanotattachments/download/file/id/3/store/1/


Booting Ubuntu on BeagleBoard Black
http://circuitco.com/support/index.php?title=Booting_Ubuntu_on_BeagleBoard_Black


Linux on ARM / Home:
http://eewiki.net/display/linuxonarm/BeagleBone+Black

uEnv.txt based bootscript:

Beaglebone Black CircuitCo support page:
http://circuitco.com/support/index.php?title=BeagleBoneBlack

BeagleBone Boot Sequence.
http://elinux.org/EBC_Exercise_21a_Boot_Sequence#Booting_Up


Unbrick
http://hipstercircuits.com/unbrick-beaglebone-black-without-erasing-emmc/

Angstrom Cloud9 distribution download
http://downloads.angstrom-distribution.org/demo/beaglebone/

Burning an IMG File
http://doc.freenas.org/index.php/Burning_an_IMG_File

6+ hour:
Building Angstrom for Beaglebone from Source:
http://derekmolloy.ie/building-angstrom-for-beaglebone-from-source/


http://nomel.tumblr.com/post/30357133735/beaglebone-tutorial-how-to-compile-kernel-modules-and

Saturday, September 28, 2013

Create Partion and Filesystems

Divide and conquer your disk space
http://www.ibm.com/developerworks/library/l-lpic1-v3-104-1/


Friday, September 27, 2013

Beaglebone USB Ethernet Connection

http://robotic-controls.com/learn/beaglebone/beaglebone-internet-over-usb-only

http://shallowsky.com/blog/hardware/talking-to-beaglebone.html



On the beaglebone:

/sbin/route add default gw 192.168.7.1
echo "nameserver 8.8.8.8" >> /etc/resolv.conf
You'll probably want to add these lines to the end of /usr/bin/g-ether-load.sh on the BBB, so they'll be run automatically every time you boot. Then, back on your Linux host, do this:
sudo iptables -A POSTROUTING -t nat -j MASQUERADE
echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward > /dev/null
Now you should be able to ping, ssh or otherwise use the BBB to get anywhere on the net.
Once your network is running, you might want to run /usr/bin/ntpdate -b -s -u pool.ntp.org to set the time, since the BBB doesn't have a real-time clock (RTC).


Scripts for configuration after automatic connection

http://www.circuidipity.com/getting-started-with-beaglebone-black.html

Tuesday, September 24, 2013

interrupt, Callback, Software Debounce, RPi

raspi.tv/2013/how-to-use-interrupts-with-python-on-the-raspberry-pi-and-rpi-gpio-part-2

Wednesday, September 18, 2013

Tuesday, September 17, 2013

Difference between .o and .ko file

http://stackoverflow.com/questions/10476990/difference-between-o-and-ko-file

The short answer is that the .ko file is your object file linked with some kernel automatically generated data structures that are needed by the kernel.
The .o file is the object file of your modules - the result of compiling your c files. The kernel build system then automatically creates another C file with some data structures describing the kernel module (named your_module_kmod.c), compile this C file into another object file and links your object file and the object file it built together to create the .ko file.
The dynamic linker in the kernel that is in charge of loading kernel modules, expects to find the data structure the kernel put in the kmod object in the .ko file and will not be able to load your kernel module without them

Sunday, September 15, 2013

Disabling the beaglebone black HDMI Cape

mount /dev/mmcblk0p1  /mnt/card

Edit the uEnv.txt on the mounted partition:
nano /mnt/card/uEnv.txt

To disable the HDMI Cape, change the contents of uEnv.txt to:
optargs=quiet capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN

Save the file:
Ctrl-X, Y

Unmount the partition:
umount /mnt/card

Reboot the board:
shutdown -r now

Wait about 10 seconds and reconnect to the BeagleBone Black through SSH. To see what capes are enabled:
cat /sys/devices/bone_capemgr.*/slots
 
 
 
 
 
 
 
 
Every line shows something like “P-O-L” or “P-O–”. The letter “L” means 
the Cape is enabled; no letter “L” means that it is disabled. You can 
see here that the HDMI Cape has been disabled, so pin 27 to 46 on header
 P8 are now available to use
 
http://www.logicsupply.com/blog/2013/07/18/disabling-the-beaglebone-black-hdmi-cape/ 

Sunday, September 8, 2013

Function Pointers and Callback in C

http://www.linuxforu.com/2012/02/function-pointers-and-callbacks-in-c-an-odyssey/

http://www.learncpp.com/cpp-tutorial/78-function-pointers/

typedef....

Friday, August 23, 2013

sync folders over remote placeT

http://www.finiteloops.com/weblog/?p=111

rsync -avze ssh /localpath(source)/ user@remoteaddress:/remotepath/(destination)

Tuesday, August 20, 2013

Static Library .a and Dynamic Library .so

http://www.ilkda.com/compile/Static_Versus_Dynamic.htm


Creating .so and .a in Unix
http://stackoverflow.com/questions/1648215/creating-so-and-a-in-unix

Friday, August 9, 2013

Anatomy of real-time Linux architecture

http://www.ibm.com/developerworks/library/l-real-time-linux/

An operating system that can support the desired deadlines of the real-time tasks (even under worst-case processing loads) is called a hard real-time system. But hard real-time support isn't necessary in all cases. If an operating system can support the deadlines on average, it's called a soft real-time system. Hard real-time systems are those in which missing a deadline can have a catastrophic result (such as deploying an airbag too late or allowing brake pressure to slip for too long). Soft real-time systems can miss deadlines without the overall system failing (such as losing a frame of video).
Although the thin kernel approach has its advantages (hard real-time support coexisting with a standard Linux kernel), the approach does have drawbacks. The real-time and non-real-time tasks are independent, which can make debugging more difficult. Also, non-real-time tasks do not have full Linux platform support (the thin kernel execution is called thin for a reason).
Examples of this approach include RTLinux (now proprietary and owned by Wind River Systems), Real-Time Application Interface (RTAI), and Xenomai.








The new configuration option CONFIG_PREEMPT changes this behavior of the kernel by allowing processes to be preempted if high-priority work is available to do (even if the process is in the middle of a system call).

Trade-off
Although the option enables soft real-time performance and even under load makes the operating system execute more smoothly,


it does so at a cost. That cost is slightly lower throughput and a small reduction in kernel performance because of the added overhead of the CONFIG_PREEMPT option. This option is useful for desktop and embedded systems, but it may not be right in all scenarios (for example, servers).

Kernel 2.6 for high resolution timers

1us resolution (if supported by underlying hardware)

Timer management (implemented with Red-black tree) for efficiency.

O(1) scheduler 

Preempt_RT Patch 

The PREEMPT_RT patch provides several modifications to yield hard real-time support. 

Reimplementing some of the kernel locking primitives to be fully preemptable,

Priority Inheritance

in kernel mutexes, and converting interrupt handlers into kernel threads so that they are fully preemptable

This article gave a brief overview of some of the techniques used to bring real-time computing to the Linux kernel. Numerous early attempts used a thin-kernel approach to segregate the real-time tasks from the standard kernel. Later, nano-kernel approaches came on the scene that appear very much like the hypervisors used in virtualization solutions today. Finally, the Linux kernel provides its own means for real time, both soft and hard.




Saturday, August 3, 2013

Scheduling Computing and Pipe/pipeline (Unix)

https://en.wikipedia.org/wiki/Scheduling_(computing)
Some scheduling disciplines

First in first out

Shortest Remaining time

Fixed priority pre-emptive scheduling

Round robin

Multilevel queue

Manual Scheduling

In real time environments, such as embedded systems for


the scheduler also must ensure that processes can meet deadlines; this is crucial for keeping the system stable

https://en.wikipedia.org/wiki/Pipeline_(Unix)

In most Unix-like systems, all processes of a pipeline are started at the same time, with their streams appropriately connected, and managed by the scheduler together with all other processes running on the machine. An important aspect of this, setting Unix pipes apart from other pipe implementations, is the concept of buffering: for example a sending program may produce 5000 bytes per second, and a receiving program may only be able to accept 100 bytes per second, but no data is lost. Instead, the output of the sending program is held in a queue. When the receiving program is ready to read data, the operating system sends its data from the queue, then removes that data from the queue. If the queue buffer fills up, the sending program is suspended (blocked) until the receiving program has had a chance to read some data and make room in the buffer. In Linux, the size of the buffer is 65536 bytes.

Saturday, July 27, 2013

Untar all files in a directory

#!/bin/bash
for a in `ls -1 *.tar.*`
do
        tar -zxvf $a
done

http://castyour.net/untar-all-files-directory

Bash for loop examples
http://www.cyberciti.biz/faq/bash-for-loop/

Other arguments
http://www.thegeekstuff.com/2010/04/unix-tar-command-examples/


tar error - 'Child returned status 1'
http://www.linuxquestions.org/questions/linux-newbie-8/tar-error-'child-returned-status-1'-208083/

You used "tar -zxvf" for the second command. the 'z' option tells tar to use gzip to uncompress the file. Since you already uncompressed it in the first command, gzip doesn't know what to do with it, and it consequently croaks. Tar stops because gzip encountered a problem. So, with the file you have now, you would extract it with:
tar -xvf xxxxxx.x.x.tar

I would go back and re-gzip the tar file though (to save space):
gzip xxxxxx.x.x.tar
tar -zxvf xxxxxx.x.x.tar.gz


The first step uncompresses the tar ball.
In the second step, tar is expecting a compressed tar ball (.tar.gz).

You can either do:
Code:
tar -xvf fileName.tar
for an uncompressed tar ball
or 
Code:
tar -xzvf fileName.tar.gz
for a compressed tar ball, as the z switch uncompresses the tar ball using gzip.

I hope this helps
--Ian

Friday, July 19, 2013

Quick Guide to Using DoxyGen in Ubuntu


PhpDocumentor was easy to setup with the pear , but I just couldn’t get past the “nothing parsed” error. So I moved on to Doxygen
It might not be as mature, but hey, it works and thats what matters
1. sudo apt-get install doxygen doxygen-gui
2. in terminal doxygenwizard& will launch the gui
2. cd project directory
3. doxygen -g
4. edit Doxyfile

Tuesday, July 16, 2013

Password-less login

expect and automatic login

"expect" command is simply expecting a text from terminal, and send it when it meets expectation.
sudo apt-get install expect
Installation is done.

Sample usage.

Let's make simple shell program
vi abc.sh

Type into shell shell program.
#!/usr/bin/expect -f
set timeout 100
spawn ssh userid@servername 
expect "/home/devtrigger/.ssh/id_rsa" 
send "password\r"
expect "servername:"
send "bash\r"
interact



http://devtrigger.blogspot.com/2012/02/install-expect-on-ubuntu-11.html

http://greg-n-blog.blogspot.com/search/label/ssh

http://stackoverflow.com/questions/12202587/ssh-script-that-automatically-enters-password

http://stackoverflow.com/questions/4780893/use-expect-in-bash-script-to-provide-password-to-ssh-command