linux0.12 compilation process

Source: Internet
Author: User
Tags unsupported

Compilation is a very painful thing, I want to put linux0.12 on the Bochs run up and then you can learn the modules, did not think of various problems.

Question 1:

1 gas-c-o boot/head.o boot/head.s2 make:gas:Command not found

Gas is obsolete and will all makfile gas-

Specific Solutions

MSEd Gas AS

MSEd is a simple shell function, specifically defined in the portal below.

Portal: http://www.cnblogs.com/strugglesometimes/p/4231348.html

Question 2:

1boot/Head. S: +: error:unsupported instruction ' mov'2boot/Head. S: -: error:unsupported instruction ' mov'3boot/Head. S: -: error:unsupported instruction ' mov'4boot/Head. S: A: error:unsupported instruction ' mov'5boot/Head. S:136: error:invalid instruction suffix for' Push'6boot/Head. S:137: error:invalid instruction suffix for' Push'7boot/Head. S:138: error:invalid instruction suffix for' Push'8boot/Head. S:139: error:invalid instruction suffix for' Push'9boot/Head. S: $: error:invalid instruction suffix for' Push'Tenboot/Head. S:151: error:invalid instruction suffix for' Push' Oneboot/Head. S: the: error:invalid instruction suffix for' Push' Aboot/Head. S:153: error:invalid instruction suffix for' Push' -boot/Head. S:154: Error:operand Type Mismatch for' Push' -boot/Head. S:155: Error:operand Type Mismatch for' Push' theboot/Head. S:161: error:invalid instruction suffix for' Push' -boot/Head. S:163: error:invalid instruction suffix for' Pop' -boot/Head. S:165: Error:operand Type Mismatch for' Pop' -boot/Head. S:166: Error:operand Type Mismatch for' Pop' +boot/Head. S:167: error:invalid instruction suffix for' Pop' -boot/Head. S:168: error:invalid instruction suffix for' Pop' +boot/Head. S:169: error:invalid instruction suffix for' Pop' Aboot/Head. S:214: error:unsupported instruction ' mov' atboot/Head. S:215: error:unsupported instruction ' mov' -boot/Head. S:217: error:unsupported instruction ' mov'

This is due to the compiler on the 64-bit machine, we need to tell the compiler that we are going to compile the 32-bit code, add--32,cflags in the-m32 after all makefile as

Specific Solutions

msed as$ as\--32
Msed-o-o\-m32

Question 3:

boot/heads:assembler messages:boot/head. S:2312Make: * * * [ boot/head1

Put align N-align 2^n

Specific Solutions

sed ' s/align 2/align 4/g ' boot/head. ssed's/align 3/align 8/g' boot/  Head. S

Question 4:

gcc: error:unrecognized command line option '-fcombine-regs 'gcc: error:unrecognized Command line option '-mstring-insns '

Remove the two, and now GCC doesn't support it.

Specific Solutions

msed-fcombine-

Question 5:

The amount .... In order to find the error more quickly, I turned off all the warning. That is, add-W in Cflags

Specific Solutions

Msed-wall-W

Question 6:

InchfileIncluded from INIT/MAIN.C:8:0: Init/MAIN.C: at: in: error:static declaration of ' fork ' follows non-Static declaration static inline _syscall0 (int, fork)^include/unistd.h:151:6: Note:inchdefinition of macro ' _syscall0 ' type name (void)^Init/MAIN.C: -: in: error:static declaration of ' pause ' follows non-Static declaration static inline _syscall0 (int, pause)^include/unistd.h:151:6: Note:inchdefinition of macro ' _syscall0 ' type name (void)^include/unistd.h:241:5: note:previous declaration of ' pause ' is hereintpause (void); ^Init/MAIN.C: -: in: error:static declaration of 'Sync' Follows non-Static declaration static inline _syscall0 (int,Sync)                             ^include/unistd.h:151:6: Note:inchdefinition of macro ' _syscall0 ' type name (void)^include/unistd.h:252:5: note:previous declaration of 'Sync' is hereint Sync(void);

This is because Include/unistd.h declares a pause () sync () fork (), and in Main.c, the three functions are defined by a macro, but there is a static limit defined, which is different from the declaration, so an error occurs. So just remove the unistd.h from the statement.

Question 7:

INIT/MAIN.C:179:error:static Declaration of ' printf ' follows non-intChar *fmt, ...)

