From 472deb14a14616b07df41e754fad89fa0bb7cf29 Mon Sep 17 00:00:00 2001 From: Christophe Fergeau Date: Thu, 17 Sep 2009 14:56:52 +0000 Subject: Rough plymouth support --- lib/MDV/Draklive/Initrd.pm | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) (limited to 'lib') diff --git a/lib/MDV/Draklive/Initrd.pm b/lib/MDV/Draklive/Initrd.pm index dcba8d2..bffc684 100644 --- a/lib/MDV/Draklive/Initrd.pm +++ b/lib/MDV/Draklive/Initrd.pm @@ -7,6 +7,7 @@ use MDV::Draklive::Utils; use MDV::Draklive::StorageFS; use MDV::Draklive::Loopback; use MDV::Draklive::Overlay; +use File::Basename; my %module_to_config = ( ext3 => 'EXT3_FS', @@ -95,10 +96,6 @@ sub create_media_specific_initrd { inst_initrd_bin($root, $initrd_tree, '/usr/bin/strace') if $live->{debug}; - foreach (chomp_(run_program::rooted_get_stdout($root, "/usr/sbin/splashy_find_files"))) { - inst_initrd_file($root, $initrd_tree, $_); - } - #- busybox is required to: #- detect usb-storage process (we need sh/while/ps/grep) #- mount loopbacks read-only with losetup (useful over NFS) @@ -123,10 +120,11 @@ sub create_media_specific_initrd { require devices; devices::make($initrd_tree . "/dev/$_") foreach if_($rrpt_dev, $rrpt_dev), - qw(console initrd null ram systty tty), + qw(console initrd null ram systty tty tty1), (map { "tty$_" } 0..8), (map { "loop$_" } 0 .. $loop_nb); - syscall_('mknod', $initrd_tree . "/dev/fb0", c::S_IFCHR(), makedev(29, 0)) or die "mknod failed (dev $_): $!"; + syscall_('mknod', $initrd_tree . "/dev/ptmx", c::S_IFCHR(), makedev(5, 2)) or die "mknod failed (dev $_): $!"; + syscall_('mknod', $initrd_tree . "/dev/fb", c::S_IFCHR(), makedev(29, 0)) or die "mknod failed (dev $_): $!"; #- pre-create devfsd compatibility loop devices (since busybox is still built with devfsd support) mkdir_p($initrd_tree . "/dev/loop"); cp_af($initrd_tree . "/dev/loop$_", $initrd_tree . "/dev/loop/$_") foreach 0 .. $loop_nb; @@ -192,6 +190,21 @@ sub create_media_specific_initrd { uniq(map { list_modules::dependencies_closure($_) } @$extra_modules); create_initrd_scriptlet($live, $media, @extra_modules_closure, @additional_modules); + + my $plymouth_theme_name = basename(dirname(expand_symlinks($root . "/usr/share/plymouth/themes/default.plymouth"))); + my $plymouth_theme_path = "/usr/share/plymouth/themes/" . $plymouth_theme_name; + print "Copying plymouth theme $plymouth_theme_name\n"; + mkdir_p($initrd_tree . "/usr/share/plymouth/themes"); + cp_af($root . $plymouth_theme_path, $initrd_tree . $plymouth_theme_path); + + my $plymouth_module_name = `grep "ModuleName *= *" $root/usr/share/plymouth/themes/$plymouth_theme_name/$plymouth_theme_name.plymouth | sed 's/ModuleName *= *//'`; + chomp $plymouth_module_name; + foreach (qw(/sbin/plymouthd /bin/plymouth /usr/share/plymouth/themes/text/text.plymouth /usr/share/plymouth/themes/details/details.plymouth /usr/share/icons/large/mandriva.png /etc/mandriva-release /usr/share/plymouth/themes/default.plymouth ), "/usr/$lib_prefix/plymouth/text.so", "/usr/$lib_prefix/plymouth/details.so", "/usr/$lib_prefix/plymouth/$plymouth_module_name.so") { + inst_initrd_file ($root, $initrd_tree, $_); + } + + print "Compressing initrd\n"; + compress_initrd_tree($live, $initrd_tree, $initrd); add_splash($live, $initrd); } @@ -214,8 +227,11 @@ sub create_initrd_scriptlet { "nash-mount -t proc /proc /proc", #- required for cdrom labels "nash-mount -t sysfs /sys /sys", - "splashy_chvt 8", - "splashy boot", + #- required for plymouthd + "mkdir /dev/pts", + "nash-mount -t devpts -o gid=5,mode=620 /dev/pts /dev/pts", + "/bin/plymouthd --attach-to-session", + "plymouth --show-splash", (map { join(" ", "probe-modules", list_modules::filename2modname($_), grep { $_ } $live->{system}{module_options}{$_}) } @modules), "probe-modules --$media->{storage}", if_($rrpt_dev, @@ -228,11 +244,12 @@ sub create_initrd_scriptlet { (map { $loop_types{$_->{type}}{mount}->($live, $_) } @$mount_first, @$mount_last), ($live->{mount}{overlay} ? $MDV::Draklive::Overlay::overlay{$live->{mount}{overlay}}{mount}->($live) : ()), if_($live->{system}{initrd_pre_pivot}, deref_array($live->{system}{initrd_pre_pivot})), - qq(splashy_update "chroot $target"), + "plymouth --newroot=$target", "echo 0x0100 > /proc/sys/kernel/real-root-dev", "umount /sys", "sh -c 'umount /proc/bus/usb 2>/dev/null'", "umount /proc", + "umount /dev/pts", "pivot_root $target $target$initrdroot", if_($live->{mount}{root}, "sh -c 'rmdir $initrdroot$live->{prefix}{live}{mnt}$live->{mount}{root}'"), (map { $loop_types{$_->{type}}{pivot_clean}->($live, $_, $initrdroot) } grep { $loop_types{$_->{type}}{pivot_clean} } @{$live->{mount}{dirs} || []}), -- cgit v1.2.1