[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Support for sunxi-based ARM systems in d-i



On Sun, 2014-05-18 at 14:54 -0700, Vagrant Cascadian wrote:
> On Sun, May 18, 2014 at 07:41:58PM +0200, Karsten Merker wrote:
> > attached is a small patch against flash-kernel to add machine db
> > entries for the Cubieboard 1/2 and the Mele A1000.  
> ...
> > I'll probably get access to a Cubieboard2 sometime next week and
> > will test an installation on it, but for the Cubieboard 1 and the
> > Mele somebody else would have to give them a try.
> 
> Thanks for your work. I could test on a Cubieboard 1...

I've not written my notes into prose for the wiki yet but, perhaps they
are sufficient for you and others to get going with though.

First section is for a board supported by flash-kernel (cubietruck) and
is pretty trivial and mostly pretty obvious I think.

The second section is a delta covering how to install+boot on a board
without f-k support so the flash-kernel db can be updated and a bug
reported. The second section I'm afraid is particularly cryptic right
now, since it is just the bits which differ from the first, but good
luck...

It's all a bit sunxi specific, but actually it wouldn't take too much to
make it into a more general armhf/armmp set of runes I think...

Oh and you'll need a u-boot which supports SATA -- I'm using:
        git://gitorious.org/ijc/u-boot.git sunxi-mainlining-with-smp-and-ahci-wip

If u-boot can't see the disks (e.g. scsi scan times out) try increasing
drivers/block/ahci.c:WAIT_MS_LINKUP to e.g. 200.

Ian.

=======================================================

SETUP (host running TFTP)
=====
# cd /srv/tftp/didaily/armhf/daily/
# wget -P netboot http://d-i.debian.org/daily-images/armhf/daily/netboot/vmlinuz http://d-i.debian.org/daily-images/armhf/daily/netboot/initrd.gz
# wget -P device-tree http://d-i.debian.org/daily-images/armhf/daily/device-tree/sun7i-a20-cubietruck.dtb 

# cat >/srv/tftp/didaily/cubietruck <<EOF
#setenv diargs <EXTRA ARGUMENTS>

setenv fdt_addr       0x43000000
setenv ramdisk_addr_r 0x48000000
setenv kernel_addr_r  0x47000000

setenv dibase /didaily/armhf/daily

tftp ${kernel_addr_r} ${dibase}/netboot/vmlinuz
# mirror/suite=sid required until flash-kernel 3.19 has propagated to testing
setenv bootargs "console=ttyS0,115200 -- ${diargs} mirror/suite=sid"

tftp ${fdt_addr} ${dibase}/device-tree/sun7i-a20-cubietruck.dtb
fdt addr ${fdt_addr} 0x40000

tftp ${ramdisk_addr_r} ${dibase}/netboot/initrd.gz
bootz ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr}
EOF
# mkimage -T script -A arm -d /srv/tftp/didaily/cubietruck /srv/tftp/didaily/cubietruck.scr

BOOT DI
=======
uboot> setenv autoload no
uboot> dhcp
uboot> tftp ${scriptaddr} /didaily/cubietruck.scr
uboot> source ${scriptaddr}

-or-

uboot> setenv didaily setenv autoload no\;dhcp\;tftp \${scriptaddr} /didaily/cubietruck.scr\;source \${scriptaddr}
uboot> saveenv
uboot> run didaily

(can repeat run didaily to install fresh again)

INSTALL
=======

Answer Questions etc

BOOT DEBIAN
===========

uboot> scsi scan
uboot> setenv device scsi
uboot> setenv partition 0
uboot> load ${device} ${partition} ${scriptaddr} boot.scr
uboot> setenv bootargs console=ttyS0,115200n8 root=/dev/sda2 rootwait
uboot> source ${scriptaddr}

=======================================================

As per cubietruck above, but:

Find correct dtb in
http://d-i.debian.org/daily-images/armhf/daily/device-tree/, or write
you own, or bribe someone to write one etc.

# wget -P device-tree http://d-i.debian.org/daily-images/armhf/daily/device-tree/sun7i-a20-cubieboard2.dtb
*** ADJUST SCRIPT TO FIT ***
# mkimage -T script -A arm -d /srv/tftp/didaily/cubieboard2 /srv/tftp/didaily/cubieboard2.scr

uboot> setenv didaily setenv autoload no\;dhcp\;tftp \${scriptaddr} /didaily/cubieboard2.scr\;source \${scriptaddr}

Install as normal. 

You will get:
   ┌─────────────────┤ [!] Continue without boot loader ├──────────────────┐
   │                                                                       │
   │                       No boot loader installed                        │
   │ No boot loader has been installed, either because you chose not to or │
   │ because your specific architecture doesn't support a boot loader yet. │
   │                                                                       │
   │ You will need to boot manually with the /vmlinuz kernel on partition  │
   │ /dev/sda1 and root=/dev/sda2 passed as a kernel argument.             │
   │                                                                       │
   │                              <Continue>                               │
   │                                                                       │
   └───────────────────────────────────────────────────────────────────────┘
This is expected. Make a note of the partitions and continue.

Now boot from the installed vmlinuz+initrd.gz, but still need the DT
from tftp (unless you furtle it out of /usr/lib):
 
uboot> setenv fdt_addr       0x43000000
uboot> setenv ramdisk_addr_r 0x48000000
uboot> setenv kernel_addr_r  0x47000000
uboot> setenv dibase /didaily/armhf/daily
uboot> setenv autoload no;dhcp
uboot> tftp ${fdt_addr} ${dibase}/device-tree/sun7i-a20-cubieboard2.dtb
uboot> fdt addr ${fdt_addr} 0x40000
uboot> scsi scan
uboot> load scsi 0 ${kernel_addr_r} /vmlinuz
uboot> load scsi 0 ${ramdisk_addr_r} /initrd.img
uboot> setenv bootargs console=ttyS0,115200n8 root=/dev/sda2 rootwait
uboot> bootz ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr}

This should boot to a login prompt.

# apt-get install flash-kernel u-boot-tools

<Extra echo because no \n in the proc file>
# cat /proc/device-tree/model ; echo
Cubietech Cubieboard2

Now create a suitable flash-kernel entry by modifying Machine (using
the above) and DTB-Id.

# cat >> /etc/flash-kernel/db <<EOF
Machine: Cubietech Cubieboard2
Kernel-Flavors: armmp armmp-lpae
Boot-Script-Path: /boot/boot.scr
DTB-Id: sun7i-a20-cubieboard2.dtb
U-Boot-Script-Name: bootscr.sunxi
Required-Packages: u-boot-tools
Bootloader-Sets-Incorrect-Root: no
EOF

Run flash-kernel by hand.

# flash-kernel
Installing sun7i-a20-cubieboard2.dtb 3.14-1-armmp-lpae into /boot
flash-kernel: installing version 3.14-1-armmp-lpae
Generating boot script u-boot image... done.
Installing new boot.scr.

Boot as for cubietruck.

reportbug flash-kernel, wishlist, "Support for $BOARD", attach
/etc/flash-kernel/db.


Reply to: