Difference between revisions of "Novena/Debian Wheezy Bootstrap"
Jimmy Tang (talk | contribs) |
Jimmy Tang (talk | contribs) |
||
Line 36: | Line 36: | ||
<pre> | <pre> | ||
sudo apt-get install -y qemu-utils apt-cacher-ng build-essential less rsync lzop u-boot-tools git debhelper bc device-tree-compiler parted | sudo apt-get install -y qemu-utils apt-cacher-ng build-essential less rsync lzop u-boot-tools git debhelper bc device-tree-compiler parted | ||
+ | </pre> | ||
+ | |||
+ | Here's is a run down of all the steps needed to generate a base image | ||
+ | |||
+ | <pre> | ||
+ | # create image, then map it to a nbd, create and format partitions | ||
+ | qemu-img create novena.img 4G | ||
+ | # might need this | ||
+ | # sudo modprobe nbd max_part=16 | ||
+ | sudo qemu-nbd --connect=/dev/nbd0 novena.img | ||
+ | sudo parted --script /dev/nbd0 -- mklabel msdos | ||
+ | # there might be alignment issues -- need to test | ||
+ | sudo parted --script /dev/nbd0 -- mkpart primary fat32 1 64 | ||
+ | #sudo parted --script /dev/nbd0 -- mkpart primary fat32 0 64 | ||
+ | sudo parted --script /dev/nbd0 -- mkpart primary ext4 64 -0 | ||
+ | #sudo parted --script /dev/nbd0 -- set 1 boot on | ||
+ | sudo mkfs.ext4 /dev/nbd0p2 | ||
+ | sudo mkfs.vfat /dev/nbd0p1 | ||
+ | |||
+ | # mount the ext4 partition | ||
+ | sudo mount /dev/nbd0p2 /mnt | ||
+ | |||
+ | # use local apt-cacher-ng proxy | ||
+ | sudo debootstrap --include=sudo,openssh-server,ntpdate,dosfstools,sysvinit,fbset,less,xserver-xorg-video-modesetting,task-xfce-desktop,hicolor-icon-theme,gnome-icon-theme,tango-icon-theme,i3-wm,i3status wheezy /mnt http://127.0.0.1:3142/ftp.ie.debian.org/debian/ | ||
+ | |||
+ | # basic configuration | ||
+ | |||
+ | sudo mount --bind /dev/ /mnt/dev | ||
+ | sudo mount --bind /dev/pts /mnt/dev/pts | ||
+ | sudo chroot /mnt mount -t proc none /proc | ||
+ | sudo chroot /mnt mount -t sysfs none /sys | ||
+ | |||
+ | sudo cp files/usr/sbin/policy-rc.d /mnt/usr/sbin/policy-rc.d | ||
+ | echo root:kosagi | sudo chroot /mnt /usr/sbin/chpasswd | ||
+ | |||
+ | # install some basic things needed to kick of the networking etc... | ||
+ | sudo cp files/hostname /mnt/etc/hostname | ||
+ | sudo cp files/hosts /mnt/etc/hosts | ||
+ | sudo cp files/fstab /mnt/etc/fstab | ||
+ | sudo cp files/network/interfaces /mnt/etc/network/interfaces | ||
+ | sudo cp files/etc/apt/sources.list.d/kosagi.list /mnt/etc/apt/sources.list.d/kosagi.list | ||
+ | sudo cp files/etc/apt/sources.list /mnt/etc/apt/sources.list | ||
+ | sudo cp files/kosagi.gpg.key /mnt/root/kosagi.gpg.key | ||
+ | sudo chroot /mnt apt-key add /root/kosagi.gpg.key | ||
+ | sudo chroot /mnt apt-get update -y | ||
+ | sudo chroot /mnt env DEBCONF_NONINTERACTIVE_SEEN=true DEBIAN_FRONTEND=noninteractive apt-get install -y imx-sdma-firmware | ||
+ | sudo chroot /mnt apt-get clean -y | ||
+ | |||
+ | sudo cp binaries/*.deb /mnt/root | ||
+ | sudo chroot /mnt dpkg -i /root/linux-firmware-image-3.16.0-rc2-28074-g8b39edb_1.2_armhf.deb | ||
+ | sudo chroot /mnt dpkg -i /root/linux-image-3.16.0-rc2-28074-g8b39edb_1.2_armhf.deb | ||
+ | sudo chroot /mnt dpkg -i /root/linux-headers-3.16.0-rc2-28074-g8b39edb_1.2_armhf.deb | ||
+ | |||
+ | sudo rm /mnt/usr/sbin/policy-rc.d | ||
+ | sudo mkdir -p /mnt/etc/X11 | ||
+ | sudo cp files/etc/X11/xorg.conf /mnt/etc/X11/xorg.conf | ||
+ | sudo cp files/etc/inittab /mnt/etc/inittab | ||
+ | sudo cp files/etc/default/locale /mnt/etc/default/locale | ||
+ | |||
+ | # setup boot loader | ||
+ | sudo mkdir -p /mnt/boot/bootloader | ||
+ | sudo mount /dev/nbd0p1 /mnt/boot/bootloader | ||
+ | sudo cp binaries/uImage /mnt/boot/bootloader/uImage | ||
+ | sudo cp binaries/imx6q-novena.dtb /mnt/boot/bootloader/uImage.dtb | ||
+ | sudo cp boot.scr /mnt/boot/bootloader/boot.scr | ||
+ | |||
+ | sudo chroot /mnt umount /proc | ||
+ | sudo chroot /mnt umount /sys | ||
+ | sudo umount /mnt/dev/pts | ||
+ | sudo umount /mnt/dev | ||
+ | |||
+ | sudo umount /mnt/boot/bootloader | ||
+ | sudo umount /mnt | ||
+ | sudo dd if=binaries/u-boot.imx of=/dev/nbd0 seek=2 bs=512 conv=notrunc | ||
+ | sudo qemu-nbd -d /dev/nbd0 | ||
</pre> | </pre> |
Revision as of 11:19, 10 July 2014
Debian Wheezy Debootstrap
A VERY ROUGH SET OF INSTRUCTIONS, RUN WITH CARE
This set of instructions assumes you have a functioning Novena board with Debian Wheezy. These instructions are primarily for people who want to re-create the firmware/base image. It relies on various bits and pieces of information on this wiki.
Prerequisites
- An existing Novena board running Debian Wheezy .
- Root access on your board, ideally have sudo access with no password.
- A 4gb microsd card.
- A reasonably fast network connection.
- Approximately 10gigs of free diskspace (more is probably better so you can cache things during testing/dev) - ideally get a SSD plugged into the board.
- Assumes 'you as a user' has tried building a linux kernel, u-boot etc...
- i.e. we assume you have generated the kernel debian packages, uImage, uImage.dtb, the relevant boot loader and boot scripts.
Summary
- generate u-boot boot loader and boot script
- generate uImage and uImage.dtb file
- generate debian packages for the kernel
- generate a blockdevice or use a real sdcard
- qemu-nbd was used in this example
- first partition is a fat32 partition for the kernel and boot.scr
- second partition is for the operating system
- debootstrap the second partition (via apt-cacher-ng to reduce network traffic)
Steps
Install at least these things...
sudo apt-get install -y qemu-utils apt-cacher-ng build-essential less rsync lzop u-boot-tools git debhelper bc device-tree-compiler parted
Here's is a run down of all the steps needed to generate a base image
# create image, then map it to a nbd, create and format partitions qemu-img create novena.img 4G # might need this # sudo modprobe nbd max_part=16 sudo qemu-nbd --connect=/dev/nbd0 novena.img sudo parted --script /dev/nbd0 -- mklabel msdos # there might be alignment issues -- need to test sudo parted --script /dev/nbd0 -- mkpart primary fat32 1 64 #sudo parted --script /dev/nbd0 -- mkpart primary fat32 0 64 sudo parted --script /dev/nbd0 -- mkpart primary ext4 64 -0 #sudo parted --script /dev/nbd0 -- set 1 boot on sudo mkfs.ext4 /dev/nbd0p2 sudo mkfs.vfat /dev/nbd0p1 # mount the ext4 partition sudo mount /dev/nbd0p2 /mnt # use local apt-cacher-ng proxy sudo debootstrap --include=sudo,openssh-server,ntpdate,dosfstools,sysvinit,fbset,less,xserver-xorg-video-modesetting,task-xfce-desktop,hicolor-icon-theme,gnome-icon-theme,tango-icon-theme,i3-wm,i3status wheezy /mnt http://127.0.0.1:3142/ftp.ie.debian.org/debian/ # basic configuration sudo mount --bind /dev/ /mnt/dev sudo mount --bind /dev/pts /mnt/dev/pts sudo chroot /mnt mount -t proc none /proc sudo chroot /mnt mount -t sysfs none /sys sudo cp files/usr/sbin/policy-rc.d /mnt/usr/sbin/policy-rc.d echo root:kosagi | sudo chroot /mnt /usr/sbin/chpasswd # install some basic things needed to kick of the networking etc... sudo cp files/hostname /mnt/etc/hostname sudo cp files/hosts /mnt/etc/hosts sudo cp files/fstab /mnt/etc/fstab sudo cp files/network/interfaces /mnt/etc/network/interfaces sudo cp files/etc/apt/sources.list.d/kosagi.list /mnt/etc/apt/sources.list.d/kosagi.list sudo cp files/etc/apt/sources.list /mnt/etc/apt/sources.list sudo cp files/kosagi.gpg.key /mnt/root/kosagi.gpg.key sudo chroot /mnt apt-key add /root/kosagi.gpg.key sudo chroot /mnt apt-get update -y sudo chroot /mnt env DEBCONF_NONINTERACTIVE_SEEN=true DEBIAN_FRONTEND=noninteractive apt-get install -y imx-sdma-firmware sudo chroot /mnt apt-get clean -y sudo cp binaries/*.deb /mnt/root sudo chroot /mnt dpkg -i /root/linux-firmware-image-3.16.0-rc2-28074-g8b39edb_1.2_armhf.deb sudo chroot /mnt dpkg -i /root/linux-image-3.16.0-rc2-28074-g8b39edb_1.2_armhf.deb sudo chroot /mnt dpkg -i /root/linux-headers-3.16.0-rc2-28074-g8b39edb_1.2_armhf.deb sudo rm /mnt/usr/sbin/policy-rc.d sudo mkdir -p /mnt/etc/X11 sudo cp files/etc/X11/xorg.conf /mnt/etc/X11/xorg.conf sudo cp files/etc/inittab /mnt/etc/inittab sudo cp files/etc/default/locale /mnt/etc/default/locale # setup boot loader sudo mkdir -p /mnt/boot/bootloader sudo mount /dev/nbd0p1 /mnt/boot/bootloader sudo cp binaries/uImage /mnt/boot/bootloader/uImage sudo cp binaries/imx6q-novena.dtb /mnt/boot/bootloader/uImage.dtb sudo cp boot.scr /mnt/boot/bootloader/boot.scr sudo chroot /mnt umount /proc sudo chroot /mnt umount /sys sudo umount /mnt/dev/pts sudo umount /mnt/dev sudo umount /mnt/boot/bootloader sudo umount /mnt sudo dd if=binaries/u-boot.imx of=/dev/nbd0 seek=2 bs=512 conv=notrunc sudo qemu-nbd -d /dev/nbd0