[debian-knoppix] [Tiny] pivot_root.asm - Für Christian Perle zum Runterladen aus dem Archiv...
pivot_root.asm:
section .text ; declaring our .text segment
global _start ; telling where program execution should start
_start: ; this is where code starts getting exec'ed
pop ebx ; argc
pop ebx ; argv[0]
pop ebx ; the first real arg, new_root
pop ecx ; the first real arg, put_old
mov eax,217 ; the syscall number for pivot_root
; we already have the new_root in ebx
; and put_old in ecx
int 80h ; call the kernel
mov ebx,eax ; save the errno in ebx
mov eax,1 ; put the exit syscall number in eax
int 80h ; bail out
Kompilieren mit:
nasm -f elf pivot_root.asm
gcc -Wall -nostdlib -s pivot_root.o -o my_pivot_root
ls -l
412 my_pivot_root
Wir brauchen dies für die initrd im knx-hdinstall-Skript, um nicht die ganze
libc mitschleppen zu müssen (damit syslinux-bootdiskette erzeugbar ist).
Eventuell könnte man das auch noch in die ash miteinbauen ?!
cu
Fabian
_______________________________________________
debian-knoppix mailing list
debian-knoppix@linuxtag.org
http://mailman.linuxtag.org/mailman/listinfo/debian-knoppix
Reply to: