Difference between revisions of "Debian Init Update (PVT)"

From Studio Kousagi Wiki
Jump to: navigation, search
(Copy a kernel and device tree onto the card)
(Configure your machine type)
Line 118: Line 118:
 
==Configure your machine type==
 
==Configure your machine type==
  
First, configure the hardware options using novena-eeprom. You will also need to set a MAC address for eth0 if you want to use it, and a serial number.
+
Configure the hardware options using novena-eeprom. You will also need to set a MAC address for eth0 if you want to use it, and a serial number.
  
 
The recommended options are es8328,retina,pcie,gbit,hdmi
 
The recommended options are es8328,retina,pcie,gbit,hdmi
 
Then, run
 
 
tasksel
 
 
to configure the machine beyond the basic debian minimum.
 
  
 
==Add packages==
 
==Add packages==

Revision as of 10:17, 8 January 2014

Bootstrapping Debian

Assumes you are initializing a single SD card for booting. You can also do SD card + SATA SSD, the procedure is similar except the boot partition is on the SD card and the data partition on the SSD. It's recommended to still keep the VFAT boot partition on the SSD even though it's not used at the moment, for forward compatibility reasons.

Assumes you have a debian host (in particular, another Novena...) to bootstrap a new card first.

Make partitions

Build two partitions. Partition 1 should be 32M in size and of type W95 FAT32 and holds the kernel and device tree. Partition 2 should fill the rest of the disk and should be type Linux.

Disk /dev/mmcblk1: 3965 MB, 3965190144 bytes
1 heads, 16 sectors/track, 484032 cylinders, total 7744512 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

        Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk1p1            2048       67583       32768    b  W95 FAT32
/dev/mmcblk1p2           67584     7744511     3838464   83  Linux

Build filesystems

sudo mkfs.ext4 /dev/mmcblk1p2 # make ext4 filesystem on the larger partition
sudo mkfs.vfat /dev/mmcblk1p1 # make FAT filesystem on the boot partition

Mount and bootstrap the filesystem

sudo mount /dev/mmcblk1p2 /mnt
sudo debootstrap wheezy ~/mnt http://bunniefoo.com/debian  # replace URL with your favorite mirror

Several minutes pass. You become sleepy.

Add Kosagi package server

While you are waiting, you grab these files:

wget http://bunniefoo.com/novena/debian/sources.list  # contains the bunniefoo mirror for novena local packages
wget http://bunniefoo.com/novena/debian/trusted.gpg   # contains public keys

These contain links so you can grab the novena-specific packages, which for now we're serving as we're still in development mode.

Once debian is done initializing the filesystem, install the new sources and key files:

sudo cp ./sources.list /mnt/etc/apt/
sudo cp ./trusted.gpg /mnt/etc/apt/

Now run an update to grab the new packages, but in a chroot environment:

sudo chroot /mnt apt-get update

Set a password

You should probably set a root password on the new image. Make sure you don't forget to chroot or else you'll set it on your own machine!

sudo chroot /mnt/ passwd

FIXME Install novena-eeprom

novena-eeprom is a utility to manipulate the hardware configuration template stored in the on-board EEPROM. As of the writing of this guide, novena-eeprom is not yet a package in debian. That's why this section is a FIXME. It's quite possible by the time you read this, this step will be fixed.

wget http://bunniefoo.com/novena/debian/novena-eeprom
chmod a+x novena-eeprom
sudo cp novena--eeprom /mnt/usr/sbin/

Add SDMA firmware

sudo chroot /mnt/ apt-get install imx-sdma-firmware

You will need this to boot.

Enable login via console

sudo emacs /mnt/etc/inittab # or whatever your favorite editor is

Add this to the end of the file:

T1:2345:respawn:/sbin/getty -L ttymxc1 115200 vt100

Copy a kernel and device tree onto the card

The kernel and device tree are a bit of a moving target at the moment, so no link is provided; but basically, you need a boot.scr, a uImage, and a uImage.dtb file on the win32 partition of the card.

You can build your own kernel by following directions here: http://www.kosagi.com/w/index.php?title=Building_novena_firmware#Making_kernel_changes

Copy a u-boot onto the card

You'll need a u-boot. You can build source from this link: http://www.kosagi.com/w/index.php?title=Building_novena_firmware#Getting_and_building_u-boot

Once you have u-boot built, you need to place it at the right sector in the card for loading with this command:

sudo dd if=u-boot.imx of=/dev/mmcblk1 seek=2

Setup the u-boot script to point to the right filesystem

Make sure the kernel args point to the right location for the filesystem you want to use.

/dev/mmcblk0p2 if you're sourcing from the internal microSD card /dev/sda2 if you're going from an external SATA drive

Also note that due to a bug in the pfuze driver boot is more reliable if you turn of early printk.

If you want console output also specify console=ttymxc1,115200 in the bootargs.

The command to generate the u-boot script (just to jog my memory) is

mkimage -T script -C none -n 'Novena Boot Script' -d <scriptname.txt> boot.scr

Boot into the native environment

Install the initialized card into the target platform, and boot it. It should come up to a shell.

But wait, you're not done yet. Make sure you have a net connection on the target and you'll need to execute the following commands on the *new* machine.

Configure your machine type

Configure the hardware options using novena-eeprom. You will also need to set a MAC address for eth0 if you want to use it, and a serial number.

The recommended options are es8328,retina,pcie,gbit,hdmi

Add packages

Here's some recommended packages:

sudo apt-get install build-essential openssh-server systemd

You'll want systemd so login prompt comes faster (e.g. scripts are blocking the console login). You'll want SSH so you can log into your machine via net. build-essential will be needed for you to compile stuff.

You have to install ssh and systemd from the native environment and not a chroot environment.

From there, the machine is pretty much primed and ready for use.