Shiny New E-Book Gizmo: The Amazon Kindle


View Full Version : Build the Sony Sources


scotty1024
02-16-2007, 05:47 PM
As others have noticed Sony's quality of workmanship does not extend to how they put up the sources for the open source projects they incorporated into the Sony Portable Reader.

We could of course wish they'd treat the task with a bit more professionalism and respect for the code they were allowed to exploit...

I used a fresh Fedora Core 6 VM in Parallels 3150 on my 15.4" C2D Macbook Pro.

In these postings I'm working from the 0131 sources.

Login to your FC6 and create a "sony" directory someplace where you'll have 1GB of room.

I sftp'd the RPM's from my Mac side into my FC6 side. You can use anyway you want so long as you get them there, including just DL'ing straight there from Sony if you wish.

My unpacking command:

rpm -i *.rpm

I then copied everything in /usr/src/redhat/SOURCES to my sony directory.

I used the following script to unpack everything.

tar xfz bash_2.05a.orig.tar.gz
tar xfz cramfs_2.4.16.orig.tar.gz
tar xfz debianutils_1.14.tar.gz
tar xfz fileutils_4.1.orig.tar.gz
tar xfz findutils_4.1.7.orig.tar.gz
tar xfz gcc-3.2.tar.gz
tar xfz glib1.2_1.2.10.orig.tar.gz
tar xfj glibc-2.2.5.tar.bz2
tar xfj glibc-linuxthreads-2.2.5.tar.bz2 -C glibc-2.2.5
tar xfz grep-2.4.2.tar.gz
tar xfz hostname_2.09.tar.gz
tar xfz initdconfig.tar.gz
tar xfz Linux-PAM-0.72.tar.gz
tar xfz mtd-utils-2.4.16_1.16.tar.gz
tar xfz ncurses-5.2.tar.gz
tar xfz nss_db-2.2.tar.gz
tar xfz nss_lwres-0.92.tar.gz
tar xfz openssl_0.9.7b.orig.tar.gz
tar xfz procps_2.0.7.orig.tar.gz
tar xfz psmisc_20.1.orig.tar.gz
tar xfz sed_3.02.orig.tar.gz
tar xfz shellconfig.tar.gz
tar xfz shellutils_2.0.11.orig.tar.gz
tar xfz start-stop-daemon.tar.gz
tar xfz sysvinit_2.78-4.tar.gz
tar xfz tar-1.13.19.tar.gz
tar xfz textutils-2.0.tar.gz
tar xfz time-1.7.tar.gz
tar xfz tzcode2001c.tar.gz
tar xfz usleep.tar.gz
tar xfz util-linux_2.11h.orig.tar.gz
gunzip bash_2.05a-4.diff.gz
gunzip fileutils_4.1-3.diff.gz
gunzip findutils_4.1.7-2.diff.gz
gunzip glib1.2_1.2.10-1.diff.gz
gunzip glibc_2.2.3-9.diff.gz
gunzip ncurses-5.2-20010714.patch.gz
gunzip openssl_0.9.7b-2.diff.gz
gunzip pam_0.72-30.diff.gz
gunzip procps_2.0.7-3.diff.gz
gunzip psmisc_20.1-1.diff.gz
gunzip sed_3.02-6.diff.gz
gunzip shellutils_2.0.11-11.diff.gz
gunzip util-linux_2.11h-1.diff.gz

Please note I had to make a custom patch, Sony didn't supply fully functional sources/patches.

Save this as: scotty-inittab.patch
*** sysvinit-2.78/debian/etc/inittab~ 1998-05-28 11:32:09.000000000 -0700
--- sysvinit-2.78/debian/etc/inittab 2007-02-16 07:11:23.000000000 -0800
***************
*** 49,62 ****
# <id>:<runlevels>:<action>:<process>
1:2345:respawn:/sbin/getty 38400 tty1
2:23:respawn:/sbin/getty 38400 tty2
! 3:23:respawn:/sbin/getty 38400 tty3
! 4:23:respawn:/sbin/getty 38400 tty4
! 5:23:respawn:/sbin/getty 38400 tty5
6:23:respawn:/sbin/getty 38400 tty6

