View: 5465|Reply: 2

compiling kernel on orange PI OK

[Copy link]

12

threads

30

posts

150

credits

Registered member

Rank: 2

credits
150
Published in 2016-3-14 03:06:37 | Show all floors |Read mode
You cannot compile the kernel on the OPI. (you have to crosscompile it)
However on the website of Jean Francois Moine ->  http://moinejf.free.fr/opi2/kernel-3.4.patch

I used the kernel of the Armbian project 3.4.110

(1)     I just replaced the Makefile in
/usr/src/h3-wip/arch/arm/mach-sunxi/power/brom
with the one displayed on the bottom

(2) and put the mksunxichecksum.c in that directory (compiled it with gcc .... -o mksunxichecksum)

(3) that's all -- you now can compile the kernel with make on the OPI (I used make -j3 this way you can make use of three cores)





----------------------------------------------------adapt Makefile
#makefile for resume.bin

always  := resumes.code
targets := resumes.elf


hostprogs-y := mksunxichecksum
# toegvoegd

#use "-Os" flags.
#Don't use "-O2" flags.
KBUILD_CFLAGS := -g -c -nostdlib -march=armv7-a -marm -fno-unwind-tables -fno-asynchronous-unwind-tables -mlittle-endian -Os
#--min_array_alignment=4 --no_unaligned_access

#Include the cur dir.
KBUILD_CPPFLAGS += -I.

LD_FLAGS = -static
LIBS =

INCLUDE   = -I. \
       -I$(KDIR)/include \
       -I$(KDIR)/arch/arm/mach-sunxi/include

resumes-y :=   resumes.o        \
               resume_head.o

resumes-y := $(addprefix $(obj)/,$(resumes-y))

$(obj)/resumes.code: $(obj)/resumes.bin
        $(obj)/mksunxichecksum $(obj)/resumes.bin $(obj)/resumes.code
#       $(Q)$(obj)/gen_check_code $(obj)/resumes.bin $(obj)/resumes.code
$(obj)/resumes.bin: $(obj)/resumes.elf FORCE
        $(Q)$(CROSS_COMPILE)objcopy -O binary $(obj)/resumes.elf $(obj)/resumes.bin

ifneq ($(strip $(CONFIG_ARCH_SUN9I)),)
$(obj)/resumes.elf: $(obj)/sun9i_brom_scatter.scat $(resumes-y)
        $(Q)$(CROSS_COMPILE)ld -T $(obj)/sun9i_brom_scatter.scat  -EL  $(resumes-y) -o $(obj)/resumes.elf  -Map $(obj)/resumes.map
        $(Q)$(CROSS_COMPILE)objdump -D $(obj)/resumes.elf > $(obj)/resumes.lst
endif

ifneq ($(strip $(CONFIG_ARCH_SUN8I)),)
#$(obj)/resumes.elf: $(obj)/sun8i_brom_scatter.scat $(resumes-y)
#       $(Q)$(CROSS_COMPILE)ld -T $(obj)/sun8i_brom_scatter.scat  -EL  $(resumes-y) -o $(obj)/resumes.elf  -Map $(obj)/resumes.map
                                                             1,1           Top

2

threads

45

posts

936

credits

Senior member

Rank: 4

credits
936
Published in 2016-3-16 03:52:26 | Show all floors
Fine,
but how long it takes?


12

threads

30

posts

150

credits

Registered member

Rank: 2

credits
150
 Author| Published in 2016-3-16 21:38:24 | Show all floors
A full kernel compilation took about 2 hours in the background (I only used three cores for the compilation)

I'm playing with some modules, and then I only need the compilation of the changes, which is way faster (couple of minutes)

You need to log in before you can reply login | Register

Points Rule

Quick reply Top Return list