Page 1 of 3

problem with imgboot trying to boot for the first time

Posted: Tue Aug 27, 2013 1:29 pm
by oscar
Hello Andy and Visopsys community,

I tried to compile the Visopsys 0.72, and just after the Visopsys logo a pagefault error related to imgboot appears. It's always the same error.
I tried to use the utils folder of the Visopsys 0.71 to see if the problem is related to the utils folder of the new version, but the same error appears again. I can compile and create the ISO successfully, but it can't boot due of that error. When the error appears and I click on 'Ok', the blue-colored screen and the mousse are there, I can move the mousse but nothing more happens, and sometimes if I wait for some time, the screen and the mousse also fail and I have to shutdown the system.

I attach an image for more detailed information about the error. Have a nice day ;)

Re: problem with imgboot trying to boot for the first time

Posted: Tue Aug 27, 2013 3:25 pm
by andymc
Hi Oscar,

It sounds as though maybe there is some issue with the way things are being built or linked. That multitaskerGetCurrentProcessId() call is the first thing that the imgboot.c program does. It assigns the return value to a global variable, which might be a problem if the executable is being linked in a way that the runtime loader can't handle.

What versions of gcc and binutils are you using? On what distro/version of Linux?

Do you have the readelf command on your system? I'd be interested to see the output.

Code: Select all

$ readelf -e build/programs/imgboot 
ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           Intel 80386
  Version:                           0x1
  Entry point address:               0x8048bac
  Start of program headers:          52 (bytes into file)
  Start of section headers:          6780 (bytes into file)
  Flags:                             0x0
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         6
  Size of section headers:           40 (bytes)
  Number of section headers:         15
  Section header string table index: 14

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .interp           PROGBITS        080480f4 0000f4 000013 00   A  0   0  1
  [ 2] .gnu.hash         GNU_HASH        08048108 000108 000034 04   A  3   0  4
  [ 3] .dynsym           DYNSYM          0804813c 00013c 000320 10   A  4   1  4
  [ 4] .dynstr           STRTAB          0804845c 00045c 00031e 00   A  0   0  1
  [ 5] .rel.plt          REL             0804877c 00077c 000160 08   A  3   6  4
  [ 6] .plt              PROGBITS        080488dc 0008dc 0002d0 04  AX  0   0  4
  [ 7] .text             PROGBITS        08048bac 000bac 00079a 00  AX  0   0  4
  [ 8] .rodata           PROGBITS        08049348 001348 000504 00   A  0   0  4
  [ 9] .dynamic          DYNAMIC         0804a84c 00184c 0000a8 08  WA  4   0  4
  [10] .got.plt          PROGBITS        0804a8f4 0018f4 0000bc 04  WA  0   0  4
  [11] .data             PROGBITS        0804a9b0 0019b0 000004 00  WA  0   0  4
  [12] .bss              NOBITS          0804a9c0 0019b4 00050c 00  WA  0   0 32
  [13] .comment          PROGBITS        00000000 0019b4 00005c 00      0   0  1
  [14] .shstrtab         STRTAB          00000000 001a10 00006a 00      0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings)
  I (info), L (link order), G (group), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  PHDR           0x000034 0x08048034 0x08048034 0x000c0 0x000c0 R E 0x4
  INTERP         0x0000f4 0x080480f4 0x080480f4 0x00013 0x00013 R   0x1
      [Requesting program interpreter: /lib/ld-linux.so.2]
  LOAD           0x000000 0x08048000 0x08048000 0x0184c 0x0184c R E 0x1000
  LOAD           0x00184c 0x0804a84c 0x0804a84c 0x00168 0x00680 RW  0x1000
  DYNAMIC        0x00184c 0x0804a84c 0x0804a84c 0x000a8 0x000a8 RW  0x4
  GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RW  0x4

 Section to Segment mapping:
  Segment Sections...
   00     
   01     .interp 
   02     .interp .gnu.hash .dynsym .dynstr .rel.plt .plt .text .rodata 
   03     .dynamic .got.plt .data .bss 
   04     .dynamic 
   05     

