转自:http://www.mamicode.com/info-detail-1321279.html

标签:

Ubuntu16.10偶遇linux0.11

编译环境

  • Ubuntu 16.10
  • gcc 5.2.1

问题集锦

1.

as86 -0 -a -o boot/bootsect.o boot/bootsect.s
make: as86:命令未找到
Makefile:92: recipe for target ‘boot/bootsect’ Failed
make: * [boot/bootsect] Error 127

#解决:下载bin86包 sudo aptitude install bin86

2.

gas -c -o boot/head.o boot/head.s
make: gas:命令未找到
Makefile:34: recipe for target ‘boot/head.o’ Failed
make: * [boot/head.o] Error 127

#解决:把所有Makefile的gas改为as --32,执行下面命令后忽略输出信息就行了。还有个gar,这里一起修改了 find -name "Makefile" | xargs -ti sed -i s/gas/as --32/g {} \; find -name "Makefile" | xargs -ti sed -i s/gar/ar/g {} \;

3.

as –32 -c -o boot/head.o boot/head.s
boot/head.s: Assembler messages:
boot/head.s:231: Error: alignment not a power of 2
Makefile:34: recipe for target ‘boot/head.o’ Failed
make: * [boot/head.o] Error 1

#解决:对齐要是2的倍数,就是align 4,8,16,等等 #把.align 2改为.align 4 #把.align 3改为.align 8 sed -i s/align 2/align 4/g boot/head.s; sed -i s/align 3/align 8/g boot/head.s

4.

as –32 -c -o boot/head.o boot/head.s
gcc -Wall -O -g -fstrength-reduce -fomit-frame-pointer -fcombine-regs \
-nostdinc -Iinclude -c -o init/main.o init/main.c
gcc: error: unrecognized command line option ‘-fcombine-regs’
Makefile:36: recipe for target ‘init/main.o’ Failed
make: * [init/main.o] Error 1

#同理 find -name "Makefile" | xargs -ti sed -i s/-fcombine-regs//g‘ {} \;

5.

In file included from init/main.c:8:0:
init/main.c:23:29: error: static declaration of ‘fork’ follows non-static declaration
static inline _syscall0(int,fork)

#把static去掉 sed -i s/static inline/inline/g init/main.c

6.

init/main.c: Assembler messages:
init/main.c:138: Error: invalid instruction suffix for push‘
init/main.c:139: Error: invalid instruction suffix for
push’
init/main.c:140: Error: invalid instruction suffix for pushf‘
init/main.c:141: Error: invalid instruction suffix for
push’
init/main.c:142: Error: invalid instruction suffix for `push’

To build a binary for x86 on 64 bit machine,you will need to install 32 bit c library as well. One way to do this is to install gcc/g++ multilib.

If you don't need x86 library,you can remove linux_x86 platform in the build.gradle as you already did.

#使用了gcc64位编译了,应该用32位,加上-m32这个选项就行了 #注意要使用-m32这个选项还需要安装一些相关的库,具体的我忘记了 find -name "Makefile" | xargs -ti sed -i s/gcc/gcc -m32 /g {} \; sudo apt-get install gcc-multilib sudo apt-get install g++-multilib


编译报错:

boot/head.s:43: Error: unsupported instruction `mov'
boot/head.s:161: Error: invalid instruction suffix for `push'
boot/head.s:163: Error: invalid instruction suffix for `pop'

出错原因:64位系统原因

解决方案:

修改head.s,在文件前加.code32


7

