Search:  
Gentoo Wiki

HOWTO_Canon_Pixma_ip4500_using_Canon_32bit_drivers_on_AMD64


This article is part of the HOWTO series.
Installation Kernel & Hardware Networks Portage Software System X Server Gaming Non-x86 Emulators Misc

Contents

Introduction

First of all, much of what's listed in this page is applicable to other printers with similar driver limitations (only 32bit available), so read on even if you don't specifically have the ip4500!

Canon only provides 32bit i386 driver utilities (CUPS filters/backends, etc) for the ip4500, and I run AMD64, so I needed to have a 32bit chroot installation to run the Canon driver.

Getting the chroot

alias chroot32_shell="sudo linux32 chroot /chroot/gentoo32 /usr/bin/env - TERM=$TERM COLORTERM=$COLORTERM /bin/bash"
source /root/.bash_profile
source /etc/profile
env-update
export HOME="/root"
export SHELL="/bin/bash"

Starting the chrooted cupsd from the normal environment

#!/sbin/runscript

depend() {
        need localmount
        need bootmisc
        provide chrootprep
}

start() {
ebegin "Mounting 32bits chroot dirs"
mount -o bind /dev /chroot/gentoo32/dev >/dev/null
mount -o bind /dev/pts /chroot/gentoo32/dev/pts >/dev/null &
mount -o bind /dev/shm /chroot/gentoo32/dev/shm >/dev/null &
mount -o bind /proc /chroot/gentoo32/proc >/dev/null
mount -o bind /proc/bus/usb /chroot/gentoo32/proc/bus/usb >/dev/null &
mount -o bind /sys /chroot/gentoo32/sys >/dev/null &
mount -o bind /tmp /chroot/gentoo32/tmp >/dev/null &
eend $? "An error occured while attempting to mount 32bit chroot directories"
ebegin "Copying 32bits chroot files"
cp -pf /etc/resolv.conf /chroot/gentoo32/etc >/dev/null &
cp -pf /etc/passwd /chroot/gentoo32/etc >/dev/null &
cp -pf /etc/shadow /chroot/gentoo32/etc >/dev/null &
cp -pf /etc/group /chroot/gentoo32/etc >/dev/null &
cp -pf /etc/gshadow /chroot/gentoo32/etc >/dev/null &
cp -pf /etc/hosts /chroot/gentoo32/etc > /dev/null &
cp -Ppf /etc/localtime /chroot/gentoo32/etc >/dev/null &
eend $? "An error occured while attempting to copy 32 bits chroot files."
}

stop() {
    ebegin "Unmounting 32bits chroot dirs"
    umount -f /chroot/gentoo32/dev/pts >/dev/null
    umount -f /chroot/gentoo32/dev/shm >/dev/null
    umount -f /chroot/gentoo32/dev >/dev/null &
    umount -f /chroot/gentoo32/proc/bus/usb >/dev/null
    umount -f /chroot/gentoo32/proc >/dev/null &
    umount -f /chroot/gentoo32/sys >/dev/null &
    umount -f /chroot/gentoo32/tmp >/dev/null &
    eend $? "An error occured while attempting to unmount 32bits chroot directories"
}
#!/sbin/runscript

depend() {
    need chrootprep
    after logger
}

start() {
    ebegin "Starting chroot gentoo32 cupsd"
    chroot /chroot/gentoo32 /sbin/start-stop-daemon --start --exec /usr/sbin/cupsd 
    eend $?
}

stop() {
    ebegin "Stopping chroot gentoo32 cupsd"
    chroot /chroot/gentoo32 /sbin/start-stop-daemon --stop --exec /usr/sbin/cupsd 
    eend $?
}

Installing the Canon drivers into the chroot

Common tarball

I'm assuming that all commands are executed inside the dir that resulted from untarring the common tarball

Fix permissions

chown -R root:root .
find . -type d -print0 | xargs -0 chmod 755
find . -type f -print0 | xargs -0 chmod 644
chmod 755 usr/lib/cups/backend/cnij_usb usr/lib/cups/filter/pstocanonij usr/local/bin/cngpij

Copy the files

I put the cups filter and backend in the chroot's /usr/local/libexec/cups to keep the actual files out of the standard cups hierarchy, then symlinked them in to where cups expects them. I prefer to keep things that are not installed by portage out of /usr (and in /usr/local instead) as much as possible, but feel free to just copy the binaries into /chroot/gentoo32/usr/libexec/cups/{backend,filter} if you wish to avoid the extra step.

mkdir -p /chroot/gentoo32/usr/local/libexec/cups/backend
mkdir -p /chroot/gentoo32/usr/local/libexec/cups/filter

cp usr/lib/cups/backend/cnij_usb /chroot/gentoo32/usr/local/libexec/cups/backend/
cp usr/lib/cups/filter/pstocanonij /chroot/gentoo32/usr/local/libexec/cups/filter/

ln -s /usr/local/libexec/cups/backend/cnij_usb /chroot/gentoo32/usr/libexec/cups/backend/
ln -s /usr/local/libexec/cups/filter/pstocanonij /chroot/gentoo32/usr/libexec/cups/filter/

cp usr/local/bin/cngpij /chroot/gentoo32/usr/local/bin/

Model-specific (ip4500) tarball

I'm assuming that all commands are executed inside the directory that resulted from untarring the ip4500 tarball.

Fix permissions

chown -R root:root .
find . -type d -print0 | xargs -0 chmod 755
find . -type f -print0 | xargs -0 chmod 644
chmod 755 usr/local/bin/*

Copy the files

Note that the usr/local/share/locale directory is only needed if you want languages other than english.

cp usr/lib/*.so.* /chroot/gentoo32/usr/local/lib
ldconfig
cp -r usr/lib/bjlib /chroot/gentoo32/usr/lib/
cp usr/local/bin/* /chroot/gentoo32/usr/local/bin/
cp usr/share/cups/model/canonip4500.ppd /chroot/gentoo32/usr/share/cups/model/
cp usr/local/share/cngpijmonip4500 /chroot/gentoo32/usr/local/share/
cp usr/local/share/printuiip4500 /chroot/gentoo32/usr/local/share/

Final notes

You should now be able to start up the chrooted cupsd (/etc/init.d/chroot32_cupsd start) and be able to access it at http://localhost:631 and add the Canon printer and print a test page. The default usb backend worked fine for me, but you may also wish to try the Canon backend. (The two backends are why the printer will show up twice in the Add Printer page -- each backend is reporting the printer to CUPS.)

Retrieved from "http://www.gentoo-wiki.info/HOWTO_Canon_Pixma_ip4500_using_Canon_32bit_drivers_on_AMD64"

Last modified: Sat, 30 Aug 2008 20:28:00 +0000 Hits: 4,640