Re: problem with imgboot trying to boot for the first time

Posted: Tue Aug 27, 2013 6:38 pm
by oscar
Hi Andy,

I use Fedora Linux 18, recently updated, so I have the GCC version 4.7.2-8 and the binutils version 2.23.51.0.1-10.
I used the command readelf and I attached its output here. I hope it helps you ;)

Have a good night! :)

Code: Select all

$ readelf -e build/programs/imgboot
ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           Intel 80386
  Version:                           0x1
  Entry point address:               0x80490f4
  Start of program headers:          52 (bytes into file)
  Start of section headers:          8560 (bytes into file)
  Flags:                             0x0
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         8
  Size of section headers:           40 (bytes)
  Number of section headers:         17
  Section header string table index: 16

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .interp           PROGBITS        08048134 000134 000013 00   A  0   0  1
  [ 2] .note.gnu.build-i NOTE            08048148 000148 000024 00   A  0   0  4
  [ 3] .gnu.hash         GNU_HASH        0804816c 00016c 000034 04   A  4   0  4
  [ 4] .dynsym           DYNSYM          080481a0 0001a0 000310 10   A  5   1  4
  [ 5] .dynstr           STRTAB          080484b0 0004b0 000317 00   A  0   0  1
  [ 6] .rel.plt          REL             080487c8 0007c8 000158 08   A  4   7  4
  [ 7] .plt              PROGBITS        08048920 000920 0002c0 04  AX  0   0 16
  [ 8] .text             PROGBITS        08048be0 000be0 00080f 00  AX  0   0  4
  [ 9] .rodata           PROGBITS        080493ef 0013ef 0004e8 01 AMS  0   0  1
  [10] .eh_frame         PROGBITS        080498d8 0018d8 000000 00   A  0   0  4
  [11] .dynamic          DYNAMIC         0804af58 001f58 0000a8 08  WA  5   0  4
  [12] .got.plt          PROGBITS        0804b000 002000 0000b8 04  WA  0   0  4
  [13] .data             PROGBITS        0804b0b8 0020b8 000004 00  WA  0   0  4
  [14] .bss              NOBITS          0804b0bc 0020bc 0004f8 00  WA  0   0  4
  [15] .comment          PROGBITS        00000000 0020bc 00002c 01  MS  0   0  1
  [16] .shstrtab         STRTAB          00000000 0020e8 000087 00      0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings)
  I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  PHDR           0x000034 0x08048034 0x08048034 0x00100 0x00100 R E 0x4
  INTERP         0x000134 0x08048134 0x08048134 0x00013 0x00013 R   0x1
      [Requesting program interpreter: /lib/ld-linux.so.2]
  LOAD           0x000000 0x08048000 0x08048000 0x018d8 0x018d8 R E 0x1000
  LOAD           0x001f58 0x0804af58 0x0804af58 0x00164 0x0065c RW  0x1000
  DYNAMIC        0x001f58 0x0804af58 0x0804af58 0x000a8 0x000a8 RW  0x4
  NOTE           0x000148 0x08048148 0x08048148 0x00024 0x00024 R   0x4
  GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RW  0x4
  GNU_RELRO      0x001f58 0x0804af58 0x0804af58 0x000a8 0x000a8 R   0x1

 Section to Segment mapping:
  Segment Sections...
   00     
   01     .interp 
   02     .interp .note.gnu.build-id .gnu.hash .dynsym .dynstr .rel.plt .plt .text .rodata 
   03     .dynamic .got.plt .data .bss 
   04     .dynamic 
   05     .note.gnu.build-id 
   06     
   07     .dynamic 

Re: problem with imgboot trying to boot for the first time

