HOWTO_Canon_Pixma_ip4500_using_Canon_32bit_drivers_on_AMD64
| 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
- Follow the Gentoo Chroot guide, but see the next few steps below for a couple tips. I opted to put the have a separate /usr/portage dir and to put my chroot in /chroot/gentoo32.
- Set up an alias to easily get into your chroot to install packages, etc, during installation (you won't need it after your chroot has cups and gtk installed). Put this in your zsh or bash init files:
alias chroot32_shell="sudo linux32 chroot /chroot/gentoo32 /usr/bin/env - TERM=$TERM COLORTERM=$COLORTERM /bin/bash"
- Make sure the chrooted shell has the appropriate environment variables set
- In /chroot/gentoo32/.bashrc:
source /root/.bash_profile
- According to the chroot guide, we should always source /etc/profile and env-update, so in /chroot/gentoo32/.bash_profile:
source /etc/profile env-update export HOME="/root" export SHELL="/bin/bash"
- Compile your chroot system with USE="X" and make sure to emerge gtk+ (for the Canon utilities) and cups (because the whole point is to run cups...).
- After this point you won't need to be working in the chrooted shell any more.
Starting the chrooted cupsd from the normal environment
- I want the init script to provide 'chrootprep' so that the chrooted cupsd init script can depend on that facility. Put this file in /etc/init.d/chroot32_gentoo or something like that.
#!/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"
}
- You'll also need an init script for the chrooted cupsd, so put this in /etc/init.d/chroot32_cupsd:
#!/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 $?
}
- Run /sbin/depscan.sh --update as root to update the init script dependencies
- Add the two init scripts to the default runlevel with rc-update
Installing the Canon drivers into the chroot
- Go to the Canon Europe (the Canon US site doesn't have linux drivers listed) to download the Linux drivers: http://software.canon-europe.com/products/0010484.asp
- Select Linux as the OS and English as the language, then click through to the Linux Driver page (at the time of this writing, you'll get to http://software.canon-europe.com/software/0028476.asp?model= which is version 2.80 of the linux drivers)
- You should download and read the faq and guideip4500 tarballs as well as the rpms for cnijfilter-common and cnijfilter-ip4500series
- Use rpm2tar to get tar files for each of the two rpms
Common tarball
I'm assuming that all commands are executed inside the dir that resulted from untarring the common tarball
Fix permissions
- Chown everything to be root:root:
chown -R root:root .
- Chmod all directories to be 755:
find . -type d -print0 | xargs -0 chmod 755
- Chmod all files to be 644
find . -type f -print0 | xargs -0 chmod 644
- Chmod the executables to be 755:
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 everything to be root:root:
chown -R root:root .
- Chmod all directories to be 755:
find . -type d -print0 | xargs -0 chmod 755
- Chmod all files to be 644
find . -type f -print0 | xargs -0 chmod 644
- Chmod the executables to be 755:
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.
- Copy the shared libraries
cp usr/lib/*.so.* /chroot/gentoo32/usr/local/lib
- From a chrooted root shell (use the alias you made above), recalculate the ld.so cache to include the new libraries
ldconfig
- Copy the bjlib config files -- these MUST go in /usr/lib not /usr/local/lib (hardcoded path in the binaries that use the config files)
cp -r usr/lib/bjlib /chroot/gentoo32/usr/lib/
- Copy the executables
cp usr/local/bin/* /chroot/gentoo32/usr/local/bin/
- Copy the ppd
cp usr/share/cups/model/canonip4500.ppd /chroot/gentoo32/usr/share/cups/model/
- Copy the pixmaps used by the canon utilities
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.)
Created by NickStallman.net, Luxury Homes Australia
Real estate agents should be using interactive floor plans and list their apartments, townhouses and units.