This problem has been troubling for a long time, the online solution is to remove the static, but to do so, there will be another error in the link after the undefined reference to ' _put '. The new problem is that GCC is optimized for printf, which optimizes the non-parametric printf to put, and the linux0.12 libc does not implement put to cause new problems. So now back to this question, speculation should also be due to the GCC itself on the function name of printf due to special care, so the printf slightly changed the name, printf-printw. The discovery sure did compile the pass.

Specific solutions:

sed ' s/printf/printw/g ' init/main.c

Question 8:

function ' main ': Init/main.c:176:3: Error: ' asm ' operand has impossible constraints   __asm__ ("int $0x80"::"a" (__nr_pause):"  Ax");

Similar problems appear in the subsequent compilation of many, C-embedded Assembly format __asm__ (assembly statement: Input Register: Output register: May be modified register), the latest GCC specified input or output register cannot appear in In the register that may be modified , the current way to see the Internet is to delete all possible modified registers for all similar problems.

Specific Solutions

Find sed ' s/:\ "\w\{2\}\" \ (, \ "\w\{2\}\" \) *)/:)/g' {} \;

Question 9:

 Make [1]: Gld:command not found

With gas, put GLD---LD

Specific Solutions

Ld

Question 10:

LD -R-o kernel.o sched.o sys_call.o traps.o asm.o fork.o panic.o printk.o vsprintf.o sys.o exit.o signal.o m KTIME.Old: relocatable linking with relocations from format elf32-i386 (SCHED.O) to format elf64-x86-64 (KERNEL.O) is not supported

With question 2, tell LD to 32-bit link, add-M elf_i386 after the LD command

Specific Solutions

LD ld\-m\ elf_i386

Question 11:

.. /include/asm/Segment.h:assembler messages:.. /include/asm/segment.h:Error:bad register name '%sil'

Go to segment.h the 27th line to find, did not find SIL related things, according to the method of the Internet, the =r or R to =q or Q, sure enough, this should be caused by the compiler, R for any register, in the compile time with the SIL this register, but why the invalid will be used to it. Q means using any one of the Eax,ebx,ecx,edx.

Specific Solutions

sed -i s'/R "/q"/g' include/asm/segment.h

Question 12:

function ' copy_strings ': exec.c: 162:error:lvalue required         as left operand of assignment! ( Pag = (char *) page[p/page_size] =
if (! (Pag = (char *) page[p/page_size]) &&    ! ( Pag = (char *) page[p/page_size] =      Long *) get_free_page ()     )return  0;

The above is the original code, the following is OK code

if ((!page[p/page_size]) &&                                                                                                          ! ( Page[p/page_size] =      Long *) Get_free_page ()))                                                                                           return0;                                                                                                                    Else=                                                                                                                                (char *) page[p/page_size];

Question 13:

file included from floppy.c:0: blk.h:6#elif #elif

Here's #else #elif, line 90th.

Question 14:

 Make [1]: Gar:command not found

Old question, Gar ar

Ar

Question 15:

function ' malloc ': malloc.c: 156:error:lvalue required as left operand of assignment   Bdesccp = get_free_ Page ();

and problem 121 like

Bdesc->page = Bdesc->freeptr = (void *) CP = Get_free_page ();

The above is the original, the following is OK, the code is broken down just fine

CP = get_free_page (); Bdesc->page = Bdesc->freeptr = (void *) CP;

linux0.12 compilation process

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.