Posted: Tue Aug 27, 2013 8:18 pm
by andymc
oscar wrote:I use Fedora Linux 18, recently updated, so I have the GCC version 4.7.2-8 and the binutils version 2.23.51.0.1-10.
Hmm, I'm using gcc 4.6.1 and binutils 2.21.53 (Ubuntu)

There are extra sections in your executable, that aren't in mine. Can you attach your executable, so I can experiment with it? :ugeek:

The source code for yours is the same, yes?

Andy

Re: problem with imgboot trying to boot for the first time

Posted: Wed Aug 28, 2013 2:29 pm
by oscar
Hello Andy,

I think that the readelf of my previous post is from the source code plus two little programs that I tried to port. By the way, I'm glad to say that they worked in the Visopsys 0.72 that I installed in VirtualBox from the ISO image of the website, so I can try to write a more serious program for Visopsys :dance: .

Anyway, I attached (1) the imgboot executable obtained from the source code with my two little experimental programs and (2) the imgboot executable obtained from the original unmodified source code, so that you can experiment with them :geek:

Following you have the readelf again, but this time I'm sure that it comes from the original source code (as well as its imgboot, attached here) because I extracted the source code again from the zip file to a new folder and I compiled it again :)

Have a nice day!

Code: Select all

$ readelf -e build/programs/imgboot
ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           Intel 80386
  Version:                           0x1
  Entry point address:               0x80490f4
  Start of program headers:          52 (bytes into file)
  Start of section headers:          8560 (bytes into file)
  Flags:                             0x0
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         8
  Size of section headers:           40 (bytes)
  Number of section headers:         17
  Section header string table index: 16

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .interp           PROGBITS        08048134 000134 000013 00   A  0   0  1
  [ 2] .note.gnu.build-i NOTE            08048148 000148 000024 00   A  0   0  4
  [ 3] .gnu.hash         GNU_HASH        0804816c 00016c 000034 04   A  4   0  4
  [ 4] .dynsym           DYNSYM          080481a0 0001a0 000310 10   A  5   1  4
  [ 5] .dynstr           STRTAB          080484b0 0004b0 000317 00   A  0   0  1
  [ 6] .rel.plt          REL             080487c8 0007c8 000158 08   A  4   7  4
  [ 7] .plt              PROGBITS        08048920 000920 0002c0 04  AX  0   0 16
  [ 8] .text             PROGBITS        08048be0 000be0 00080f 00  AX  0   0  4
  [ 9] .rodata           PROGBITS        080493ef 0013ef 0004e8 01 AMS  0   0  1
  [10] .eh_frame         PROGBITS        080498d8 0018d8 000000 00   A  0   0  4
  [11] .dynamic          DYNAMIC         0804af58 001f58 0000a8 08  WA  5   0  4
  [12] .got.plt          PROGBITS        0804b000 002000 0000b8 04  WA  0   0  4
  [13] .data             PROGBITS        0804b0b8 0020b8 000004 00  WA  0   0  4
  [14] .bss              NOBITS          0804b0bc 0020bc 0004f8 00  WA  0   0  4
  [15] .comment          PROGBITS        00000000 0020bc 00002c 01  MS  0   0  1
  [16] .shstrtab         STRTAB          00000000 0020e8 000087 00      0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings)
  I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  PHDR           0x000034 0x08048034 0x08048034 0x00100 0x00100 R E 0x4
  INTERP         0x000134 0x08048134 0x08048134 0x00013 0x00013 R   0x1
      [Requesting program interpreter: /lib/ld-linux.so.2]
  LOAD           0x000000 0x08048000 0x08048000 0x018d8 0x018d8 R E 0x1000
  LOAD           0x001f58 0x0804af58 0x0804af58 0x00164 0x0065c RW  0x1000
  DYNAMIC        0x001f58 0x0804af58 0x0804af58 0x000a8 0x000a8 RW  0x4
  NOTE           0x000148 0x08048148 0x08048148 0x00024 0x00024 R   0x4
  GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RW  0x4
  GNU_RELRO      0x001f58 0x0804af58 0x0804af58 0x000a8 0x000a8 R   0x1

 Section to Segment mapping:
  Segment Sections...
   00     
   01     .interp 
   02     .interp .note.gnu.build-id .gnu.hash .dynsym .dynstr .rel.plt .plt .text .rodata 
   03     .dynamic .got.plt .data .bss 
   04     .dynamic 
   05     .note.gnu.build-id 
   06     
   07     .dynamic 

