Here I am running two instance of same program in two different terminals. The process map of them are
In first terminal -
vikram#vikram-Studio-XPS-1645:~$ pmap 6548
6548: ./a.out
0000000000400000 4K r-x-- /home/vikram/a.out
0000000000600000 4K r---- /home/vikram/a.out
0000000000601000 4K rw--- /home/vikram/a.out
00007f90f2406000 1576K r-x-- /lib/x86_64-linux-gnu/libc-2.13.so
00007f90f2590000 2044K ----- /lib/x86_64-linux-gnu/libc-2.13.so
00007f90f278f000 16K r---- /lib/x86_64-linux-gnu/libc-2.13.so
00007f90f2793000 4K rw--- /lib/x86_64-linux-gnu/libc-2.13.so
00007f90f2794000 24K rw--- [ anon ]
00007f90f279a000 132K r-x-- /lib/x86_64-linux-gnu/ld-2.13.so
00007f90f2992000 12K rw--- [ anon ]
00007f90f29b7000 12K rw--- [ anon ]
00007f90f29ba000 4K r---- /lib/x86_64-linux-gnu/ld-2.13.so
00007f90f29bb000 8K rw--- /lib/x86_64-linux-gnu/ld-2.13.so
00007fffb2333000 132K rw--- [ stack ]
00007fffb23ff000 4K r-x-- [ anon ]
ffffffffff600000 4K r-x-- [ anon ]
total 3984K
In second terminal -
vikram#vikram-Studio-XPS-1645:~$ pmap 6676
6676: ./a.out
0000000000400000 4K r-x-- /home/vikram/a.out
0000000000600000 4K r---- /home/vikram/a.out
0000000000601000 4K rw--- /home/vikram/a.out
00007f3b0ad37000 1576K r-x-- /lib/x86_64-linux-gnu/libc-2.13.so
00007f3b0aec1000 2044K ----- /lib/x86_64-linux-gnu/libc-2.13.so
00007f3b0b0c0000 16K r---- /lib/x86_64-linux-gnu/libc-2.13.so
00007f3b0b0c4000 4K rw--- /lib/x86_64-linux-gnu/libc-2.13.so
00007f3b0b0c5000 24K rw--- [ anon ]
00007f3b0b0cb000 132K r-x-- /lib/x86_64-linux-gnu/ld-2.13.so
00007f3b0b2c3000 12K rw--- [ anon ]
00007f3b0b2e8000 12K rw--- [ anon ]
00007f3b0b2eb000 4K r---- /lib/x86_64-linux-gnu/ld-2.13.so
00007f3b0b2ec000 8K rw--- /lib/x86_64-linux-gnu/ld-2.13.so
00007fffb1153000 132K rw--- [ stack ]
00007fffb11c7000 4K r-x-- [ anon ]
ffffffffff600000 4K r-x-- [ anon ]
total 3984K
My questions are -
"/lib/x86_64-linux-gnu/ld-2.13.so" this library has two different addresses in terminal 1 and 2 ( 00007f90f279a000 and 00007f3b0b0cb000 ). Is it means this library is loaded 2 times in main memory ?
Assuming a.out is binary of simple Hello_World.c program
#include<stdio.h>
void main()
{ printf("Hello World");}
then which part of a.out has r & w permission ?
In simple words which part of source " 0000000000601000 4K rw--- /home/vikram/a.out " this segment is suppose to contain ?
Why anon is not continuous like other segments ?
What " 00007f90f2590000 2044K ----- /lib/x86_64-linux-gnu/libc-2.13.so " this segment suppose to contain .... because it doesn't have read, write, execute permissions.
1) Dynamic loader or the ld is the first to be executed after OS starts the process. Those address are virtual addresses of the process, but would ultimately map to same physical memory.
2) data segment of the process. (both initialized data and BSS)
3) Its used various purposes such as heap, mmap and any sharedmemory etc.
4) AFAIK its internal private data.
Related
I was trying to print all the memory regions of a process using the mach_vm_region and it seemed to work fine but when I compared it to the vmmap command vmmap -v -interleaved <PID>, I realized that I was still missing many memory regions.
For instance, after my program and vmmap were giving the same memory regions for about 50 regions straight, , in a certain region my program got this:
180000000 to 1f8000000
1f8000000 to 1f869c000
1f869c000 to 1f86bc000
1f86bc000 to 1f86c0000
1f86c0000 to 1fa000000
1fa000000 to 1faeac000
1faeac000 to 1fc5a0000
1fc5a0000 to 1ff928000
1ff928000 to 200000000
while in the same space, vmmap got this:
Submap 180000000-1f8000000 [ 1.9G 0K 0K 0K] r--/r-- SM=SHM machine-wide VM submap
unused shlib __TEXT 1a2174000-1a21c5000 [ 324K 324K 0K 0K] r-x/r-x SM=COW system shared lib __TEXT not used by this process
__TEXT 1a21c5000-1a21c7000 [ 8K 8K 0K 0K] r-x/r-x SM=COW /usr/lib/system/libsystem_blocks.dylib
__TEXT 1a21c7000-1a2209000 [ 264K 264K 0K 0K] r-x/r-x SM=COW /usr/lib/system/libxpc.dylib
__TEXT 1a2209000-1a2223000 [ 104K 104K 0K 0K] r-x/r-x SM=COW /usr/lib/system/libsystem_trace.dylib
__TEXT 1a2223000-1a22ad000 [ 552K 536K 0K 0K] r-x/r-x SM=COW /usr/lib/system/libcorecrypto.dylib
__TEXT 1a22ad000-1a22d8000 [ 172K 172K 0K 0K] r-x/r-x SM=COW /usr/lib/system/libsystem_malloc.dylib
__TEXT 1a22d8000-1a231f000 [ 284K 284K 0K 0K] r-x/r-x SM=COW /usr/lib/system/libdispatch.dylib
__TEXT 1a231f000-1a235d000 [ 248K 248K 0K 0K] r-x/r-x SM=COW /usr/lib/libobjc.A.dylib
__TEXT 1a235d000-1a2360000 [ 12K 12K 0K 0K] r-x/r-x SM=COW /usr/lib/system/libsystem_featureflags.dylib
__TEXT 1a2360000-1a23e2000 [ 520K 488K 0K 0K] r-x/r-x SM=COW /usr/lib/system/libsystem_c.dylib
__TEXT 1a23e2000-1a2449000 [ 412K 396K 0K 0K] r-x/r-x SM=COW /usr/lib/libc++.1.dylib
__TEXT 1a2449000-1a2461000 [ 96K 96K 0K 0K] r-x/r-x SM=COW /usr/lib/libc++abi.dylib
__TEXT 1a2461000-1a2499000 [ 224K 224K 0K 0K] r-x/r-x SM=COW /usr/lib/system/libsystem_kernel.dylib
__TEXT 1a2499000-1a24a6000 [ 52K 52K 0K 0K] r-x/r-x SM=COW /usr/lib/system/libsystem_pthread.dylib
__TEXT 1a24a6000-1a24b3000 [ 52K 52K 0K 0K] r-x/r-x SM=COW /usr/lib/system/libdyld.dylib
__TEXT 1a24b3000-1a24bb000 [ 32K 32K 0K 0K] r-x/r-x SM=COW /usr/lib/system/libsystem_platform.dylib
__TEXT 1a24bb000-1a24e8000 [ 180K 164K 0K 0K] r-x/r-x SM=COW /usr/lib/system/libsystem_info.dylib
__TEXT 1a24e8000-1a2a2f000 [ 5404K 4092K 0K 0K] r-x/r-x SM=COW /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
unused shlib __TEXT 1a2a2f000-1a4921000 [ 30.9M 17.4M 0K 0K] r-x/r-x SM=COW system shared lib __TEXT not used by this process
__TEXT 1a4921000-1a4bd7000 [ 2776K 2568K 0K 0K] r-x/r-x SM=COW /usr/lib/libicucore.A.dylib
...
__DATA_DIRTY 1fb3fe3e8-1fb3fe3f0 [ 8 8 8 0K] rw-/rw- SM=COW /usr/lib/system/libsystem_notify.dylib
__DATA_DIRTY 1fb3fe3f0-1fb3fe404 [ 20 20 20 0K] rw-/rw- SM=COW /usr/lib/system/libsystem_platform.dylib
unused shlib __DATA 1fb3fe404-1fb400000 [ 7K 7K 7K 0K] rw-/rw- SM=COW unused system shared lib __DATA, on dirty page
__DATA_DIRTY 1fb400000-1fb405838 [ 22K 22K 22K 0K] rw-/rw- SM=COW /usr/lib/system/libsystem_pthread.dylib
__DATA_DIRTY 1fb405838-1fb405848 [ 16 16 16 0K] rw-/rw- SM=COW /usr/lib/system/libsystem_symptoms.dylib
__DATA_DIRTY 1fb405848-1fb405cb8 [ 1136 1136 1136 0K] rw-/rw- SM=COW /usr/lib/system/libsystem_trace.dylib
__DATA_DIRTY 1fb405cb8-1fb406708 [ 2640 2640 2640 0K] rw-/rw- SM=COW /usr/lib/system/libxpc.dylib
unused shlib __DATA 1fb406708-1fb408000 [ 6K 6K 6K 0K] rw-/rw- SM=COW unused system shared lib __DATA, on dirty page
__AUTH 1fb408000-1fb4081b8 [ 440 440 0K 0K] rw-/rw- SM=COW /usr/lib/system/libsystem_trace.dylib
__AUTH 1fb4081b8-1fb408218 [ 96 96 0K 0K] rw-/rw- SM=COW /usr/lib/system/libcorecrypto.dylib
unused shlib __DATA 1fb408218-1fb40c000 [ 15K 15K 0K 0K] rw-/rw- SM=COW system shared lib __DATA not used by this process
__AUTH 1fb40c000-1fb414000 [ 32K 32K 0K 0K] rw-/rw- SM=COW /usr/lib/system/libsystem_malloc.dylib
__DATA 1fb414000-1fb415400 [ 5K 5K 0K 0K] rw-/rw- SM=COW /usr/lib/system/libdispatch.dylib
__AUTH 1fb415400-1fb415478 [ 120 120 0K 0K] rw-/rw- SM=COW /usr/lib/libobjc.A.dylib
__AUTH 1fb415478-1fb416190 [ 3352 3352 0K 0K] rw-/rw- SM=COW /usr/lib/system/libsystem_c.dylib
__AUTH 1fb416190-1fb418628 [ 9K 9K 1576 0K] rw-/rw- SM=COW /usr/lib/libc++.1.dylib
__AUTH 1fb418628-1fb418670 [ 72 72 72 0K] rw-/rw- SM=COW /usr/lib/libc++abi.dylib
__AUTH 1fb418670-1fb4186b0 [ 64 64 64 0K] rw-/rw- SM=COW /usr/lib/system/libdyld.dylib
__AUTH 1fb4186b0-1fb418880 [ 464 464 464 0K] rw-/rw- SM=COW /usr/lib/system/libsystem_info.dylib
__AUTH 1fb418880-1fb41a740 [ 8K 8K 8K 0K] rw-/rw- SM=COW /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
unused shlib __DATA 1fb41a740-1fb41c000 [ 6K 6K 6K 0K] rw-/rw- SM=COW unused system shared lib __DATA, on dirty page
unused shlib __DATA 1fb41c000-1fb4a2640 [ 538K 506K 0K 0K] rw-/rw- SM=COW system shared lib __DATA not used by this process
__AUTH 1fb4a2640-1fb4a2660 [ 32 32 0K 0K] rw-/rw- SM=COW /usr/lib/system/libcommonCrypto.dylib
__AUTH 1fb4a2660-1fb4a2668 [ 8 8 0K 0K] rw-/rw- SM=COW /usr/lib/libSystem.B.dylib
unused shlib __DATA 1fb4a2668-1fbb2c000 [ 6694K 982K 0K 0K] rw-/rw- SM=COW system shared lib __DATA not used by this process
__AUTH_CONST 1fbb2c000-1fbc08e80 [ 884K 884K 0K 0K] rw-/rw- SM=COW /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
__OBJC_CONST 1fbc08e80-1fbc0f9f0 [ 27K 27K 0K 0K] rw-/rw- SM=COW /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
unused shlib __DATA 1fbc0f9f0-1fc288000 [ 6626K 1250K 0K 0K] rw-/rw- SM=COW system shared lib __DATA not used by this process
__OBJC_RW 1fc288000-1fc5a0000 [ 3168K 1616K 16K 0K] rw-/rw- SM=COW /usr/lib/libobjc.A.dylib
__AUTH_CONST 1fc5a0000-1fc5a0030 [ 48 48 0K 0K] r--/rw- SM=COW /usr/lib/system/libsystem_blocks.dylib
__OBJC_CONST 1fc5a0030-1fc5a0390 [ 864 864 0K 0K] r--/rw- SM=COW /usr/lib/system/libsystem_blocks.dylib
__DATA_CONST 1fc5a0390-1fc5a4e20 [ 19K 19K 0K 0K] r--/rw- SM=COW /usr/lib/system/libxpc.dylib
__OBJC_CONST 1fc5a4e20-1fc5a5f90 [ 4K 4K 0K 0K] r--/rw- SM=COW /usr/lib/system/libxpc.dylib
__AUTH_CONST 1fc5a5f90-1fc5a6c90 [ 3328 3328 0K 0K] r--/rw- SM=COW /usr/lib/system/libsystem_trace.dylib
__OBJC_CONST 1fc5a6c90-1fc5a6e40 [ 432 432 0K 0K] r--/rw- SM=COW /usr/lib/system/libsystem_trace.dylib
__AUTH_CONST 1fc5a6e40-1fc5a7f10 [ 4K 4K 0K 0K] r--/rw- SM=COW /usr/lib/system/libcorecrypto.dylib
__AUTH_CONST 1fc5a7f10-1fc5a84e8 [ 1496 1496 0K 0K] r--/rw- SM=COW /usr/lib/system/libsystem_malloc.dylib
unused shlib __TEXT 1fc5a84e8-1fc5a8500 [ 24 24 0K 0K] r--/rw- SM=COW system shared lib __TEXT not used by this process
__DATA_CONST 1fc5a8500-1fc5bb8e8 [ 77K 29K 0K 0K] r--/rw- SM=COW /usr/lib/system/libdispatch.dylib
__OBJC_CONST 1fc5bb8e8-1fc5bc938 [ 4K 4K 0K 0K] r--/rw- SM=COW /usr/lib/system/libdispatch.dylib
unused shlib __TEXT 1fc5bc938-1fc5bc940 [ 8 8 0K 0K] r--/rw- SM=COW system shared lib __TEXT not used by this process
__AUTH_CONST 1fc5bc940-1fc5bd3c8 [ 2696 2696 0K 0K] r--/rw- SM=COW /usr/lib/libobjc.A.dylib
__OBJC_CONST 1fc5bd3c8-1fc5bd698 [ 720 720 0K 0K] r--/rw- SM=COW /usr/lib/libobjc.A.dylib
__AUTH_CONST 1fc5bd698-1fc5bd808 [ 368 368 0K 0K] r--/rw- SM=COW /usr/lib/system/libsystem_featureflags.dylib
__AUTH_CONST 1fc5bd808-1fc5be168 [ 2400 2400 0K 0K] r--/rw- SM=COW /usr/lib/system/libsystem_c.dylib
__AUTH_CONST 1fc5be168-1fc5c02a8 [ 8K 8K 0K 0K] r--/rw- SM=COW /usr/lib/libc++.1.dylib
__AUTH_CONST 1fc5c02a8-1fc5c34b8 [ 13K 13K 0K 0K] r--/rw- SM=COW /usr/lib/libc++abi.dylib
__AUTH_CONST 1fc5c34b8-1fc5c35e0 [ 296 296 0K 0K] r--/rw- SM=COW /usr/lib/system/libsystem_kernel.dylib
__AUTH_CONST 1fc5c35e0-1fc5c3810 [ 560 560 0K 0K] r--/rw- SM=COW /usr/lib/system/libsystem_pthread.dylib
__AUTH_CONST 1fc5c3810-1fc5c3fc8 [ 1976 1976 0K 0K] r--/rw- SM=COW /usr/lib/system/libdyld.dylib
__AUTH_CONST 1fc5c3fc8-1fc5c4250 [ 648 648 0K 0K] r--/rw- SM=COW /usr/lib/system/libsystem_platform.dylib
__AUTH_CONST 1fc5c4250-1fc5c53f0 [ 4K 4K 0K 0K] r--/rw- SM=COW /usr/lib/system/libsystem_info.dylib
unused shlib __TEXT 1fc5c53f0-1fc6e1e10 [ 1139K 947K 0K 0K] r--/rw- SM=COW system shared lib __TEXT not used by this process
__AUTH_CONST 1fc6e1e10-1fc6f3d48 [ 72K 72K 0K 0K] r--/rw- SM=COW /usr/lib/libicucore.A.dylib
__AUTH_CONST 1fc6f3d48-1fc6f41c8 [ 1152 1152 0K 0K] r--/rw- SM=COW /usr/lib/system/libsystem_darwin.dylib
unused shlib __TEXT 1fc6f41c8-1fc70fa80 [ 110K 110K 0K 0K] r--/rw- SM=COW system shared lib __TEXT not used by this process
__AUTH_CONST 1fc70fa80-1fc70fe00 [ 896 896 0K 0K] r--/rw- SM=COW /usr/lib/system/libsystem_notify.dylib
unused shlib __TEXT 1fc70fe00-1fc896a40 [ 1563K 1451K 0K 0K] r--/rw- SM=COW system shared lib __TEXT not used by this process
__AUTH_CONST 1fc896a40-1fc897608 [ 3016 3016 0K 0K] r--/rw- SM=COW /usr/lib/system/libsystem_networkextension.dylib
unused shlib __TEXT 1fc897608-1fc8e5718 [ 312K 136K 0K 0K] r--/rw- SM=COW system shared lib __TEXT not used by this process
__AUTH_CONST 1fc8e5718-1fc8e6160 [ 2632 2632 0K 0K] r--/rw- SM=COW /usr/lib/system/libsystem_asl.dylib
unused shlib __TEXT 1fc8e6160-1fc9af288 [ 804K 724K 0K 0K] r--/rw- SM=COW system shared lib __TEXT not used by this process
__AUTH_CONST 1fc9af288-1fc9af560 [ 728 728 0K 0K] r--/rw- SM=COW /usr/lib/system/libsystem_symptoms.dylib
unused shlib __TEXT 1fc9af560-1fcae6480 [ 1244K 892K 0K 0K] r--/rw- SM=COW system shared lib __TEXT not used by this process
__AUTH_CONST 1fcae6480-1fcae78c0 [ 5K 5K 0K 0K] r--/rw- SM=COW /usr/lib/system/libsystem_containermanager.dylib
unused shlib __TEXT 1fcae78c0-1fcbf6250 [ 1082K 842K 0K 0K] r--/rw- SM=COW system shared lib __TEXT not used by this process
__AUTH_CONST 1fcbf6250-1fcbf6560 [ 784 784 0K 0K] r--/rw- SM=COW /usr/lib/system/libsystem_configuration.dylib
__AUTH_CONST 1fcbf6560-1fcbf6768 [ 520 520 0K 0K] r--/rw- SM=COW /usr/lib/system/libsystem_sandbox.dylib
unused shlib __TEXT 1fcbf6768-1fcc3f8b8 [ 292K 212K 0K 0K] r--/rw- SM=COW system shared lib __TEXT not used by this process
__AUTH_CONST 1fcc3f8b8-1fcc3f9c0 [ 264 264 0K 0K] r--/rw- SM=COW /usr/lib/system/libquarantine.dylib
unused shlib __TEXT 1fcc3f9c0-1fccc6ac0 [ 540K 268K 0K 0K] r--/rw- SM=COW system shared lib __TEXT not used by this process
__AUTH_CONST 1fccc6ac0-1fccc6d50 [ 656 656 0K 0K] r--/rw- SM=COW /usr/lib/system/libsystem_coreservices.dylib
unused shlib __TEXT 1fccc6d50-1fccf2d88 [ 176K 144K 0K 0K] r--/rw- SM=COW system shared lib __TEXT not used by this process
__AUTH_CONST 1fccf2d88-1fccf2da8 [ 32 32 0K 0K] r--/rw- SM=COW /usr/lib/system/libsystem_m.dylib
unused shlib __TEXT 1fccf2da8-1fccf2e28 [ 128 128 0K 0K] r--/rw- SM=COW system shared lib __TEXT not used by this process
__AUTH_CONST 1fccf2e28-1fccf2e98 [ 112 112 0K 0K] r--/rw- SM=COW /usr/lib/system/libmacho.dylib
unused shlib __TEXT 1fccf2e98-1fccf2fb0 [ 280 280 0K 0K] r--/rw- SM=COW system shared lib __TEXT not used by this process
__AUTH_CONST 1fccf2fb0-1fccf3d80 [ 3536 3536 0K 0K] r--/rw- SM=COW /usr/lib/system/libcommonCrypto.dylib
__AUTH_CONST 1fccf3d80-1fccf3e98 [ 280 280 0K 0K] r--/rw- SM=COW /usr/lib/system/libunwind.dylib
__AUTH_CONST 1fccf3e98-1fccf4168 [ 720 720 0K 0K] r--/rw- SM=COW /usr/lib/liboah.dylib
__AUTH_CONST 1fccf4168-1fccf45a0 [ 1080 1080 0K 0K] r--/rw- SM=COW /usr/lib/system/libcopyfile.dylib
__AUTH_CONST 1fccf45a0-1fccf4600 [ 96 96 0K 0K] r--/rw- SM=COW /usr/lib/system/libcompiler_rt.dylib
__AUTH_CONST 1fccf4600-1fccf4750 [ 336 336 0K 0K] r--/rw- SM=COW /usr/lib/system/libsystem_collections.dylib
__AUTH_CONST 1fccf4750-1fccf4a18 [ 712 712 0K 0K] r--/rw- SM=COW /usr/lib/system/libsystem_secinit.dylib
__AUTH_CONST 1fccf4a18-1fccf4b78 [ 352 352 0K 0K] r--/rw- SM=COW /usr/lib/system/libremovefile.dylib
__AUTH_CONST 1fccf4b78-1fccf4bf8 [ 128 128 0K 0K] r--/rw- SM=COW /usr/lib/system/libkeymgr.dylib
__AUTH_CONST 1fccf4bf8-1fccf4db0 [ 440 440 0K 0K] r--/rw- SM=COW /usr/lib/system/libsystem_dnssd.dylib
__AUTH_CONST 1fccf4db0-1fccf4e70 [ 192 192 0K 0K] r--/rw- SM=COW /usr/lib/system/libcache.dylib
__AUTH_CONST 1fccf4e70-1fccf5120 [ 688 688 0K 0K] r--/rw- SM=COW /usr/lib/libSystem.B.dylib
__AUTH_CONST 1fccf5120-1fccf5208 [ 232 232 0K 0K] r--/rw- SM=COW /usr/lib/libfakelink.dylib
__AUTH_CONST 1fccf5208-1fccf5260 [ 88 88 0K 0K] r--/rw- SM=COW /System/Library/PrivateFrameworks/SoftLinking.framework/Versions/A/SoftLinking
unused shlib __TEXT 1fccf5260-1ff928000 [ 44.2M 6603K 0K 0K] r--/rw- SM=COW system shared lib __TEXT not used by this process
Submap 1ff928000-200000000 [ 7008K 0K 0K 0K] r--/r-- SM=PRV process-only VM submap
Now I understand submaps and that all of these mini regions only happened after vmmap specified that the REGION TYPE (first column) was of type Submap and I did try along using mach_vm_region_recurse with depth greater than 0 however that only gave this:
1a2174000 to 1f1b30000
1f3b30000 to 1f669c000
1f869c000 to 1f86bc000
that was extra information - nothing even close to vmmap. I did try looking around and the closest thing I could try to find to fix this problem was the segment_command_64 struct defined as :
struct segment_command_64 { /* for 64-bit architectures */
uint32_t cmd; /* LC_SEGMENT_64 */
uint32_t cmdsize; /* includes sizeof section_64 structs */
char segname[16]; /* segment name */
uint64_t vmaddr; /* memory address of this segment */
uint64_t vmsize; /* memory size of this segment */
uint64_t fileoff; /* file offset of this segment */
uint64_t filesize; /* amount to map from the file */
vm_prot_t maxprot; /* maximum VM protection */
vm_prot_t initprot; /* initial VM protection */
uint32_t nsects; /* number of sections in segment */
uint32_t flags; /* flags */
};
along side the getsectbynamefromheader_64 function but I really couldn't figure anything out as there is 0 documentation for anything.
For parsing Mach-O segments, there is a fair bit of information out on the web about the Mach-O executable file format, which is what you're dealing with here, it's just mapped directly into memory.
Essentially though, each Mach-O segment (segment_command_64) will contain some number of sections (section_64). The sections are described in an array of section_64 structs immediately following the segment_command_64 struct. There will be nsects array entries. You can skip from segment to segment by moving cmdsize bytes ahead in memory. (The number of load commands you will encounter is specified in the ncmds field of the mach_header_64 file header. They won't all be segments (cmd == LC_SEGMENT_64) but share the load_command struct prefix.
The other thing to bear in mind about vmmap is that it has a whole bunch of special security entitlements which allow it more access to kernel APIs and data structures than most processes:
$ codesign -d --entitlements - /usr/bin/vmmap
Executable=/usr/bin/vmmap
??qq?<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.private.iosurfaceinfo</key>
<true/>
<key>com.apple.private.security.storage.AppDataContainers</key>
<true/>
<key>com.apple.security.iokit-user-client-class</key>
<array>
<string>IOSurfaceRootUserClient</string>
</array>
<key>com.apple.system-task-ports</key>
<true/>
<key>com.apple.system-task-ports.read</key>
<true/>
<key>com.apple.system-task-ports.read.safe</key>
<true/>
<key>com.apple.system-task-ports.safe</key>
<true/>
<key>task_for_pid-allow</key>
<true/>
</dict>
</plist>
However most of that is for allowing inspection of other processes - I'm not sure if those entitlements enable it to view more information than a regular process can get about itself.
Unable to connect via SSH to my Amazon Linux AMI, However I am able to connect to other instance with same VPC, security group and key.
These are the system logs, appreciate any help on this.
> [ 0.000000] Linux version 4.14.101-75.76.amzn1.x86_64 (mockbuild#gobi-build-60003) (gcc version 7.2.1 20170915 (Red Hat
> 7.2.1-2) (GCC)) #1 SMP Tue Feb 19 18:14:51 UTC 2019
> [ 0.000000] Command line: root=LABEL=/ console=tty1 console=ttyS0 selinux=0 nvme_core.io_timeout=4294967295
> LANG=en_US.UTF-8 KEYTABLE=us
> [ 0.000000] x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers'
> [ 0.000000] x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers'
> [ 0.000000] x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers'
> [ 0.000000] x86/fpu: xstate_offset[2]: 576, xstate_sizes[2]: 256
> [ 0.000000] x86/fpu: Enabled xstate features 0x7, context size is 832 bytes, using 'standard' format.
> [ 0.000000] e820: BIOS-provided physical RAM map:
> [ 0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009dfff] usable
> [ 0.000000] BIOS-e820: [mem 0x000000000009e000-0x000000000009ffff] reserved
> [ 0.000000] BIOS-e820: [mem 0x00000000000e0000-0x00000000000fffff] reserved
> [ 0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000003fffffff] usable
> [ 0.000000] BIOS-e820: [mem 0x00000000fc000000-0x00000000ffffffff] reserved
> [ 0.000000] NX (Execute Disable) protection: active
> [ 0.000000] SMBIOS 2.7 present.
> [ 0.000000] DMI: Xen HVM domU, BIOS 4.2.amazon 08/24/2006
> [ 0.000000] Hypervisor detected: Xen HVM
> [ 0.000000] Xen version 4.2.
> [ 0.000000] Netfront and the Xen platform PCI driver have been compiled for this kernel: unplug emulated NICs.
> [ 0.000000] Blkfront and the Xen platform PCI driver have been compiled for this kernel: unplug emulated disks.
> [ 0.000000] You might have to change the root device
> [ 0.000000] from /dev/hd[a-d] to /dev/xvd[a-d]
> [ 0.000000] in your root= kernel command line option
> [ 0.000000] tsc: Fast TSC calibration using PIT
> [ 0.000000] e820: last_pfn = 0x40000 max_arch_pfn = 0x400000000
> [ 0.000000] x86/PAT: Configuration [0-7]: WB WC UC- UC WB WP UC- WT
> [ 0.000000] found SMP MP-table at [mem 0x000fbc50-0x000fbc5f] mapped at [ffffffffff240c50]
> [ 0.000000] RAMDISK: [mem 0x37088000-0x37feffff]
> [ 0.000000] ACPI: Early table checksum verification disabled
> [ 0.000000] ACPI: RSDP 0x00000000000EA020 000024 (v02 Xen )
> [ 0.000000] ACPI: XSDT 0x00000000FC00E2A0 000054 (v01 Xen HVM 00000000 HVML 00000000)
> [ 0.000000] ACPI: FACP 0x00000000FC00DF60 0000F4 (v04 Xen HVM 00000000 HVML 00000000)
> [ 0.000000] ACPI: DSDT 0x00000000FC0021C0 00BD19 (v02 Xen HVM 00000000 INTL 20090123)
> [ 0.000000] ACPI: FACS 0x00000000FC002180 000040
> [ 0.000000] ACPI: FACS 0x00000000FC002180 000040
> [ 0.000000] ACPI: APIC 0x00000000FC00E060 0000D8 (v02 Xen HVM 00000000 HVML 00000000)
> [ 0.000000] ACPI: HPET 0x00000000FC00E1B0 000038 (v01 Xen HVM 00000000 HVML 00000000)
> [ 0.000000] ACPI: WAET 0x00000000FC00E1F0 000028 (v01 Xen HVM 00000000 HVML 00000000)
> [ 0.000000] ACPI: SSDT 0x00000000FC00E220 000031 (v02 Xen HVM 00000000 INTL 20090123)
> [ 0.000000] ACPI: SSDT 0x00000000FC00E260 000033 (v02 Xen HVM 00000000 INTL 20090123)
> [ 0.000000] No NUMA configuration found
> [ 0.000000] Faking a node at [mem 0x0000000000000000-0x000000003fffffff]
> [ 0.000000] NODE_DATA(0) allocated [mem 0x3ffde000-0x3fffffff]
> [ 0.000000] Zone ranges:
> [ 0.000000] DMA [mem 0x0000000000001000-0x0000000000ffffff]
> [ 0.000000] DMA32 [mem 0x0000000001000000-0x000000003fffffff]
> [ 0.000000] Normal empty
> [ 0.000000] Movable zone start for each node
> [ 0.000000] Early memory node ranges
> [ 0.000000] node 0: [mem 0x0000000000001000-0x000000000009dfff]
> [ 0.000000] node 0: [mem 0x0000000000100000-0x000000003fffffff]
> [ 0.000000] Initmem setup node 0 [mem 0x0000000000001000-0x000000003fffffff]
> [ 0.000000] ACPI: PM-Timer IO Port: 0xb008
> [ 0.000000] IOAPIC[0]: apic_id 1, version 17, address 0xfec00000, GSI 0-47
> [ 0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
> [ 0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 5 global_irq 5 low level)
> [ 0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 10 global_irq 10 low level)
> [ 0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 11 global_irq 11 low level)
> [ 0.000000] Using ACPI (MADT) for SMP configuration information
> [ 0.000000] ACPI: HPET id: 0x8086a201 base: 0xfed00000
> [ 0.000000] smpboot: Allowing 15 CPUs, 14 hotplug CPUs
> [ 0.000000] PM: Registered nosave memory: [mem 0x00000000-0x00000fff]
> [ 0.000000] PM: Registered nosave memory: [mem 0x0009e000-0x0009ffff]
> [ 0.000000] PM: Registered nosave memory: [mem 0x000a0000-0x000dffff]
> [ 0.000000] PM: Registered nosave memory: [mem 0x000e0000-0x000fffff]
> [ 0.000000] e820: [mem 0x40000000-0xfbffffff] available for PCI devices
> [ 0.000000] Booting paravirtualized kernel on Xen HVM
> [ 0.000000] clocksource: refined-jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645519600211568 ns
> [ 0.000000] setup_percpu: NR_CPUS:8192 nr_cpumask_bits:15 nr_cpu_ids:15 nr_node_ids:1
> [ 0.000000] percpu: Embedded 44 pages/cpu #ffff88803e200000 s140120 r8192 d31912 u262144
> [ 0.000000] PV qspinlock hash table entries: 256 (order: 0, 4096 bytes)
> [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 257928
> [ 0.000000] Policy zone: DMA32
> [ 0.000000] Kernel command line: root=LABEL=/ console=tty1 console=ttyS0 selinux=0 nvme_core.io_timeout=4294967295
> LANG=en_US.UTF-8 KEYTABLE=us
> [ 0.000000] PID hash table entries: 4096 (order: 3, 32768 bytes)
> [ 0.000000] Memory: 988264K/1048180K available (8204K kernel code, 1920K rwdata, 2768K rodata, 2044K init, 3876K bss, 59916K
> reserved, 0K cma-reserved)
> [ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=15, Nodes=1
> [ 0.000000] Kernel/User page tables isolation: enabled
> [ 0.000000] ftrace: allocating 25766 entries in 101 pages
> [ 0.004000] Hierarchical RCU implementation.
> [ 0.004000] RCU restricting CPUs from NR_CPUS=8192 to nr_cpu_ids=15.
> [ 0.004000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=15
> [ 0.004000] NR_IRQS: 524544, nr_irqs: 952, preallocated irqs: 16
> [ 0.004000] xen:events: Using 2-level ABI
> [ 0.004000] xen:events: Xen HVM callback vector for event delivery is enabled
> [ 0.004000] Console: colour VGA+ 80x25
> [ 0.004000] console [tty1] enabled
> [ 0.004000] Cannot get hvm parameter CONSOLE_EVTCHN (18): -22!
> [ 0.004000] console [ttyS0] enabled
> [ 0.004000] clocksource: hpet: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 30580167144 ns
> [ 0.008000] tsc: Fast TSC calibration using PIT
> [ 0.024004] tsc: Detected 2400.059 MHz processor
> [ 0.028010] Calibrating delay loop (skipped), value calculated using timer frequency.. 4800.15 BogoMIPS (lpj=9600312)
> [ 0.040005] pid_max: default: 32768 minimum: 301
> [ 0.044020] ACPI: Core revision 20170728
> [ 0.059670] ACPI: 3 ACPI AML tables successfully acquired and loaded
> [ 0.068038] Security Framework initialized
> [ 0.076206] Dentry cache hash table entries: 131072 (order: 8, 1048576 bytes)
> [ 0.092100] Inode-cache hash table entries: 65536 (order: 7, 524288 bytes)
> [ 0.112022] Mount-cache hash table entries: 2048 (order: 2, 16384 bytes)
> [ 0.116007] Mountpoint-cache hash table entries: 2048 (order: 2, 16384 bytes)
> [ 0.120233] mce: CPU supports 2 MCE banks
> [ 0.124030] Last level iTLB entries: 4KB 1024, 2MB 1024, 4MB 1024
> [ 0.132003] Last level dTLB entries: 4KB 1024, 2MB 1024, 4MB 1024, 1GB 4
> [ 0.148005] Spectre V2 : Mitigation: Full generic retpoline
> [ 0.152004] Spectre V2 : Spectre v2 / SpectreRSB mitigation: Filling RSB on context switch
> [ 0.160004] Speculative Store Bypass: Vulnerable
> [ 0.173851] smpboot: Max logical packages: 15
> [ 0.176833] x2apic: IRQ remapping doesn't support X2APIC mode
> [ 0.184004] Switched APIC routing to physical flat.
> [ 0.190772] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=0 pin2=0
> [ 0.238435] clocksource: xen: mask: 0xffffffffffffffff max_cycles: 0x1cd42e4dffb, max_idle_ns: 881590591483 ns
> [ 0.244018] installing Xen timer for CPU 0
> [ 0.248079] smpboot: CPU0: Intel(R) Xeon(R) CPU E5-2676 v3 # 2.40GHz (family: 0x6, model: 0x3f, stepping: 0x2)
> [ 0.252050] cpu 0 spinlock event irq 53
> [ 0.256035] Performance Events: unsupported p6 CPU model 63 no PMU driver, software events only.
> [ 0.260056] Hierarchical SRCU implementation.
> [ 0.264304] NMI watchdog: Perf event create on CPU 0 failed with -2
> [ 0.268008] NMI watchdog: Perf NMI watchdog permanently disabled
> [ 0.272202] smp: Bringing up secondary CPUs ...
> [ 0.275796] smp: Brought up 1 node, 1 CPU
> [ 0.276011] smpboot: Total of 1 processors activated (4800.15 BogoMIPS)
> [ 0.280482] devtmpfs: initialized
> [ 0.283941] x86/mm: Memory block size: 128MB
> [ 0.284230] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
> [ 0.288031] futex hash table entries: 4096 (order: 6, 262144 bytes)
> [ 0.292282] NET: Registered protocol family 16
> [ 0.296242] cpuidle: using governor ladder
> [ 0.300010] cpuidle: using governor menu
> [ 0.304044] ACPI: bus type PCI registered
> [ 0.308007] acpiphp: ACPI Hot Plug PCI Controller Driver version: 0.5
> [ 0.312456] PCI: Using configuration type 1 for base access
> [ 0.318787] HugeTLB registered 2.00 MiB page size, pre-allocated 0 pages
> [ 0.320217] ACPI: Added _OSI(Module Device)
> [ 0.324021] ACPI: Added _OSI(Processor Device)
> [ 0.328007] ACPI: Added _OSI(3.0 _SCP Extensions)
> [ 0.332006] ACPI: Added _OSI(Processor Aggregator Device)
> [ 0.339182] ACPI: Interpreter enabled
> [ 0.340021] ACPI: (supports S0 S4 S5)
> [ 0.343460] ACPI: Using IOAPIC for interrupt routing
> [ 0.344043] PCI: Using host bridge windows from ACPI; if necessary, use "pci=nocrs" and report a bug
> [ 0.348445] ACPI: Enabled 2 GPEs in block 00 to 0F
> [ 0.412557] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff])
> [ 0.416018] acpi PNP0A03:00: _OSC: OS supports [ASPM ClockPM Segments MSI]
> [ 0.420033] acpi PNP0A03:00: _OSC failed (AE_NOT_FOUND); disabling ASPM
> [ 0.424030] acpi PNP0A03:00: fail to add MMCONFIG information, can't access extended PCI configuration space under this bridge.
> [ 0.429218] acpiphp: Slot [0] registered
> [ 0.433312] acpiphp: Slot [3] registered
> [ 0.436509] acpiphp: Slot [4] registered
> [ 0.440524] acpiphp: Slot [5] registered
> [ 0.444541] acpiphp: Slot [6] registered
> [ 0.448541] acpiphp: Slot [7] registered
> [ 0.452544] acpiphp: Slot [8] registered
> [ 0.458516] acpiphp: Slot [9] registered
> [ 0.460544] acpiphp: Slot [10] registered
> [ 0.464527] acpiphp: Slot [11] registered
> [ 0.468568] acpiphp: Slot [12] registered
> [ 0.472652] acpiphp: Slot [13] registered
> [ 0.476608] acpiphp: Slot [14] registered
> [ 0.480511] acpiphp: Slot [15] registered
> [ 0.484590] acpiphp: Slot [16] registered
> [ 0.489551] acpiphp: Slot [17] registered
> [ 0.492548] acpiphp: Slot [18] registered
> [ 0.496621] acpiphp: Slot [19] registered
> [ 0.500593] acpiphp: Slot [20] registered
> [ 0.504608] acpiphp: Slot [21] registered
> [ 0.508563] acpiphp: Slot [22] registered
> [ 0.512509] acpiphp: Slot [23] registered
> [ 0.516537] acpiphp: Slot [24] registered
> [ 0.520580] acpiphp: Slot [25] registered
> [ 0.524589] acpiphp: Slot [26] registered
> [ 0.528546] acpiphp: Slot [27] registered
> [ 0.532617] acpiphp: Slot [28] registered
> [ 0.536625] acpiphp: Slot [29] registered
> [ 0.540551] acpiphp: Slot [30] registered
> [ 0.544492] acpiphp: Slot [31] registered
> [ 0.548403] PCI host bridge to bus 0000:00
> [ 0.552006] pci_bus 0000:00: root bus resource [io 0x0000-0x0cf7 window]
> [ 0.556005] pci_bus 0000:00: root bus resource [io 0x0d00-0xffff window]
> [ 0.560005] pci_bus 0000:00: root bus resource [mem 0x000a0000-0x000bffff window]
> [ 0.564009] pci_bus 0000:00: root bus resource [mem 0xf0000000-0xfbffffff window]
> [ 0.568008] pci_bus 0000:00: root bus resource [bus 00-ff]
> [ 0.580994] pci 0000:00:01.1: legacy IDE quirk: reg 0x10: [io 0x01f0-0x01f7]
> [ 0.584013] pci 0000:00:01.1: legacy IDE quirk: reg 0x14: [io 0x03f6]
> [ 0.588009] pci 0000:00:01.1: legacy IDE quirk: reg 0x18: [io 0x0170-0x0177]
> [ 0.592013] pci 0000:00:01.1: legacy IDE quirk: reg 0x1c: [io 0x0376]
> [ 0.597469] * Found PM-Timer Bug on the chipset. Due to workarounds for a bug,
> [ 0.597469] * this clock source is slow. Consider trying other clock sources
> [ 0.601963] pci 0000:00:01.3: quirk: [io 0xb000-0xb03f] claimed by PIIX4 ACPI
> [ 0.617879] ACPI: PCI Interrupt Link [LNKA] (IRQs *5 10 11)
> [ 0.620484] ACPI: PCI Interrupt Link [LNKB] (IRQs 5 *10 11)
> [ 0.624308] ACPI: PCI Interrupt Link [LNKC] (IRQs 5 10 *11)
> [ 0.628273] ACPI: PCI Interrupt Link [LNKD] (IRQs *5 10 11)
> [ 0.659090] xen:balloon: Initialising balloon driver
> [ 0.672470] pci 0000:00:02.0: vgaarb: setting as boot VGA device
> [ 0.676000] pci 0000:00:02.0: vgaarb: VGA device added: decodes=io+mem,owns=io+mem,locks=none
> [ 0.676028] pci 0000:00:02.0: vgaarb: bridge control possible
> [ 0.680005] vgaarb: loaded
> [ 0.684298] EDAC MC: Ver: 3.0.0
> [ 0.688228] PCI: Using ACPI for IRQ routing
> [ 0.692903] NetLabel: Initializing
> [ 0.696007] NetLabel: domain hash size = 128
> [ 0.700005] NetLabel: protocols = UNLABELED CIPSOv4 CALIPSO
> [ 0.704026] NetLabel: unlabeled traffic allowed by default
> [ 0.708043] HPET: 3 timers in total, 0 timers will be used for per-cpu timer
> [ 0.712018] hpet0: at MMIO 0xfed00000, IRQs 2, 8, 0
> [ 0.716006] hpet0: 3 comparators, 64-bit 62.500000 MHz counter
> [ 0.722208] clocksource: Switched to clocksource xen
> [ 0.732257] VFS: Disk quotas dquot_6.6.0
> [ 0.735847] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
> [ 0.741239] pnp: PnP ACPI init
> [ 0.743942] system 00:00: [mem 0x00000000-0x0009ffff] could not be reserved
> [ 0.749560] system 00:01: [io 0x08a0-0x08a3] has been reserved
> [ 0.755099] system 00:01: [io 0x0cc0-0x0ccf] has been reserved
> [ 0.759542] system 00:01: [io 0x04d0-0x04d1] has been reserved
> [ 0.765628] system 00:07: [io 0x10c0-0x1141] has been reserved
> [ 0.769988] system 00:07: [io 0xb044-0xb047] has been reserved
> [ 0.774201] random: fast init done
> [ 0.802572] pnp: PnP ACPI: found 8 devices
> [ 0.815571] clocksource: acpi_pm: mask: 0xffffff max_cycles: 0xffffff, max_idle_ns: 2085701024 ns
> [ 0.823851] NET: Registered protocol family 2
> [ 0.828295] TCP established hash table entries: 8192 (order: 4, 65536 bytes)
> [ 0.836223] TCP bind hash table entries: 8192 (order: 5, 131072 bytes)
> [ 0.842471] TCP: Hash tables configured (established 8192 bind 8192)
> [ 0.848377] UDP hash table entries: 512 (order: 2, 16384 bytes)
> [ 0.854312] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
> [ 0.865357] NET: Registered protocol family 1
> [ 0.870057] pci 0000:00:00.0: Limiting direct PCI/PCI transfers
> [ 0.874521] pci 0000:00:01.0: PIIX3: Enabling Passive Release
> [ 0.880434] pci 0000:00:01.0: Activating ISA DMA hang workarounds
> [ 0.886961] pci 0000:00:02.0: Video device with shadowed ROM at [mem 0x000c0000-0x000dffff]
> [ 0.900418] Unpacking initramfs...
> [ 1.140068] Freeing initrd memory: 15776K
> [ 1.144270] audit: initializing netlink subsys (disabled)
> [ 1.149487] Initialise system trusted keyrings
> [ 1.153120] random: get_random_bytes called from key_alloc+0x209/0x430 with crng_init=1
> [ 1.159656] Key type blacklist registered
> [ 1.164319] audit: type=2000 audit(1621604183.240:1): state=initialized audit_enabled=0 res=1
> [ 1.173559] workingset: timestamp_bits=36 max_order=18 bucket_order=0
> [ 1.181126] zbud: loaded
> [ 1.462923] Key type asymmetric registered
> [ 1.466712] Asymmetric key parser 'x509' registered
> [ 1.471526] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 253)
> [ 1.478219] io scheduler noop registered (default)
> [ 1.482503] xen:grant_table: Grant tables using version 1 layout
> [ 1.488560] Grant table initialized
> [ 1.492864] Cannot get hvm parameter CONSOLE_EVTCHN (18): -22!
> [ 1.498136] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
> [ 1.532534] 00:06: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
> [ 1.539067] xen_netfront: Initialising Xen virtual ethernet driver
> [ 1.546587] i8042: PNP: PS/2 Controller [PNP0303:PS2K,PNP0f13:PS2M] at 0x60,0x64 irq 1,12
> [ 1.557894] serio: i8042 KBD port at 0x60,0x64 irq 1
> [ 1.563616] serio: i8042 AUX port at 0x60,0x64 irq 12
> [ 1.569522] input: AT Translated Set 2 keyboard as /devices/platform/i8042/serio0/input/input0
> [ 1.578461] rtc_cmos 00:02: rtc core: registered rtc_cmos as rtc0
> [ 1.584470] rtc_cmos 00:02: alarms up to one day, 114 bytes nvram, hpet irqs
> [ 1.591556] hidraw: raw HID events driver (C) Jiri Kosina
> [ 1.597392] NET: Registered protocol family 17
> [ 1.602551] sched_clock: Marking stable (1602191383, 0)->(2508005586, -905814203)
> [ 1.608985] registered taskstats version 1
> [ 1.613380] Loading compiled-in X.509 certificates
> [ 1.617465] zswap: loaded using pool lzo/zbud
> [ 1.724098] xenbus_probe_frontend: Device with no driver: device/vbd/768
> [ 1.733164] rtc_cmos 00:02: setting system clock to 2021-05-21 13:36:24 UTC (1621604184)
> [ 1.740878] Freeing unused kernel memory: 2044K
> [ 1.752090] Write protecting the kernel read-only data: 14336k
> [ 1.759007] Freeing unused kernel memory: 2016K
> [ 1.766675] Freeing unused kernel memory: 1328K
> [ 1.788444] device-mapper: uevent: version 1.0.3
> [ 1.794113] device-mapper: ioctl: 4.37.0-ioctl (2017-09-20) initialised: dm-devel#redhat.com
> [ 1.808846] udevd[853]: starting version 173
> [ 1.859269] SCSI subsystem initialized
> [ 1.951311] scsi host0: ata_piix
> [ 1.964023] Invalid max_queues (4), will use default max: 1.
> [ 1.970827] scsi host1: ata_piix
> [ 1.973941] ata1: PATA max MWDMA2 cmd 0x1f0 ctl 0x3f6 bmdma 0xc100 irq 14
> [ 1.979650] ata2: PATA max MWDMA2 cmd 0x170 ctl 0x376 bmdma 0xc108 irq 15
> [ 2.011829] blkfront: xvda: barrier or flush: disabled; persistent grants: disabled; indirect descriptors: enabled;
> [ 2.026784] xvda: xvda1
> [ 2.144087] tsc: Refined TSC clocksource calibration: 2399.999 MHz
> [ 2.148782] clocksource: tsc: mask: 0xffffffffffffffff max_cycles: 0x2298364cab5, max_idle_ns: 440795214892 ns
> growroot: NOCHANGE: disk=/dev/xvda partition=1: size=16773086, it cannot be grown
> [ 2.214915] EXT4-fs (xvda1): mounted filesystem with ordered data mode. Opts: (null)
> [ 2.224557] dracut: Remounting /dev/disk/by-label/\x2f with -o noatime,nofail,ro
> [ 2.232584] EXT4-fs (xvda1): mounted filesystem with ordered data mode. Opts: (null)
> [ 2.240125] dracut: Mounted root filesystem /dev/xvda1
> [ 2.273312] dracut: Switching root
> [ 2.321659] random: init: uninitialized urandom read (12 bytes read)
> image_name="amzn-ami-hvm"
> image_version="2018.03"
> image_arch="x86_64"
> image_file="amzn-ami-hvm-2018.03.0.20180811-x86_64.ext4.gpt"
> image_stamp="cc81-f2f3"
> image_date="20180811012746"
> recipe_name="amzn ami"
> recipe_id="5b283820-dc60-a7ea-d436-39fa-439f-02ea-5c802dbd"
> Welcome to Amazon Linux AMI
> Starting udev: [ 2.454862] udevd[1570]: starting version 173
> [ 2.518886] input: Power Button as /devices/LNXSYSTM:00/LNXPWRBN:00/input/input3
> [ 2.543884] input: ImExPS/2 Generic Explorer Mouse as /devices/platform/i8042/serio1/input/input4
> [ 2.611788] ACPI: Power Button [PWRF]
> [ 2.615632] input: Sleep Button as /devices/LNXSYSTM:00/LNXSLPBN:00/input/input5
> [ 2.669689] ACPI: Sleep Button [SLPF]
> [ 2.678057] mousedev: PS/2 mouse device common for all mice
> [ OK ]
>
>
Setting hostname localhost.localdomain: [ OK ]
Setting up Logical Volume Management: [ 3.718097] random: lvm: uninitialized urandom read (4 bytes read)
WARNING: Failed to connect to lvmetad. Falling back to device scanning.
[ OK ]
Checking filesystems
Checking all file systems.
[ OK ]
Remounting root filesystem in read-write mode: [ 3.759745] EXT4-fs (xvda1): re-mounted. Opts: (null)
[ OK ]
Mounting local filesystems: [ OK ]
Enabling local filesystem quotas: [ OK ]
[ 3.791456] random: dd: uninitialized urandom read (4096 bytes read)
Enabling /etc/fstab swaps: [ OK ]
Entering non-interactive startup
Starting LVM metadata daemon: [ OK ]
Starting LVM poll daemon: [ OK ]
[ 3.924597] random: vgs: uninitialized urandom read (4 bytes read)
[ 4.010580] NET: Registered protocol family 10
[ 4.018195] Segment Routing with IPv6
Bringing up loopback interface: [ OK ]
Bringing up interface eth0:
Determining IP information for eth0... done.
Determining IPv6 information for eth0... done.
[ OK ]
Starting auditd: [ OK ]
Starting system logger: [ OK ]
Starting irqbalance: [ OK ]
Starting rngd: [ 5.871299] urandom_read: 1 callbacks suppressed
[ 5.871300] random: rngd: uninitialized urandom read (16 bytes read)
Unable to open file: /dev/hwrng
[ OK ]
[ 5.910283] random: crng init done
Starting rpcbind: [ OK ]
Starting NFS statd: [ OK ]
Starting system message bus: [ OK ]
Mounting filesystems: [ OK ]
Starting acpi daemon: [ OK ]
Retrigger failed udev events--type=failed is deprecated and will be removed from a future udev release.
[ OK ]
Starting cloud-init: Cloud-init v. 0.7.6 running 'init-local' at Fri, 21 May 2021 13:36:29 +0000. Up 6.53 seconds.
Starting cloud-init: Cloud-init v. 0.7.6 running 'init' at Fri, 21 May 2021 13:36:29 +0000. Up 6.73 seconds.
ci-info: +++++++++++++++++++++++Net device info++++++++++++++++++++++++
ci-info: Device Up Address Mask Hw-Address
ci-info: lo True 127.0.0.1 255.0.0.0 .
ci-info: eth0 True 172.31.10.11 255.255.240.0 0a:3b:55:e4:8b:7e
ci-info: ++++++++++++++++++++++++++++++Route info+++++++++++++++++++++++++++++++
ci-info: Route Destination Gateway Genmask Interface Flags
ci-info: 0 0.0.0.0 172.31.0.1 0.0.0.0 eth0 UG
ci-info: 1 169.254.169.254 0.0.0.0 255.255.255.255 eth0 UH
ci-info: 2 172.31.0.0 0.0.0.0 255.255.240.0 eth0 U
May 21 13:36:29 cloud-init[2433]: __init__.py[WARNING]: Unhandled non-multipart (text/x-not-multipart) userdata: 'sudo yum install -y
http...'
Starting cloud-init: Cloud-init v. 0.7.6 running 'modules:config' at Fri, 21 May 2021 13:36:30 +0000. Up 7.43 seconds.
Starting sshd: [ OK ]
Starting ntpd: [ OK ]
Starting sendmail: [ OK ]
Starting sm-client: [ OK ]
Starting httpd: [ OK ]
Starting mongod: [ OK ]
My issue was resolved. Please follow below post to check procedure that was followed. Hope it helps someone else as well.
https://stackoverflow.com/a/67648386/3224357
I am trying to build an embedded Linux to be run on PocketBeagle using Buildroot; and following the instructions in (source1). The resulting images are copied then to the uSD-card.
When inserting the uSD-card in the Pocketbeagle and monitor the booting process via a serial connection; I got the following error:
No filesystem could mount root, tried:
ext4
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(179,1)
---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(179,1).
The used resources are:
Buildroot: 2018.02
File system: ext4
Bootloader: U-Boot (custom version 2018.01)
Kernel version: 4.14.24
Applying all the patches stated in source above and can be found in (source2):
- 0001-Stripped-back-pocketbeagle-devicetree.patch
- 0001-am335x_evm-uEnv.txt-bootz-n-fixes.patch
- 0002-U-Boot-BeagleBone-Cape-Manager.patch
- 0003-pocketbeagle-tweaks.patch
Runing the build results in the following files and images:
MLO: First stage bootloader
U-boot.img: Second stage bootloader
uEnv.txt: U-boot environmnt
zImage: Linux kernel image
am335x-pocketbeagle.dtb: Linux kernel Device Tree Blob
rootfs.ext4: Root filesystem image
The uEnv.txt is as follows:
fdtfile=am335x-pocketbeagle.dtb
bootpart=0:1
bootdir=
bootargs=console=ttyO0,115200n8 root=/dev/mmcblk0p1 rw rootfstype=ext4 rootwait
uenvcmd=run loadimage;run loadfdt;printenv bootargs;bootz ${loadaddr} - ${fdtaddr};
Then by using genimage in buildroot (and rebuilding) to generate the uSd-image that contains two partitions:
1. FAT partition containing the bootloader images, the kernel image and Device Tree
2. Rootfs partition containing the root filesystem ext4
The resulting image is called sdcard.img is copies to the uSD-card by using program etcher (etcher-electron-1.4.3-x86_64.AppImage) or by (sudo dd if=output/images/sdcard.img of=/dev/mmcblk0 bs=1M)
I have used two different uSD-cards to test the build, but the result was the same:
1. Kingstone 32 GB (SDHC 10)
2. Sandisk 16GB (SDHC 10)
It's worth to say that I have used the same uSD-cards to load the original image of the PocketBeagle from the official site and boot from them, the cards boots without problem.
Any idea to help is highly appreciated.
ADDENDUM
Another error that is shown in the log file occurs in the beginning of the boot:
U-Boot SPL 2018.01 (Mar 24 2018 - 21:13:25)
Trying to boot from MMC1
*** Warning - bad CRC, using default environment
reading u-boot.img
reading u-boot.img
U-Boot 2018.01 (Mar 24 2018 - 21:13:25 +0100)
CPU : AM335X-GP rev 2.1 I2C: ready DRAM: 512 MiB
No match for driver 'omap_hsmmc'
No match for driver 'omap_hsmmc'
Some drivers were not found
Reset Source: Power-on reset has occurred.
MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1
*** Warning - bad CRC, using default environment
The full log is as follows:
U-Boot SPL 2018.01 (Mar 24 2018 - 21:13:25)
Trying to boot from MMC1
*** Warning - bad CRC, using default environment
reading u-boot.img
reading u-boot.img
U-Boot 2018.01 (Mar 24 2018 - 21:13:25 +0100)
CPU : AM335X-GP rev 2.1
I2C: ready
DRAM: 512 MiB
No match for driver 'omap_hsmmc'
No match for driver 'omap_hsmmc'
Some drivers were not found
Reset Source: Power-on reset has occurred.
MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1
*** Warning - bad CRC, using default environment
Model: BeagleBoard.org PocketBeagle
<ethaddr> not set. Validating first E-fuse MAC
Net: No ethernet found.
Press SPACE to abort autoboot in 2 seconds
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
gpio: pin 56 (gpio 56) value is 0
gpio: pin 55 (gpio 55) value is 0
gpio: pin 54 (gpio 54) value is 0
gpio: pin 53 (gpio 53) value is 1
switch to partitions #0, OK
mmc0 is current device
gpio: pin 54 (gpio 54) value is 1
Checking for: /uEnv.txt ...
reading uEnv.txt
218 bytes read in 4 ms (52.7 KiB/s)
gpio: pin 55 (gpio 55) value is 1
Loaded environment from /uEnv.txt
Importing environment from mmc ...
Checking if uenvcmd is set ...
gpio: pin 56 (gpio 56) value is 1
Running uenvcmd ...
reading /zImage
5540120 bytes read in 351 ms (15.1 MiB/s)
loading /am335x-pocketbeagle.dtb ...
reading /am335x-pocketbeagle.dtb
33516 bytes read in 9 ms (3.6 MiB/s)
bootargs=console=ttyO0,115200n8 root=/dev/mmcblk0p1 rw rootfstype=ext4 rootwait
## Flattened Device Tree blob at 88000000
Booting using the fdt blob at 0x88000000
Loading Device Tree to 8fff4000, end 8ffff2eb ... OK
Starting kernel ...
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.14.24 (ammar#ammar-System-Product-Name) (gcc version 7.2.1 20171011 (Linaro GCC 7.2-2017.11)) #1 SMP Sat Mar 24 21:23:50 CET 2018
[ 0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c5387d
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[ 0.000000] OF: fdt: Machine model: TI AM335x PocketBeagle
[ 0.000000] Memory policy: Data cache writeback
[ 0.000000] cma: Reserved 16 MiB at 0x9e800000
[ 0.000000] CPU: All CPU(s) started in SVC mode.
[ 0.000000] AM335X ES2.1 (sgx neon)
[ 0.000000] random: fast init done
[ 0.000000] percpu: Embedded 17 pages/cpu #df93f000 s40872 r8192 d20568 u69632
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 129412
[ 0.000000] Kernel command line: console=ttyO0,115200n8 root=/dev/mmcblk0p1 rw rootfstype=ext4 rootwait
[ 0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
[ 0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
[ 0.000000] Memory: 479900K/522240K available (8192K kernel code, 810K rwdata, 2412K rodata, 1024K init, 7547K bss, 25956K reserved, 16384K cma-reserved, 0K highmem)
[ 0.000000] Virtual kernel memory layout:
[ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
[ 0.000000] fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
[ 0.000000] vmalloc : 0xe0000000 - 0xff800000 ( 504 MB)
[ 0.000000] lowmem : 0xc0000000 - 0xdfe00000 ( 510 MB)
[ 0.000000] pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB)
[ 0.000000] modules : 0xbf000000 - 0xbfe00000 ( 14 MB)
[ 0.000000] .text : 0xc0008000 - 0xc0900000 (9184 kB)
[ 0.000000] .init : 0xc0c00000 - 0xc0d00000 (1024 kB)
[ 0.000000] .data : 0xc0d00000 - 0xc0dca9b8 ( 811 kB)
[ 0.000000] .bss : 0xc0dcc000 - 0xc152af94 (7548 kB)
[ 0.000000] Running RCU self tests
[ 0.000000] Hierarchical RCU implementation.
[ 0.000000] RCU event tracing is enabled.
[ 0.000000] RCU lockdep checking is enabled.
[ 0.000000] RCU restricting CPUs from NR_CPUS=2 to nr_cpu_ids=1.
[ 0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
[ 0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[ 0.000000] IRQ: Found an INTC at 0xfa200000 (revision 5.0) with 128 interrupts
[ 0.000000] OMAP clockevent source: timer2 at 24000000 Hz
[ 0.000017] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[ 0.000044] clocksource: timer1: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[ 0.000097] OMAP clocksource: timer1 at 24000000 Hz
[ 0.000569] timer_probe: no matching timers found
[ 0.001470] Console: colour dummy device 80x30
[ 0.001516] Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingo Molnar
[ 0.001530] ... MAX_LOCKDEP_SUBCLASSES: 8
[ 0.001542] ... MAX_LOCK_DEPTH: 48
[ 0.001554] ... MAX_LOCKDEP_KEYS: 8191
[ 0.001566] ... CLASSHASH_SIZE: 4096
[ 0.001578] ... MAX_LOCKDEP_ENTRIES: 32768
[ 0.001589] ... MAX_LOCKDEP_CHAINS: 65536
[ 0.001601] ... CHAINHASH_SIZE: 32768
[ 0.001613] memory used by lock dependency info: 4655 kB
[ 0.001626] per task-struct memory footprint: 1536 bytes
[ 0.001663] Calibrating delay loop... 996.14 BogoMIPS (lpj=4980736)
[ 0.078740] pid_max: default: 32768 minimum: 301
[ 0.079147] Security Framework initialized
[ 0.079285] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.079306] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.082392] CPU: Testing write buffer coherency: ok
[ 0.083889] CPU0: thread -1, cpu 0, socket -1, mpidr 0
[ 0.085406] Setting up static identity map for 0x80100000 - 0x80100078
[ 0.085975] Hierarchical SRCU implementation.
[ 0.087625] smp: Bringing up secondary CPUs ...
[ 0.087648] smp: Brought up 1 node, 1 CPU
[ 0.087665] SMP: Total of 1 processors activated (996.14 BogoMIPS).
[ 0.087679] CPU: All CPU(s) started in SVC mode.
[ 0.091643] devtmpfs: initialized
[ 0.116033] VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 3
[ 0.116853] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.116916] futex hash table entries: 256 (order: 2, 16384 bytes)
[ 0.118550] pinctrl core: initialized pinctrl subsystem
[ 0.123225] NET: Registered protocol family 16
[ 0.130326] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.171692] omap_hwmod: debugss: _wait_target_disable failed
[ 0.226390] cpuidle: using governor menu
[ 0.237629] OMAP GPIO hardware version 0.1
[ 0.262333] No ATAGs?
[ 0.262360] hw-breakpoint: debug architecture 0x4 unsupported.
[ 0.262655] omap4_sram_init:Unable to allocate sram needed to handle errata I688
[ 0.262675] omap4_sram_init:Unable to get sram pool needed to handle errata I688
[ 0.298256] edma 49000000.edma: TI EDMA DMA engine driver
[ 0.303666] SCSI subsystem initialized
[ 0.305374] omap_i2c 44e0b000.i2c: could not find pctldev for node /ocp/l4_wkup#44c00000/scm#210000/pinmux#800/pinmux_i2c0_pins, deferring probe
[ 0.307447] omap_i2c 4802a000.i2c: bus 1 rev0.11 at 400 kHz
[ 0.307764] omap_i2c 4819c000.i2c: could not find pctldev for node /ocp/l4_wkup#44c00000/scm#210000/pinmux#800/mma8452_pins_default, deferring probe
[ 0.308058] pps_core: LinuxPPS API ver. 1 registered
[ 0.308076] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti#linux.it>
[ 0.308128] PTP clock support registered
[ 0.312478] clocksource: Switched to clocksource timer1
[ 0.448001] VFS: Disk quotas dquot_6.6.0
[ 0.448193] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[ 0.473020] NET: Registered protocol family 2
[ 0.474843] TCP established hash table entries: 4096 (order: 2, 16384 bytes)
[ 0.474948] TCP bind hash table entries: 4096 (order: 5, 147456 bytes)
[ 0.476120] TCP: Hash tables configured (established 4096 bind 4096)
[ 0.476506] UDP hash table entries: 256 (order: 2, 20480 bytes)
[ 0.476689] UDP-Lite hash table entries: 256 (order: 2, 20480 bytes)
[ 0.477446] NET: Registered protocol family 1
[ 0.479566] RPC: Registered named UNIX socket transport module.
[ 0.479614] RPC: Registered udp transport module.
[ 0.479629] RPC: Registered tcp transport module.
[ 0.479643] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 0.482107] hw perfevents: no interrupt-affinity property for /pmu, guessing.
[ 0.483357] hw perfevents: enabled with armv7_cortex_a8 PMU driver, 5 counters available
[ 0.487455] audit: initializing netlink subsys (disabled)
[ 0.490304] audit: type=2000 audit(0.480:1): state=initialized audit_enabled=0 res=1
[ 0.490640] workingset: timestamp_bits=14 max_order=17 bucket_order=3
[ 0.493682] NFS: Registering the id_resolver key type
[ 0.494058] Key type id_resolver registered
[ 0.494099] Key type id_legacy registered
[ 0.494253] jffs2: version 2.2. (NAND) (SUMMARY) © 2001-2006 Red Hat, Inc.
[ 0.500669] io scheduler noop registered
[ 0.500700] io scheduler deadline registered
[ 0.500822] io scheduler cfq registered (default)
[ 0.500841] io scheduler mq-deadline registered
[ 0.500856] io scheduler kyber registered
[ 0.503256] pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568
[ 0.510527] Serial: 8250/16550 driver, 6 ports, IRQ sharing enabled
[ 0.516492] omap_uart 44e09000.serial: no wakeirq for uart0
[ 0.516942] 44e09000.serial: ttyO0 at MMIO 0x44e09000 (irq = 30, base_baud = 3000000) is a OMAP UART0
[ 1.250345] console [ttyO0] enabled
[ 1.255586] omap_uart 48022000.serial: no wakeirq for uart1
[ 1.261829] 48022000.serial: ttyO1 at MMIO 0x48022000 (irq = 31, base_baud = 3000000) is a OMAP UART1
[ 1.272744] omap_uart 48024000.serial: no wakeirq for uart2
[ 1.278844] 48024000.serial: ttyO2 at MMIO 0x48024000 (irq = 32, base_baud = 3000000) is a OMAP UART2
[ 1.289570] omap_uart 481a8000.serial: no wakeirq for uart4
[ 1.295781] 481a8000.serial: ttyO4 at MMIO 0x481a8000 (irq = 33, base_baud = 3000000) is a OMAP UART4
[ 1.334046] brd: module loaded
[ 1.362138] loop: module loaded
[ 1.368162] mtdoops: mtd device (mtddev=name/number) must be supplied
[ 1.383297] libphy: Fixed MDIO Bus: probed
[ 1.390588] i2c /dev entries driver
[ 1.398755] omap_hsmmc 48060000.mmc: Got CD GPIO
[ 1.465093] ledtrig-cpu: registered to indicate activity on CPUs
[ 1.472542] oprofile: using arm/armv7
[ 1.477095] Initializing XFRM netlink socket
[ 1.481985] NET: Registered protocol family 10
[ 1.493215] Segment Routing with IPv6
[ 1.497190] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[ 1.505262] NET: Registered protocol family 17
[ 1.509973] NET: Registered protocol family 15
[ 1.515090] Key type dns_resolver registered
[ 1.519724] omap_voltage_late_init: Voltage driver support not added
[ 1.526481] sr_dev_init: No voltage domain specified for smartreflex0. Cannot initialize
[ 1.535007] sr_dev_init: No voltage domain specified for smartreflex1. Cannot initialize
[ 1.543566] ThumbEE CPU extension supported.
[ 1.548049] Registering SWP/SWPB emulation handler
[ 1.553116] SmartReflex Class3 initialized
[ 1.623490] mmc0: host does not support reading read-only switch, assuming write-enable
[ 1.635560] mmc0: new high speed SDHC card at address 0007
[ 1.644119] mmcblk0: mmc0:0007 SD32G 28.8 GiB
[ 1.655081] mmcblk0: p1 p2
[ 1.671199] tps65217 0-0024: TPS65217 ID 0xe version 1.2
[ 1.677649] omap_i2c 44e0b000.i2c: bus 0 rev0.11 at 400 kHz
[ 1.686633] omap_i2c 4819c000.i2c: bus 2 rev0.11 at 400 kHz
[ 1.694194] hctosys: unable to open rtc device (rtc0)
[ 1.699490] sr_init: No PMIC hook to init smartreflex
[ 1.705144] sr_init: platform driver register failed for SR
[ 1.720670] List of all partitions:
[ 1.724586] 0100 16384 ram0
[ 1.724597] (driver?)
[ 1.730999] 0101 16384 ram1
[ 1.731008] (driver?)
[ 1.737842] 0102 16384 ram2
[ 1.737854] (driver?)
[ 1.744389] 0103 16384 ram3
[ 1.744400] (driver?)
[ 1.750791] 0104 16384 ram4
[ 1.750800] (driver?)
[ 1.757269] 0105 16384 ram5
[ 1.757278] (driver?)
[ 1.763737] 0106 16384 ram6
[ 1.763746] (driver?)
[ 1.770139] 0107 16384 ram7
[ 1.770148] (driver?)
[ 1.776597] 0108 16384 ram8
[ 1.776607] (driver?)
[ 1.783061] 0109 16384 ram9
[ 1.783071] (driver?)
[ 1.789456] 010a 16384 ram10
[ 1.789465] (driver?)
[ 1.795999] 010b 16384 ram11
[ 1.796008] (driver?)
[ 1.802540] 010c 16384 ram12
[ 1.802549] (driver?)
[ 1.809029] 010d 16384 ram13
[ 1.809038] (driver?)
[ 1.815571] 010e 16384 ram14
[ 1.815580] (driver?)
[ 1.822056] 010f 16384 ram15
[ 1.822065] (driver?)
[ 1.828679] b300 30228480 mmcblk0
[ 1.828690] driver: mmcblk
[ 1.835867] b301 16384 mmcblk0p1 00000000-01
[ 1.835877]
[ 1.843044] b302 524288 mmcblk0p2 00000000-02
[ 1.843053]
[ 1.850164] No filesystem could mount root, tried:
[ 1.850173] ext4
[ 1.855340]
[ 1.858913] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(179,1)
[ 1.867873] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(179,1)
The failure to mount the rootfs is occurring because the correct partition of the SDcard has not been specified.
In the kernel command line, the kernel is (incorrectly) instructed to find the rootfs in the partition corresponding to /dev/mmcblk0p1.
bootargs=console=ttyO0,115200n8 root=/dev/mmcblk0p1 rw rootfstype=ext4 rootwait
and
[ 0.000000] Kernel command line: console=ttyO0,115200n8 root=/dev/mmcblk0p1 rw rootfstype=ext4 rootwait
However the mmc subsystem reports that there are two partitions on your SDcard, and the boot log reports the device names of these partitions for you twice.
First:
[ 1.635560] mmc0: new high speed SDHC card at address 0007
[ 1.644119] mmcblk0: mmc0:0007 SD32G 28.8 GiB
[ 1.655081] mmcblk0: p1 p2
And then:
[ 1.720670] List of all partitions:
...
[ 1.828679] b300 30228480 mmcblk0
[ 1.828690] driver: mmcblk
[ 1.835867] b301 16384 mmcblk0p1 00000000-01
[ 1.835877]
[ 1.843044] b302 524288 mmcblk0p2 00000000-02
So the kernel command line (through bootargs) should specify the second partition, /dev/mmcblk0p2, rather than the first partition for the rootfs.
Since the storage area for your U-Boot environment has not been properly initialized (i.e. the "Warning - bad CRC, using default environment" messages) (or your uEnv.txt file is missing or corrupt), U-Boot is booting the Linux kernel with a hardcoded bootargs value that is defined in your board's configuration file.
You could either edit that file and re-build U-Boot, or abort the autoboot and use
setenv bootargs console=ttyO0,115200n8 root=/dev/mmcblk0p2 rw rootfstype=ext4 rootwait and saveenv commands to correct this mis-specification.
I have a simple program:
#include <iostream>
int main() {
std::cout << "Starting" << std::endl;
while (1) {
}
return 0;
}
I compile and run it:
clang -o test test.cpp
bash$ ./test
Starting
In another terminal, I examine it and kill it:
bash$ top
Processes: 284 total, 3 running, 9 stuck, 272 sleeping, 1505 threads 14:45:49
Load Avg: 1.86, 1.81, 2.06 CPU usage: 13.57% user, 0.96% sys, 85.45% idle
SharedLibs: 21M resident, 12M data, 0B linkedit.
MemRegions: 87372 total, 4974M resident, 86M private, 1203M shared.
PhysMem: 15G used (1887M wired), 1450M unused.
VM: 729G vsize, 1064M framework vsize, 3299196(0) swapins, 3711511(0) swapouts.
Networks: packets: 2686338/648M in, 2068186/355M out.
Disks: 1141818/44G read, 1926370/100G written.
PID COMMAND %CPU TIME #TH #WQ #PORT MEM PURG CMPRS PGRP PPID STATE
30161 test 100.3 02:12.71 1/1 0 9 312K 0B 0B 29470 28181 running
66064 Terminal 2.7 01:29.69 9 3 257 53M 0B 4580K 66064 1 sleeping
bash$ ls -al /cores/
total 917024
drwxrwxr-t# 3 root admin 102 May 1 14:54 .
drwxr-xr-x 33 root wheel 1190 Apr 14 09:13 ..
bash$ killall -SIGSEGV test
bash$ ls -al /cores/
total 1818048
drwxrwxr-t# 4 root admin 136 May 1 14:55 .
drwxr-xr-x 33 root wheel 1190 Apr 14 09:13 ..
-r-------- 1 stebro admin 469516288 May 1 14:54 core.30161
vmmap says:
==== Summary for process 50745
ReadOnly portion of Libraries: Total=316K resident=280K(89%) swapped_out_or_unallocated=36K(11%)
Writable regions: Total=40.3M written=16K(0%) resident=12.1M(30%) swapped_out=14.4M(36%) unallocated=28.3M(70%)
REGION TYPE VIRTUAL
=========== =======
Kernel Alloc Once 4K
MALLOC 9388K see MALLOC ZONE table below
MALLOC (admin) 24K
STACK GUARD 56.0M
Stack 8192K
VM_ALLOCATE 4K
__DATA 680K
__LINKEDIT 70.9M
__TEXT 5960K
shared memory 4K
=========== =======
TOTAL 150.6M
VIRTUAL ALLOCATION BYTES
MALLOC ZONE SIZE COUNT ALLOCATED % FULL
=========== ======= ========= ========= ======
DefaultMallocZone_0x104a0e000 9216K 357 27K 0%
Why is my core file 469 MB?
Your core dump includes the complete state of memory as well as symbol information for the frameworks and libraries that your application was running with at the time. That's a lot of data. For more information you might check out the core dumps section of technical note 2124
I get the following error while booting linux-3.14.4 on FPGA ZC706. I have build all tools following ways:
Rocket-Chip:
$ Latest master branch is checked out and generate boot.bin
riscv-gnu-toolchain:
$ ./build.sh (riscv64-unknown-elf)
$ make linux (for riscv64-unknown-linux-gnu-gcc)
Linux kernel:
$curl -L https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.14.41.tar.xz | tar -xJkf -
$ cd linux-3.14.41
$ git init
$ git remote add origin https://github.com/riscv/riscv-linux.git
$ git fetch
$ git checkout -f -t origin/master
$ make ARCH=riscv defconfig
$ make -j12 ARCH=riscv vmlinux
Root disc image:
$ dd if=/dev/zero of=root.bin bs=1M count=64
$ mkfs.ext2 -F root.bin
Booting:
1. First copy all files (vmlinux, root.bin, boot.bin, devicetree.dtb, uImage, uramdisk.image.gz) into sdcard.
(2) $ mkdir /sdcard
$ mount /dev/mmcblk0p1 /sdcard
$ ./fesvr-zynq +disk=/sdcard/riscv/root.bin bbl /sdcard/riscv/vmlinux
Booting starts, but stuck at a point. The following are the booting error
[ 0.000000] Zone ranges:
[ 0.000000] Normal [mem 0x00200000-0x0fffffff]
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x00200000-0x0fffffff]
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 64135
[ 0.000000] Kernel command line: root=/dev/htifblk0
[ 0.000000] PID hash table entries: 1024 (order: 1, 8192 bytes)
[ 0.000000] Dentry cache hash table entries: 32768 (order: 6, 262144 bytes)
[ 0.000000] Inode-cache hash table entries: 16384 (order: 5, 131072 bytes)
[ 0.000000] Sorting __ex_table...
[ 0.000000] Memory: 253568K/260096K available (1725K kernel code, 120K rwdata, 356K rodata, 68K init, 211K bss, 6528K reserved)
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] NR_IRQS:2
[ 0.150000] Calibrating delay using timer specific routine.. 20.01 BogoMIPS (lpj=100074)
[ 0.150000] pid_max: default: 32768 minimum: 301
[ 0.150000] Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
[ 0.150000] Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes)
[ 0.150000] devtmpfs: initialized
[ 0.150000] NET: Registered protocol family 16
[ 0.150000] bio: create slab <bio-0> at 0
[ 0.150000] Switched to clocksource riscv_clocksource
[ 0.150000] NET: Registered protocol family 2
[ 0.150000] TCP established hash table entries: 2048 (order: 2, 16384 bytes)
[ 0.150000] TCP bind hash table entries: 2048 (order: 2, 16384 bytes)
[ 0.150000] TCP: Hash tables configured (established 2048 bind 2048)
[ 0.150000] TCP: reno registered
[ 0.150000] UDP hash table entries: 256 (order: 1, 8192 bytes)
[ 0.150000] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[ 0.150000] NET: Registered protocol family 1
[ 0.150000] futex hash table entries: 256 (order: 0, 6144 bytes)
[ 0.150000] io scheduler noop registered
[ 0.150000] io scheduler cfq registered (default)
[ 0.170000] htifcon htif1: detected console
[ 0.180000] console [htifcon0] enabled
[ 0.180000] htifblk htif2: detected disk
[ 0.180000] htifblk htif2: added htifblk0
[ 0.180000] TCP: cubic registered
[ 0.180000] VFS: Mounted root (ext2 filesystem) readonly on device 254:0.
[ 0.180000] devtmpfs: error mounting -2
[ 0.180000] Freeing unused kernel memory: 68K (ffffffff80000000 - ffffffff80011000)
[ 0.180000] Kernel panic - not syncing: No working init found. Try passing init= option to kernel. See Linux Documentation/init.txt for guidance.
[ 0.180000] CPU: 0 PID: 1 Comm: swapper Not tainted 3.14.41-g2317c43-dirty #2
[ 0.180000] Call Trace:
[ 0.180000] [<ffffffff80012f54>] walk_stackframe+0x0/0xc8
[ 0.180000] [<ffffffff801bbff4>] panic+0xb4/0x1c4
[ 0.180000] [<ffffffff80012a24>] sys_rt_sigreturn+0x140/0x178
[ 0.180000] [<ffffffff801bba08>] rest_init+0x80/0x84
[ 0.180000] [<ffffffff801bbafc>] kernel_init+0xf0/0xf4
[ 0.180000] [<ffffffff801bba08>] rest_init+0x80/0x84
Can anyone help me, whether I miss anything. I also tried with
linux-3.14.33; the same error comes
I can now boot kernel on SPIKE ISA as well as FPGA. I omit some steps while building root.bin mentioned at https://github.com/riscv/riscv-tools.
$ dd if=/dev/zero of=root.bin bs=1M count=64
$ mkfs.ext2 -F root.bin
will generate empty root.bin. We need to mount disc image and complete the file systems after completing busy box building as mentioned at https://github.com/riscv/riscv-tools