August 6, 2016

 

Compiling i686 kernel v2.6.34.1 on x86_64 centos v3.10.0

Want to compile small kernel.

As a first step, as I cannot yet compose the working initrd, I will use the existing pmagic iso which is 2.6.34 for i686 and replace kernel image.

As for package dependencies/toolchain - too many, search for error or ask me in comments.

$ git clone -v git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
$ git branch v2.6.34.1
Then patch something:
$ cd linux-stable ; patch -p0 < patch.diff

Patch is below:

diff --git arch/x86/include/asm/ptrace.h arch/x86/include/asm/ptrace.h
index 69a686a..2041a43 100644
--- arch/x86/include/asm/ptrace.h
+++ arch/x86/include/asm/ptrace.h
@@ -131,6 +131,7 @@ struct pt_regs {
 #ifdef __KERNEL__
 
 #include 
+#include 
 
 struct cpuinfo_x86;
 struct task_struct;
@@ -143,8 +144,8 @@ extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs,
     int error_code, int si_code);
 void signal_fault(struct pt_regs *regs, void __user *frame, char *where);
 
-extern long syscall_trace_enter(struct pt_regs *);
-extern void syscall_trace_leave(struct pt_regs *);
+extern asmregparm long syscall_trace_enter(struct pt_regs *);
+extern asmregparm void syscall_trace_leave(struct pt_regs *);
 
 static inline unsigned long regs_return_value(struct pt_regs *regs)
 {
diff --git arch/x86/vdso/Makefile arch/x86/vdso/Makefile
index 6b4ffed..f576f51 100644
--- arch/x86/vdso/Makefile
+++ arch/x86/vdso/Makefile
@@ -2,7 +2,7 @@
 # Building vDSO images for x86.
 #
 
-VDSO64-$(CONFIG_X86_64)  := y
+VDSO64-$(CONFIG_X86_64)  := n
 VDSO32-$(CONFIG_X86_32)  := y
 VDSO32-$(CONFIG_COMPAT)  := y
 
@@ -25,7 +25,8 @@ targets += vdso.so vdso.so.dbg vdso.lds $(vobjs-y)
 
 export CPPFLAGS_vdso.lds += -P -C
 
-VDSO_LDFLAGS_vdso.lds = -m elf_x86_64 -Wl,-soname=linux-vdso.so.1 \
+#VDSO_LDFLAGS_vdso.lds = -m elf_x86_64 -Wl,-soname=linux-vdso.so.1 \
+VDSO_LDFLAGS_vdso.lds = -m64 -Wl,-soname=linux-vdso.so.1 \
          -Wl,-z,max-page-size=4096 -Wl,-z,common-page-size=4096
 
 $(obj)/vdso.o: $(src)/vdso.S $(obj)/vdso.so
@@ -69,7 +70,7 @@ vdso32.so-$(VDSO32-y)  += sysenter
 vdso32-images   = $(vdso32.so-y:%=vdso32-%.so)
 
 CPPFLAGS_vdso32.lds = $(CPPFLAGS_vdso.lds)
-VDSO_LDFLAGS_vdso32.lds = -m elf_i386 -Wl,-soname=linux-gate.so.1
+VDSO_LDFLAGS_vdso32.lds = -m32 -Wl,-soname=linux-gate.so.1
 
 # This makes sure the $(obj) subdirectory exists even though vdso32/
 # is not a kbuild sub-make subdirectory.

Labels: , ,

Comments: Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?