Scanner + Printer = Copy Machine

Multi-functional printer is just a combination of printer and scanner.
So, why don’t you make DIY copy machine in Linux if you have a printer and scanner?
Make sure your scanner is supported in SANE in Linux, and install scanbuttond for scanner’s button control.
scanbuttond seems no longer in active development, but it works OK in CentOS.

I added these commands in /usr/local/etc/buttonpressed.sh as follows:

In the button pressed event,

scanimage --mode lineart --resolution 300 -x 215 -y 297 > test.pnm
pnmtops -scale 1000 -dpi 300 test.pnm | lpr -PHL-2040
convert test.pnm /some/archive/`date + %Y%m%d%H%M`.pdf

So, whenever I press the button, it automatically starts scanning, then prints it out and archives as PDF.
The only thing that bugs me is the slow scanning time…

How to move /home to other drive.

Be careful to check if your /home is mounted or just a directory.
Thanks to IBM, following this instruction suffice for everybody.
http://www.ibm.com/developerworks/linux/library/l-partplan.html

I finally made the /home in software RAID 1… Next thing I need a UPS for the machine.

Posted in Linux. Tags: , , . Leave a Comment »

Xen Paravirtualized CentOS domU on CentOS 5.3 dom0

How to install paravirtualized CentOS 5.3 x64 as domU

# virt-install --paravirt \
               --name centosx64 \
               --ram 512 \
               --file /home/xen/images/centosx64.img \
               --file-size 10 \
               --nographics \
               --location http://mirrors.kernel.org/centos/5.3/os/x86_64/

It means Memory: 512MB, Disk Image: 10GB and No Graphics
Check the comment if you want to make use of pre-downloaded iso image or dvd.

If you want to add Desktop environment after instrallation, just add these.

# yum groupinstall "X Window System" 
# yum groupinstall "GNOME Desktop Environment"

Reference: http://www.cyberciti.biz/tips/rhel-centos-xen-virtualization-installation-howto.html

Installing Fedora 10 on a MacBook Pro

Ubuntu was a really bad choice for XEN HVM dom0/domUs…
Fedora 10 doesn’t support xen kernel as well.
Back to Fedora 8…

http://www.linuxquestions.org/questions/fedora-35/xen-in-fedora-10-691804/

Install Xen Kernel on Ubuntu 9.04 Jaunty i386

I stole the kernel from debian’s pool.

wget http://ftp.debian.org/debian/pool/main/l/linux-2.6/linux-modules-2.6.26-2-xen-686_2.6.26-15_i386.deb
wget http://ftp.debian.org/debian/pool/main/l/linux-2.6/linux-image-2.6.26-2-xen-686_2.6.26-15_i386.deb
sudo dpkg -i linux-modules-2.6.26-2-xen-686_2.6.26-15_i386.deb
sudo dpkg -i linux-image-2.6.26-2-xen-686_2.6.26-15_i386.deb

* It’s a good idea to look for newer version. I don’t know why we cannot search by the debian website. But you can use the FTP…

Compiling XEN Kernel 2.6.29.2 on Ubuntu 9.04 32bit

I am compiling XEN Kernel 2.6.29.2 on Ubuntu 9.04 32bit
GCC is 4.3.3 and some issues with new compiler’s optimization.

This is on-going memo… I have compiled the kernel but it seems not compatible with Ubuntu 9.04.
So, I switched the xen kernel version supported by debian team.

References:

(1) http://www.infohit.net/blog/post/running-xen-on-ubuntu-intrepid-and-jaunty.html
(2) http://linux.derkeiler.com/Mailing-Lists/Kernel/2008-05/msg01854.html
(3) http://www.comptechdoc.org/os/linux/usersguide/linux_ugkernel.html
(4) http://bderzhavets.wordpress.com/2009/01/03/setup-xen-330-ubuntu-intrepid-server-dom0-via-build-xen-kernel-based-on-httpxenbitsxensourcecomextlinux-2627-xenhg/

Errors:

(1) undefined reference to `__udivdi3′
arch/x86/kernel/built-in.o: In function `timer_interrupt’:
/usr/src/linux-2.6.29.2-xen/arch/x86/kernel/time_32-xen.c:465: undefined reference to `__udivdi3′
make: *** [.tmp_vmlinux1] Error 1
root@ubunzzo:/usr/src/linux-2.6.29.2-xen# vi /usr/src/linux-2.6.29.2-xen/arch/x86/kernel/time_32-xen.c

My attempt after reading reference (2) was successful, I inserted the asm(“”:”+r”(delta)) to the timer_interrupt function at the while scope at line number around 500.

        /* System-wide jiffy work. */
        if (delta >= NS_PER_TICK) {
                do_div(delta, NS_PER_TICK);
                processed_system_time += delta * NS_PER_TICK;
                while (delta > HZ) {

                        asm("":"+r"(delta));

                        do_timer(HZ);
                        delta -= HZ;
                }
                do_timer(delta);
        }

* This works because this asm fools gcc compiler not to use optimization.
I guess do_timer internally uses do_div macro?

I found the same kind of fix in linux kernel here

The AT&T assembly format still looks confusing…