Index: head/sysutils/u-boot-rpi3/Makefile =================================================================== --- head/sysutils/u-boot-rpi3/Makefile (revision 426265) +++ head/sysutils/u-boot-rpi3/Makefile (revision 426266) @@ -1,59 +1,59 @@ # $FreeBSD$ PORTNAME= u-boot -PORTVERSION= 2016.09 +PORTVERSION= 2016.11 CATEGORIES= sysutils MASTER_SITES= ftp://ftp.denx.de/pub/u-boot/ \ LOCAL/db:bootfiles PKGNAMESUFFIX= -rpi3 DISTFILES= u-boot-${PORTVERSION}.tar.bz2 \ rpi3-boot-files-2016.05.tar.bz2:bootfiles MAINTAINER= db@FreeBSD.org COMMENT= Cross-build U-Boot loader for RPi3 LICENSE= GPLv2 BUILD_DEPENDS= aarch64-none-elf-gcc:devel/aarch64-none-elf-gcc NO_ARCH= yes WRKSRC= ${WRKDIR}/u-boot-${DISTVERSION} USES= gmake tar:bzip2 SSP_UNSAFE= yes # cross-LD does not support -fstack-protector WRK_BOOTFILES= ${WRKDIR}/rpi3-boot-files-2016.05 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 MAKE_ARGS+= ARCH=arm \ CROSS_COMPILE=aarch64-none-elf- \ CONFIG_EFI=y do-configure: (cd ${WRKSRC}; ${GMAKE} rpi_3_defconfig) # 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). 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} .include Index: head/sysutils/u-boot-rpi3/distinfo =================================================================== --- head/sysutils/u-boot-rpi3/distinfo (revision 426265) +++ head/sysutils/u-boot-rpi3/distinfo (revision 426266) @@ -1,5 +1,5 @@ -TIMESTAMP = 1476719881 -SHA256 (u-boot-2016.09.tar.bz2) = 994e7b9e0e350d9f91f5892d5e5bff00d3714a4962f520f78a64a461ef950ba9 -SIZE (u-boot-2016.09.tar.bz2) = 11790685 +TIMESTAMP = 1479225351 +SHA256 (u-boot-2016.11.tar.bz2) = 45813e6565dcc0436abe6752624324cdbf5f3ac106570d76d32b46ec529bcdc8 +SIZE (u-boot-2016.11.tar.bz2) = 12019669 SHA256 (rpi3-boot-files-2016.05.tar.bz2) = 8d5a2e453c9140d989133bc7cd991456138f4eb6c9722cd9eee4af4c1722e216 SIZE (rpi3-boot-files-2016.05.tar.bz2) = 6905733 Property changes on: head/sysutils/u-boot-rpi3/distinfo ___________________________________________________________________ Modified: fbsd:nokeywords ## -1 +1 ## -on \ No newline at end of property +1 \ No newline at end of property Index: head/sysutils/u-boot-rpi3/files/patch-include_configs_rpi.h =================================================================== --- head/sysutils/u-boot-rpi3/files/patch-include_configs_rpi.h (revision 426265) +++ head/sysutils/u-boot-rpi3/files/patch-include_configs_rpi.h (revision 426266) @@ -1,17 +1,17 @@ ---- include/configs/rpi.h.orig 2016-09-12 14:05:51 UTC +--- include/configs/rpi.h.orig 2016-11-14 16:27:11 UTC +++ include/configs/rpi.h -@@ -108,11 +108,13 @@ +@@ -104,11 +104,13 @@ #endif /* 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 Property changes on: head/sysutils/u-boot-rpi3/files/patch-include_configs_rpi.h ___________________________________________________________________ Modified: fbsd:nokeywords ## -1 +1 ## -on \ No newline at end of property +1 \ No newline at end of property Index: head/sysutils/u-boot-rpi3/files/patch-include_efi__api.h =================================================================== --- head/sysutils/u-boot-rpi3/files/patch-include_efi__api.h (revision 426265) +++ head/sysutils/u-boot-rpi3/files/patch-include_efi__api.h (revision 426266) @@ -1,21 +1,21 @@ ---- include/efi_api.h.orig 2016-09-12 14:05:51 UTC +--- include/efi_api.h.orig 2016-11-14 16:27:11 UTC +++ include/efi_api.h -@@ -264,6 +264,18 @@ struct efi_device_path { +@@ -268,6 +268,18 @@ struct efi_device_path { u16 length; }; +struct efi_mac_addr { + u8 addr[32]; +}; + +#define DEVICE_PATH_TYPE_MESSAGING_DEVICE 0x03 +struct efi_device_path_mac_addr { + struct efi_device_path dp; + struct efi_mac_addr mac; + u8 if_type; +}; + +# define DEVICE_PATH_SUB_TYPE_MSG_MAC_ADDR 0x0b #define DEVICE_PATH_TYPE_MEDIA_DEVICE 0x04 # define DEVICE_PATH_SUB_TYPE_FILE_PATH 0x04 Property changes on: head/sysutils/u-boot-rpi3/files/patch-include_efi__api.h ___________________________________________________________________ Modified: fbsd:nokeywords ## -1 +1 ## -on \ No newline at end of property +1 \ No newline at end of property Index: head/sysutils/u-boot-rpi3/files/patch-lib_efi__loader_efi__console.c =================================================================== --- head/sysutils/u-boot-rpi3/files/patch-lib_efi__loader_efi__console.c (revision 426265) +++ head/sysutils/u-boot-rpi3/files/patch-lib_efi__loader_efi__console.c (revision 426266) @@ -1,40 +1,40 @@ ---- lib/efi_loader/efi_console.c.orig 2016-09-12 14:05:51 UTC +--- lib/efi_loader/efi_console.c.orig 2016-11-14 16:27:11 UTC +++ lib/efi_loader/efi_console.c @@ -9,9 +9,9 @@ #include #include -/* If we can't determine the console size, default to 80x24 */ +/* If we can't determine the console size, default to 80x25 */ static int console_columns = 80; -static int console_rows = 24; +static int console_rows = 25; static bool console_size_queried; const efi_guid_t efi_guid_console_control = CONSOLE_CONTROL_GUID; @@ -165,6 +165,8 @@ static efi_status_t EFIAPI efi_cout_quer unsigned long mode_number, unsigned long *columns, unsigned long *rows) { + unsigned long current_mode; + EFI_ENTRY("%p, %ld, %p, %p", this, mode_number, columns, rows); if (!console_size_queried) { @@ -196,6 +198,16 @@ static efi_status_t EFIAPI efi_cout_quer } out: + if (console_columns == 80 && console_rows == 25) + current_mode = 0; + else if (console_columns == 80 && console_rows == 50) + current_mode = 1; + else + current_mode = 2; + + if (mode_number != current_mode) + return EFI_EXIT(EFI_UNSUPPORTED); + if (columns) *columns = console_columns; if (rows) Property changes on: head/sysutils/u-boot-rpi3/files/patch-lib_efi__loader_efi__console.c ___________________________________________________________________ Modified: fbsd:nokeywords ## -1 +1 ## -on \ No newline at end of property +1 \ No newline at end of property Index: head/sysutils/u-boot-rpi3/files/patch-lib_efi__loader_efi__disk.c =================================================================== --- head/sysutils/u-boot-rpi3/files/patch-lib_efi__loader_efi__disk.c (revision 426265) +++ head/sysutils/u-boot-rpi3/files/patch-lib_efi__loader_efi__disk.c (revision 426266) @@ -1,126 +1,126 @@ ---- lib/efi_loader/efi_disk.c.orig 2016-09-12 14:05:51 UTC +--- lib/efi_loader/efi_disk.c.orig 2016-11-14 16:27:11 UTC +++ lib/efi_loader/efi_disk.c -@@ -196,11 +196,13 @@ static void efi_disk_add_dev(const char +@@ -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) -@@ -217,16 +219,28 @@ static void efi_disk_add_dev(const char +@@ -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]; -@@ -261,8 +275,7 @@ static int efi_disk_create_eltorito(stru +@@ -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++; } -@@ -271,6 +284,30 @@ static int efi_disk_create_eltorito(stru +@@ -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 -@@ -295,13 +332,14 @@ int efi_disk_register(void) +@@ -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); } -@@ -331,15 +369,17 @@ int efi_disk_register(void) +@@ -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 Property changes on: head/sysutils/u-boot-rpi3/files/patch-lib_efi__loader_efi__disk.c ___________________________________________________________________ Modified: fbsd:nokeywords ## -1 +1 ## -on \ No newline at end of property +1 \ No newline at end of property Index: head/sysutils/u-boot-rpi3/files/patch-lib_efi__loader_efi__net.c =================================================================== --- head/sysutils/u-boot-rpi3/files/patch-lib_efi__loader_efi__net.c (revision 426265) +++ head/sysutils/u-boot-rpi3/files/patch-lib_efi__loader_efi__net.c (revision 426266) @@ -1,48 +1,48 @@ ---- lib/efi_loader/efi_net.c.orig 2016-09-12 14:05:51 UTC +--- lib/efi_loader/efi_net.c.orig 2016-11-14 16:27:11 UTC +++ lib/efi_loader/efi_net.c @@ -27,7 +27,8 @@ struct efi_net_obj { struct efi_simple_network net; struct efi_simple_network_mode net_mode; /* Device path to the network adapter */ - struct efi_device_path_file_path dp[2]; + struct efi_device_path_mac_addr dp_mac; + struct efi_device_path_file_path dp_end; /* PXE struct to transmit dhcp data */ struct efi_pxe pxe; struct efi_pxe_mode pxe_mode; -@@ -198,7 +199,7 @@ static efi_status_t efi_net_open_dp(void +@@ -205,7 +206,7 @@ static efi_status_t EFIAPI efi_net_open_ struct efi_simple_network *net = handle; struct efi_net_obj *netobj = container_of(net, struct efi_net_obj, net); - *protocol_interface = netobj->dp; + *protocol_interface = &netobj->dp_mac; return EFI_SUCCESS; } -@@ -229,11 +230,10 @@ void efi_net_set_dhcp_ack(void *pkt, int +@@ -236,11 +237,10 @@ void efi_net_set_dhcp_ack(void *pkt, int int efi_net_register(void **handle) { struct efi_net_obj *netobj; - struct efi_device_path_file_path dp_net = { - .dp.type = DEVICE_PATH_TYPE_MEDIA_DEVICE, - .dp.sub_type = DEVICE_PATH_SUB_TYPE_FILE_PATH, + struct efi_device_path_mac_addr dp_net = { + .dp.type = DEVICE_PATH_TYPE_MESSAGING_DEVICE, + .dp.sub_type = DEVICE_PATH_SUB_TYPE_MSG_MAC_ADDR, .dp.length = sizeof(dp_net), - .str = { 'N', 'e', 't' }, }; struct efi_device_path_file_path dp_end = { .dp.type = DEVICE_PATH_TYPE_END, -@@ -272,8 +272,9 @@ int efi_net_register(void **handle) +@@ -279,8 +279,9 @@ int efi_net_register(void **handle) netobj->net.receive = efi_net_receive; netobj->net.mode = &netobj->net_mode; netobj->net_mode.state = EFI_NETWORK_STARTED; - netobj->dp[0] = dp_net; - netobj->dp[1] = dp_end; + netobj->dp_mac = dp_net; + netobj->dp_end = dp_end; + memcpy(netobj->dp_mac.mac.addr, eth_get_ethaddr(), 6); memcpy(netobj->net_mode.current_address.mac_addr, eth_get_ethaddr(), 6); netobj->net_mode.max_packet_size = PKTSIZE; Property changes on: head/sysutils/u-boot-rpi3/files/patch-lib_efi__loader_efi__net.c ___________________________________________________________________ Modified: fbsd:nokeywords ## -1 +1 ## -on \ No newline at end of property +1 \ No newline at end of property