Booting with SYSLINUX on Loopback Device: Kernel Panic - Where to Start?

张云 zyunone at 163.com
Tue Mar 8 01:08:25 EST 2016


> On Mar 8, 2016, at 7:29 AM, Patrick <plafratt at gmail.com> wrote:
> 
> On Fri, Mar 4, 2016 at 9:09 PM, 张云 <zyunone at 163.com <mailto:zyunone at 163.com>> wrote:
> First your must know exactly how linux boot (not at source code level).
> 
> Most recent linux distributions boot as
> 
>         grub —> kernel —> initramfs’ /init executable
> 
> All the userspace affair is started by initramfs’ /init. Kernel no longer join the boot process.
> 
> >From you description, I think you were blocked by the initramfs concept. Initramfs is the first root filesystem and reside in memeory.
> It’s loaded by grub, and the kernel automatically mount it, execute the /init. The /init executable can do some extra initialisation
> and switch to the real root filesystem on disk.
> for detail /Documentaion/filesystems/ramfs-rootfs-initramfs
> 
> Hope that would be useful to your.
> 
> ​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't yet made the switch over to root filesystem on a drive, but this is at least enough to get me started.
> 
> 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.
> 
> It looks like I might be using mkfs incorrectly. Can anyone see anything obvious that I am doing wrong?
> 
> ==============
> 
> dd if=/dev/zero of=./disk.img bs=1M count=1000
> sudo losetup /dev/loop0 ./disk.img
> sudo fdisk /dev/loop0
> (commands in fdisk)
> > n (new partition)
> > p (primary partition)
> > 1 (partition number)
> > (default start and end for partition)
> > t (change type of partition)
> > b (change type of partition to FAT32)
> > a (set boot flag)
> > 1 (set boot flag for first partition)
> > w (write changes)
> ​fdisk -lu /dev/loop0
> ​Disk /dev/loo​p0​
> : 1048 MB, 1048576000 bytes
> 123 heads, 59 sectors/track, 282 cylinders, total 2048000 sectors
> Units = sectors of 1 * 512 = 512 bytes
> Sector size (logical/physical): 512 bytes / 512 bytes
> I/O size (minimum/optimal): 512 bytes / 512 bytes
> Disk identifier: 0x7b9351bf
> 
>       Device Boot      Start         End      Blocks   Id  System
> /dev/loop​0​p1   *        2048     2047999     1022976    b  W95 FAT32
> 

The problem is caused by the command below

> mkfs -t vfat /dev/loop0

/dev/loop0 is the whole disk, and /dev/loop0p1 is the partition.

The command make a file system on the disk, thus overrides the disk’s partition table.  

I guess that it is the partition on which you want to make a filesystem.
The right command is 

      mkfs -t ext2 /dev/loop0p1

We prefer ext2,3,4 to fat32 on linux.


> fdisk -lu /dev/loop0
> ​Disk /dev/loop0: 1048 MB, 1048576000 bytes
> 255 heads, 63 sectors/track, 127 cylinders, total 2048000 sectors
> Units = sectors of 1 * 512 = 512 bytes
> Sector size (logical/physical): 512 bytes / 512 bytes
> I/O size (minimum/optimal): 512 bytes / 512 bytes
> Disk identifier: 0x00000000
> 
>       Device Boot      Start         End      Blocks   Id  System​
> 
> ​==============
> 
> Thanks,
> Patrick​
> 
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160308/de3eecfe/attachment.html 


More information about the Kernelnewbies mailing list