Page MenuHomeFreeBSD

D14630.diff
No OneTemporary

D14630.diff

Index: sysutils/u-boot-rpi3/Makefile
===================================================================
--- sysutils/u-boot-rpi3/Makefile
+++ sysutils/u-boot-rpi3/Makefile
@@ -1,75 +1,19 @@
# $FreeBSD$
-PORTNAME= u-boot
-PORTVERSION= 2017.01
-PORTREVISION= 1
-CATEGORIES= sysutils
-MASTER_SITES= ftp://ftp.denx.de/pub/u-boot/:uboot \
- LOCAL/db:bootfiles
-PKGNAMESUFFIX= -rpi3
-DISTFILES= u-boot-${PORTVERSION}.tar.bz2:uboot \
- rpi3-boot-files-2016.05.tar.bz2:bootfiles \
- rpi3-psci-monitor-master.tgz:pscimon
+MAINTAINER= manu@FreeBSD.org
+MASTERDIR= ${.CURDIR}/../u-boot-master
-MAINTAINER= db@FreeBSD.org
-COMMENT= Cross-build U-Boot loader for RPi3
+MODEL= rpi3
+BOARD_CONFIG= rpi_3_defconfig
+FAMILY= rpi
+UBOOT_ARCH= aarch64
-LICENSE= GPLv2
+DEPENDS= ${LOCALBASE}/share/rpi-firmware/bootcode.bin:sysutils/rpi-firmware
+EXTRA_PATCHES= ${.CURDIR}/files/patch-board_raspberry_rpi_rpi.c:-p1 \
+ ${.CURDIR}/files/patch-configs_rpi__3__defconfig:-p1 \
+ ${.CURDIR}/files/patch-drivers_usb_host_dwc2.c:-p1 \
+ ${.CURDIR}/files/patch-drivers_video_bcm2835.c:-p1 \
+ ${.CURDIR}/files/patch-include_configs_rpi.h:-p1 \
+ ${.CURDIR}/files/patch-lib_efi__loader_efi__console.c:-p1
-BUILD_DEPENDS= aarch64-none-elf-gcc:devel/aarch64-none-elf-gcc
-
-USE_GITHUB= nodefault
-GH_ACCOUNT= gonzoua:pscimon
-GH_PROJECT= rpi3-psci-monitor:pscimon
-GIT_TAG= 5782052
-GH_TAGNAME= ${GIT_TAG}:pscimon
-
-NO_ARCH= yes
-
-USES= gmake tar:bzip2
-SSP_UNSAFE= yes # cross-LD does not support -fstack-protector
-
-WRK_BOOTFILES= ${WRKDIR}/rpi3-boot-files-2016.05
-PSCI_MONITOR= rpi3-psci-monitor-${GIT_TAG}
-PSCI_DIR= ${WRKDIR}/${PSCI_MONITOR}
-
-U_BOOT_DIR= share/u-boot/${PORTNAME}${PKGNAMESUFFIX}
-PLIST_FILES= ${U_BOOT_DIR}/u-boot.bin \
- ${U_BOOT_DIR}/README \
- ${U_BOOT_DIR}/bootcode.bin \
- ${U_BOOT_DIR}/fixup.dat \
- ${U_BOOT_DIR}/fixup_cd.dat \
- ${U_BOOT_DIR}/fixup_db.dat \
- ${U_BOOT_DIR}/fixup_x.dat \
- ${U_BOOT_DIR}/start.elf \
- ${U_BOOT_DIR}/start_cd.elf \
- ${U_BOOT_DIR}/start_db.elf \
- ${U_BOOT_DIR}/start_x.elf \
- ${U_BOOT_DIR}/config.txt \
- ${U_BOOT_DIR}/LICENCE.broadcom \
- ${U_BOOT_DIR}/armstub8.bin
-MAKE_ARGS+= ARCH=arm \
- CROSS_COMPILE=aarch64-none-elf- \
- CONFIG_EFI=y
-
-do-configure:
- (cd ${WRKSRC}; ${GMAKE} rpi_3_defconfig)
-
-do-build:
- (cd ${WRKSRC}; ${GMAKE} ${MAKE_ARGS})
- (cd ${PSCI_DIR}; ${MAKE})
-
-# The output of the u-boot build process is u-boot.bin. Older firmware
-# versions require a standard header, but the recent versions (our case)
-# are capable of booting u-boot.bin directly. Also copy the entire
-# contents of the bootfiles distribution (these are proprietary binary
-# files required to boot).
-# Also include the armstub8.bin needed to go SMP on RPI3
-do-install:
- ${MKDIR} ${STAGEDIR}/${PREFIX}/${U_BOOT_DIR}
- ${INSTALL_DATA} ${WRKSRC}/u-boot.bin ${STAGEDIR}/${PREFIX}/${U_BOOT_DIR}/
- ${INSTALL_DATA} ${DESCR} ${STAGEDIR}/${PREFIX}/${U_BOOT_DIR}/README
- ${INSTALL_DATA} ${WRK_BOOTFILES}/* ${STAGEDIR}/${PREFIX}/${U_BOOT_DIR}
- ${INSTALL_DATA} ${PSCI_DIR}/pscimon.bin ${STAGEDIR}/${PREFIX}/${U_BOOT_DIR}/armstub8.bin
-
-.include <bsd.port.mk>
+.include "${MASTERDIR}/Makefile"
Index: sysutils/u-boot-rpi3/distinfo
===================================================================
--- sysutils/u-boot-rpi3/distinfo
+++ /dev/null
@@ -1,9 +0,0 @@
-TIMESTAMP = 1486166232
-SHA256 (u-boot-2017.01.tar.bz2) = 6c425175f93a4bcf2ec9faf5658ef279633dbd7856a293d95bd1ff516528ecf2
-SIZE (u-boot-2017.01.tar.bz2) = 12224884
-SHA256 (rpi3-boot-files-2016.05.tar.bz2) = 8d5a2e453c9140d989133bc7cd991456138f4eb6c9722cd9eee4af4c1722e216
-SIZE (rpi3-boot-files-2016.05.tar.bz2) = 6905733
-SHA256 (rpi3-psci-monitor-master.tgz) = 47bbda7baede4e0a018869e9a7a9a05e37de5f8255ce6b5939c90bbd4f42f5a2
-SIZE (rpi3-psci-monitor-master.tgz) = 5033
-SHA256 (gonzoua-rpi3-psci-monitor-5782052_GH0.tar.gz) = 0d1095492a31a6bcb726b688a75769959099bc4d1701c888e46711b1d528c3ae
-SIZE (gonzoua-rpi3-psci-monitor-5782052_GH0.tar.gz) = 5110
Index: sysutils/u-boot-rpi3/files/patch-arch_arm_include_asm_system.h
===================================================================
--- sysutils/u-boot-rpi3/files/patch-arch_arm_include_asm_system.h
+++ /dev/null
@@ -1,48 +0,0 @@
---- arch/arm/include/asm/system.h.orig 2017-01-09 16:57:05 UTC
-+++ arch/arm/include/asm/system.h
-@@ -329,22 +329,6 @@ void psci_arch_init(void);
- * void save_boot_params(u32 r0, u32 r1, u32 r2, u32 r3);
- */
-
--/**
-- * save_boot_params_ret() - Return from save_boot_params()
-- *
-- * If you provide save_boot_params(), then you should jump back to this
-- * function when done. Try to preserve all registers.
-- *
-- * If your implementation of save_boot_params() is in C then it is acceptable
-- * to simply call save_boot_params_ret() at the end of your function. Since
-- * there is no link register set up, you cannot just exit the function. U-Boot
-- * will return to the (initialised) value of lr, and likely crash/hang.
-- *
-- * If your implementation of save_boot_params() is in assembler then you
-- * should use 'b' or 'bx' to return to save_boot_params_ret.
-- */
--void save_boot_params_ret(void);
--
- #ifdef CONFIG_ARMV7_LPAE
- void switch_to_hypervisor_ret(void);
- #endif
-@@ -538,6 +522,22 @@ void mmu_page_table_flush(unsigned long
-
- #ifndef __ASSEMBLY__
- /**
-+ * save_boot_params_ret() - Return from save_boot_params()
-+ *
-+ * If you provide save_boot_params(), then you should jump back to this
-+ * function when done. Try to preserve all registers.
-+ *
-+ * If your implementation of save_boot_params() is in C then it is acceptable
-+ * to simply call save_boot_params_ret() at the end of your function. Since
-+ * there is no link register set up, you cannot just exit the function. U-Boot
-+ * will return to the (initialised) value of lr, and likely crash/hang.
-+ *
-+ * If your implementation of save_boot_params() is in assembler then you
-+ * should use 'b' or 'bx' to return to save_boot_params_ret.
-+ */
-+void save_boot_params_ret(void);
-+
-+/**
- * Change the cache settings for a region.
- *
- * \param start start address of memory region to change
Index: sysutils/u-boot-rpi3/files/patch-board_raspberry_rpi_rpi.c
===================================================================
--- /dev/null
+++ sysutils/u-boot-rpi3/files/patch-board_raspberry_rpi_rpi.c
@@ -0,0 +1,15 @@
+diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c
+index 530f149617..0813bce9f7 100644
+--- a/board/raspberrypi/rpi/rpi.c
++++ b/board/raspberrypi/rpi/rpi.c
+@@ -267,6 +267,10 @@ static void set_fdt_addr(void)
+ return;
+
+ env_set_hex("fdt_addr", fw_dtb_pointer);
++ /*
++ * Set fdtcontroladdr too so it can be picked up by boot script
++ */
++ env_set_hex("fdtcontroladdr", fw_dtb_pointer);
+ }
+
+ /*
Index: sysutils/u-boot-rpi3/files/patch-board_raspberrypi_rpi_lowlevel__init.S
===================================================================
--- sysutils/u-boot-rpi3/files/patch-board_raspberrypi_rpi_lowlevel__init.S
+++ /dev/null
@@ -1,28 +0,0 @@
---- board/raspberrypi/rpi/lowlevel_init.S.orig 2017-01-09 16:57:05 UTC
-+++ board/raspberrypi/rpi/lowlevel_init.S
-@@ -9,10 +9,15 @@
-
- .align 8
- .global fw_dtb_pointer
--fw_dtb_pointer:
-+
- #ifdef CONFIG_ARM64
-+fw_dtb_pointer:
-+ .dword 0x0
-+.global reserve_memory
-+reserve_memory:
- .dword 0x0
- #else
-+fw_dtb_pointer:
- .word 0x0
- #endif
-
-@@ -28,6 +33,8 @@ save_boot_params:
- #ifdef CONFIG_ARM64
- adr x8, fw_dtb_pointer
- str x0, [x8]
-+ adr x8, reserve_memory
-+ str x1, [x8]
- #else
- str r2, fw_dtb_pointer
- #endif
Index: sysutils/u-boot-rpi3/files/patch-board_raspberrypi_rpi_rpi.c
===================================================================
--- sysutils/u-boot-rpi3/files/patch-board_raspberrypi_rpi_rpi.c
+++ /dev/null
@@ -1,43 +0,0 @@
---- board/raspberrypi/rpi/rpi.c.orig 2017-01-09 16:57:05 UTC
-+++ board/raspberrypi/rpi/rpi.c
-@@ -14,6 +14,7 @@
- #include <lcd.h>
- #include <memalign.h>
- #include <mmc.h>
-+#include <asm/system.h>
- #include <asm/gpio.h>
- #include <asm/arch/mbox.h>
- #include <asm/arch/sdhci.h>
-@@ -27,7 +28,7 @@ DECLARE_GLOBAL_DATA_PTR;
-
- /* From lowlevel_init.S */
- extern unsigned long fw_dtb_pointer;
--
-+extern unsigned long reserve_memory;
-
- struct msg_get_arm_mem {
- struct bcm2835_mbox_hdr hdr;
-@@ -220,6 +221,12 @@ static struct mm_region bcm2837_mem_map[
- };
-
- struct mm_region *mem_map = bcm2837_mem_map;
-+
-+void dram_init_banksize(void)
-+{
-+ gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE + reserve_memory;
-+ gd->bd->bi_dram[0].size = get_effective_memsize() - reserve_memory;
-+}
- #endif
-
- int dram_init(void)
-@@ -355,6 +362,10 @@ int misc_init_r(void)
- set_board_info();
- #endif
- set_serial_number();
-+#ifdef CONFIG_ARM64
-+ if (fw_dtb_pointer)
-+ setenv_hex("fdt_addr_r", (ulong)fw_dtb_pointer);
-+#endif
-
- return 0;
- }
Index: sysutils/u-boot-rpi3/files/patch-configs_rpi__3__defconfig
===================================================================
--- /dev/null
+++ sysutils/u-boot-rpi3/files/patch-configs_rpi__3__defconfig
@@ -0,0 +1,13 @@
+diff --git a/configs/rpi_3_defconfig b/configs/rpi_3_defconfig
+index 0f3a54ec9a..ca55f8dc66 100644
+--- a/configs/rpi_3_defconfig
++++ b/configs/rpi_3_defconfig
+@@ -13,7 +13,7 @@ CONFIG_SYS_PROMPT="U-Boot> "
+ CONFIG_CMD_GPIO=y
+ CONFIG_CMD_MMC=y
+ CONFIG_CMD_USB=y
+-CONFIG_OF_EMBED=y
++CONFIG_OF_BOARD=y
+ CONFIG_ENV_FAT_INTERFACE="mmc"
+ CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
+ CONFIG_DM_KEYBOARD=y
Index: sysutils/u-boot-rpi3/files/patch-drivers_usb_host_dwc2.c
===================================================================
--- /dev/null
+++ sysutils/u-boot-rpi3/files/patch-drivers_usb_host_dwc2.c
@@ -0,0 +1,12 @@
+diff --git a/drivers/usb/host/dwc2.c b/drivers/usb/host/dwc2.c
+index 0efe645044..a57616696f 100644
+--- a/drivers/usb/host/dwc2.c
++++ b/drivers/usb/host/dwc2.c
+@@ -1283,6 +1283,7 @@ struct dm_usb_ops dwc2_usb_ops = {
+
+ static const struct udevice_id dwc2_usb_ids[] = {
+ { .compatible = "brcm,bcm2835-usb" },
++ { .compatible = "brcm,bcm2708-usb" },
+ { .compatible = "snps,dwc2" },
+ { }
+ };
Index: sysutils/u-boot-rpi3/files/patch-drivers_video_bcm2835.c
===================================================================
--- /dev/null
+++ sysutils/u-boot-rpi3/files/patch-drivers_video_bcm2835.c
@@ -0,0 +1,12 @@
+diff --git a/drivers/video/bcm2835.c b/drivers/video/bcm2835.c
+index 952ef59661..9c73bacc32 100644
+--- a/drivers/video/bcm2835.c
++++ b/drivers/video/bcm2835.c
+@@ -49,6 +49,7 @@ static int bcm2835_video_probe(struct udevice *dev)
+
+ static const struct udevice_id bcm2835_video_ids[] = {
+ { .compatible = "brcm,bcm2835-hdmi" },
++ { .compatible = "brcm,bcm2708-fb" },
+ { }
+ };
+
Index: sysutils/u-boot-rpi3/files/patch-include_configs_rpi.h
===================================================================
--- sysutils/u-boot-rpi3/files/patch-include_configs_rpi.h
+++ sysutils/u-boot-rpi3/files/patch-include_configs_rpi.h
@@ -1,17 +1,12 @@
---- include/configs/rpi.h.orig 2017-01-09 16:57:05 UTC
-+++ include/configs/rpi.h
-@@ -99,11 +99,13 @@
- #endif
+diff --git a/include/configs/rpi.h b/include/configs/rpi.h
+index 17cdecd1c3..fc6800575c 100644
+--- a/include/configs/rpi.h
++++ b/include/configs/rpi.h
+@@ -133,6 +133,7 @@
- /* Console UART */
-+/*
- #ifdef CONFIG_BCM2837
- #define CONFIG_BCM283X_MU_SERIAL
- #else
-+*/
- #define CONFIG_PL01X_SERIAL
--#endif
-+/* #endif */
- #define CONFIG_CONS_INDEX 0
- #define CONFIG_BAUDRATE 115200
-
+ #define BOOT_TARGET_DEVICES(func) \
+ func(MMC, mmc, 0) \
++ func(MMC, mmc, 1) \
+ func(USB, usb, 0) \
+ func(PXE, pxe, na) \
+ func(DHCP, dhcp, na)
Index: sysutils/u-boot-rpi3/files/patch-lib_efi__loader_efi__console.c
===================================================================
--- /dev/null
+++ sysutils/u-boot-rpi3/files/patch-lib_efi__loader_efi__console.c
@@ -0,0 +1,15 @@
+diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c
+index 5ebce4b544..bd6e74040d 100644
+--- a/lib/efi_loader/efi_console.c
++++ b/lib/efi_loader/efi_console.c
+@@ -473,8 +473,8 @@ int efi_console_register(void)
+ printf("ERROR: Failed to register console event\n");
+ return r;
+ }
+- /* 5000 ns cycle is sufficient for 2 MBaud */
+- r = efi_set_timer(console_timer_event, EFI_TIMER_PERIODIC, 50);
++ /* 100 ms */
++ r = efi_set_timer(console_timer_event, EFI_TIMER_PERIODIC, 100*1000*10);
+ if (r != EFI_SUCCESS)
+ printf("ERROR: Failed to set console timer\n");
+ return r;
Index: sysutils/u-boot-rpi3/files/patch-lib_efi__loader_efi__disk.c
===================================================================
--- sysutils/u-boot-rpi3/files/patch-lib_efi__loader_efi__disk.c
+++ /dev/null
@@ -1,126 +0,0 @@
---- lib/efi_loader/efi_disk.c.orig 2017-01-09 16:57:05 UTC
-+++ lib/efi_loader/efi_disk.c
-@@ -197,11 +197,13 @@ static void efi_disk_add_dev(const char
- const char *if_typename,
- 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;
-
- /* Don't add empty devices */
- if (!desc->lba)
-@@ -218,16 +220,28 @@ static void efi_disk_add_dev(const char
- diskobj->ops = block_io_disk_template;
- diskobj->ifname = if_typename;
- diskobj->dev_index = dev_index;
-- diskobj->offset = offset;
-+ if (info)
-+ diskobj->offset = info->start;
-+
- diskobj->desc = desc;
-
- /* 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 - offset;
-+ diskobj->media.media_id = mediaid++;
- diskobj->ops.media = &diskobj->media;
-+ if (logical_partition) {
-+ printf("Adding logical partition\n");
-+ 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;
-+ }
-
- /* Fill in device path */
- dp = (void*)&diskobj[1];
-@@ -262,8 +276,7 @@ static int efi_disk_create_eltorito(stru
- while (!part_get_info(desc, part, &info)) {
- snprintf(devname, sizeof(devname), "%s:%d", pdevname,
- part);
-- efi_disk_add_dev(devname, if_typename, desc, diskid,
-- info.start);
-+ efi_disk_add_dev(devname, if_typename, desc, diskid, 0, 0);
- part++;
- disks++;
- }
-@@ -272,6 +285,30 @@ static int efi_disk_create_eltorito(stru
- return disks;
- }
-
-+static int efi_disk_create_mbr(struct blk_desc *desc,
-+ const struct blk_driver *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->if_typename,
-+ diskid, part);
-+
-+ efi_disk_add_dev(devname, cur_drvr->if_typename, 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
-@@ -296,13 +333,14 @@ int efi_disk_register(void)
- const char *if_typename = dev->driver->name;
-
- printf("Scanning disk %s...\n", dev->name);
-- efi_disk_add_dev(dev->name, if_typename, desc, desc->devnum, 0);
-+ efi_disk_add_dev(dev->name, if_typename, desc, desc->devnum, NULL, 0);
- disks++;
-
- /*
- * El Torito images show up as block devices in an EFI world,
- * so let's create them here
- */
-+ disks += efi_disk_create_mbr(desc, dev, desc->devnum);
- disks += efi_disk_create_eltorito(desc, if_typename,
- desc->devnum, dev->name);
- }
-@@ -332,15 +370,17 @@ int efi_disk_register(void)
-
- snprintf(devname, sizeof(devname), "%s%d",
- if_typename, i);
-- efi_disk_add_dev(devname, if_typename, desc, i, 0);
-+ efi_disk_add_dev(devname, if_typename, desc, i, 0, 0);
- disks++;
-
- /*
- * El Torito images show up as block devices
- * in an EFI world, so let's create them here
- */
-+ disks += efi_disk_create_mbr(desc, cur_drvr, i);
- disks += efi_disk_create_eltorito(desc, if_typename,
- i, devname);
-+
- }
- }
- #endif

File Metadata

Mime Type
text/plain
Expires
Thu, Aug 20, 12:35 PM (15 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
36986181
Default Alt Text
D14630.diff (16 KB)

Event Timeline