Warning: THE VOID WIKI IS DEPRECATED. It is no longer being maintained, contains outdated and incorrect information, and will eventually be shut down. Please refer to the Void Handbook, https://docs.voidlinux.org/, for the official documentation. If you can't find the information you're seeking, please raise an issue at https://github.com/void-linux/void-docs/issues

Difference between revisions of "Cubieboard2 SD-Card"

From Void Linux Wiki
Jump to navigation Jump to search
(Created page with "== rootfs-install == Grab latest rootfs for the Cubieboard2: <pre>$ wget http://repo.voidlinux.eu/live/void-cubieboard2-rootfs-latest.tar.xz</pre> <blockquote>Make sure to c...")
 
(.eu address no longer valid)
 
(5 intermediate revisions by 4 users not shown)
Line 3: Line 3:
 
Grab latest rootfs for the Cubieboard2:
 
Grab latest rootfs for the Cubieboard2:
  
<pre>$ wget http://repo.voidlinux.eu/live/void-cubieboard2-rootfs-latest.tar.xz</pre>
+
$ wget <nowiki>https://alpha.de.repo.voidlinux.org/live/current/void-cubieboard2-PLATFORMFS-<date>.tar.xz</nowiki>
<blockquote>Make sure to check that sha256 is correct. The sha256 hash is stored in the <code>sha256sums.txt</code> file.
+
 
</blockquote>
+
{{tip|Make sure to check that sha256 is correct. The sha256 hash is stored in the <code>sha256sums.txt</code> file.}}
 +
 
 
=== Preparing the SD card ===
 
=== Preparing the SD card ===
  
The SD card must have at least 2 partitions, one as '''FAT''' for <code>/boot</code> and another one as <code>ext4</code> (the default kernel cmdline expects the rootfs to be in ext4) for /; let's begin preparing the partitions and mounting them in a directory:
+
The SD card must have at least 2 partitions, one as '''FAT''' for <code>/boot</code> and another one as <code>ext4</code> (the default kernel cmdline expects the rootfs to be in ext4) for <code>/</code>; let's begin preparing the partitions and mounting them in a directory:
  
 
<pre>$ parted /dev/sda &lt;- change this to match your SD card
 
<pre>$ parted /dev/sda &lt;- change this to match your SD card
Line 20: Line 21:
 
(parted) mkpart primary ext4 64MB -1
 
(parted) mkpart primary ext4 64MB -1
 
(parted) quit</pre>
 
(parted) quit</pre>
 +
 
Now let's create the filesystems in the SD card:
 
Now let's create the filesystems in the SD card:
  
 
<pre> $ mkfs.vfat /dev/sda1 &lt;- change this to match your SD card and FAT32 partition
 
<pre> $ mkfs.vfat /dev/sda1 &lt;- change this to match your SD card and FAT32 partition
 
  $ mkfs.ext4 -O ^has_journal /dev/sda2 &lt;- change this to match your SD card and ext4 partition</pre>
 
  $ mkfs.ext4 -O ^has_journal /dev/sda2 &lt;- change this to match your SD card and ext4 partition</pre>
 +
 
The <code>-O ^has_journal</code> option disables journaling on ext4 partition. It'll extend the life of your drive (usually Flash drives).
 
The <code>-O ^has_journal</code> option disables journaling on ext4 partition. It'll extend the life of your drive (usually Flash drives).
  
Line 32: Line 35:
 
  # mkdir -p ~/rootfs/boot
 
  # mkdir -p ~/rootfs/boot
 
  # mount /dev/sda1 ~/rootfs/boot</pre>
 
  # mount /dev/sda1 ~/rootfs/boot</pre>
 +
 
Unpack the rootfs into the target rootfs directory and sync to make sure files are written to storage:
 
Unpack the rootfs into the target rootfs directory and sync to make sure files are written to storage:
  
<pre> # tar xvfJp void-cubieboard2-rootfs-latest.tar.xz -C ~/rootfs
+
<pre> # tar xvfJp void-cubieboard2-PLATFORMFS-<date>.tar.xz -C ~/rootfs
 
  # sync</pre>
 
  # sync</pre>
<blockquote>Do not forget to unpack the rootfs as root and with the <code>-p</code> flag to set appropiate permissions.
+
 
</blockquote>
+
{{tip|Do not forget to unpack the rootfs as root and with the <code>-p</code> flag to set appropiate permissions.}}
 +
 
 
The <code>/boot</code> partition must also be added to <code>/etc/fstab</code>:
 
The <code>/boot</code> partition must also be added to <code>/etc/fstab</code>:
  
 
<pre> # echo '/dev/mmcblk0p1 /boot vfat defaults 0 2' &gt;&gt; ~/rootfs/etc/fstab</pre>
 
<pre> # echo '/dev/mmcblk0p1 /boot vfat defaults 0 2' &gt;&gt; ~/rootfs/etc/fstab</pre>
 +
 
=== Flashing the u-boot bootloader ===
 
=== Flashing the u-boot bootloader ===
  
 
<pre> # dd if=~/rootfs/boot/u-boot-sunxi-with-spl.bin of=/dev/sdX bs=1024 seek=8
 
<pre> # dd if=~/rootfs/boot/u-boot-sunxi-with-spl.bin of=/dev/sdX bs=1024 seek=8
 
  # sync</pre>
 
  # sync</pre>
 +
 
