<div dir="ltr"><div class="gmail_default" style="font-family:georgia,serif;font-size:small"><span style="font-family:arial,sans-serif">On Fri, Mar 4, 2016 at 9:09 PM, 张云 </span><span dir="ltr" style="font-family:arial,sans-serif">&lt;<a href="mailto:zyunone@163.com" target="_blank">zyunone@163.com</a>&gt;</span><span style="font-family:arial,sans-serif"> wrote:</span><br></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">First your must know exactly how linux boot (not at source code level).<br>
<br>
Most recent linux distributions boot as<br>
<br>
        grub —&gt; kernel —&gt; initramfs’ /init executable<br>
<br>
All the userspace affair is started by initramfs’ /init. Kernel no longer join the boot process.<br>
<br>
>From you description, I think you were blocked by the initramfs concept. Initramfs is the first root filesystem and reside in memeory.<br>
It’s loaded by grub, and the kernel automatically mount it, execute the /init. The /init executable can do some extra initialisation<br>
and switch to the real root filesystem on disk.<br>
for detail /Documentaion/filesystems/ramfs-rootfs-initramfs<br>
<br>
Hope that would be useful to your.<br>
</blockquote></div><br></div><div class="gmail_extra"><div class="gmail_default" style="font-family:georgia,serif;font-size:small">​Thanks for the response. I was able to get a minimal boot using the files in the mini.iso image from Ubuntu.​ I just copied the kernel and the ramdisk image from that iso, and these have given me enough to start learning some things. It is still just dropping me into the prompt for the ramdisk image, so the kernel hasn&#39;t yet made the switch over to root filesystem on a drive, but this is at least enough to get me started.</div><div class="gmail_default" style="font-family:georgia,serif;font-size:small"><br></div><div class="gmail_default" style="font-family:georgia,serif;font-size:small">One thing I noticed that confused me was the result of the commands pasted below. It looks like the partition table on the disk image might be getting messed up. But, interestingly enough, it still seems to allow me to use the image for booting. In spite of this, fdisk is giving me strange output when I ask it to print out the partition tables after I build a file system on the disk image using mkfs. When I look at the disk image using gparted, on the other hand, it actually looks OK.</div><div class="gmail_default" style="font-family:georgia,serif;font-size:small"><br></div><div class="gmail_default" style="font-family:georgia,serif;font-size:small">It looks like I might be using mkfs incorrectly. Can anyone see anything obvious that I am doing wrong?</div><div class="gmail_default" style="font-family:georgia,serif;font-size:small"><br></div><div class="gmail_default" style="font-family:georgia,serif;font-size:small">==============</div><div class="gmail_default" style="font-family:georgia,serif;font-size:small"><br></div><div class="gmail_default" style="font-family:georgia,serif;font-size:small">dd if=/dev/zero of=./disk.img bs=1M count=1000</div><div class="gmail_default" style="font-family:georgia,serif;font-size:small">sudo losetup /dev/loop0 ./disk.img</div><div class="gmail_default" style="font-family:georgia,serif;font-size:small">sudo fdisk /dev/loop0</div></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_default" style="font-family:georgia,serif;font-size:small">(commands in fdisk)</div></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_default" style="font-family:georgia,serif;font-size:small">&gt; n (new partition)</div></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_default" style="font-family:georgia,serif;font-size:small">&gt; p (primary partition)</div></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_default" style="font-family:georgia,serif;font-size:small">&gt; 1 (partition number)</div></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_default" style="font-family:georgia,serif;font-size:small">&gt; (default start and end for partition)</div></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_default" style="font-family:georgia,serif;font-size:small">&gt; t (change type of partition)</div></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_default" style="font-family:georgia,serif;font-size:small">&gt; b (change type of partition to FAT32)</div></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_default" style="font-family:georgia,serif;font-size:small">&gt; a (set boot flag)</div></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_default" style="font-family:georgia,serif;font-size:small">&gt; 1 (set boot flag for first partition)</div></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_default" style="font-family:georgia,serif;font-size:small">&gt; w (write changes)</div></div></blockquote><font face="georgia, serif"><div class="gmail_default" style="font-family:georgia,serif;font-size:small;display:inline">​fdisk -lu /dev/loop0</div></font><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><font face="georgia, serif"><div class="gmail_default" style="font-family:georgia,serif;font-size:small;display:inline">​</div>Disk /dev/loo</font><span style="font-family:georgia,serif">​p0​</span></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><font face="georgia, serif">: 1048 MB, 1048576000 bytes</font></div><div><font face="georgia, serif"><div>123 heads, 59 sectors/track, 282 cylinders, total 2048000 sectors</div></font></div><div><font face="georgia, serif"><div>Units = sectors of 1 * 512 = 512 bytes</div></font></div><div><font face="georgia, serif"><div>Sector size (logical/physical): 512 bytes / 512 bytes</div></font></div><div><font face="georgia, serif"><div>I/O size (minimum/optimal): 512 bytes / 512 bytes</div></font></div><div><font face="georgia, serif"><div>Disk identifier: 0x7b9351bf</div></font></div><div><font face="georgia, serif"><div><br></div></font></div><div><font face="georgia, serif"><div>      Device Boot      Start         End      Blocks   Id  System</div></font></div><div><font face="georgia, serif"><div>/dev/loop<div class="gmail_default" style="font-family:georgia,serif;font-size:small;display:inline">​0​</div>p1   *        2048     2047999     1022976    b  W95 FAT32</div></font></div></blockquote><div><div class="gmail_extra"><div class="gmail_default" style="font-family:georgia,serif;font-size:small"><br></div><div class="gmail_default" style="font-family:georgia,serif;font-size:small">mkfs -t vfat /dev/loop0</div><div class="gmail_default" style="font-family:georgia,serif;font-size:small">fdisk -lu /dev/loop0</div></div></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><div class="gmail_extra"><div class="gmail_default" style=""><span style="font-family:georgia,serif;font-size:small">​</span><font face="georgia, serif">Disk /dev/loop0: 1048 MB, 1048576000 bytes</font></div></div></div><div><div class="gmail_extra"><div class="gmail_default" style=""><font face="georgia, serif">255 heads, 63 sectors/track, 127 cylinders, total 2048000 sectors</font></div></div></div><div><div class="gmail_extra"><div class="gmail_default" style=""><font face="georgia, serif">Units = sectors of 1 * 512 = 512 bytes</font></div></div></div><div><div class="gmail_extra"><div class="gmail_default" style=""><font face="georgia, serif">Sector size (logical/physical): 512 bytes / 512 bytes</font></div></div></div><div><div class="gmail_extra"><div class="gmail_default" style=""><font face="georgia, serif">I/O size (minimum/optimal): 512 bytes / 512 bytes</font></div></div></div><div><div class="gmail_extra"><div class="gmail_default" style=""><font face="georgia, serif">Disk identifier: 0x00000000</font></div></div></div><div><div class="gmail_extra"><div class="gmail_default" style=""><font face="georgia, serif"><br></font></div></div></div><div><div class="gmail_extra"><div class="gmail_default" style=""><font face="georgia, serif">      Device Boot      Start         End      Blocks   Id  System</font><span style="font-family:georgia,serif;font-size:small">​</span></div></div></div></blockquote><div><div class="gmail_extra"><br></div></div><div class="gmail_extra"><div class="gmail_default" style="font-family:georgia,serif;font-size:small">​==============</div><div class="gmail_default" style="font-family:georgia,serif;font-size:small"><br></div><div class="gmail_default" style="font-family:georgia,serif;font-size:small">Thanks,</div><div class="gmail_default" style="font-family:georgia,serif;font-size:small">Patrick​</div><br></div></div>