Howto: Patch the 3.0.0 Debian testing (wheezy) kernel to boot on GoFlex Net/Home (tested with Debian squeeze) October 08, 2011 04:01PM |
Registered: 12 years ago Posts: 128 |
sudo apt-get install aptitude libncurses5 libncurses5-dev qt3-dev-tools libqt3-mt-dev build-essential fakeroot kernel-package libncurses5 libncurses5-dev patchNow we want to setup the codesourcery compiler via setup_codesourcery.sh script by Matthias "Maddes" Buecher. I attached the script to this post, but you can find this script on many sites, for example here. We can simply get the script via wget
mkdir ~/Kernel cd ~/Kernel wget http://ftp.maddes.net/hardware/Linkstation/setup_codesourcery.shNow let's install the compiler
chmod +x setup_codesourcery.sh sudo ./setup_codesourcery.shDownload the kernel patch for GoFlex Net and GoFlex Home provided my the Arch Linux ARM Project as well as Debian kernel sources and patches .
wget https://raw.github.com/archlinuxarm/PKGBUILDs/master/core/linux/archlinuxarm.patch wget http://ftp.ch.debian.org/debian/pool/main/l/linux-2.6/linux-source-3.0.0_3.0.0-3_all.deb wget http://ftp.ch.debian.org/debian/pool/main/l/linux-2.6/linux-patch-debian-3.0.0_3.0.0-3_all.deb wget http://ftp.ch.debian.org/debian/pool/main/l/linux-2.6/linux-support-3.0.0-1_3.0.0-3_all.debInstall the source packages
sudo dpkg -i linux-source-3.0.0_3.0.0-3_all.deb sudo dpkg -i linux-support-3.0.0-1_3.0.0-3_all.deb sudo dpkg -i linux-patch-debian-3.0.0_3.0.0-3_all.debExtract kernel source to the current directory
tar jxf /usr/src/linux-source-3.0.0.tar.bz2 cd linux-source-3.0.0Apply Debian patches and subsequently the GoFlex patch
/usr/src/kernel-patches/all/3.0.0/apply/debian patch -p1 < ../archlinuxarm.patchGet Debian kernel config for armel
wget http://kernel.alioth.debian.org/config/3.0.0-5/config_armel_none_kirkwood --directory-prefix ../ cp ../config_armel_none_kirkwood .configGo to the crosscompile environment and import the config.
codesourcery-arm-2009q3.sh make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- oldconfigYou will be asked two questions
Seagate GoFlex Net (MACH_GOFLEXNET) [N/y/?] (NEW) Seagate GoFlex Home (MACH_GOFLEXHOME) [N/y/?] (NEW)answer both of them with "y"
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- xconfigVery important! Disable mv_cesa completely! It doesn't work properly with the 3.0.0 kernel. If your system has more than one CPU, you can also do this to speed up the compilation process. The rule of thumb is number of CPUs + 1, which makes 3 for a Dual Core
export CONCURRENCY_LEVEL=3Clean up the mess
make-kpkg cleanLet's go
make-kpkg --rootcmd fakeroot --arch armel --cross-compile arm-none-linux-gnueabi- --append-to-version=-goflex --revision=1.1 --initrd kernel_imageThis will take some time depending on the power of your machine. After that, it's a good idea to compile kernel-headers too, just in case you'll need them someday.
make-kpkg --rootcmd fakeroot --arch armel --cross-compile arm-none-linux-gnueabi- --append-to-version=-goflex --revision=1.1 --initrd kernel_headersWhen finished, in ~/Kernel you will find a file called linux-image-3.0.0-goflex_1.1_armel.deb. Copy this to your GoFlex, for example to /root.
scp ~/Kernel/linux-image-3.0.0-goflex_1.1_armel.deb root@ip-of-the-goflex:/rootNow login to your GoFlex Net via ssh.
ssh root@ip-of-the-goflex cd /rootBefore you install your custom kernel, it's a good idea to install the official 3.0.0 kernel from the testing repo first. Why? Because when installing the "official" 3.x kernel for the first time, Debian apparently also updates linux-base and udev, which won't happend if you install your custom kernel only.
cat <<END > /etc/apt/preferences Package: * Pin: release a=stable Pin-Priority: 900 Package: * Pin: release o=Debian Pin-Priority: -10 END echo 'APT::Default-Release "stable";' >> /etc/apt/apt.confand add the testing repo to your sources.list
echo 'deb http://ftp.debian.org/debian/ testing main contrib' >> /etc/apt/sources.list apt-get updateInstall the official kernel
apt-get install -t testing linux-image-2.6-kirkwood and the custom kernel dpkg -i linux-image-3.0.0-goflex_1.1_armel.deb mkdir /lib/modules/3.0.0-goflex/kernel/archDon't remove that official kernel (packages linux-image-kirkwood etc.) even if you don't use it. Removing it may cause troubles so better keep it there.
cd /boot cp uImage uImage.old cp uInitrd uInitrd.old mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n Linux-3.0.0 -d /boot/vmlinuz-3.0.0-goflex /boot/uImage mkimage -A arm -O linux -T ramdisk -C gzip -a 0 -e 0 -n Linux-3.0.0 -d /boot/initrd.img-3.0.0-goflex /boot/uInitrd
cp /path-to-rootfs/boot/uImage.old /path-to-rootfs/boot/uImage cp /path-to-rootfs/boot/uInitrd /path-to-rootfs/boot/uInitrdThis will give you the old kernel back
sudo tune2fs -L "rootfs" /dev/whateverwhere /dev/whatever is the path to the partition containing the rootfs for GoFlex Net
fw_setenv usb_init "run usb_scan; setenv usb_root LABEL=rootfs"after that reboot and you're done. For more information on this solution check out this thread
cd /boot mkdir initrd.img-new && cp initrd.img-3.0.0-goflex initrd.img-new/ cd initrd.img-new/ && gzip -dc initrd.img-3.0.0-goflex | cpio -id rm initrd.img-3.0.0-goflex nano initFind the section which looks like
if [ -n "${noresume}" ]; then export noresume unset resume else resume=${RESUME:-} fiand replace it by
if [ -n "${noresume}" ]; then export noresume unset resume else resume=${RESUME:-} fi ROOT="/dev/disk/by-label/rootfs"Save your changes (Ctrl+W) and exit (Ctrl+X) nano. Now run
find ./ | cpio -H newc -o > ../initrd.img-3.0.0-goflex_arc gzip ../initrd.img-3.0.0-goflex_arc mv ../initrd.img-3.0.0-goflex_arc.gz ..//initrd.img-3.0.0-goflex_mod cd .. rm -r initrd.img-new mkimage -A arm -O linux -T ramdisk -C gzip -a 0 -e 0 -n Linux-3.0.0 -d /boot/initrd.img-3.0.0-goflex_mod /boot/uInitrdThe purpose of all this is to hardcode a rootfs partition. In this case we tell the kernel (via initramfs) that the rootfs partition is a partition with the label "rootfs". This is a very ugly hack but it works when everything else fails.
cd ~/Kernel dpkg-deb -x linux-headers-3.0.0-goflex_1.1_armel.deb linux-headers-3.0.0-goflex_1.1_armel_hacked dpkg-deb -e linux-headers-3.0.0-goflex_1.1_armel.deb linux-headers-3.0.0-goflex_1.1_armel_hacked/DEBIAN nano linux-headers-3.0.0-goflex_1.1_armel_hacked/DEBIAN/controlRemove libaudio 2, libfontconfig1, libfreetype6, libice6, libqt3-mt, libsm6, libx11-6, libxcursor1, libxext6, libxft2, libxi6, libxinerama1, libxrandr2, libxrender1, libxt6 from the Depends line.
dpkg-deb -b linux-headers-3.0.0-goflex_1.1_armel_hacked rm -r linux-headers-3.0.0-goflex_1.1_armel_hackedcopy linux-headers-3.0.0-goflex_1.1_armel_hacked.deb to your device and install it via
dpkg -i linux-headers-3.0.0-goflex_1.1_armel_hacked.deb
Re: Howto: Patch the 3.0.0 Debian testing (wheezy) kernel to boot on GoFlex Net/Home (tested with Debian squeeze) October 08, 2011 05:06PM |
Registered: 12 years ago Posts: 128 |
CONFIG_IP_PNP CONFIG_IP_PNP_DHCP CONFIG_IP_PNP_BOOTPand not enabled in the Debian kernel by default.
Re: Howto: Patch the 3.0.0 Debian testing (wheezy) kernel to boot on GoFlex Net/Home (tested with Debian squeeze) October 09, 2011 04:41PM |
Registered: 12 years ago Posts: 128 |
Nigel Roberts
Re: Howto: Patch the 3.0.0 Debian testing (wheezy) kernel to boot on GoFlex Net/Home (tested with Debian squeeze) April 01, 2012 07:05AM |
Djamu
Re: Howto: Patch the 3.0.0 Debian testing (wheezy) kernel to boot on GoFlex Net/Home (tested with Debian squeeze) April 18, 2012 06:46PM |
export CONCURRENCY_LEVEL=`getconf _NPROCESSORS_ONLN`which will set the correct amount of threads