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

From Studio Kousagi Wiki
Jump to: navigation, search
(Created page with "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 p...")
 
Line 1: Line 1:
 +
=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 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==
 
==Make partitions==
Line 29: Line 33:
 
  sudo debootstrap wheezy ~/mnt http://bunniefoo.com/debian  # replace URL with your favorite mirror
 
  sudo debootstrap wheezy ~/mnt http://bunniefoo.com/debian  # replace URL with your favorite mirror
  
Several minutes pass.
+
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/
 +
 
 +
==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
 +
 
 +
==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.

Revision as of 06:53, 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/

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

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.