From f710ad7efecee968f33bf64a3ec7a567789ddfd5 Mon Sep 17 00:00:00 2001 From: Antoine Ginies Date: Thu, 20 Jan 2011 09:53:15 +0000 Subject: add firmware support --- images/make_boot_img | 27 +++++++++++++++++++++++++-- images/update_kernel | 1 + 2 files changed, 26 insertions(+), 2 deletions(-) (limited to 'images') diff --git a/images/make_boot_img b/images/make_boot_img index bc341be9c..02fd0b85d 100755 --- a/images/make_boot_img +++ b/images/make_boot_img @@ -143,8 +143,9 @@ sub initrd { my $stage1_root = "../mdk-stage1"; _ "rm -rf $tmp_initrd"; - mkdir_p("$tmp_initrd$_") foreach qw(/etc /lib /modules /sbin /tmp /var); + mkdir_p("$tmp_initrd$_") foreach qw(/etc /firmware /lib /modules /sbin /tmp /var); symlink "../modules", "$tmp_initrd/lib/modules"; + symlink "../firmware", "$tmp_initrd/lib/firmware"; symlink "/proc/mounts", "$tmp_initrd/etc/mtab"; symlink "../tmp", "$tmp_initrd/var/run"; @@ -156,7 +157,29 @@ sub initrd { foreach ("/usr/share/ldetect-lst/fallback-modules.alias", "/lib/module-init-tools/ldetect-lst-modules.alias") { _ "install -D $_ $tmp_initrd$_"; } - + foreach my $firm (glob_("all.kernels$I/$ext/firmware/*")) { + my $dest=$firm; + $dest =~ s|all.kernels$I/$ext/||; + _ "cp -a $firm $tmp_initrd/$dest"; + }; + + output("$tmp_initrd/hotplug", q{#!/bin/sh -e +if [ "$SUBSYSTEM" = firmware ] && [ "$ACTION" = add ] && [ -n "$FIRMWARE" ] ; then + if [ ! -e /sys$DEVPATH/loading ]; then + exit 1 + fi + if [ -e "/lib/firmware/$FIRMWARE" ]; then + echo 1 > /sys$DEVPATH/loading + cat "/lib/firmware/$FIRMWARE" > /sys$DEVPATH/data + echo 0 > /sys$DEVPATH/loading + exit 0 + fi + echo -1 > /sys$DEVPATH/loading + exit 1 +fi +}); + _ "chmod 755 $tmp_initrd/hotplug"; + symlink "../hotplug", "$tmp_initrd/sbin/hotplug"; _ "install $stage1_root/init $tmp_initrd/"; foreach ('stage1', 'pppd', 'pppoe') { _ "install $stage1_root/$_ $tmp_initrd/sbin/"; diff --git a/images/update_kernel b/images/update_kernel index d06ccf126..0b2b82fae 100755 --- a/images/update_kernel +++ b/images/update_kernel @@ -75,6 +75,7 @@ sub extract_installed_rpm { } sys('perl', '../kernel/modules.pl', 'remove_unneeded_modules', $kern_ver); + sys('perl', '../kernel/modules.pl', 'get_firmwares', $kern_ver); sys('perl', '../kernel/modules.pl', 'make_modules_per_image', $kern_ver); rm_rf("$local_dir/modules"); -- cgit v1.2.1