Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:olh:xen-4.7
qemu-2.10
seabios_128kb.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File seabios_128kb.patch of Package qemu-2.10
From 5fff5f1e79d8bc7ef24d1f8ff42c8021215f23a6 Mon Sep 17 00:00:00 2001 From: Bruce Rogers <brogers@suse.com> Date: Thu, 19 Mar 2015 16:34:31 -0600 Subject: [PATCH] Eliminate some duplicate string segments to reduce bios image size In some build environments, we are running up against the 128K bios size limit. This change simply takes larger string segments which are used in printf style messages and uses a single copy, now referenced with a %s specifier, resulting in the needed space savings. Signed-off-by: Bruce Rogers <brogers@suse.com> --- src/boot.c | 20 +++++++++++--------- src/bootsplash.c | 5 +++-- src/fw/paravirt.c | 8 +++++--- src/fw/pciinit.c | 19 ++++++++++--------- src/hw/usb-hub.c | 9 +++++---- src/hw/usb-msc.c | 6 ++++-- 6 files changed, 38 insertions(+), 29 deletions(-) --- a/roms/seabios/src/boot.c +++ b/roms/seabios/src/boot.c @@ -27,6 +27,8 @@ * Boot priority ordering ****************************************************************/ +static const char *no_boot_dev_str = "No bootable device."; +static const char *boot_str = "Booting from "; static char **Bootorder VARVERIFY32INIT; static int BootorderCount; @@ -596,7 +598,7 @@ bcv_prepboot(void) static void call_boot_entry(struct segoff_s bootsegip, u8 bootdrv) { - dprintf(1, "Booting from %04x:%04x\n", bootsegip.seg, bootsegip.offset); + dprintf(1, "%s%04x:%04x\n", boot_str, bootsegip.seg, bootsegip.offset); struct bregs br; memset(&br, 0, sizeof(br)); br.flags = F_IF; @@ -652,7 +654,7 @@ boot_cdrom(struct drive_s *drive_g) { if (! CONFIG_CDROM_BOOT) return; - printf("Booting from DVD/CD...\n"); + printf("%sDVD/CD...\n", boot_str); int status = cdrom_boot(drive_g); if (status) { @@ -678,7 +680,7 @@ boot_cbfs(struct cbfs_file *file) { if (!CONFIG_COREBOOT_FLASH) return; - printf("Booting from CBFS...\n"); + printf("%sCBFS...\n", boot_str); cbfs_run_payload(file); } @@ -686,7 +688,7 @@ boot_cbfs(struct cbfs_file *file) static void boot_rom(u32 vector) { - printf("Booting from ROM...\n"); + printf("%sROM...\n", boot_str); struct segoff_s so; so.segoff = vector; call_boot_entry(so, 0); @@ -697,10 +699,10 @@ static void boot_fail(void) { if (BootRetryTime == (u32)-1) - printf("No bootable device.\n"); + printf("%s\n", no_boot_dev_str); else - printf("No bootable device. Retrying in %d seconds.\n" - , BootRetryTime/1000); + printf("%s Retrying in %d seconds.\n", no_boot_dev_str, + BootRetryTime/1000); // Wait for 'BootRetryTime' milliseconds and then reboot. u32 end = irqtimer_calc(BootRetryTime); for (;;) { @@ -726,11 +728,11 @@ do_boot(int seq_nr) struct bev_s *ie = &BEV[seq_nr]; switch (ie->type) { case IPL_TYPE_FLOPPY: - printf("Booting from Floppy...\n"); + printf("%sFloppy...\n", boot_str); boot_disk(0x00, CheckFloppySig); break; case IPL_TYPE_HARDDISK: - printf("Booting from Hard Disk...\n"); + printf("%sHard Disk...\n", boot_str); boot_disk(0x80, 1); break; case IPL_TYPE_CDROM: --- a/roms/seabios/src/bootsplash.c +++ b/roms/seabios/src/bootsplash.c @@ -16,6 +16,7 @@ #include "string.h" // memset #include "util.h" // enable_bootsplash +static const char *decode_failed_str = "_decode failed with return code "; /**************************************************************** * Helper functions @@ -155,7 +156,7 @@ enable_bootsplash(void) dprintf(5, "Decoding bootsplash.jpg\n"); ret = jpeg_decode(jpeg, filedata); if (ret) { - dprintf(1, "jpeg_decode failed with return code %d...\n", ret); + dprintf(1, "jpeg%s%d...\n", decode_failed_str, ret); goto done; } jpeg_get_size(jpeg, &width, &height); @@ -169,7 +170,7 @@ enable_bootsplash(void) dprintf(5, "Decoding bootsplash.bmp\n"); ret = bmp_decode(bmp, filedata, filesize); if (ret) { - dprintf(1, "bmp_decode failed with return code %d...\n", ret); + dprintf(1, "bmp%s%d...\n", decode_failed_str, ret); goto done; } bmp_get_size(bmp, &width, &height); --- a/roms/seabios/src/fw/paravirt.c +++ b/roms/seabios/src/fw/paravirt.c @@ -45,6 +45,8 @@ inline int qemu_cfg_dma_enabled(void) */ #define KVM_CPUID_SIGNATURE 0x40000000 +static const char *running_on_qemu_str = "Running on QEMU ("; + static void kvm_detect(void) { unsigned int eax, ebx, ecx, edx; @@ -82,13 +84,13 @@ static void qemu_detect(void) PlatformRunningOn |= PF_QEMU; switch (d) { case 0x1237: - dprintf(1, "Running on QEMU (i440fx)\n"); + dprintf(1, "%si440fx)\n", running_on_qemu_str); break; case 0x29c0: - dprintf(1, "Running on QEMU (q35)\n"); + dprintf(1, "%sq35)\n", running_on_qemu_str); break; default: - dprintf(1, "Running on QEMU (unknown nb: %04x:%04x)\n", v, d); + dprintf(1, "%sunknown nb: %04x:%04x)\n", running_on_qemu_str, v, d); break; } kvm_detect(); --- a/roms/seabios/src/fw/pciinit.c +++ b/roms/seabios/src/fw/pciinit.c @@ -39,6 +39,10 @@ enum pci_region_type { PCI_REGION_TYPE_COUNT, }; +static const char *pri_bus_str = "PCI: primary bus = "; +static const char *sec_bus_str = "PCI: secondary bus = "; +static const char *sub_bus_str = "PCI: subordinate bus = "; + static const char *region_type_name[] = { [ PCI_REGION_TYPE_IO ] = "io", [ PCI_REGION_TYPE_MEM ] = "mem", @@ -522,7 +526,6 @@ static void pci_bios_init_platform(void) } } - /**************************************************************** * Bus initialization ****************************************************************/ @@ -553,21 +556,20 @@ pci_bios_init_bus_rec(int bus, u8 *pci_b u8 pribus = pci_config_readb(bdf, PCI_PRIMARY_BUS); if (pribus != bus) { - dprintf(1, "PCI: primary bus = 0x%x -> 0x%x\n", pribus, bus); + dprintf(1, "%s0x%x -> 0x%x\n", pri_bus_str, pribus, bus); pci_config_writeb(bdf, PCI_PRIMARY_BUS, bus); } else { - dprintf(1, "PCI: primary bus = 0x%x\n", pribus); + dprintf(1, "%s0x%x\n", pri_bus_str, pribus); } u8 secbus = pci_config_readb(bdf, PCI_SECONDARY_BUS); (*pci_bus)++; if (*pci_bus != secbus) { - dprintf(1, "PCI: secondary bus = 0x%x -> 0x%x\n", - secbus, *pci_bus); + dprintf(1, "%s0x%x -> 0x%x\n", sec_bus_str, secbus, *pci_bus); secbus = *pci_bus; pci_config_writeb(bdf, PCI_SECONDARY_BUS, secbus); } else { - dprintf(1, "PCI: secondary bus = 0x%x\n", secbus); + dprintf(1, "%s0x%x\n", sec_bus_str, secbus); } /* set to max for access to all subordinate buses. @@ -578,11 +580,10 @@ pci_bios_init_bus_rec(int bus, u8 *pci_b pci_bios_init_bus_rec(secbus, pci_bus); if (subbus != *pci_bus) { - dprintf(1, "PCI: subordinate bus = 0x%x -> 0x%x\n", - subbus, *pci_bus); + dprintf(1, "%s0x%x -> 0x%x\n", sub_bus_str, subbus, *pci_bus); subbus = *pci_bus; } else { - dprintf(1, "PCI: subordinate bus = 0x%x\n", subbus); + dprintf(1, "%s0x%x\n", sub_bus_str, subbus); } pci_config_writeb(bdf, PCI_SUBORDINATE_BUS, subbus); } --- a/roms/seabios/src/hw/usb-hub.c +++ b/roms/seabios/src/hw/usb-hub.c @@ -11,6 +11,8 @@ #include "usb-hub.h" // struct usb_hub_descriptor #include "util.h" // timer_calc +static const char *port_hub_fail_str = "Failure on hub port "; + static int get_hub_desc(struct usb_pipe *pipe, struct usb_hub_descriptor *desc) { @@ -82,7 +84,6 @@ get_port_status(struct usbhub_s *hub, in mutex_unlock(&hub->lock); return ret; } - // Check if device attached to port static int usb_hub_detect(struct usbhub_s *hub, u32 port) @@ -90,7 +91,7 @@ usb_hub_detect(struct usbhub_s *hub, u32 struct usb_port_status sts; int ret = get_port_status(hub, port, &sts); if (ret) { - dprintf(1, "Failure on hub port %d detect\n", port); + dprintf(1, "%s%d detect\n", port_hub_fail_str, port); return -1; } return (sts.wPortStatus & USB_PORT_STAT_CONNECTION) ? 1 : 0; @@ -102,7 +103,7 @@ usb_hub_disconnect(struct usbhub_s *hub, { int ret = clear_port_feature(hub, port, USB_PORT_FEAT_ENABLE); if (ret) - dprintf(1, "Failure on hub port %d disconnect\n", port); + dprintf(1, "%s%d disconnect\n", port_hub_fail_str, port); } // Reset device on port @@ -142,7 +143,7 @@ usb_hub_reset(struct usbhub_s *hub, u32 >> USB_PORT_STAT_SPEED_SHIFT); fail: - dprintf(1, "Failure on hub port %d reset\n", port); + dprintf(1, "%s%d reset\n", port_hub_fail_str, port); usb_hub_disconnect(hub, port); return -1; } --- a/roms/seabios/src/hw/usb-msc.c +++ b/roms/seabios/src/hw/usb-msc.c @@ -50,6 +50,8 @@ struct csw_s { u8 bCSWStatus; } PACKED; +static const char *cant_config_str = "Unable to configure USB MSC "; + static int usb_msc_send(struct usbdrive_s *udrive_gf, int dir, void *buf, u32 bytes) { @@ -160,7 +162,7 @@ usb_msc_lun_setup(struct usb_pipe *inpip int prio = bootprio_find_usb(usbdev, lun); int ret = scsi_drive_setup(&drive->drive, "USB MSC", prio); if (ret) { - dprintf(1, "Unable to configure USB MSC drive.\n"); + dprintf(1, "%sdrive.\n", cant_config_str); free(drive); return -1; } @@ -215,7 +217,7 @@ usb_msc_setup(struct usbdevice_s *usbdev return 0; fail: - dprintf(1, "Unable to configure USB MSC device.\n"); + dprintf(1, "%sdevice.\n", cant_config_str); usb_free_pipe(usbdev, inpipe); usb_free_pipe(usbdev, outpipe); return -1;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor