diff options
author | Thierry Vignaud <tv@mageia.org> | 2012-12-21 17:37:51 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mageia.org> | 2012-12-21 17:37:51 +0000 |
commit | e183b4d29a27ee00591ea9aa4ffd838c6b1ade0d (patch) | |
tree | 659943b1b60d3b7cbad847ceda4a1aaa81beb248 /mdk-stage1 | |
parent | 0c86441bcee8fe1e307033c562350051cd614baa (diff) | |
download | drakx-backup-do-not-use-e183b4d29a27ee00591ea9aa4ffd838c6b1ade0d.tar drakx-backup-do-not-use-e183b4d29a27ee00591ea9aa4ffd838c6b1ade0d.tar.gz drakx-backup-do-not-use-e183b4d29a27ee00591ea9aa4ffd838c6b1ade0d.tar.bz2 drakx-backup-do-not-use-e183b4d29a27ee00591ea9aa4ffd838c6b1ade0d.tar.xz drakx-backup-do-not-use-e183b4d29a27ee00591ea9aa4ffd838c6b1ade0d.zip |
kill firmware loader now that firmware are loaded by the kernel
Diffstat (limited to 'mdk-stage1')
-rw-r--r-- | mdk-stage1/Makefile | 6 | ||||
-rw-r--r-- | mdk-stage1/NEWS | 2 | ||||
-rw-r--r-- | mdk-stage1/hotplug.c | 90 | ||||
-rw-r--r-- | mdk-stage1/modules.c | 14 | ||||
-rw-r--r-- | mdk-stage1/stage1.c | 1 |
5 files changed, 3 insertions, 110 deletions
diff --git a/mdk-stage1/Makefile b/mdk-stage1/Makefile index 8978af384..f84dc2a75 100644 --- a/mdk-stage1/Makefile +++ b/mdk-stage1/Makefile @@ -128,7 +128,7 @@ NETWORK_STANDALONE_DEFS = -DDISABLE_CDROM -DDISABLE_DISK -DENABLE_NETWORK_STANDA STAGE1OBJS-FULL = $(subst .c,-FULL.o,$(STAGE1_ALLSRC)) -BINS = init stage1 dhcp-client rescue-gui probe-modules hotplug +BINS = init stage1 dhcp-client rescue-gui probe-modules DIRS += pci-resource usb-resource ifeq (i386, $(ARCH)) @@ -196,10 +196,6 @@ localclean: rm -f *.o .depend *.rdz *.img $(BINS) -hotplug: hotplug.o - $(DIET) $(CC) $(LDFLAGS) -o $@ $^ - $(STRIPCMD) $@ - rescue-gui: rescue-gui.o frontend-common.o params.o utils.o log.o automatic.o $(FRONTEND_LINK) $(STAGE1_LIBC) $(DIET) $(CC) $(LDFLAGS) -o $@ $^ $(STRIPCMD) $@ diff --git a/mdk-stage1/NEWS b/mdk-stage1/NEWS index 6b8e0aa0f..fc529794e 100644 --- a/mdk-stage1/NEWS +++ b/mdk-stage1/NEWS @@ -1,3 +1,5 @@ +- kill firmware loader now that firmware are loaded by the kernel + 1.73 - add firmware loader written in C (based on hotplug2) (mga#6323) diff --git a/mdk-stage1/hotplug.c b/mdk-stage1/hotplug.c deleted file mode 100644 index 8e4379462..000000000 --- a/mdk-stage1/hotplug.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Firmware loader - * Base on hotplug2 code (GPL v2) (http://code.google.com/p/hotplug2/) - * Copyright stepan@davidovic.cz, iSteve <isteve@bofh.cz> Tomas Janousek <tomi@nomi.cz> - */ - -#include <sys/types.h> -#include <sys/param.h> -#include <unistd.h> -#include <stdio.h> -#include <stdlib.h> - -/** - * Function supplementing 'echo > file' - * - * @1 File to be written to - * @2 Data to be written - * @3 Data size - * - * Returns: 0 on success, -1 on failure. - */ -static int echo_to_file(const char *filename, const char *data, size_t size) { - FILE *fp; - size_t written; - - fp = fopen(filename, "w"); - if (fp == NULL) - return -1; - written = fwrite(data, size, 1, fp); - fclose(fp); - - return (written == size) ? 0 : -1; -} - - -int main(int argc, char **argv) { - char buffer[1024]; - char *devpath; - char *firmware; - char firmware_path[PATH_MAX]; - char sysfs_path_loading[PATH_MAX]; - char sysfs_path_data[PATH_MAX]; - int rv; - FILE *infp, *outfp; - size_t inlen, outlen; - - devpath = getenv("DEVPATH"); - if (devpath == NULL) - return -1; - - firmware = getenv("FIRMWARE"); - if (firmware == NULL) - return -1; - - if (snprintf(sysfs_path_loading, PATH_MAX, "/sysfs%s/loading", devpath) >= PATH_MAX) - return -1; - if (snprintf(sysfs_path_data, PATH_MAX, "/sysfs%s/data", devpath) >= PATH_MAX) - return -1; - if (snprintf(firmware_path, PATH_MAX, "%s/%s", argv[0], firmware) >= PATH_MAX) - return -1; - - echo_to_file(sysfs_path_loading, "1\n", 2); - - infp = fopen(firmware_path, "r"); - if (infp == NULL) { - echo_to_file(sysfs_path_loading, "0\n", 2); - return -1; - } - outfp = fopen(sysfs_path_data, "w"); - if (outfp == NULL) { - fclose(infp); - echo_to_file(sysfs_path_loading, "0\n", 2); - return -1; - } - - rv = 0; - while ((inlen = fread(buffer, 1, 1024, infp)) > 0) { - outlen = fwrite(buffer, 1, inlen, outfp); - if (outlen != inlen) { - rv = -1; - break; - } - } - - fclose(infp); - - echo_to_file(sysfs_path_loading, "0\n", 2); - - return rv; -} diff --git a/mdk-stage1/modules.c b/mdk-stage1/modules.c index 745070052..0c9aa0c32 100644 --- a/mdk-stage1/modules.c +++ b/mdk-stage1/modules.c @@ -40,9 +40,6 @@ #include "modules.h" -#define UEVENT_HELPER_FILE "/sys/kernel/uevent_helper" -#define UEVENT_HELPER_VALUE "/sbin/hotplug" - static char modules_directory[100]; static struct module_deps_elem * modules_deps = NULL; static struct module_descr_elem * modules_descr = NULL; @@ -236,17 +233,6 @@ static int load_modules_descriptions(void) return 0; } -void init_firmware_loader(void) -{ - int fd = open(UEVENT_HELPER_FILE, O_WRONLY|O_TRUNC, 0666); - if (!fd) { - log_message("warning, unable to set firmware loader"); - return; - } - write(fd, UEVENT_HELPER_VALUE, strlen(UEVENT_HELPER_VALUE)); - close(fd); -} - void init_modules_insmoding(void) { find_modules_directory(); diff --git a/mdk-stage1/stage1.c b/mdk-stage1/stage1.c index be9b08301..8d1d092aa 100644 --- a/mdk-stage1/stage1.c +++ b/mdk-stage1/stage1.c @@ -420,7 +420,6 @@ int main(int argc __attribute__ ((unused)), char **argv __attribute__ ((unused)) spawn_shell(); #endif init_modules_insmoding(); - init_firmware_loader(); init_frontend("Welcome to " DISTRIB_DESCR ", " __DATE__ " " __TIME__); probe_that_type(VIRTIO_DEVICES, BUS_ANY); |