Subject: port-i386/26041: netbsd image with embedded root, boot problem
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <J.Pilipovic@flarion.com>
List: netbsd-bugs
Date: 06/24/2004 18:30:13
>Number:         26041
>Category:       port-i386
>Synopsis:       netbsd image with embedded root,  boot problem
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-i386-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jun 24 18:31:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Josip  Pilipovic
>Release:        NetBSD2.0_Beta
>Organization:
Flaruin
>Environment:
jnetbsd2# uname -a
NetBSD jnetbsd2 2.0_BETA NetBSD 2.0_BETA (FLARION) #0: Sun Jun 20 00:03:41 EDT 2004  root@superlight:/usr/work/kroberts/netbsd2/sys/arch/i386/compile/obj/FLARION i386

>Description:
Activated ram disk options. Build kernel with root ram disk embedded in netbsd.ram image.
Move netbsd.ram to root directory. Reboot wait till netBSD header come 
up, press space.
On prompt issue command
>How-To-Repeat:
In configuration file activate options
options     MEMORY_DISK_HOOKS
options     MEMORY_DISK_IS_ROOT         
options     MEMORY_DISK_SERVER=1        
options     MEMORY_DISK_ROOT_SIZE=16384  # 8Meg
options     MEMORY_RBFLAGS=0      
 
Build kernel run crunchgen and build  obj exe. Created ramdirectory. Populated directory with needed files.
run
jnetbsd2# makefs -s 8m -t ffs crunch.image ramdirectory
jnetbsd2# mdsetimage netbsd.ram crunch.image
move netbsd.ram to root directory. Reboot wait till netBSD header come 
up, press space.
On prompt issue command
>Fix:
Not at this time!!!!!
>Release-Note:
>Audit-Trail:
>Unformatted:
 >boot netbsd.ram
 
 62244676+8509708
 read text: input/output error ........
 .....
 
 I did some preliminary investigation here are results:
 
 Activate -DDEBUG_MEMSIZE in Makefile.boot. Rebuild secondary boot file
 modified diagnostic in loadfile_elf32.c
 
 PROGRESS(("%d fs 0x%x offs 0x%x vadd 0x%x ms 0x%x \n",i, (u_long)phdr[i].p_filesz,(u_long)phdr[i].p_offset, (u_long)phdr[i].p_vaddr, (u_long)phdr[i].p_memsz));
  
   if (lseek(fd, phdr[i].p_offset, SEEK_SET) == -1)  { 
                                 WARN(("lseek text"));
                                 FREE(phdr, sz);
                                 return 1;
                         }
  if (READ(fd, phdr[i].p_vaddr, phdr[i].p_filesz) !=
                             (ssize_t)phdr[i].p_filesz)  {
                         WARN(("\nread text"));
                         FREE(phdr, sz);
                         return 1; 
                   }
 
 
 
 Move boot to /. Reboot repeat above steps and here is printout
 
 extmem1:fc00k
 extmem2:3c00k + 3ba80k
 mementry: (0) 0      0 a0000   0  1
 mementry: (1) f0000  0 100000  0  2
 mementry: (3) a00000 0 fdae000 0  1
 mementry: (4) feae000 0 52000  0  2
 mementry: (5) ff00000 0 100000 0  2
 mementry: (6) ffb0000 0 500000 0  2
 
 
 0 fs 0x5f4944 offs 0x1000 vadd 0xc0100000 ms 0x5f4944
 1 fs 0x81d90c offs 0x5f4944 vadd 0xc06f5960 ms 0x89d748 
 
 Same error message. It looks that pread() is failing. There is
 enough memory (256M!!!  here is netbsd.ram file data:
 
 jnetbsd2# ls -aslg /netbsd.ram
 30304 -rwxr-xr-x  1 root  wheel  15503284 Jun 24 15:33 /netbsd.ram*
 jnetbsd2# file /netbsd.ram
 /netbsd.ram: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, not stripped
 jnetbsd2# readelf -S /netbsd.ram
 There are 15 section headers, starting at offset 0xe2c9e8:
 
 Section Headers:
   [Nr] Name    Type            Addr     Off    Size   ES Flg Lk Inf Al
   [ 0]         NULL            00000000 000000 000000 00      0   0  0
   [ 1] .text   PROGBITS        c0100000 001000 437450 00  AX  0   0 16
   [ 2] .rodata PROGBITS        c0537460 438460 128fed 00   A  0   0 32
   [ 3] .rodata.str1.1  PROGBITS c066044d 56144d 034787 01 AMS  0   0  1
   [ 4] .rodata.str1.32 PROGBITS c0694be0 595be0 05fb13 01 AMS  0   0 32
   [ 5] link_set_malloc_t PROGBITS c06f46f4 5f56f4 000160 00 A  0   0  4
   [ 6] link_set_sysctl_f PROGBITS c06f4854 5f5854 0000c0 00 A  0   0  4
   [ 7] link_set_evcnts PROGBITS c06f4914 5f5914 000030 00   A  0   0  4
   [ 8] .data           PROGBITS c06f5960 5f5960 81d90c 00  WA  0   0 32
   [ 9] .bss            NOBITS   c0f13280 e13280 07fe28 00  WA  0   0 32
   [10] .comment       PROGBITS  00000000 e13280 00ad7c 00      0   0  1
   [11] .ident          PROGBITS 00000000 e1dffc 00e94c 00      0   0  1
   [12] .shstrtab       STRTAB 00000000 e2c948 00009f 00      0   0  1
   [13] .symtab         SYMTAB  00000000 e2cc40 052590 10     14 2109  4
   [14] .strtab         STRTAB  00000000 e7f1d0 049de4 00      0   0  1
 Key to Flags:
 
 
  
 
 
 
 
 
 >boot netbsd.ram