Re: problem with imgboot trying to boot for the first time

Posted: Fri Aug 30, 2013 11:57 am
by andymc
Hiya Oscar,

My first look at this issue - I build version 0.72 on my machine, then copy your (unmodified source) imgboot program into my build directory, and install on a USB stick. The system boots successfully and the imgboot program works. So I guess it's not a problem with the runtime loader and your executables, per se.

I'll look at it a bit more.

Re: problem with imgboot trying to boot for the first time

Posted: Fri Aug 30, 2013 12:20 pm
by oscar
Hi Andy,

Could it be something related to the hardware of my computer? If I have the chance, I will try to boot the same image in another laptop to see if I have the same problem again or not.
By the way, you are telling me that you compiled Visopsys and after that you replaced its imgboot for the imgboot that I sent you, so I think it's also possible that, as you said at the beginning, something happens during the compilation in my laptop that produces the error in imgboot, but not because of imgboot per se, as you also have said :think: .

I will try to do some little experiments too :geek:

See you soon! :)

Re: problem with imgboot trying to boot for the first time

Posted: Fri Aug 30, 2013 12:59 pm
by andymc
oscar wrote:Hi Andy,

Could it be something related to the hardware of my computer? If I have the chance, I will try to boot the same image in another laptop to see if I have the same problem again or not.
By the way, you are telling me that you compiled Visopsys and after that you replaced its imgboot for the imgboot that I sent you, so I think it's also possible that, as you said at the beginning, something happens during the compilation in my laptop that produces the error in imgboot, but not because of imgboot per se, as you also have said :think: .

I will try to do some little experiments too :geek:
It's difficult to say, since I can't reproduce your problem. Yes, I took both of your binary imgboot executables and inserted them into my installations.

1. Does the binary distribution (built on my system) boot on your computer? Assuming yes.
2. Does the unmodified source distribution (built on your system) boot on your computer? Assuming no.
3. The problem looks like the runtime loader has difficulty with binaries built and linked (especially linked) on your system, but when I take your binary and run it, that doesn't seem to be the case.
4. Perhaps you can attach an unmodified-source kernel built on your system (the file build/visopsys)? It might also be instructive for me to try inserting your shared libraries into my installation (the files build/system/libraries/*.so).
5. Is your hardware an 32-bit x86 processor, or a 64-bit x86_64? Can your compiler generate x86 binaries? It looks like it, since the ELF executable you uploaded seems to be 32-bit, and loads and runs in my 32-bit OS.

Re: problem with imgboot trying to boot for the first time

Posted: Fri Aug 30, 2013 2:53 pm
by oscar
Let's see :)

1. Yes, I installed the ISO image from your website (built in your sistem) and it runs perfectly in VirtualBox.
2. No, you're right. I can compile it successfully (at least the compiler says that) and put it in an ISO image. But when I try to run it, that error appears.
3. That is an interesting fact, at least my computer is not so ' crazy ' hehe :D
4. Absolutely. They are attached in this post. I'm quite convinced it's something related to my computer :think:
5. As far as I know, I have a 32 bit x86 processor. Uhm, I guess it can generate x86 binaries as normally my programs work in Linux.

I hope it helps you. See ya!

Oscar

Re: problem with imgboot trying to boot for the first time

Posted: Tue Sep 03, 2013 6:14 am
by oscar
Hi Andy,

What version of Linux are you using? I want to try to use the same Linux and software versions as you to see if it works or not.
Have a nice day!

Oscar