Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Jun 2016 22:19:53 +0000 (UTC)
From:      Brad Davis <brd@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r417689 - in head/sysutils: . u-boot-pine64 u-boot-pine64/files
Message-ID:  <201606272219.u5RMJrbD040062@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: brd
Date: Mon Jun 27 22:19:53 2016
New Revision: 417689
URL: https://svnweb.freebsd.org/changeset/ports/417689

Log:
  Add sysutils/u-boot-pine64 to support the Pine64 boards.
  
  Approved by:	bdrewery (mentor)

Added:
  head/sysutils/u-boot-pine64/
  head/sysutils/u-boot-pine64/Makefile   (contents, props changed)
  head/sysutils/u-boot-pine64/distinfo   (contents, props changed)
  head/sysutils/u-boot-pine64/files/
  head/sysutils/u-boot-pine64/files/patch-arm-trusted-firmware--Makefile   (contents, props changed)
  head/sysutils/u-boot-pine64/files/patch-lib_efi__loader_efi__disk.c   (contents, props changed)
  head/sysutils/u-boot-pine64/pkg-descr   (contents, props changed)
Modified:
  head/sysutils/Makefile

Modified: head/sysutils/Makefile
==============================================================================
--- head/sysutils/Makefile	Mon Jun 27 22:16:20 2016	(r417688)
+++ head/sysutils/Makefile	Mon Jun 27 22:19:53 2016	(r417689)
@@ -1099,6 +1099,7 @@
     SUBDIR += u-boot-cubox-hummingboard
     SUBDIR += u-boot-duovero
     SUBDIR += u-boot-pandaboard
+    SUBDIR += u-boot-pine64
     SUBDIR += u-boot-rpi
     SUBDIR += u-boot-rpi2
     SUBDIR += u-boot-utilite

Added: head/sysutils/u-boot-pine64/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/u-boot-pine64/Makefile	Mon Jun 27 22:19:53 2016	(r417689)
@@ -0,0 +1,52 @@
+# $FreeBSD$
+
+PORTNAME=	u-boot
+PORTVERSION=	2016.05
+CATEGORIES=	sysutils
+MASTER_SITES=	ftp://ftp.denx.de/pub/u-boot/:uboot \
+		http://download.opensuse.org/repositories/devel:/ARM:/Factory:/Contrib:/Pine64/standard/src/:firmware
+PKGNAMESUFFIX=	-pine64
+DISTFILES=	u-boot-${PORTVERSION}.tar.bz2:uboot \
+		firmware-pine64-20160329-6.1.src.rpm:firmware
+
+MAINTAINER=	brd@FreeBSD.org
+COMMENT=	Cross-build U-Boot loader for Pine64
+
+LICENSE=	GPLv2
+
+BUILD_DEPENDS=	aarch64-none-elf-gcc:devel/aarch64-none-elf-gcc
+
+WRKSRC=		${WRKDIR}/u-boot-${DISTVERSION}
+USES=		gmake tar:bzip2
+SSP_UNSAFE=	yes # cross-LD does not support -fstack-protector
+
+U_BOOT_DIR=	share/u-boot/${PORTNAME}${PKGNAMESUFFIX}
+PLIST_FILES=	${U_BOOT_DIR}/pine64.img \
+		${U_BOOT_DIR}/README
+
+MAKE_ARGS+=	ARCH=arm \
+		CROSS_COMPILE=aarch64-none-elf- \
+		PLAT=sun50iw1p1 \
+		CONFIG_EFI=y
+
+post-extract:
+	(cd ${WRKSRC}; ${EXTRACT_CMD} xvf ${DISTDIR}/firmware-pine64-20160329-6.1.src.rpm)
+	${RM} -fr ${WRKSRC}/arm-trusted-firmware
+	(cd ${WRKSRC}; ${EXTRACT_CMD} xvf pine64atf.tar.xz)
+
+do-configure:
+	(cd ${WRKSRC}; ${GMAKE} pine64_plus_defconfig)
+
+post-build:
+	(cd ${WRKSRC}/arm-trusted-firmware; ${GMAKE} ${MAKE_ARGS} DEBUG=1)
+	(cd ${WRKSRC}; ${CC} -o pine64_image pine64_image.c)
+	(cd ${WRKSRC}; ${CAT} arm-trusted-firmware/build/sun50iw1p1/debug/bl31.bin u-boot-dtb.bin > bl31uboot.bin)
+	(cd ${WRKSRC}; ./pine64_image scp.bin bl31uboot.bin u-boot.img)
+	(cd ${WRKSRC}; ${CAT} boot0.bin u-boot.img > pine64.img)
+
+do-install:
+	${MKDIR} ${STAGEDIR}/${PREFIX}/${U_BOOT_DIR}
+	${CP} ${WRKSRC}/pine64.img ${STAGEDIR}/${PREFIX}/${U_BOOT_DIR}/
+	${CP} ${DESCR} ${STAGEDIR}/${PREFIX}/${U_BOOT_DIR}/README
+
+.include <bsd.port.mk>