# Example how to put a getty on a serial line (for a terminal)
#
! #T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100
#T1:23:respawn:/sbin/getty -L ttyS1 9600 vt100

# Example how to put a getty on a modem line.
--- 49,62 ----
# <id>:<runlevels>:<action>:<process>
1:2345:respawn:/sbin/getty 38400 tty1
2:23:respawn:/sbin/getty 38400 tty2
! #3:23:respawn:/sbin/getty 38400 tty3
! #4:23:respawn:/sbin/getty 38400 tty4
! #5:23:respawn:/sbin/getty 38400 tty5
6:23:respawn:/sbin/getty 38400 tty6

# Example how to put a getty on a serial line (for a terminal)
#
! T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100
#T1:23:respawn:/sbin/getty -L ttyS1 9600 vt100

# Example how to put a getty on a modem line.


I used the following commands to patch everything. Yes, this was a bit of effort to h to work out and no, you don't want to change the order of anything below without careful thought/experimentation.

patch -p1 -d bash-2.05a.orig < bash-2.05a-random.patch
patch -p1 -d bash-2.05a.orig < bash-noautoconf.patch
patch -p1 -d bash-2.05a.orig < bash-version.patch
patch -p1 -d bash-2.05a.orig < hhl-cross-signal-2.05a-0.patch
patch -p1 -d bash-2.05a.orig < bash_2.05a-4.diff
patch -p1 -d cramfs_2.4.16.orig < cramfs-2.4.16-endian-aware.patch
patch -p1 -d cramfs_2.4.16.orig < cramfs-2.4.16-little_endian.patch
patch -p1 -d cramfs_2.4.16.orig < cramfs-2.4.16-out-of-kernel-build.patch
patch -p1 -d cramfs_2.4.16.orig < cramfs_2.4.18-xip.patch
patch -p1 -d fileutils-4.1 < fileutils-4.0.37-gcc-3.0.patch
patch -p1 -d fileutils-4.1 < fileutils_4.1-man.diff
patch -p1 -d fileutils-4.1 < fileutils_4.1-3.diff
patch -p1 -d fileutils-4.1 < mvl-fileutils-config_xtensa.patch
patch -p1 -d findutils-4.1.7.orig < mvl-findutils-xtensa.patch
patch -p1 -d findutils-4.1.7.orig < findutils_4.1.7-2.diff
patch -p1 -d gcc-3.2 < gcc-3.1.1-arm_be_nfp.patch
patch -p1 -d gcc-3.2 < gcc-3.1-cross.patch
patch -p1 -d gcc-3.2 < gcc-3.1-libstdcxx-incdir.patch
patch -p1 -d gcc-3.2 < gcc-3.1-mips_nfp.patch
patch -p1 -d gcc-3.2 < gcc-3.1-powerpc-atomicity.patch
patch -p1 -d gcc-3.2 < gcc-3.1-sh.patch
patch -p1 -d gcc-3.2 < gcc-3.1-visibility.patch
patch -p1 -d gcc-3.2 < gcc-3.1-with-default-cpu.patch
patch -p1 -d gcc-3.2 < hhl-gcc3.1-target_include.patch
patch -p1 -d gcc-3.2 < hhl-gcc3.1-target_lib.patch
patch -p1 -d gcc-3.2 < hhl-gcc3.1-target-nls.patch
patch -p1 -d gcc-3.2 < gcc-3.2-arm-link-spec.patch
patch -p1 -d gcc-3.2 < gcc-3.2-compoundlit.patch
patch -p1 -d gcc-3.2 < gcc-3.2-cvs.patch
patch -p1 -d gcc-3.2 < gcc-3.2-dwarf-current.patch
patch -p1 -d gcc-3.2 < gcc-3.2-ifcvt.patch
patch -p1 -d gcc-3.2 < gcc-3.2-libstdc-mips.patch
patch -p1 -d gcc-3.2 < gcc-3.2-lifetimes.patch
patch -p1 -d gcc-3.2 < gcc-3.2_mempcpy.patch
patch -p1 -d gcc-3.2 < gcc-3.2-relocation-dirsep.patch
patch -p1 -d gcc-3.2 < gcc-3.2-relocation-symlink.patch
patch -p1 -d gcc-3.2 < gcc-3.2-sh-and.patch
patch -p1 -d gcc-3.2 < gcc-3.2-sh-libcall.patch
patch -p1 -d gcc-3.2 < gcc-3.2-sh-reload-crash.patch
patch -p1 -d gcc-3.2 < gcc-3.2-sh-sibcall.patch
patch -p1 -d gcc-3.2 < gcc-3.2-softfloat.patch
patch -p1 -d gcc-3.2 < gcc-3.2-stack-temps.patch
patch -p1 -d gcc-3.2 < gcc-3.2-truncate-int.patch
patch -p0 -d gcc-3.2 < gcc-3.2-x86_reload.patch
patch -p1 -d gcc-3.2 < hhl-gcc3.2-cross-profile.patch
patch -p1 -d gcc-3.2 < hhl-gcc3.2-include-poison.patch
patch -p1 -d gcc-3.2 < hhl-gcc3.2-sb1.patch
patch -p1 -d gcc-3.2 < hhl-gcc3.2-version.patch
patch -p1 -d gcc-3.2 < gcc-3.2.2-declone-apple.patch
patch -p1 -d gcc-3.2 < gcc-3.2.2-declone-mvista.patch
patch -p1 -d gcc-3.2 < libstdc-include-dir.patch
patch -p1 -d glib-1.2.10 < glib-1.2.8-cross.diff
patch -p1 -d glib-1.2.10 < glib1.2_1.2.10-1.diff
patch -p1 -d glibc-2.2.5 < glibc_2.2.3-9.diff
patch -p1 -d glibc-2.2.5 < glibc-2.2.3-arm_sa_be.patch
patch -p1 -d glibc-2.2.5 < glibc-2.2.5-arm-errlist.patch
patch -p1 -d glibc-2.2.5 < glibc-2.2.5-cvs2.patch
patch -p1 -d glibc-2.2.5 < glibc-2.2.5-cvs.patch
patch -p1 -d glibc-2.2.5 < glibc-2.2.5-cvs-po.patch
patch -p1 -d glibc-2.2.5 < glibc-2.2.5-ia64-signal_h.patch
patch -p1 -d glibc-2.2.5 < glibc-2.2.5-lock-memory.patch
patch -p1 -d glibc-2.2.5 < glibc-2.2.5-lsb-locale.patch
patch -p1 -d glibc-2.2.5 < glibc-2.2.5-lsb-nice.patch
patch -p1 -d glibc-2.2.5 < glibc-2.2.5_mips_nfp.patch
patch -p1 -d glibc-2.2.5 < glibc-2.2.5-mips-profile.patch
patch -p1 -d glibc-2.2.5 < glibc-2.2.5-mips-regdump.patch
patch -p1 -d glibc-2.2.5 < glibc-2.2.5-mips-vfork.patch
patch -p1 -d glibc-2.2.5 < glibc-2.2.5-ppc-odirect.patch
patch -p1 -d glibc-2.2.5 < glibc-2.2.5-procstat.patch
patch -p1 -d glibc-2.2.5 < glibc-2.2.5-resolvleak.patch
patch -p1 -d glibc-2.2.5 < hhl-glibc-2.2.5-save-lds.patch
patch -p1 -d glibc-2.2.5 < hhl-glibc-2.2.5-sh.patch
patch -p1 -d glibc-2.2.5 < glibc-2.2.5-sh-compat.patch
patch -p1 -d glibc-2.2.5 < glibc-2.2.5-sh-mcount.patch
patch -p1 -d glibc-2.2.5 < glibc-2.2.5-timers.patch
patch -p1 -d glibc-2.2.5 < glibc-2.2.5-vfork-backtrace.patch
patch -p1 -d glibc-2.2.5 < glibc-2.2.5-xdrmem.patch
patch -p1 -d glibc-2.2.5 < glibc-affinity-syscalls-rml-2.2.5-1.patch
patch -p1 -d glibc-2.2.5 < glibc-linuxthreads-db-static.patch
patch -p1 -d glibc-2.2.5 < hhl-405-atomicity.patch
patch -p1 -d glibc-2.2.5 < hhl-powerpc-altivec.patch
patch -p1 -d glibc-2.2.5 < hhl-powerpc-fpu.patch
patch -p0 < hhl-glibc-asm-debug.patch
patch -p1 -d glibc-2.2.5 < hhl-glibc-ftw-lsb-compat.patch
patch -p1 -d glibc-2.2.5 < hhl-glibc-rpc-cpp.patch
patch -p1 -d glibc-2.2.5 < hhl-glibc-rpc-cross.patch
patch -p1 -d glibc-2.2.5 < hhl-glibc-sysconf-lsb-compat.patch
patch -p1 -d glibc-2.2.5 < hhl-glibc-mips-regsets.patch
patch -p1 -d glibc.2.2.5 < hhl-glibc-mips-atomic-op.patch
patch -p1 -d glibc-2.2.5 < hhl-glibc-grantpt-lsb-compat.patch
patch -p1 -d glibc.2.2.5 < hhl-glibc-libgcc-compat.patch
patch -p1 -d hostname-2.09 < hostname-2.07-make.patch
patch -p1 -d hostname-2.09 < hostname-2.09-makefile.patch
patch -p0 -d initdconfig < initdconfig-skeleton.diff
patch -p1 -d Linux-PAM-0.72 < pam_0.72-30.diff
patch -p1 -d ncurses-5.2 < ncurses_5.2-crosslib.diff
patch -p1 -d ncurses-5.2 < ncurses_5.2-pic.diff
patch -p1 -d ncurses-5.2 < ncurses_5.2-tichack.diff
patch -p0 < mvl-ncurses-config_xtensa.patch
patch -p1 -d ncurses-5.2 < ncurses-5.2-20010714.patch
patch -p1 -d mtd-utils-2.4.16_1.16 < no_kernel_string_h.patch
patch -p1 -d openssl-0.9.7b.orig < openssl_0.9.7b-2.diff
patch -p1 -d openssl-0.9.7b.orig < openssl-mvl-arch.diff
patch -p1 -d openssl-0.9.7b.orig < mvl-openssl-xtensa.patch
patch -p0 < openssl-gzman.patch
patch -p0 < pam_0.72-hhl.diff
patch -p1 -d procps-2.0.7.orig < procps_2.0.7-3.diff
patch -p1 -d procps-2.0.7.orig < procps-initd.diff
patch -p1 -d psmisc-20.1.orig < psmisc_20.1-1.diff
patch -p1 -d shellutils-2.0.11 < mvl-shellutils-config_xtensa.patch
patch -p1 -d shellutils-2.0.11 < hhl-remove-zh.diff
patch -p1 -d shellutils-2.0.11 < shellutils_2.0.11-11.diff
patch -p1 -d sed-3.02 < sed_3.02-6.diff
patch -p1 -d sysvinit-2.78 < sysvinit-hhl.patch
patch -p0 < scotty-inittab.patch
patch -p1 -d sysvinit-2.78 < hhl-inittab.patch
patch -p1 -d sysvinit-2.78 < sysvinit-inittab-devfs.diff
patch -p1 -d sysvinit-2.78 < hhl-inittab-runlevel.patch
patch -p1 -d sysvinit-2.78 < sysvinit-2.78-cread.patch
patch -p1 -d sysvinit-2.78 < sysvinit-2.78-install.patch
patch -p1 -d sysvinit-2.78 < sysvinit-bootmisc.patch
patch -p1 -d sysvinit-2.78 < sysvinit-fsckswap.diff
patch -p1 -d sysvinit-2.78 < sysvinit-mountswap.diff
patch -p1 -d sysvinit-2.78 < sysvinit-sendsigs.patch
patch -p1 -d sysvinit-2.78 < sysvinit-single.patch
patch -p1 -d sysvinit-2.78 < sysvinit-skeleton.patch
patch -p1 -d tar-1.13.19 < tar-1.13.19-gcc3.patch
patch -p1 -d textutils-2.0 < textutils_2.0-12.diff
patch -p1 -d time-1.7 < time-1.7-glibc.patch
patch -p1 -d util-linux-2.11h < util-linux-2.11h-agetty.patch
patch -p1 -d util-linux-2.11h < util-linux-2.11h-cross.diff
patch -p1 -d util-linux-2.11h < util-linux-2.11h-msgfmt.diff
patch -p1 -d util-linux-2.11h < util-linux_2.11h-1.diff
patch -p1 -d util-linux-2.11h < util-linux-initd.diff
patch -p1 -d util-linux-2.11h < mvl-util-linux-xtensa.patch

