Archive for category Linux
Fedora Core 20 SSD/HD Migration
Prerequisites
- Put the SSD/HD in your system (can be Sata or USB through a case with adaptor)
- Boot on the Fedora 20 and Perform a cleanup of all unneeded stuff to reduce the time spent, you don’t want to put old crap
- IMPORTANT: Have a USB stick of at least 1 GB to put a Fedora 20 on it, in case you cannot boot …
- Check you have enough space on the SSD, ideally it should be less than 50% of usage.
Partitioning the HD(s)/SSD(s)
Using either fdisk on command line or gparted for a simple version, partition the disk according to the layout you want to have.
Formatting partitions
If you have a lot of small files, or the reverse a lot of huge file. It is better to perform the format on the command line to setup the size of inodes and other stuff according to the filesystem you have or you want.
Otherwise, if you don’t know just use gparted and stick to an ext4 filesystem.
Setting labels on partitions
Put at least the / mount point…
Copying content on the SSD/HD
- Mount the SSD/HD partitions
- If you use a ext2/ext3/ext4 filesystem, you can go for the simple tar method (I like it very much):
- tar cf – /boot | ( cd /mnt/ | tar xfp – )
- tar cf – /etc | (cd /mnt/ | tar xfp – )
- tar cf – /var | (cd /mnt/ | tar xfp – )
- tar cf – /root | (cd /mnt/ | tar xfp – )
- tar cf – /opt | (cd /mnt/ | tar xfp – )
- tar cf – /home | (cd /mnt | tar xfp – )
- tar cf – /tmp| (cd /mnt | tar xfp – )….
- Create empty dirs for
- dev
- mnt
- run
- sys
- proc
- Add symbolic links on / if any: it is the case on the 64 bits version
Update /etc/fstab in the target HD
Probably the new SSD(s)/HD(s) are having a new ID, you have to find it.
Personally,, I was too lazy so I used the old school way: /dev/sd[a-z][1-9]+.
Then modify the fstab on the new SSD/HD accordingly.
Setup boot loader (grub2)
- As root run the following commands
- grub2-install –recheck /dev/MYHARDDRIVE
- grub2-mkconfig -o /boot/grub2/grub.cfg
- sync
- reboot
- If the system does not boot use the USB key
- Mount partitions for instance in /mnt/sysimage/
- mount –bind /dev /mnt/sysimage/dev
- mount –bind /proc /mnt/sysimage/proc
- mount –bind /sys /mnt/sysimage/sys
- chroot /mnt/sysimage
- Then redo steps from 1. to 4. it should be ok
SSD Specific Tuning
- Check the SSD supports TRIM: sudo hdparm -I /dev/MYSSD | grep TRIM
- Ext4 changes in /etc/fstab add discard in options:
- Example: /dev/sdb1 / ext4 defaults,discard 1 1
- Avoid to swap too early, add this in /etc/sysctl.conf
- #SSD
vm.swappiness = 0
- #SSD
- IO Scheduler change (create /etc/rc.d/rc.local and append this if existing, after enable the rc.local. Google this: “Fedora 20 rc.local” )
#!/usr/bin/bash#SSD Specific
echo ‘noop’ > /sys/block/sdb/queue/scheduler
echo ‘noop’ > /sys/block/sda/queue/schedulerexit 0
Jukebox with RaspberryPi
Posted by admin in RaspberryPi on August 31st, 2013
Configuration Raspberry Output
You can force the Raspy to take some output (default is HDMI)
amixer cset numid=3 n
Where <n> is the required interface : 0=auto, 1=analog, 2=hdmi. To force the Raspberry Pi to use the analog output :
amixer cset numid=3 1
Quick check that the Raspy is working fine
sudo apt-get install mpg123
–> mpg123 my.mp3
sudo apt-get install sox libsox-fmt-all
–> play myStuff
Install MPD and flokebox
sudo apt-get install flokebox
–> Configure /etc/mpd.conf (set the music path and enable network access)
bind_to_address "0.0.0.0"
–> Configure flokebox (set the music path to display art works)
Install a Window MPD client used as a remote (faster than flokebox)
https://code.google.com/p/auremo/
Ubuntu on ASUS X401U AMD E2-1800
Installing [UBUNTU] on [ASUS X401U E2-1800]
Last updated: 02/11/2012
General Hardware Specifications of [ASUS X401U E2-1800]:
Hardware Components
|
Status under Linux
|
Notes
|
AMD E2 1800 | Works | No special procedure required during installation. |
14″ LCD | Works | No special procedure required during installation |
AMD | Works | No special procedure required during installation HDMI output and VGA not tested |
4GB RAM | Works | No special procedure required during installation |
500 GB SATA Hard Drive | Works | No special procedure required during installation |
Integrated Memory Card Reader | Should Works | Not tested should work |
Internal WEBCAM | Works | No special procedure required during installation |
Internal WIFI | Works | No special procedure required during installation |
Internal Ethernet | Works | No special procedure required during installation |
Internal SoundCard | Works | No special procedure required during installation |
This laptop is operating under Kernel version [Linux boucaron-X401U 3.5.0-17-generic #28-Ubuntu SMP]
- Why to use [UBUNTU]
- It is the simplest to install on this laptop (for the moment)
- Obtaining [UBUNTU]
- Installing
- This laptop has UEFI, the first thing to do is to disable in the BIOS (Security panel) the secure HD.
- Download the x86_64 desktop ISO version that has UEFI boot loader
- Format a fresh USB stick in FAT32
- Mount the ISO and Copy all the content to the USB stick
- Boot on the USB stick (Go in the BIOS, you should have a new entry to boot onto)
- Post-Install modifications/tweaks see below
- julien DOT boucaron AT gmail DOT com
- And of course, back to Linux on Laptops!
Plus other useful things I may have forgotten
ffmpeg X11 grab
ffmpeg is so useful
ffmpeg -f x11grab -s 1280×800 -r 25 -i :0.0 -f oss -ac 2 -i /dev/dsp output.mpg
Intel TBB Reduction Code Snippet
ParallelReduction.h
#ifndef _JB_PARRED_H_ #define _JB_PARRED_H_ #include "tbb/parallel_reduce.h" #include "tbb/blocked_range.h" using namespace tbb; struct SumInt { int value; SumInt(); SumInt(SumInt &s, split); void operator() (const blocked_range<int*>& range); void join( SumInt &rhs); }; int ParallelSumInt( int array[], size_t n ); struct ProductInt { int value; ProductInt(); ProductInt(ProductInt &s, split); void operator() (const blocked_range<int*>& range); void join( ProductInt &rhs); }; unsigned int ParallelProductInt(int array[], size_t n); #endif
ParallelReduction.cc
#include "tbb/parallel_reduce.h" #include "tbb/blocked_range.h" #include "ParallelReduce.h" using namespace tbb; SumInt::SumInt() : value(0) {} SumInt::SumInt(SumInt &s, split) { value = 0 ; } void SumInt::operator() (const blocked_range<int*>& range) { int temp = value; for( int* a=range.begin(); a!=range.end(); ++a) { temp += *a; } value = temp; } void SumInt::join( SumInt &rhs) { value += rhs.value; } int ParallelSumInt( int array[], size_t n ) { SumInt total; parallel_reduce(blocked_range<int*> (array, array+n, 1000), total); return total.value; } ProductInt::ProductInt() : value(1) {} ProductInt::ProductInt(ProductInt &s, split) { value = 1; } void ProductInt::operator() (const blocked_range<int*>& range) { int temp = value; for( int* a=range.begin(); a!=range.end(); ++a) { temp *= *a; } value = temp; } void ProductInt::join( ProductInt &rhs) { value *= rhs.value; } unsigned int ParallelProductInt(int array[], size_t n) { ProductInt total; parallel_reduce(blocked_range<int*>(array, array+n, 1000), total); return total.value; }
BenchParallelReduce.cc
#include “ParallelReduce.h”
#include “tbb/task_scheduler_init.h”
#include “tbb/tick_count.h”
#include <iostream>
#include <cstdlib>
using namespace std;
using namespace tbb;
void usage() {
cout << “BenchParallelReduce threads? “ << endl;
}
int main(int argc, char**argv) {
task_scheduler_init init(task_scheduler_init::deferred);
int p = 0;
if ( argc == 2 ) {
p = atoi(argv[1]);
}
else if ( argc > 2 ) {
usage(); exit(-1);
}
if ( p != 0 ) { init.initialize(p); }
else {
p = task_scheduler_init::default_num_threads();
init.initialize(p);
}
const int size = 100000000;
int *array = new int[size];
for(int i = 0 ; i < size - 1 ;i++ ) {
array[i] = i;
}
tick_count t0 = tick_count::now();
int res = ParallelSumInt(array, size);
tick_count t1 = tick_count::now();
cout << “Result: “ << res << endl;
cout << “Takes “ << (t1-t0).seconds() << ” seconds” << endl;
cout << “Thread(s) “ << p << endl;
return 0;
}
Files
Irrlicht code snippet: slow down FPS
A simple code snippet to slow down frame rate and slow down CPU usage.
#include <irrlicht.h> #include <iostream> using namespace irr; struct IrrlichtDelayFPS { int maxFPS; int lastFPS; int yieldCounter; IrrlichtDevice *device; IrrlichtDelayFPS() { maxFPS = 50; yieldCounter = 0; device = 0; } void delay() { video::IVideoDriver* driver = device->getVideoDriver(); int lastFPS = driver->getFPS(); for( int i = 0 ; i < yieldCounter ; i++ ) { device->yield(); } if ( lastFPS >maxFPS ) { yieldCounter++ ; } else { if (yieldCounter > 0 ) { --yieldCounter; } else { yieldCounter = 0 ; } } } }; /* IrrlichtDelayFPS delayFPS; delayFPS.maxFPS = 50; //set max FPS delayFPS.device = device; //set device while(device->run()) { //your code here //delay loop delayFPS.delay(); } */
Cross compiling lpsolve under linux for win32
Here is the attached Makefile (no other patch)
<<
# # Makefile for cross-compiling lp_solve using GNU Make # Usage: # make -f Makefile.MinGW [all | bin | lib | clean] # # $Revision: 1.1 $ # AR = i586-mingw32msvc-ar ARFLAGS = rv CC = i586-mingw32msvc-gcc LEX = flex YACC = bison INCLUDE = -I. -Ibfp -Ibfp/bfp_LUSOL -Ibfp/bfp_LUSOL/LUSOL -Icolamd -Ishared # Uncomment any of the following two depending on your profile #DEBUG = -g -pg DEBUG = -O2 DEFINE = -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine # Uncomment any of the following two depending on how easily compiler messages scare you #CFLAGS= $(INCLUDE) $(DEBUG) $(DEFINE) -fpic -Wall -pedantic -trigraphs CFLAGS= $(INCLUDE) $(DEBUG) $(DEFINE) -mno-cygwin -DWIN32 -Wall LFLAGS = -L YFLAGS = --no-lines -y LDFLAGS = -lm -Wl,--allow-multiple-definition demo.exe: demo/demo.c $(OBJECTS) $(CC) $(CFLAGS) $(DEBUG) $(DEFINE) $(INCLUDE) $< $(OBJECTS) -o demo/demo $(LDFLAGS) LUSOLSRC = bfp/bfp_LUSOL/lp_LUSOL.c bfp/bfp_LUSOL/LUSOL/lusol.c LUSOLOBJS = bfp/bfp_LUSOL/lp_LUSOL.o bfp/bfp_LUSOL/LUSOL/lusol.o OBJECTS = $(LUSOLOBJS) lp_MDO.o shared/commonlib.o colamd/colamd.o \ shared/mmio.o shared/myblas.o ini.o fortify.o lp_rlp.o lp_crash.o \ lp_Hash.o lp_lib.o lp_wlp.o lp_matrix.o lp_mipbb.o lp_MPS.o \ lp_params.o lp_presolve.o lp_price.o lp_pricePSE.o lp_report.o \ lp_scale.o lp_simplex.o lp_SOS.o lp_utils.o yacc_read.o SRC = $(LUSOLSRC) lp_MDO.c shared/commonlib.c colamd/colamd.c \ shared/mmio.c shared/myblas.c ini.c fortify.c lp_rlp.c lp_crash.c \ lp_Hash.c lp_lib.c lp_wlp.c lp_matrix.c lp_mipbb.c lp_MPS.c \ lp_params.c lp_presolve.c lp_price.c lp_pricePSE.c lp_report.c \ lp_scale.c lp_simplex.c lp_SOS.c lp_utils.c yacc_read.c LIBRARIES = liblpsolve55.a liblpsolve55.so liblpsolve55.dll BINARIES = lp_solve.exe demo.exe ALL = $(BINARIES) $(DEMOS) $(LIBRARIES) .PHONY=clean lp_solve all: $(ALL) lib: $(LIBRARIES) bin: $(BINARIES) objects: $(OBJECTS) lp_rlp.o: lp_rlp.l lp_rlp.y $(LEX) $(LFLAGS) lp_rlp.l sed -e "s/yy/lp_yy/g" lex.yy.c >lp_rlp.h rm -f lex.yy.c $(YACC) $(YFLAGS) lp_rlp.y sed -e "s/yy/lp_yy/g" y.tab.c >lp_rlp.c rm -f y.tab.c $(CC) $(CFLAGS) $(DEBUG) $(DEFINE) $(INCLUDE) -c $*.c lp_solve.exe: lp_solve/lp_solve.c $(OBJECTS) $(CC) $(CFLAGS) $(DEBUG) $(DEFINE) $(INCLUDE) $< $(OBJECTS) -o lp_solve/lp_solve.exe $(LDFLAGS) demo.exe: demo/demo.c $(OBJECTS) $(CC) $(CFLAGS) $(DEBUG) $(DEFINE) $(INCLUDE) $< $(OBJECTS) -o demo/demo.exe $(LDFLAGS) liblpsolve55.a: $(OBJECTS) $(AR) $(ARFLAGS) lpsolve55/$@ `echo $(SRC)|sed 's/[.]c/.o/g'` ranlib lpsolve55/$@ liblpsolve55.so: $(OBJECTS) $(CC) -shared -Wl,-Bsymbolic -Wl,-soname,$@ -o lpsolve55/$@ `echo $(SRC)|sed 's/[.]c/.o/g'` $(LDFLAGS) liblpsolve55.dll: $(OBJECTS) $(CC) -shared -o $@ -Wl,--out-implib,liblpsolve55.a $(OBJECTS) $(LDFLAGS) clean: rm -f $(OBJECTS) *.so *.a lp_solve/lp_solve.exe demo/demo.exe lpsolve55/*.so lpsolve55/*.a lpsolve55/*.dll
>>
SystemC for Linux amd64
I have update the systemc package version 2.2 for Ubuntu amd64, see there:
Ubuntu 8.10 x64 on Dell Latitude D630
Installing [UBUNTU 8.10 (x64)] on [DELL LATITUDE D630]
Last updated: 18/11/2008
General Hardware Specifications of [DELL LATITUDE D630]:
Hardware Components
|
Status under Linux
|
Notes
|
Intel(R) Core(TM)2 Duo CPU T7500 @ 2.20GHz | Works | No special procedure required during installation. |
14″ LCD | Works | No special procedure required during installation |
nVidia Corporation Quadro NVS 135M | Works | Check your BIOS (last release is A13) and the GPU fan will run at full speed using version 177 driver, I am using version 173 driver and there is no fan issue with an old BIOS |
2GB, RAM, 2DIMMs | Works | No special procedure required during installation |
120 GB SATA Hard Drive | Works | No special procedure required during installation |
Integrated Bluetooth | Works | No special procedure required during installation, BUT must be enabled using Windows utility |
Integrated PCMCIA | Works | No special procedure required during installation |
Integrated IEEE1384 | Works | No special procedure required during installation |
Internal V92 Modem | Should Work | Not tested |
DVD-RW Unit | Works | No special procedure required during installation |
Internal Intel WIFI | Works | No special procedure required during installation |
Internal Intel Ethernet | Works | No special procedure required during installation |
Intel HDA SoundCard | Works | No special procedure required during installation INTERNAL MIC CAPTURE ISSUE see https://wiki.ubuntu.com/Gutsy_Intel_HD_Audio_Controller |
This laptop is operating under Kernel version [Linux 2.6.27-7-generic]
- Why to use [UBUNTU 8.10 (x64)]
- Because only one live CD that we can install, good support for auto detection of hardware
- Obtaining [UBUNTU]
- Installing
- Post-Install modifications/tweaks see below
- sudo apt-get install nvidia-settings sensors-applet
- julien DOT boucaron AT free DOT fr
- And of course, back to Linux on Laptops!
Plus other useful things I may have forgotten
Ubuntu on Sony VAIO VGN-FE21B
Installing [UBUNTU] on [SONY VAIO VGN-FE21B]
Last updated: 13/01/2007
General Hardware Specifications of [SONY VAIO VGN-FE21B]:
Hardware Components
|
Status under Linux
|
Notes
|
Pentium T2300 @ 1.66 GHz |
Works | No special procedure required during installation. |
15.4″ LCD | Works | No special procedure required during installation |
NVIDIA 7400 | Works | No special procedure required during installation If you want xgl, compiz or beryl download and install NVIDIA drivers see procedure here and X11 configuration here VGA output and S-video output not tested |
1GB, RAM, 2DIMMs | Works | No special procedure required during installation |
80 GB SATA Hard Drive | Works | No special procedure required during installation |
Integrated 5-1 Memory Card Reader | Should Works | Not tested should work |
Integrated Bluetooth | Works | No special procedure required during installation |
Integrated PCMCIA | Works | No special procedure required during installation |
Integrated IEEE1384 | Works | No special procedure required during installation |
Internal V92 Modem | Should Work | Not tested should work see http://www.linuxant.com/drivers/ |
DVD-RW Unit | Works | No special procedure required during installation |
Internal Intel WIFI | Works | No special procedure required during installation |
Internal Intel Ethernet | Works | No special procedure required during installation |
Intel HDA SoundCard | Works | No special procedure required during installation for PLAYBACK If you want to CAPTURE with integrated microphone see instructions here |
This laptop is operating under Kernel version [Linux boucaron-laptop 2.6.17-10-generic #2 SMP]
- Why to use [UBUNTU]
- Because only one live CD that we can install, good support for auto detection of hardware
- Obtaining [UBUNTU]
- Installing
- Post-Install modifications/tweaks see below
- Getting the CAPTURE of the soundcard working (line and microphone)
- Getting last NVIDIA driver works for xgl, compiz, beryl …etc…
- For XGL, Compiz, Beryl ….
- Download and install NVIDIA Drivers
- However if you reboot now you will do not have X11 working, actually because in UBUNTU nvidia is a “restricted” module and UBUNTU is having a service run at startup called /etc/init.d/linux-restricted-modules-common that “copy” files from /lib/linux-restricted-modules/2.6.17-10-generic/nvidia (our case) into the appropriate place in the /lib/modules/2.6.17-10-generic/.
- The trick is the following after installing NVIDIA driver we just have to copy the nvidia.ko file from /lib/modules/2.6.17-10-generic/ into /lib/linux-restricted-modules/2.6.17-10-generic/nvidia/ after removed present files in this directory. Take care also to remove /lib/linux-restricted-modules/2.6.17-10-generic/nvidia_legacy.
-
# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig: version 1.0 (buildmeister@builder3) Mon Oct 16 22:13:07 PDT 2006
# /etc/X11/xorg.conf (xorg X Window System server configuration file)
#
# This file was generated by dexconf, the Debian X Configuration tool, using
# values from the debconf database.
#
# Edit this file with caution, and see the /etc/X11/xorg.conf manual page.
# (Type “man /etc/X11/xorg.conf” at the shell prompt.)
#
# This file is automatically updated on xserver-xorg package upgrades *only*
# if it has not been modified since the last upgrade of the xserver-xorg
# package.
#
# If you have edited this file but would like it to be automatically updated
# again, run the following command:
# sudo dpkg-reconfigure -phigh xserver-xorg
Section “ServerLayout”
Identifier “Default Layout”
Screen “Default Screen” 0 0
InputDevice “Generic Keyboard”
InputDevice “Configured Mouse”
InputDevice “stylus” “SendCoreEvents”
InputDevice “cursor” “SendCoreEvents”
InputDevice “eraser” “SendCoreEvents”
InputDevice “Synaptics Touchpad”
EndSection
Section “Files”
# path to defoma fonts
FontPath “/usr/share/X11/fonts/misc”
FontPath “/usr/share/X11/fonts/cyrillic”
FontPath “/usr/share/X11/fonts/100dpi/:unscaled”
FontPath “/usr/share/X11/fonts/75dpi/:unscaled”
FontPath “/usr/share/X11/fonts/Type1″
FontPath “/usr/share/X11/fonts/100dpi”
FontPath “/usr/share/X11/fonts/75dpi”
FontPath “/usr/share/fonts/X11/misc”
FontPath “/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType”
EndSection
Section “Module”
Load “i2c”
Load “bitmap”
Load “ddc”
Load “extmod”
Load “freetype”
Load “glx”
Load “int10″
Load “type1″
Load “vbe”
EndSection
Section “InputDevice”
Identifier “Generic Keyboard”
Driver “kbd”
Option “CoreKeyboard”
Option “XkbRules” “xorg”
Option “XkbModel” “pc105″
Option “XkbLayout” “fr”
Option “XkbOptions” “lv3:ralt_switch”
EndSection
Section “InputDevice”
Identifier “Configured Mouse”
Driver “mouse”
Option “CorePointer”
Option “Device” “/dev/input/mice”
Option “Protocol” “ExplorerPS/2″
Option “ZAxisMapping” “4 5″
Option “Emulate3Buttons” “true”
EndSection
Section “InputDevice”
Identifier “Synaptics Touchpad”
Driver “synaptics”
Option “SendCoreEvents” “true”
Option “Device” “/dev/psaux”
Option “Protocol” “auto-dev”
Option “HorizScrollDelta” “0″
EndSection
Section “InputDevice”
# /dev/input/event
# for USB
Identifier “stylus”
Driver “wacom”
Option “Device” “/dev/wacom” # Change to
Option “Type” “stylus”
Option “ForceDevice” “ISDV4″ # Tablet PC ONLY
EndSection
Section “InputDevice”
# /dev/input/event
# for USB
Identifier “eraser”
Driver “wacom”
Option “Device” “/dev/wacom” # Change to
Option “Type” “eraser”
Option “ForceDevice” “ISDV4″ # Tablet PC ONLY
EndSection
Section “InputDevice”
# /dev/input/event
# for USB
Identifier “cursor”
Driver “wacom”
Option “Device” “/dev/wacom” # Change to
Option “Type” “cursor”
Option “ForceDevice” “ISDV4″ # Tablet PC ONLY
EndSection
Section “Monitor”
Identifier “Generic Monitor”
HorizSync 28.0 – 64.0
VertRefresh 43.0 – 60.0
Option “DPMS”
EndSection
Section “Device”
#Driver “nv”
Identifier “NVIDIA Corporation NVIDIA Default Card”
Driver “nvidia”
# Option “XAANoOffscreenPixmaps”
Option “TripleBuffer” “True”
EndSection
Section “Screen”
Identifier “Default Screen”
Device “NVIDIA Corporation NVIDIA Default Card”
Monitor “Generic Monitor”
DefaultDepth 24
Option “RenderAccel” “true”
Option “AllowGLXWithComposite” “true”
SubSection “Display”
Depth 1
Modes “1280×800″
EndSubSection
SubSection “Display”
Depth 4
Modes “1280×800″
EndSubSection
SubSection “Display”
Depth 8
Modes “1280×800″
EndSubSection
SubSection “Display”
Depth 15
Modes “1280×800″
EndSubSection
SubSection “Display”
Depth 16
Modes “1280×800″
EndSubSection
SubSection “Display”
Depth 24
Modes “1280×800″
EndSubSection
Option “AddARGBGLXVisuals” “True”
EndSection
Section “Extensions”
Option “Composite” “Enable”
EndSection
Section “DRI”
Mode 0666
EndSection - Modules options for sound card, append this to /etc/modprobe.d/alsa-base
options snd-hda-intel model=vaio position_fix=0
- julien DOT boucaron AT free DOT fr
- And of course, back to Linux on Laptops!
Plus other useful things I may have forgotten