Added: head/sysutils/u-boot-pine64/distinfo
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/u-boot-pine64/distinfo	Mon Jun 27 22:19:53 2016	(r417689)
@@ -0,0 +1,5 @@
+TIMESTAMP = 1466481189
+SHA256 (u-boot-2016.05.tar.bz2) = 87d02275615aaf0cd007b54cbe9fbadceef2bee7c79e6c323ea1ae8956dcb171
+SIZE (u-boot-2016.05.tar.bz2) = 11325053
+SHA256 (firmware-pine64-20160329-6.1.src.rpm) = ab3eb03902f19778a8bc62a933a24ed67f4aeacff861272cc60896a2fd8a1f43
+SIZE (firmware-pine64-20160329-6.1.src.rpm) = 6977912

Added: head/sysutils/u-boot-pine64/files/patch-arm-trusted-firmware--Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/u-boot-pine64/files/patch-arm-trusted-firmware--Makefile	Mon Jun 27 22:19:53 2016	(r417689)
@@ -0,0 +1,13 @@
+--- arm-trusted-firmware/Makefile.orig	2016-03-24 04:57:16.613720732 -0500
++++ arm-trusted-firmware/Makefile	2016-06-16 21:28:30.382863000 -0500
+@@ -421,10 +421,6 @@
+ 	@echo
+ 	@echo "Built $$@ successfully"
+ 	@echo
+-ifeq (bl31.bin,$(notdir ${BIN}))
+-	$${Q}git show HEAD --pretty=format:"%H" | head -n 1 > cur.log
+-	$${Q}./tools/add_hash_bl31.sh -f $$@ -m bl31
+-endif
+ 
+ .PHONY : bl$(1)
+ bl$(1) : $(BUILD_DIR) $(BIN) $(DUMP)

