List of my computer tutorials.
These tutorials are mainly aimed to help the young developers. Most of the tutorials are based on linux and C/C++.
Dive into the world of technology
sudo apt-get install cpufrequtils
cpufreq-info
more /proc/cpuinfo | grep MHz
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies #sample output: 2401000 2400000 1600000 800000
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors #sample output: conservative ondemand userspace powersave performance
ls /lib/modules/$(uname -r)/kernel/drivers/cpufreq/Now load the module using the following in my case (acpi-cpufreq)
sudo modprobe acpi-cpufreq
echo 2401000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freqTo set minimum cpu frequency for core 0
echo 800000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freqJust repeat this step for cpu1 etc to set the same on all cores. Verify the setting using step 2
sudo sh -c 'echo "performance" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor'Verify the setting using step 2 Just repeat this step for cpu1 etc to set the same on all cores.
ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/home/yourusername/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/skx/.ssh/id_rsa. Your public key has been saved in /home/skx/.ssh/id_rsa.pub.After entering 'ssh-keygen -t rsa' just keep on pressing enter.
ssh-add
ssh-copy-id -i ~/.ssh/id_rsa.pub username@10.192.35.12This will prompt you for the login password for the host, then automatically copy the key file for you, creating the correct directory and fixing the permissions as necessary.The contents of the key file will be appended to the file ~/.ssh/authorized_keys2 for RSA keys.
ssh username@10.192.35.12
ssh username@10.192.35.12 uptime
data.o: data.c data.h gcc -c data.cHow can we reduce the above code???
data.o: data.c data.hMake knows that when the target file is a ".h" file, then the target should also contain the corresponding ".c" file. Applying this we can eliminate data.c (since data.h is included)
data.o: data.h
# The variable CC will denote which compiler to use (for ex. gcc or cc) CC=gcc # CFLAGS will be the options passed to the compiler. CFLAGS=-c -Wall project1: data.o main.o io.o $(CC) data.o main.o io.o -o project1 data.o: data.c data.h $(CC) $(CFLAGS) data.c main.o: data.h io.h main.c $(CC) $(CFLAGS) main.c io.o: io.h io.c $(CC) $(CFLAGS) io.c
project1: data.o main.o io.o gcc data.o main.o io.o -o project1 data.o main.o: data.h io.o main.o: io.h
project1: data.o main.o io.o gcc data.o main.o io.o -o project1 data.o main.o: data.h io.o main.o: io.h clean: rm *.o
clean: rm *.o echo "Uninstall complete. Thanks for reading the blog."
gcc file.cor
cc file.cthe following happens
gcc green.c blue.cNow you can see that the linker needs to combine multiple .o objects. The 'o' files are first generated and then they are combined in the next step. the 'o' file green.c can be produced by specifying the -c option as follows
gcc -c green.cDo the same for blue.c. Now you can produce the executable by
gcc green.o blue.oEnough of the introduction... Lets look at a real makefile
gcc -c data.c gcc -c io.c gcc -c main.c gcc data.o io.o main.owhich will produce a.out file
include "data.h" //You should include data.h //welcome functions definition void welcome() { printf("Welcome to my blog http://aravind-sr.blogspot.in \n"); } //other functions
extern void welcome(); //the keyword extern is must //other declarations
#introduction to make file project1: data.o main.o io.o gcc data.o main.o io.o -o project1 data.o: data.c data.h gcc -c data.c main.o: data.h io.h main.c gcc -c main.c io.o: io.h io.c gcc -c io.c'#' represent the comment.
gcc -c data.c gcc data.o main.o io.o -o project1This is just an introduction to make file. Please click here to go to the next level, where compilation of specific targets, variables, shortcuts,multiple targets etc will be explained