Yes, patch gets fuzzy on some of the patches. So either Sony used fuzzy source to compile the Sony Reader Firmware or they haven't supplied us with the actual sources.

I figure its close enough for my purposes so far.

It's Friday evening and the wife wants to go see Ghost Rider. Evidently it is may be based on a classic Chinese story of some sort, so we're off to conduct research. :D

If you want this series to continue then post/karma/PM, lack of interest will result in my not taking the time to post this stuff.

igorsk
02-16-2007, 07:18 PM
Well, the packages provided by Sony are for MontaVista Linux, so it's understandable that other distros will require additional patches.
That said, I'm not sure what's the point of rebuilding the kernel at this moment. Is the stock one not working properly or something? The sources for Fsk or UsbUpdater are not public, so you won't be able to reproduce the full firmware (and the kernel wasn't updated in the latest patch anyway).
I'd prefer you've just released the upgrader already, even if just to get the folks from the-ebook.org forums off my back :D

porkupan
02-16-2007, 08:38 PM
Well, it's still useful to know how to prepare a development environment for the Reader (assuming some of us will eventually try to write custom applications). Besides, you may not be able to compile without first building the libraries and getting the include directories in place...

Did Sony supply a crosscompiler, or did you use the Crosstool, Scotty? At some point it might be nice just to make the entire develpment environement available for download and/or install.

IMHO, the info in the top post definitely belongs in the Sony Reader Hack Wiki.

scotty1024
02-16-2007, 11:32 PM
Well, the packages provided by Sony are for MontaVista Linux, so it's understandable that other distros will require additional patches.
That said, I'm not sure what's the point of rebuilding the kernel at this moment. Is the stock one not working properly or something? The sources for Fsk or UsbUpdater are not public, so you won't be able to reproduce the full firmware (and the kernel wasn't updated in the latest patch anyway).
I'd prefer you've just released the upgrader already, even if just to get the folks from the-ebook.org forums off my back :D

I hear your pain, but I'm not rebuilding the kernel. Sony seems to have put the gravy train kernel with biscuit wheels into the Reader. :)

I'm after the things I need to build that executable we talked about, and it needs some special sauce to complete the task we have in mind for it.

lint
02-17-2007, 12:55 AM
thank you guys for keeping up with the fiddling...

-lint

scotty1024
02-17-2007, 01:45 AM
Well, the packages provided by Sony are for MontaVista Linux, so it's understandable that other distros will require additional patches.


Almost forgot, the distro has nothing to do with the patch issues. The patches are being applied to the source in the packages, not the source that came with the distro.