comparison src/gearsTools/pmake.pl @ 63:ab729eb8356b

fix build usr command and fs.img
author anatofuz
date Fri, 26 Jul 2019 17:20:50 +0900
parents a28580a75faa
children 58c79e0c5101
comparison
equal deleted inserted replaced
62:a28580a75faa 63:ab729eb8356b
1 #!/usr/bin/env perl 1 #!/usr/bin/env perl
2 use strict; 2 use strict;
3 use warnings; 3 use warnings;
4 4
5 my ($cc,$cflags,$asm,$ld,$ldflags,$libgcc,$cmake); 5 my ($cc,$cflags,$asm,$ld,$ldflags,$libgcc,$cmake,$kernel_cflags,$kernel_ld_flags,$kernel_ld_command);
6 6
7 $cmake = 'cmake'; 7 $cmake = 'cmake';
8 8
9 if ($^O =~ /darwin/){ 9 if ($^O =~ /darwin/){
10 $cc = $ENV{CBC_LANG_COMPILER}; 10 $cc = $ENV{CBC_LANG_COMPILER};
22 $ld = '/mnt/dalmore-home/one/src/armgcc/cross/bin/arm-none-eabi-ld'; 22 $ld = '/mnt/dalmore-home/one/src/armgcc/cross/bin/arm-none-eabi-ld';
23 chomp($libgcc = `$cc --print-libgcc-file-name`); 23 chomp($libgcc = `$cc --print-libgcc-file-name`);
24 $cflags .= " $libgcc"; 24 $cflags .= " $libgcc";
25 $cmake .= 3; 25 $cmake .= 3;
26 $ldflags = " -L. -T kernel-cmake.ld"; 26 $ldflags = " -L. -T kernel-cmake.ld";
27 $kernel_cflags = '-march=armv6 -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -Werror -I. -g -O0 -iquote ../ -c';
28 # -DX_CMAKE_C_LINK_EXECUTABLE=\"$ld $ldflags -o kernel.elf <OBJECTS> $libgcc -b binary initcode fs.img\"
29 $kernel_ld_flags = ' -L. -N -e main -Ttext 0 <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -L ../ /mnt/dalmore-home/one/src/gcc-arm-none-eabi-6-2017-q2-update/bin/../lib/gcc/arm-none-eabi/6.3.1/libgcc.a';
30 $kernel_ld_command = "$ld $kernel_ld_flags";
27 } 31 }
28 32
29 $cflags =~ s/\n//g; 33 $cflags =~ s/\n//g;
30 create_link_script(); 34 create_link_script();
31 #cmake -DCMAKE_LINKER=/path/to/linker -DCMAKE_CXX_LINK_EXECUTABLE="<CMAKE_LINKER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>" 35
32 print_exec_system($cmake, "-DGCC_LIB=$libgcc", "-DCBC_COM=$cc", "-DPMAKE_ARGS=\"$cflags\"","-DCMAKE_ASM_COMPILER=$cc","-DX_CMAKE_LINKER=$ld","-DX_CMAKE_C_LINK_EXECUTABLE=\"$ld $ldflags -o kernel.elf <OBJECTS> $libgcc -b binary initcode fs.img\"","-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE",@ARGV); 36 print_exec_system($cmake, "-DGCC_LIB=$libgcc", "-DCBC_COM=$cc", "-DPMAKE_ARGS=\"$cflags\"","-DCMAKE_ASM_COMPILER=$cc","-DX_CMAKE_LINKER=$ld","-DX_CMAKE_C_LINK_EXECUTABLE=\"$ld $ldflags -o kernel.elf <OBJECTS> $libgcc -b binary initcode fs.img\"","-DKERNEL_LINK_EXECUTABLE=\"$kernel_ld_command\"","-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE",@ARGV);
37
33 system("make"); 38 system("make");
34 #system("sh","link.sh"); 39 #system("sh","link.sh");
35 40
36 sub create_link_script { 41 sub create_link_script {
37 my @link_script; 42 my @link_script;