From patchwork Thu May 16 05:34:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlo Caione X-Patchwork-Id: 244220 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from fraxinus.osuosl.org (fraxinus.osuosl.org [140.211.166.137]) by ozlabs.org (Postfix) with ESMTP id 6FF3A2C0129 for ; Thu, 16 May 2013 15:30:56 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id DB17410B996; Thu, 16 May 2013 05:30:35 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RhQ4EicmU568; Thu, 16 May 2013 05:30:27 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id BDED510BB2D; Thu, 16 May 2013 05:30:25 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 43B0F8F76F for ; Thu, 16 May 2013 05:30:45 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id E85AA8D63F for ; Thu, 16 May 2013 05:30:37 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KmXVtJNfUPwz for ; Thu, 16 May 2013 05:30:36 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ee0-f44.google.com (mail-ee0-f44.google.com [74.125.83.44]) by whitealder.osuosl.org (Postfix) with ESMTPS id 3CA368D63D for ; Thu, 16 May 2013 05:30:36 +0000 (UTC) Received: by mail-ee0-f44.google.com with SMTP id b57so1556115eek.3 for ; Wed, 15 May 2013 22:30:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=yzX2YcGIrl+GW1Wo9P9O/JgxntK7sf9DTntbnrwDvyI=; b=G5cL8HQG5dHIQo1l4ZY//Tbfa5xbyOBpNuxBHxU6upPseRvZI89ngvkSoqIXAnrHZU tRqans7zKU2mBFRA+lN12slcFst9bz4pxgyVYkrZCmLtpcE3I/VRt/lc0erbHMm/wdBg 7zE6N3zovSfPO6fL15pgNuIxbKNMJQppwi1G2azkX4HEaRT4uSn/DD/+VyXAU1vVXymZ sNxm0tVm+EOrZzi3GP9XPyIgcpBwSwtDbiQxBIVPONiKoxnOSzrDC6TNcCjPzd6qitH8 MR+h+nSeDrCVLt1c/fMCcDHkoJKvNtuwtDjbRSSnANMQKRqk5CTRuJXnoVp4jDsng2ha ExQQ== X-Received: by 10.14.178.129 with SMTP id f1mr75056276eem.10.1368682234201; Wed, 15 May 2013 22:30:34 -0700 (PDT) Received: from asus.fastwebnet.it (2-238-57-164.ip242.fastwebnet.it. [2.238.57.164]) by mx.google.com with ESMTPSA id m48sm7769682eeh.16.2013.05.15.22.30.32 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 15 May 2013 22:30:33 -0700 (PDT) From: Carlo Caione To: buildroot@busybox.net Date: Thu, 16 May 2013 07:34:27 +0200 Message-Id: <1368682467-12228-3-git-send-email-carlo.caione@gmail.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1368682467-12228-1-git-send-email-carlo.caione@gmail.com> References: <1368682467-12228-1-git-send-email-carlo.caione@gmail.com> Subject: [Buildroot] [PATCH 2/2] cubieboard: board specific files and script X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net This set of files contains: - readme.txt - mksdcard.sh: scritp to create the SD card for cubieboard - uEnv*.txt: different uEnv for u-boot (to boot using TFTP or using the SD card to host uImage and DTB) Signed-off-by: Carlo Caione --- board/cubietech/cubieboard_mainline/mksdcard.sh | 73 +++++++++++++++++++++ board/cubietech/cubieboard_mainline/readme.txt | 77 +++++++++++++++++++++++ board/cubietech/cubieboard_mainline/uEnv-tftp.txt | 4 ++ board/cubietech/cubieboard_mainline/uEnv.txt | 1 + 4 files changed, 155 insertions(+) create mode 100755 board/cubietech/cubieboard_mainline/mksdcard.sh create mode 100644 board/cubietech/cubieboard_mainline/readme.txt create mode 100644 board/cubietech/cubieboard_mainline/uEnv-tftp.txt create mode 100644 board/cubietech/cubieboard_mainline/uEnv.txt diff --git a/board/cubietech/cubieboard_mainline/mksdcard.sh b/board/cubietech/cubieboard_mainline/mksdcard.sh new file mode 100755 index 0000000..28d48bd --- /dev/null +++ b/board/cubietech/cubieboard_mainline/mksdcard.sh @@ -0,0 +1,73 @@ +#! /bin/sh +# 2013, Carlo Caione + +IMAGES_DIR=$1 +UENV=$2 +SPL_IMG=$IMAGES_DIR/sunxi-spl.bin +UBOOT_IMG=$IMAGES_DIR/u-boot.bin +UIMAGE=$IMAGES_DIR/uImage +DTB=$IMAGES_DIR/sun4i-a10-cubieboard.dtb + +export LC_ALL=C + +if [ $# -ne 3 ]; then + echo "Usage: $0 " + exit 1; +fi + +if [ $EUID -ne 0 ]; then + echo "This script must be run as root" 1>&2 + exit 1 +fi + +if [ ! -f $SPL_IMG ] || + [ ! -f $UBOOT_IMG ] || + [ ! -f $UENV ] || + [ ! -f $UIMAGE ] || + [ ! -f $DTB ]; then + echo "File(s) missing." + exit 1 +fi + +DRIVE=$3 +PART1=`mktemp -d` + +dd if=/dev/zero of=$DRIVE bs=1M count=3 + +# ~2048, 16MB, FAT, bootable +# ~rest of drive, Ext4 +{ +echo 32,,0x0C,- +} | sfdisk -D $DRIVE + +sleep 1 + +if [ -b ${DRIVE}1 ]; then + D1=${DRIVE}1 + umount ${DRIVE}1 + mkfs.vfat -n "boot" ${DRIVE}1 +else + if [ -b ${DRIVE}p1 ]; then + D1=${DRIVE}p1 + umount ${DRIVE}p1 + mkfs.vfat -n "boot" ${DRIVE}p1 + else + echo "Cant find boot partition in /dev" + exit 1 + fi +fi + +mount $D1 $PART1 + +cp -v $UENV $PART1/uEnv.txt +cp -v $UIMAGE $PART1 +cp -v $DTB $PART1 + +sync + +umount $D1 + +rm -fr $P1 + +dd if=$SPL_IMG of=$DRIVE bs=1024 seek=8 +dd if=$UBOOT_IMG of=$DRIVE bs=1024 seek=32 diff --git a/board/cubietech/cubieboard_mainline/readme.txt b/board/cubietech/cubieboard_mainline/readme.txt new file mode 100644 index 0000000..ab88197 --- /dev/null +++ b/board/cubietech/cubieboard_mainline/readme.txt @@ -0,0 +1,77 @@ +Cubieboard - mainline kernel + +----- +Intro +----- + +This is the buildroot board support for the Cubieboard using the mainline +kernel. + +--------------- +How to build it +--------------- + +You need to use the cubieboard_mainline_defconfig, to do so: + * make cubieboard_mainline_defconfig + +And to compile: + * make + +----------------- +What is generated +----------------- + +After building, you should have this tree: + + output/images/ + +-- ... + +-- sun4i-a10-cubieboard.dtb + +-- sunxi-spl.bin + +-- u-boot.bin + `-- uImage + +----------- +How to boot +----------- + +To boot the cubieboard with the file generated by buildroot you have to +choices: + +- using TFTP to load uImage and DTB +- load uImage and DTB on the SD card + +In both cases you need a SD card to host u-boot, SPL and uEnv.txt + +In case you choose to boot using TFTP, be sure to modify the file +uEnv-tftp.txt with the correct parameters for your network. + +-------------------------- +How setting up the SD card +-------------------------- + +To be able to use your cubieboard board with the images generated by +Buildroot you have to correctly setup the SD card. + +For more information, please see http://linux-sunxi.org/FirstSteps + +Depending on the rootfs size, you might want to use a 2GB or larger SD-card. +The script mksdcard.sh will take care of partitioning and formatting +the SD-card. + +BEWARE! This process will erase your SD card. + +Use dmesg to find out where the SD card is attached in the /dev tree +() and then: + +# sudo./mksdcard.sh + +where: + - is the directory containing the generated files (usually + output/images) + - is the device file of the SD card (usually /dev/sdX) + - can be: + - uEnv-tftp.txt to boot over TFTP + - uEnv.txt to boot using files on SD + +-- +Carlo Caione diff --git a/board/cubietech/cubieboard_mainline/uEnv-tftp.txt b/board/cubietech/cubieboard_mainline/uEnv-tftp.txt new file mode 100644 index 0000000..27bd417 --- /dev/null +++ b/board/cubietech/cubieboard_mainline/uEnv-tftp.txt @@ -0,0 +1,4 @@ +ethaddr=12:34:56:78:99:aa +autoload=no +serverip=10.0.0.1 +uenvcmd=dhcp; tftpboot 0x40000000 sun4i-a10-cubieboard.dtb; tftpboot 0x48000000 uImage; bootm 0x48000000 - 0x40000000 diff --git a/board/cubietech/cubieboard_mainline/uEnv.txt b/board/cubietech/cubieboard_mainline/uEnv.txt new file mode 100644 index 0000000..3a50ec0 --- /dev/null +++ b/board/cubietech/cubieboard_mainline/uEnv.txt @@ -0,0 +1 @@ +uenvcmd=fatload mmc 0 0x48000000 uImage; fatload mmc 0 0x40000000 sun4i-a10-cubieboard.dtb; bootm 0x48000000 - 0x40000000