Skip to content

Instantly share code, notes, and snippets.

@danielrichman
Created May 30, 2012 15:47
Show Gist options
  • Save danielrichman/2837109 to your computer and use it in GitHub Desktop.
Save danielrichman/2837109 to your computer and use it in GitHub Desktop.
raspi debian installer
Kernel

Prebuilt kernel & other files: http://drichman.net/files/raspi/d-i-disk.tar.gz Skip to Partitioning

Downlaods

sudo apt-get install gcc-4.6-arm-linux-gnueabi build-essential \
    libncurses-dev
sudo ln -s /usr/bin/arm-linux-gnueabi-gcc{-4.6,}
git clone https://github.com/raspberrypi/linux.git
git clone https://github.com/raspberrypi/tools.git
git clone https://github.com/raspberrypi/firmware.git
cd linux
wget http://ftp.debian.org/debian/dists/testing/main/installer-armel/current/images/versatile/netboot/initrd.gz
gunzip initrd.gz
mv initrd d-i-initrd.cpio.orig

Config

cp arch/arm/configs/bcmrpi_cutdown_defconfig .config
make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- menuconfig

In section "General Setup":

  • enable initrd
  • initrd path: d-i-initrd.cpio
  • Built in initrd compression: gzip

Modify initrd

TODO: Might be able to use fakeroot rather than cpio.

mkdir d-i-initrd
cd d-i-initrd
sudo cpio -i < ../d-i-initrd.cpio.orig

Remove modules, since they are for another kernel. Optionally at this point you could add a preseed file.

sudo rm -rf lib/modules

Repack

find . | cpio --create --format=newc > ../d-i-initrd.cpio

Build

make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- -j4

Odd stuff

cd ..
tools/mkimage/imagetool-uncompressed.py arch/arm/boot/Image

Partitioning

Repartition disk, creating a 64MB FAT32 partition only.

Mount it, then

cp kernel.img /media/disk/
cp firmware/boot/{arm*.elf,bootcode.bin,loader.bin} /media/disk
cp firmware/boot/arm224_start.elf /media/disk/start.elf

echo "dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 priority=low" > /media/disk/cmdline.txt

Install

Boot, and follow install instructions

  • priority=low will start the installer in expert mode
  • "lowmem" is a good choice on the download extra components screen.
  • When prompted "cannot load kernel modules", choose to proceed without.
  • If warned about lacking RAID and LVM, ignore. They are not built with the default kernel either.
  • Partitioning: Choose "Guided - use largest available space". We cannot add the /boot mount until after installation since the installer wont let you pick a fat32 partition for that.
  • The installer will fail to install a kernel (it's not in debian); see below. Having failed, it will offer "continue without a bootloader" later on, which you should choose.

Post install

  • Replace /media/disk/kernel.img with firmware/boot/kernel.img

  • Reset cmdline.txt (note, ensure that the root= is correct. You will be told what your root is when you choose the 'continue without a bootloader' step.

     echo "dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p5 rootfstype=ext4 rootwait" > /media/disk/cmdline.txt
    
  • Replace start.elf with desired split

  • Install /opt/vc files, /lib/modules/ for kernel

  • Add /boot to fstab:

     /dev/mmcblk0p1  /boot           vfat    defaults        0       0
    
  • Add to /etc/sysctl.conf

     vm.min_free_kbytes=8192
     vm.swappiness=1
    
  • Add to /etc/inittab

     A0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100
    
TODO
  • deb package for kernel. Automatic replacement of d-i kernel?
  • apply vm.min_free_kbytes to installer too.
  • suggestion of guided partition creates ext4/root as a logical partition
Links
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment