Rebuilding the boot partition on 410c

Hi ndec:

First an update. When I build the kernel on a i7 box running Ubuntu the kernel that gets built works. My issues came when I tried to build the kernel on the 410c.

When cross compiling on an i7 the instructions say to use compiler gcc-linaro-4.9-2014.11-x86_64-aarch-linux-gnu, but the boot log messages say the released kernel was actually build with (gcc version 4.9.2 20140904 (prerelease) (crosstool-NG linaro-1.13.1-4.9-2014.09 - Linaro GCC 4.9-2014.09) Note the month is different.

I tried getting the initrd-4.0.0-qcom-lt from two different places. The two files are different but neither works.

  1. download from the 96Boards site: https://builds.96boards.org/releases/dragonboard410c/linaro/ubuntu/15.07/initrd.img-4.0.0-linaro-lt-qcom
  2. from the 410c board by copying /boot/initrd.img

I’ll follow up with a failing log soon.

Quick follow up on the problems I was having rebuilding the kernel on the 410c. It turns out I had run into an known issue with the current release (15.07) that has been identified and fixed, all I needed to do was include the correct patch and the build worked. Here are my ‘revised’ instructions on how to successfully rebuild the kernel on the 410c, you will not there is a cherry-pick command added after fetching the source and before compiling it.

Hardware

  • 410c board and power supply.
  • HDMI Display
  • USB Mouse and Keyboard
  • 8GB SDCard (for installing Linux)
  • 8GB SDCard (for swap space to build)
    410c Setup

Install Ubuntu. Follow the SDCard install instructions here (use the 8GB SDCard):

o http://linaro.co/96b-linuxuserguide

Set MAC address

o Start ->other -> bash
o cd /lib/firmware/wlan
o sudo vi macaddr0
 Change mac adder to match sticker on board
 <esc>:wq
o reboot
o Connect to access point

Check mac address matches sticker on board.

o Start ->other -> bash
o ifconfig

install a 8GB SDCard, partition it, and mount it.

o sudo gdisk /dev/mmcblk1p1
o Command (? for help): o
o This option deletes all partitions and creates a new protective MBR.
o Proceed? (Y/N): y
o #build a 8GB partition for swap
o Command (? for help): n
o Partition number (1-128, default 1):
o First sector (34-8388574, default = 2048) or {±}size{KMGTP}:
o Last sector (2048-8388574, default = 8388574) or {±}size{KMGTP}: 8G
o Current type is ‘Linux filesystem’
o Hex code or GUID (L to show codes, Enter = 8300): 8200
o Changed type of partition to ‘Linux swap’
o
o Command (? for help): w
o Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING PARTITIONS!!
o Do you want to proceed? (Y/N): y
o

Reboot and run the following commands

o sudo mkswp /dev/mmcblk1p1

edit /etc/fstab and add the following line

o sudo vi /etc/fstab
/dev/mmcblk1p1 none swap sw 0 0
<esc>:wq

Reboot and run the following commands

o free # ensure swap is mounted

Install dev tools and support programs

Login to linaro/linaro. Start -> Other -> bash

o sudo apt-get update
o sudo apt-get install linux-headers-$(uname -r) build-essential
o sudo apt-get install linux-headers-$(uname -r) –fix-missing build-essential
o sudo apt-get install git
o sudo apt-get install device-tree-compiler

fetch the kernel sources and rebuild them

o cd /usr/src
o sudo mkdir linux-4.0.0
o sudo chown linaro linux-4.0.0
o sudo chgrp linaro linux-4.0.0
o cd linux-4.0.0
o git clone -n working/qualcomm/kernel.git - Qualcomm Landing Team kernel
o cd kernel
o git checkout -b kernel-15.07 ubuntu-qcom-dragonboard410c-15.07
o git cherry-pick –n fb68837eb7fbd9e65f6b9ed40718caa2b00452f1
o export ARCH=arm64
o make defconfig distro.config
o make -j4 Image dtbs modules
o sudo make INSTALL_MOD_STRIP=1 modules_install
o sudo make install #<-- it would be nice if this worked, then we wouldn’t need to do the remaining steps.

use the ramdisk that you just built

o cp /boot/initrd.img-4.0.0 .
o #wget http://builds.96boards.org/snapshots/dragonboard410c/linaro/ubuntu/latest/initrd.img-*

build the boot img file and install it onto the boot partition

o git clone git://codeaurora.org/quic/kernel/skales
o skales/dtbTool -o dt.img -s 2048 arch/arm64/boot/dts/qcom/
o export cmdline=“root=/dev/disk/by-partlabel/rootfs rw rootwait console=ttyMSM0,115200n8”
o skales/mkbootimg --kernel arch/arm64/boot/Image
o --ramdisk initrd.img-4.0.0
o --output boot-db410c.img
o --dt dt.img
o --pagesize 2048
o --base 0x80000000
o --cmdline “$cmdline”
o sudo dd if=boot-db410c.img of=/dev/mmcblk0p8
o sync
o reboot

thanks for the follow up message, just for the record, the issue you mentioned and that you hit is this one:

https://bugs.96boards.org/show_bug.cgi?id=80

In the following command for building the swap

# Reboot and run the following commands
o	sudo mkswp /dev/mmcblk1p1

should be:

# Reboot and run the following commands
o	sudo mkswap /dev/mmcblk1p1

Hi Linaro,
The source of this problem is https://github.com/96boards/documentation/wiki/Dragonboard-410c-Boot-Image listing "export cmdline=“root=/dev/ram0 rw rootwait console=ttyMSM0,115200n8"”. Can you please change it to "export cmdline=“root=/dev/disk/by-partlabel/rootfs rw rootwait console=ttyMSM0,115200n8"” so that others don’t stumble into the same issue?

Thanks

DISCLAIMER: I am an employee of QuIC Inc. Any opinions expressed in this or any other post may not reflect the opinions of my employer.

hi,

hardcoding the bootargs to use the ‘/dev/disk/by-partlabel/rootfs’ might not be the perfect answer neither. By using such bootargs, we are making the assumptions that:

  1. there is a partition called rootfs (which is the case only if the Linux bootloader were flashed)
  2. there is an initrd in the boot image that started udev properly. otherwise /dev/disk/by-partlabel wouldn’t exist.

So modifying the wiki as suggested here, might help some people, but would break for others.

I will see how this can be improved…