From 91cc532a55fed3c6c27a2e14759e901ed3d72579 Mon Sep 17 00:00:00 2001 From: torben Date: Mon, 13 Apr 2015 20:09:38 +0200 Subject: Code refactoring. --- testModule/hooks/pre-pivot.sh | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 testModule/hooks/pre-pivot.sh (limited to 'testModule/hooks/pre-pivot.sh') diff --git a/testModule/hooks/pre-pivot.sh b/testModule/hooks/pre-pivot.sh new file mode 100644 index 00000000..c868fc30 --- /dev/null +++ b/testModule/hooks/pre-pivot.sh @@ -0,0 +1,3 @@ +# TODO +warn '............MOUNT.............' +mount /dev/nbd0 /sysroot/mnt -- cgit v1.2.3-55-g7522 From 25f9f2ebdd4cd65c01306617cb043837a8be3171 Mon Sep 17 00:00:00 2001 From: torben Date: Mon, 13 Apr 2015 20:35:35 +0200 Subject: Remove debugging lines. --- testModule/hooks/pre-mount.sh | 4 ++-- testModule/hooks/pre-pivot.sh | 2 +- testModule/module-setup.sh | 14 ++++++++------ 3 files changed, 11 insertions(+), 9 deletions(-) (limited to 'testModule/hooks/pre-pivot.sh') diff --git a/testModule/hooks/pre-mount.sh b/testModule/hooks/pre-mount.sh index 0bf80e16..b29dbeb4 100644 --- a/testModule/hooks/pre-mount.sh +++ b/testModule/hooks/pre-mount.sh @@ -5,6 +5,6 @@ insmod /usr/lib/modules/3.10.0-229.1.2.el7.x86_64/extra/dnbd3.ko local dnbd3_device_node="$(dnbd3-client -h 132.230.4.1 -i stage4/torben/test -r 1 -d /dev/dnbd0)" dnbd3_device_node='/dev/dnbd0' # TODO sysroot normally not available yet. -qemu-img create -f qcow2 -o backing_file="$dnbd3_device_node",backing_fmt=qcow2 /sysroot/test.qcow2 +qemu-img create -f qcow2 -o backing_file="$dnbd3_device_node",backing_fmt=qcow2 /test.qcow2 insmod /usr/lib/modules/3.10.0-229.1.2.el7.x86_64/extra/nbd.ko -systemd_preserve_process_marker qemu-nbd -c /dev/nbd0 /sysroot/test.qcow2 +systemd_preserve_process_marker qemu-nbd -c /dev/nbd0 /test.qcow2 diff --git a/testModule/hooks/pre-pivot.sh b/testModule/hooks/pre-pivot.sh index c868fc30..8c013496 100644 --- a/testModule/hooks/pre-pivot.sh +++ b/testModule/hooks/pre-pivot.sh @@ -1,3 +1,3 @@ # TODO warn '............MOUNT.............' -mount /dev/nbd0 /sysroot/mnt +mount /dev/nbd0 /mnt diff --git a/testModule/module-setup.sh b/testModule/module-setup.sh index 698ebf62..158800b4 100644 --- a/testModule/module-setup.sh +++ b/testModule/module-setup.sh @@ -23,26 +23,28 @@ installkernel() { mperf libcrc32c sd_mod crc_t10dif crct10dif_common sr_mod cdrom \ ata_generic pata_acpi ahci libahci vboxvideo drm i2c_core ata_piix \ libata vboxguest dm_mirror dm_region_hash dm_log dm_mod + # Production: instmods ext4 mbcache jbd2 } install() { # Loads globally needed useful functions or fixes some native dracut ones. inst "$moddir/library.sh" /usr/lib/test-library.sh + inst "$moddir/binaries/systemd_preserve_process_marker" /usr/bin/systemd_preserve_process_marker inst "$moddir/binaries/endless" /usr/bin/endless inst "$moddir/binaries/dnbd3-client" /usr/bin/dnbd3-client inst "$moddir/binaries/busybox" /usr/bin/busybox + inst "$moddir/kernel_modules/dnbd3.ko" /usr/lib/modules/3.10.0-229.1.2.el7.x86_64/extra/dnbd3.ko inst "$moddir/kernel_modules/nbd.ko" /usr/lib/modules/3.10.0-229.1.2.el7.x86_64/extra/nbd.ko + # NOTE: Priority has to be lower than the network cmdline parsing hooks # since we have to modify the some kernel parameter before. inst_hook cmdline 1 "$moddir/hooks/cmdline.sh" - # TODO pre-pivot to pre-mount - inst_hook pre-pivot 10 "$moddir/hooks/pre-mount.sh" - # TODO 11 to 10 - inst_hook pre-pivot 11 "$moddir/hooks/pre-pivot.sh" - #inst_hook pre-mount 20 "$moddir/setup_network.sh" + inst_hook pre-mount 10 "$moddir/hooks/pre-mount.sh" + inst_hook pre-pivot 10 "$moddir/hooks/pre-pivot.sh" + inst_multiple lsblk ping ip ifconfig sshd htop dhclient tail head cat vim touch sed lsmod insmod qemu-img qemu-nbd sleep route wget find - # FINAL: inst_multiple insmod qemu-img qemu-nbd + # Production: inst_multiple insmod qemu-img qemu-nbd return 0 } -- cgit v1.2.3-55-g7522 From c7332013f0e3aa212c4e4adbccbd518a33947813 Mon Sep 17 00:00:00 2001 From: torben Date: Mon, 13 Apr 2015 20:45:22 +0200 Subject: Fixes. --- testModule/hooks/pre-pivot.sh | 1 + 1 file changed, 1 insertion(+) (limited to 'testModule/hooks/pre-pivot.sh') diff --git a/testModule/hooks/pre-pivot.sh b/testModule/hooks/pre-pivot.sh index 8c013496..94e92b1d 100644 --- a/testModule/hooks/pre-pivot.sh +++ b/testModule/hooks/pre-pivot.sh @@ -1,3 +1,4 @@ # TODO warn '............MOUNT.............' +mkdir --parents /mnt && \ mount /dev/nbd0 /mnt -- cgit v1.2.3-55-g7522 From b4a9dea1aed0919448b4fe8fc993eaa04f0d9e8c Mon Sep 17 00:00:00 2001 From: torben Date: Tue, 14 Apr 2015 17:58:35 +0200 Subject: Some tries to fix kernel panic. --- grub2.conf | 3 ++- testModule/hooks/pre-mount.sh | 12 ++++++------ testModule/hooks/pre-pivot.sh | 12 ++++++++++-- testModule/module-setup.sh | 7 +++++-- 4 files changed, 23 insertions(+), 11 deletions(-) (limited to 'testModule/hooks/pre-pivot.sh') diff --git a/grub2.conf b/grub2.conf index 556a59c4..41205d4f 100755 --- a/grub2.conf +++ b/grub2.conf @@ -6,7 +6,8 @@ menuentry 'test' --class centos --class gnu-linux --class gnu --class os --unres insmod part_msdos insmod xfs set root='hd0,msdos1' - linux16 /vmlinuz-3.10.0-229.1.2.el7.x86_64 ro vconsole.font=latarcyrheb-sun16 vconsole.keymap=de rd.break root=UUID=6c06919a-389a-4a50-8c6b-b086e65db9b0 rd.udev.log-priority=debug ip=10.0.2.15:132.230.4.2:10.0.2.2:255.255.255.0 # NOTE: Prevents dracut console: console=tty0 console=ttyS0,9600 ip=enp0s3:dhcp rd.debug rd.shell rd.info root=/dev/nbd0 rootfstype=ext4 + linux16 /vmlinuz-3.10.0-229.1.2.el7.x86_64 ro vconsole.font=latarcyrheb-sun16 vconsole.keymap=de rd.break root=UUID=6c06919a-389a-4a50-8c6b-b086e65db9b0 rd.udev.log-priority=debug ip=10.0.2.15:132.230.4.2:10.0.2.2:255.255.255.0 # NOTE: Prevents dracut console: console=tty0 console=ttyS0,9600 ip=enp0s3:dhcp root=/dev/nbd0 rootfstype=ext4 + #linux16 /vmlinuz-3.10.0-229.1.2.el7.x86_64 console=tty0 console=ttyS0,9600 ro vconsole.font=latarcyrheb-sun16 vconsole.keymap=de rd.break rd.debug rd.shell rd.info root=UUID=6c06919a-389a-4a50-8c6b-b086e65db9b0 rd.udev.log-priority=debug ip=10.0.2.15:132.230.4.2:10.0.2.2:255.255.255.0 initrd16 /initramfs-test.img # fully given: selxsrv=132.230.4.2 slxbase=boot/openselx-productive quiet splash vga=current wurstgesicht initrd=http://132.230.4.2/boot/openslx-productive/initramfs-stage31 ip=132.230.4.67:132.230.4.2:132.230.4.254:255.255.255.0 BOOTIF=01-08-00-27-60-49-62 BOOT_IMAGE=http://132.230.4.2/boot/openslx-productive/kernel diff --git a/testModule/hooks/pre-mount.sh b/testModule/hooks/pre-mount.sh index b29dbeb4..7798622e 100644 --- a/testModule/hooks/pre-mount.sh +++ b/testModule/hooks/pre-mount.sh @@ -2,9 +2,9 @@ warn '............START.............' insmod /usr/lib/modules/3.10.0-229.1.2.el7.x86_64/extra/dnbd3.ko -local dnbd3_device_node="$(dnbd3-client -h 132.230.4.1 -i stage4/torben/test -r 1 -d /dev/dnbd0)" -dnbd3_device_node='/dev/dnbd0' -# TODO sysroot normally not available yet. -qemu-img create -f qcow2 -o backing_file="$dnbd3_device_node",backing_fmt=qcow2 /test.qcow2 -insmod /usr/lib/modules/3.10.0-229.1.2.el7.x86_64/extra/nbd.ko -systemd_preserve_process_marker qemu-nbd -c /dev/nbd0 /test.qcow2 +local dnbd3_device_node="$(dnbd3-client -h 132.230.4.1 -i stage4/torben/test \ + -r 1 -d /dev/dnbd0)" +#qemu-img create -f qcow2 -o \ +# backing_file="$dnbd3_device_node",backing_fmt=qcow2 /test.qcow2 +#insmod /usr/lib/modules/3.10.0-229.1.2.el7.x86_64/extra/nbd.ko +#systemd_preserve_process_marker qemu-nbd -c /dev/nbd0 /test.qcow2 diff --git a/testModule/hooks/pre-pivot.sh b/testModule/hooks/pre-pivot.sh index 94e92b1d..8b01779a 100644 --- a/testModule/hooks/pre-pivot.sh +++ b/testModule/hooks/pre-pivot.sh @@ -1,4 +1,12 @@ # TODO warn '............MOUNT.............' -mkdir --parents /mnt && \ -mount /dev/nbd0 /mnt +# TODO +dnbd3_device_node='/dev/dnbd0' +mount -o remount,rw /sysroot +rm /sysroot/test.qcow2 +qemu-img create -f qcow2 -o \ + backing_file="$dnbd3_device_node",backing_fmt=qcow2 /sysroot/test.qcow2 +insmod /usr/lib/modules/3.10.0-229.1.2.el7.x86_64/extra/nbd.ko +systemd_preserve_process_marker qemu-nbd --connect /dev/nbd0 /sysroot/test.qcow2 --socket /sysroot/var/lock/qemu-nbd-TEST +mount /dev/nbd0 /sysroot/TEST +# strace -ff -o /sysroot/log.txt -p PID diff --git a/testModule/module-setup.sh b/testModule/module-setup.sh index 158800b4..513b9068 100644 --- a/testModule/module-setup.sh +++ b/testModule/module-setup.sh @@ -5,7 +5,8 @@ check() { } depends() { - echo base network rootfs-block bash kernel-modules systemd debug + echo base network rootfs-block bash kernel-modules debug + # systemd return 0 } @@ -44,7 +45,9 @@ install() { inst_hook pre-mount 10 "$moddir/hooks/pre-mount.sh" inst_hook pre-pivot 10 "$moddir/hooks/pre-pivot.sh" - inst_multiple lsblk ping ip ifconfig sshd htop dhclient tail head cat vim touch sed lsmod insmod qemu-img qemu-nbd sleep route wget find + inst_multiple lsblk ping ip ifconfig sshd htop dhclient tail head cat vim \ + touch sed lsmod insmod qemu-img qemu-nbd sleep route wget find lsof \ + strace chroot switch_root pivot_root # Production: inst_multiple insmod qemu-img qemu-nbd return 0 } -- cgit v1.2.3-55-g7522