board/ci20: create a SD card image

Add a genimage.cfg to create a working sdcard.img for the ci20
hardware.  We also need a uboot-env.txt to create the partition for
the uboot environment.

Update the board/ci20/readme.txt with the related information. Remove
the tftp netboot description from the readme as it is already to
complicated for a basic bootable example.

Signed-off-by: Johannes Schmitz <johannes.schmitz1@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
This commit is contained in:
Johannes Schmitz 2018-01-09 17:08:28 +01:00 committed by Thomas Petazzoni
parent 735158d55a
commit 523688ae5c
4 changed files with 79 additions and 25 deletions

29
board/ci20/genimage.cfg Normal file
View File

@ -0,0 +1,29 @@
image sdcard.img {
hdimage {
}
partition uboot-spl {
in-partition-table = "no"
image = "u-boot-spl.bin"
offset = 512
}
partition uboot {
in-partition-table = "no"
image = "u-boot.img"
offset = 14k
}
partition uboot-env {
in-partition-table = "no"
image = "uboot-env.bin"
offset = 526k
}
partition rootfs {
partition-type = 0x83
image = "rootfs.ext4"
offset = 2M
size = 60M
}
}

View File

@ -2,41 +2,45 @@
* MIPS Creator CI20 * * MIPS Creator CI20 *
********************* *********************
Introduction
============
The 'ci20_defconfig' will create a root filesystem and a kernel image The 'ci20_defconfig' will create a root filesystem and a kernel image
under the 'output/images/' directory. This document will try to explain how under the 'output/images/' directory. This document will try to explain how
to use them in order to run Buildroot in the MIPS Creator CI20 board. to use them in order to run Buildroot in the MIPS Creator CI20 board.
Assuming you are at the U-Boot prompt of the MIPS Creator CI20, you have to How to build it
load the generated kernel image by using the 'tftpboot' command. In ===============
order to do that, you will need to get the network working. Here you
have the instructions to set the ip address, netmask and gateway:
setenv ipaddr x.x.x.x Configure Buildroot
setenv netmask x.x.x.x -------------------
setenv gatewayip x.x.x.x
Now you have to set the ip for the TFTP server you are going to load the $ make ci20_defconfig
kernel image from, and also the name of the kernel image file (we use
'uImage' as a filename in this example):
setenv serverip x.x.x.x Build the rootfs
setenv bootfile uImage ----------------
And finally load the kernel image: Note: you will need to have access to the network, since Buildroot will
download the packages' sources.
tftpboot You may now build your rootfs with:
Now you have to extract the generated root filesystem into a USB drive $ make
or SD-Card. Here you have the instructions to boot from the two of them.
You have to choose the one your prefer:
From USB (This may take a while, consider getting yourself a coffee ;-) )
setenv bootargs console=ttyS4,115200 console=tty0 mem=256M@0x0
mem=768M@0x30000000 root=/dev/sda1
From SD-Card How to write the SD card
setenv bootargs console=ttyS4,115200 console=tty0 mem=256M@0x0 ========================
mem=768M@0x30000000 root=/dev/mmcblk0p1
And finally run this command to boot the board: Once the build process is finished you will have an image called
bootm "sdcard.img" in the output/images/ directory.
Make sure the SD card is not mounted then copy the bootable "sdcard.img" onto
it with "dd":
$ sudo dd if=output/images/sdcard.img of=/dev/sdX
Insert the SDcard into your ci20, and power it up. Your new system
should come up now and start a console on the UART HEADER.
see: https://elinux.org/CI20_Hardware#Dedicated_UART_header

10
board/ci20/uboot-env.txt Normal file
View File

@ -0,0 +1,10 @@
baudrate=115200
board_mfr=NP
bootargs=console=ttyS4,115200 console=tty0 mem=256M@0x0 mem=768M@0x30000000 rootwait root=/dev/mmcblk0p1 devtmpfs.mount=1 ip=dhcp
bootcmd=run ethargs; ext4load mmc 0:1 0x88000000 /boot/uImage; bootm 0x88000000
bootdelay=1
ethargs=env set bootargs ${bootargs}
loads_echo=1
stderr=eserial0,eserial4
stdin=eserial0,eserial4
stdout=eserial0,eserial4

View File

@ -8,6 +8,10 @@ BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_3_18=y
# system # system
BR2_TARGET_GENERIC_GETTY_PORT="ttyS4" BR2_TARGET_GENERIC_GETTY_PORT="ttyS4"
BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_4=y
BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/ci20/genimage.cfg"
# kernel # kernel
BR2_LINUX_KERNEL=y BR2_LINUX_KERNEL=y
@ -15,6 +19,7 @@ BR2_LINUX_KERNEL_CUSTOM_GIT=y
BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/MIPS/CI20_linux.git" BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/MIPS/CI20_linux.git"
BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="7dff33297116643485ca37141d804eddd793e834" BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="7dff33297116643485ca37141d804eddd793e834"
BR2_LINUX_KERNEL_DEFCONFIG="ci20" BR2_LINUX_KERNEL_DEFCONFIG="ci20"
BR2_LINUX_KERNEL_INSTALL_TARGET=y
# u-boot # u-boot
BR2_TARGET_UBOOT=y BR2_TARGET_UBOOT=y
@ -26,3 +31,9 @@ BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION="dd3c1b95dac7d10b2ca5806f65e5c1050d7dd0fa"
BR2_TARGET_UBOOT_FORMAT_IMG=y BR2_TARGET_UBOOT_FORMAT_IMG=y
BR2_TARGET_UBOOT_SPL=y BR2_TARGET_UBOOT_SPL=y
BR2_TARGET_UBOOT_SPL_NAME="spl/u-boot-spl.bin" BR2_TARGET_UBOOT_SPL_NAME="spl/u-boot-spl.bin"
BR2_TARGET_UBOOT_ENVIMAGE=y
BR2_TARGET_UBOOT_ENVIMAGE_SOURCE="board/ci20/uboot-env.txt"
BR2_TARGET_UBOOT_ENVIMAGE_SIZE="32768"
# host
BR2_PACKAGE_HOST_GENIMAGE=y