Added: head/sysutils/u-boot-pine64/files/patch-lib_efi__loader_efi__disk.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/u-boot-pine64/files/patch-lib_efi__loader_efi__disk.c	Mon Jun 27 22:19:53 2016	(r417689)
@@ -0,0 +1,103 @@
+--- lib/efi_loader/efi_disk.c.orig	2016-06-16 04:33:54 UTC
++++ lib/efi_loader/efi_disk.c
+@@ -145,11 +145,13 @@ static void efi_disk_add_dev(char *name,
+ 			     const struct block_drvr *cur_drvr,
+ 			     const struct blk_desc *desc,
+ 			     int dev_index,
+-			     lbaint_t offset)
++			     disk_partition_t *info,
++			     int logical_partition)
+ {
+ 	struct efi_disk_obj *diskobj;
+ 	struct efi_device_path_file_path *dp;
+ 	int objlen = sizeof(*diskobj) + (sizeof(*dp) * 2);
++	static int mediaid = 0;
+ 
+ 	diskobj = calloc(1, objlen);
+ 
+@@ -162,14 +164,24 @@ static void efi_disk_add_dev(char *name,
+ 	diskobj->ops = block_io_disk_template;
+ 	diskobj->ifname = cur_drvr->name;
+ 	diskobj->dev_index = dev_index;
+-	diskobj->offset = offset;
++	if (info)
++		diskobj->offset = info->start;
+ 
+ 	/* Fill in EFI IO Media info (for read/write callbacks) */
+ 	diskobj->media.removable_media = desc->removable;
+ 	diskobj->media.media_present = 1;
+-	diskobj->media.block_size = desc->blksz;
+-	diskobj->media.io_align = desc->blksz;
+-	diskobj->media.last_block = desc->lba;
++	diskobj->media.media_id = mediaid++;
++	if (logical_partition) {
++		diskobj->media.logical_partition = 1;
++		diskobj->media.block_size = info->blksz;
++		diskobj->media.io_align = info->blksz;
++		diskobj->media.last_block = info->size - 1;
++	}
++	else {
++		diskobj->media.block_size = desc->blksz;
++		diskobj->media.io_align = desc->blksz;
++		diskobj->media.last_block = desc->lba;
++	}
+ 	diskobj->ops.media = &diskobj->media;
+ 
+ 	/* Fill in device path */
+@@ -204,7 +216,7 @@ static int efi_disk_create_eltorito(stru
+ 	while (!part_get_info(desc, part, &info)) {
+ 		snprintf(devname, sizeof(devname), "%s%d:%d", cur_drvr->name,
+ 			 diskid, part);
+-		efi_disk_add_dev(devname, cur_drvr, desc, diskid, info.start);
++		efi_disk_add_dev(devname, cur_drvr, desc, diskid, &info, 0);
+ 		part++;
+ 		disks++;
+ 	}
+@@ -213,6 +225,30 @@ static int efi_disk_create_eltorito(stru
+ 	return disks;
+ }
+ 
++static int efi_disk_create_mbr(struct blk_desc *desc,
++				    const struct block_drvr *cur_drvr,
++				    int diskid)
++{
++	int disks = 0;
++	char devname[32] = { 0 }; /* dp->str is u16[32] long */
++	disk_partition_t info;
++	int part = 1;
++
++	if (desc->part_type != PART_TYPE_DOS)
++		return 0;
++
++	while (!part_get_info(desc, part, &info)) {
++		snprintf(devname, sizeof(devname), "%s%d:%d", cur_drvr->name,
++			 diskid, part);
++
++		efi_disk_add_dev(devname, cur_drvr, desc, diskid, &info, 1);
++		part++;
++		disks++;
++	}
++
++	return disks;
++}
++
+ /*
+  * U-Boot doesn't have a list of all online disk devices. So when running our
+  * EFI payload, we scan through all of the potentially available ones and
+@@ -241,7 +277,7 @@ int efi_disk_register(void)
+ 
+ 			snprintf(devname, sizeof(devname), "%s%d",
+ 				 cur_drvr->name, i);
+-			efi_disk_add_dev(devname, cur_drvr, desc, i, 0);
++			efi_disk_add_dev(devname, cur_drvr, desc, i, NULL, 0);
+ 			disks++;
+ 
+ 			/*
+@@ -249,6 +285,7 @@ int efi_disk_register(void)
+ 			 * in an EFI world, so let's create them here
+ 			 */
+ 			disks += efi_disk_create_eltorito(desc, cur_drvr, i);
++			disks += efi_disk_create_mbr(desc, cur_drvr, i);
+ 		}
+ 	}
+ 	printf("Found %d disks\n", disks);

Added: head/sysutils/u-boot-pine64/pkg-descr
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/u-boot-pine64/pkg-descr	Mon Jun 27 22:19:53 2016	(r417689)
@@ -0,0 +1,3 @@
+U-Boot loader and related files for the Pine64
+
+For general information about U-Boot see WWW: http://www.denx.de/wiki/U-Boot



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201606272219.u5RMJrbD040062>