Umount the SD card filesystems from target rootfs directory.
 
Umount the SD card filesystems from target rootfs directory.
  
Insert the SD card and test the Cubieboard2 boots correctly, the <code>root</code> password is <code>voidlinux</code>.
+
Insert the SD card and check that the Cubieboard2 boots correctly, the <code>root</code> password is <code>voidlinux</code>.
  
 
== X11 ==
 
== X11 ==
Line 54: Line 61:
  
 
<pre>$ xbps-install -Sy xorg-minimal xf86-video-fbturbo-sunxi</pre>
 
<pre>$ xbps-install -Sy xorg-minimal xf86-video-fbturbo-sunxi</pre>
 +
 
To install all X client applications:
 
To install all X client applications:
  
 
<pre>$ xbps-install -Sy xorg-apps</pre>
 
<pre>$ xbps-install -Sy xorg-apps</pre>
 +
 
To install all X font packages:
 
To install all X font packages:
  
 
<pre>$ xbps-install -Sy xorg-fonts</pre>
 
<pre>$ xbps-install -Sy xorg-fonts</pre>
 +
 
As final step make sure the user running X is part of the groups ''audio'' and ''video''.
 
As final step make sure the user running X is part of the groups ''audio'' and ''video''.
  
Line 66: Line 76:
 
=== How to enable the serial console ===
 
=== How to enable the serial console ===
  
First make sure that <code>ttyS0</code> is listet within <code>/etc/securetty</code>. Then mount the rootfs and add the service:
+
First make sure that <code>ttyS0</code> is listed within <code>/etc/securetty</code>. Then mount the rootfs and add the service:
  
 
<pre> # mkdir ~/rootfs
 
<pre> # mkdir ~/rootfs
Line 72: Line 82:
 
  # ln -s /etc/sv/agetty-ttyS0 ~/rootfs/etc/runit/runsvdir/default
 
  # ln -s /etc/sv/agetty-ttyS0 ~/rootfs/etc/runit/runsvdir/default
 
  # umount ~/rootfs</pre>
 
  # umount ~/rootfs</pre>
 +
 
Now you should have a console on the serial port.
 
Now you should have a console on the serial port.
 +
 +
[[Category:Guides]]
 +
[[Category:Installation]]
 +
[[Category:Embedded]]

Latest revision as of 06:31, 13 January 2019

rootfs-install

Grab latest rootfs for the Cubieboard2:

$ wget https://alpha.de.repo.voidlinux.org/live/current/void-cubieboard2-PLATFORMFS-<date>.tar.xz
Tip: Make sure to check that sha256 is correct. The sha256 hash is stored in the sha256sums.txt file.

Preparing the SD card

The SD card must have at least 2 partitions, one as FAT for /boot and another one as ext4 (the default kernel cmdline expects the rootfs to be in ext4) for /; let's begin preparing the partitions and mounting them in a directory:

$ parted /dev/sda <- change this to match your SD card

# Create the FAT partition of 64MB and make it bootable
(parted) mktable msdos
(parted) mkpart primary fat32 2048s 64MB
(parted) toggle 1 boot

# Create the rootfs partition until end of device
(parted) mkpart primary ext4 64MB -1
(parted) quit

Now let's create the filesystems in the SD card:

 $ mkfs.vfat /dev/sda1 <- change this to match your SD card and FAT32 partition
 $ mkfs.ext4 -O ^has_journal /dev/sda2 <- change this to match your SD card and ext4 partition

The -O ^has_journal option disables journaling on ext4 partition. It'll extend the life of your drive (usually Flash drives).

Preparing target rootfs directory

 $ mkdir -p ~/rootfs
 # mount /dev/sda2 ~/rootfs/
 # mkdir -p ~/rootfs/boot
 # mount /dev/sda1 ~/rootfs/boot

Unpack the rootfs into the target rootfs directory and sync to make sure files are written to storage:

 # tar xvfJp void-cubieboard2-PLATFORMFS-<date>.tar.xz -C ~/rootfs
 # sync
Tip: Do not forget to unpack the rootfs as root and with the -p flag to set appropiate permissions.

The /boot partition must also be added to /etc/fstab:

 # echo '/dev/mmcblk0p1 /boot vfat defaults 0 2' >> ~/rootfs/etc/fstab

Flashing the u-boot bootloader

 # dd if=~/rootfs/boot/u-boot-sunxi-with-spl.bin of=/dev/sdX bs=1024 seek=8
 # sync

Umount the SD card filesystems from target rootfs directory.

Insert the SD card and check that the Cubieboard2 boots correctly, the root password is voidlinux.

X11

At the very least this is the list of required packages:

$ xbps-install -Sy xorg-minimal xf86-video-fbturbo-sunxi

To install all X client applications:

$ xbps-install -Sy xorg-apps

To install all X font packages:

$ xbps-install -Sy xorg-fonts

As final step make sure the user running X is part of the groups audio and video.

Troubleshooting

How to enable the serial console

First make sure that ttyS0 is listed within /etc/securetty. Then mount the rootfs and add the service:

 # mkdir ~/rootfs
 # mount /dev/sdX2 ~/rootfs
 # ln -s /etc/sv/agetty-ttyS0 ~/rootfs/etc/runit/runsvdir/default
 # umount ~/rootfs

Now you should have a console on the serial port.