../include/string.h: In function ‘strcpy’:
../include/string.h:29:1: error: ‘asm’ operand has impossible constraints
asm(“cld\n”
^
Makefile:24: recipe for target ‘traps.o’ Failed
make[1]: * [traps.o] Error 1
make[1]: Leaving directory ‘/opt/linux-gdb/linux/kernel’
Makefile:76: recipe for target ‘kernel/kernel.o’ Failed
make: * [kernel/kernel.o] Error 2

##不需要制定哪些寄存器会改变了,所以把__asm__("":::***),这里的***寄存器删掉把。 ##一般直接复制下面的执行就行了 ##精髓。。哈哈 sed -i s/\(:*.*:*\):.*);$/\1);/g include/string.h sed -i s/:"dx")/)/g include/linux/sched.h sed -i 55s/\(:*.*:*\):.*)$/\1)/g mm/memory.c sed -i 81s/\(:*.*:*\):.*);$/\1);/g mm/memory.c sed -i 288s/\(:*.*:*\):.*)$/\1)/g fs/buffer.c sed -i 76s/\(:*.*:*\):.*);$/\1);/g mm/memory.c sed -i 17s/\(:*.*:*\):.*)$/\1)/g fs/bitmap.c sed -i 44s/\(:*.*:*\):.*);/\1);/g fs/bitmap.c sed -i 158s/\(:*.*:*\):.*)/\1)/g kernel/blk_drv/floppy.c sed -i 62s/\(:*.*:*\):.*)/\1)/g kernel/blk_drv/hd.c sed -i 65s/\(:*.*:*\):.*)/\1)/g kernel/blk_drv/hd.c sed -i 12s/\(:*.*:*\):.*);/\1);/g include/asm/memory.h sed -i s/\(:*.*:*\):.*);$/\1);/g kernel/chr_drv/console.c

8.

gld -r -o kernel.o sched.o system_call.o traps.o asm.o fork.o panic.o printk.o vsprintf.o sys.o exit.o signal.o mktime.o
make[1]: gld:命令未找到
Makefile:32: recipe for target ‘kernel.o’ Failed
make[1]: * [kernel.o] Error 127
make[1]: Leaving directory ‘/opt/linux-gdb/linux/kernel’
Makefile:76: recipe for target ‘kernel/kernel.o’ Failed
make: * [kernel/kernel.o] Error 2

find -name "Makefile" | xargs -ti sed -i s/gld/ld -melf_i386/g {} \;

9.

/opt/linux-gdb/linux/kernel/../include/string.h:396: `memset’被多次定义
traps.o:/opt/linux-gdb/linux/kernel/../include/string.h:396:第一次在此定义
Makefile:32: recipe for target ‘kernel.o’ Failed
make[1]: * [kernel.o] Error 1
make[1]: Leaving directory ‘/opt/linux-gdb/linux/kernel’
Makefile:76: recipe for target ‘kernel/kernel.o’ Failed
make: * [kernel/kernel.o] Error 2

#把extern inline 改为static extern find -name "*.h" | xargs -ti sed -i s/extern inline/static inline/g {} \;

10.

gcc -m32 -Wall -O g -fstrength-reduce -fomit-frame-pointer -nostdinc -I../include \
-c -o open.o open.c
gcc: error: g: 没有那个文件或目录
Makefile:13: recipe for target ‘open.o’ Failed
make[1]: * [open.o] Error 1
make[1]: Leaving directory ‘/opt/linux-gdb/linux/fs’
Makefile:82: recipe for target ‘fs/fs.o’ Failed
make: * [fs/fs.o] Error 2

#-O g改为-O -g find -name "Makefile" | xargs -ti sed -i s/-O g/-O -g/g {} \;

11

exec.c: In function ‘copy_strings’:
exec.c:145:44: error: lvalue required as left operand of assignment
!(pag = (char *) page[p/PAGE_SIZE] =
^
exec.c: In function ‘do_execve’:
exec.c:245:3: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
if (cp = strchr(buf,‘\n’)) {
^
Makefile:13: recipe for target ‘exec.o’ Failed
make[1]: * [exec.o] Error 1
make[1]: Leaving directory ‘/opt/linux-gdb/linux/fs’
Makefile:82: recipe for target ‘fs/fs.o’ Failed
make: * [fs/fs.o] Error 2

#替换成下面这一行 if (!(pag = (char *) page[p/PAGE_SIZE]) && !(pag = (char *) (page[p/PAGE_SIZE] = (unsigned long *) get_free_page()))) 

11.

gcc -m32 -E -nostdinc -I../../include -Traditional keyboard.S -o keyboard.s
as –32 -c -o keyboard.o keyboard.s
keyboard.S: Assembler messages:
keyboard.S:47: Error: %al‘ not allowed withxorl’
keyboard.S:53: Warning: indirect call without `*’
Makefile:22: recipe for target ‘keyboard.o’ Failed
make[1]: * [keyboard.o] Error 1
make[1]: Leaving directory ‘/opt/linux-gdb/linux/kernel/chr_drv’
Makefile:73: recipe for target ‘kernel/chr_drv/chr_drv.a’ Failed
make: * [kernel/chr_drv/chr_drv.a] Error 2

sed -i s/xorl/xor/g kernel/chr_drv/keyboard.S

12.

alloc.c:133:3: warning: function with qualified void return type called
panic(“malloc: bad arg”);
^
malloc.c:156:46: error: lvalue required as left operand of assignment
bdesc->page = bdesc->freeptr = (void *) cp = get_free_page();
^

#改为这个 bdesc->page = bdesc->freeptr = (void *) (cp = (char*)get_free_page());

13.

(.init.text+0xca7):对‘__stack_chk_fail’未定义的引用
init/built-in.o: In function do_header‘:
initramfs.c.init.text+0x4343):对‘__stack_chk_fail’未定义的引用
arch/i386/kernel/built-in.o.text+0x54c6): more undefined references to
__stack_chk_fail’ follow
make[1]: * [.tmp_vmlinux1] 错误 1
make[1]: Leaving directory `/usr/src/linux-2.6.17.10’
make: * [debian/stamp-build-kernel] 错误 2

#在每一个Makefile里找到CFLAGS然后添加-fno-stack-protector标志!!!  find -name "Makefile" | xargs -ti sed s/-Wall/-Wall -fno-stack-protector/g {} \;

13.

ld: warning: cannot find entry symbol _start; defaulting to 0000000000000000
kernel/chr_drv/chr_drv.a(console.o):在函数‘con_write’中:
/opt/linux-gdb/linux/kernel/chr_drv/console.c:461:对‘attr’未定义的引用
Makefile:59: recipe for target ‘tools/system’ Failed
make: * [tools/system] Error 1

#把attr改为¥0x07

14.

/tmp/ccQ4qmOC.o:在函数‘main’中:
/opt/linux-gdb/linux/tools/build.c:72:对‘MAJOR’未定义的引用
/opt/linux-gdb/linux/tools/build.c:73:对‘MInor’未定义的引用
collect2: error: ld returned 1 exit status
Makefile:52: recipe for target ‘tools/build’ Failed
make: * [tools/build] Error 1

##用下面这两行替换"#include <linux/fs.h>" #define MAJOR(a) (((unsigned)(a))>>8) #define MInor(a) ((a)&0xff)

16.

tools/build boot/bootsect boot/setup system.tmp /dev/fd1 > Image
/dev/fd1: No such file or directory
Couldn’t stat root device.
Makefile:42: recipe for target ‘Image’ Failed
make: * [Image] Error 1

##检查根设备是否存在 ##这里我把赵炯老师的rootimage-0.11==>/dev/fd1 sudo dd if=rootimage-0.11 of=/dev/fd1

17.

Boot sector 512 bytes.
Setup is 312 bytes.
Non-Gcc header of ‘system’
make: * [Image] Error 1

解决办法: 将第一层主 Makefile 文件中的 LDFLAGS =-s -x -M 修改为 LDFLAGS =-m elf_i386 -Ttext 0 Image: boot/bootsect boot/setup tools/system tools/build tools/build boot/bootsect boot/setup tools/system $(ROOT_DEV) > Image sync 修改为 Image: boot/bootsect boot/setup tools/system tools/build objcopy -O binary -R .note -R .comment tools/system tools/kernel tools/build boot/bootsect boot/setup tools/kernel $(ROOT_DEV) > Image rm tools/kernel -f sync  tools/build.c 文件中的 if (((long *) buf)[5] != 0) die("Non-GCC header of ‘system‘"); 这段代码注释掉 //if (((long *) buf)[5] != 0) // die("Non-GCC header of ‘system‘");

Ubuntu16.10偶遇linux0.11的更多相关文章

  1. ios – iPhone崩溃日志不能正确地符号化并且是双重间隔的

    任何建议超过欢迎.谢谢.解决方法当这件事发生在我身上时,它只是我通过电子邮件收到的日志.如果我记得,至少有一些是在.msg文件中,我不得不把它们拿出来.它可能是Exchange编码更改.如果你显示不可见的字符,你可能会看到每个字符之间的东西.您可以找到并替换它们以删除它们或更改编辑器中的编码.

  2. xamarin.ios – 没有找到ViewController ::.ctor(System.IntPtr)的构造函数

    我有一个问题,我的Monotouch应用程序有时在收到内存警告后才会崩溃.请参见下面的堆栈跟踪.堆栈跟踪是正确的,因为指定的类缺少构造函数获取IntPtr参数.但是这是有意的,因为我在应用程序中根本不使用InterfaceBuilder.那为什么会这样呢?

  3. ios – 在/usr/lib/system/libcache.dylib中,缺少必需的架构armv6

    在试图为iphoneos编写一个虚拟程序时,Xcode4,gcc似乎没有超出初始的sysroot目录如果我把sysroot,以下作品,但感觉非常干酪,而且不可伸缩.这里发生了什么?

  4. ios – Iphone / Ipad在缩放时崩溃

    i=hUb1GHJ6有没有人有什么可能出错的线索?解决方法我们正在做很多调试,我们终于找到了一个解决方案.我们有一个“跳过导航”链接,只有在您的键盘上按“标签”时才显示.这最初设置为“text-indent:-10000px”.这可能导致视口宽度超过10000像素,然后导致手机使用太多内存,然后最终崩溃.我们已经通过删除这个CSS规则来解决这个问题,所以blush.no不会崩溃那么多了.Iphone仍然有内存泄漏的问题,直到他们解决这个问题,网站有时会崩溃,但不会像以前那样接近.

  5. 更改Xcode中的工作目录

    我设法使用cmake-GXcode在Xcode中运行C项目.现在我想调试它,因为它提供了很好的gdb.但是,我需要更改gdb执行的工作目录,否则它将无法工作.我可以做的是在gdb停止键入cdworking_dir之后,然后手动输入r.这是有效的,但Xcode将不断投诉,也不是一个优雅的解决方案.所以在构建设置的某个地方我应该能够设置工作目录.但在哪里?解决方法在Xcode中,在可执行文件上执行“获取信息”,并查看第一个选项卡–有一个工作目录的设置.

  6. xamarin.ios – 如何使用System.Drawing.Color?

    我昨天遇到了问题.我想在Android和iOS项目中使用System.Drawing.Color结构.Xamarin文档声称MonoTouch框架具有System.Drawing.Color结构(link-http://iosapi.xamarin.com/?link=T:System.Drawing.Color).但是在monotouch.dll命名空间中,System.Drawing没有名称为

  7. ios – 异常类型:EXC_CRASH(SIGABRT)

    有没有人知道这次崩溃?解决方法这不是崩溃,因异常而中止.这意味着您的应用程序正在将错误数据传递给系统例程,并且例程说它很糟糕且无法继续,因此它会杀死您的应用程序.控制台应该显示出错的地方.可能发生的一个常见异常是尝试从一个只有n个对象的数组中获取第一个对象.控制台将显示一条消息.因此,请检查控制台以查看可能发生的情况.

  8. Project Perfect让Swift在服务器端跑起来-在Linux上创建你的Perfect项目(三)

    前两篇,分别讲述了入门和在Linux下部署,现在得说说如何在Linux下开发了。在Linux下开发,相对比在Mac下开发更灵活。我们先来看看构建基于Perfect的网站服务的编译方式如图通过引用基础库PerfectLib和数据链接,中间件模块创建你的网页文件,并用makefile打包生成你的网站动态库。所以如果你只是在Linux下构建项目,你只需要先创建好你的Handlers.swift即可。根据上面的方式我们开始在Linux下创建我们的Perfect项目。这里我在Perfect文件夹创建了一个Demo文

  9. 使用 Swift 语言编写 Android 应用入门

    Swift标准库可以编译安卓armv7的内核,这使得可以在安卓移动设备上执行Swift语句代码。做梦,虽然Swift编译器可以胜任在安卓设备上编译Swift代码并运行。这需要的不仅仅是用Swift标准库编写一个APP,更多的是你需要一些框架来搭建你的应用用户界面,以上这些Swift标准库不能提供。简单来说,构建在安卓设备上使用的Swiftstdlib需要libiconv和libicu。通过命令行执行以下命令:gitclonegit@github.com:SwiftAndroid/libiconv-libi

  10. Project Perfect让Swift在服务器端跑起来-Hi Linux(二)

    开篇写了一个简单的入门,今天想说说怎么让Perfect项目在Linux上运行。Swift开源后,苹果让Swift不仅在OSX/iOS上跑,更让Swift在Linux/Windows上跑。作为服务端的Perfect框架+RemObjectSilver,让Swift成为了一个全栈语言。Perfect由于是服务端的,让Perfect在Linux上跑是必然的事情。从第一篇文章中我们可以了解到Perfect由PerfectLib和PerfectServer组成。

随机推荐

  1. crontab发送一个月份的电子邮件

    ubuntu14.04邮件服务器:Postfixroot收到来自crontab的十几封电子邮件.这些邮件包含PHP警告.>我已经解决了这些警告的原因.>我已修复每个cronjobs不发送电子邮件(输出发送到>/dev/null2>&1)>我删除了之前的所有电子邮件/var/mail/root/var/spool/mail/root但我仍然每小时收到十几封电子邮件.这些电子邮件来自cronjobs,

  2. 模拟两个ubuntu服务器计算机之间的慢速连接

    我想模拟以下场景:假设我有4台ubuntu服务器机器A,B,C和D.我想在机器A和机器C之间减少20%的网络带宽,在A和B之间减少10%.使用网络模拟/限制工具来做到这一点?

  3. ubuntu-12.04 – 如何在ubuntu 12.04中卸载从源安装的redis?

    我从源代码在Ubuntu12.04上安装了redis-server.但在某些时候它无法完全安装,最后一次makeinstallcmd失败.然后我刚刚通过apt包安装.现在我很困惑哪个安装正在运行哪个conf文件?实际上我想卸载/删除通过源安装的所有内容,只是想安装一个包.转到源代码树并尝试以下命令:如果这不起作用,您可以列出软件自行安装所需的步骤:

  4. ubuntu – “apt-get source”无法找到包但“apt-get install”和“apt-get cache”可以找到它

    我正在尝试下载软件包的源代码,但是当我运行时它无法找到.但是当我运行apt-cache搜索squid3时,它会找到它.它也适用于apt-getinstallsquid3.我使用的是Ubuntu11.04服务器,这是我的/etc/apt/sources.list我已经多次更新了.我尝试了很多不同的debs,并没有发现任何其他地方的错误.这里的问题是你的二进制包(deb)与你的源包(deb-src)不

  5. ubuntu – 有没有办法检测nginx何时完成正常关闭?

    &&touchrestarted),因为即使Nginx没有完成其关闭,touch命令也会立即执行.有没有好办法呢?这样的事情怎么样?因此,pgrep将查找任何Nginx进程,而while循环将让它坐在那里直到它们全部消失.你可以改变一些有用的东西,比如睡1;/etc/init.d/Nginx停止,以便它会休眠一秒钟,然后尝试使用init.d脚本停止Nginx.你也可以在某处放置一个计数器,这样你就可以在需要太长时间时发出轰击信号.

  6. ubuntu – 如何将所有外发电子邮件从postfix重定向到单个地址进行测试

    我正在为基于Web的应用程序设置测试服务器,该应用程序发送一些电子邮件通知.有时候测试是使用真实的客户数据进行的,因此我需要保证服务器在我们测试时无法向真实客户发送电子邮件.我想要的是配置postfix,以便它接收任何外发电子邮件并将其重定向到一个电子邮件地址,而不是传递到真正的目的地.我正在运行ubuntu服务器9.10.先感谢您设置本地用户以接收所有被困邮件:你需要在main.cf中添加:然后

  7. ubuntu – vagrant无法连接到虚拟框

    当我使用基本的Vagrantfile,只配置了两条线:我看到我的虚拟框打开,但是我的流氓日志多次显示此行直到超时:然后,超时后的一段时间,虚拟框框终于要求我登录,但是太久了!所以我用流氓/流氓记录.然后在我的物理机器上,如果我“流氓ssh”.没有事情发生,直到:怎么了?

  8. ubuntu – Nginx – 转发HTTP AUTH – 用户?

    我和Nginx和Jenkins有些麻烦.我尝试使用Nginx作为Jenkins实例的反向代理,使用HTTP基本身份验证.它到目前为止工作,但我不知道如何传递带有AUTH用户名的标头?}尝试将此指令添加到您的位置块

  9. Debian / Ubuntu – 删除后如何恢复/ var / cache / apt结构?

    我在ubuntu服务器上的空间不足,所以我做了这个命令以节省空间但是现在在尝试使用apt时,我会收到以下错误:等等显然我删除了一些目录结构.有没有办法做apt-getrebuild-var-tree或类似的?

  10. 检查ubuntu上安装的rubygems版本?

    如何查看我的ubuntu盒子上安装的rubygems版本?只是一个想法,列出已安装的软件包和grep为ruby或宝石或其他:)dpkg–get-selections

返回
顶部