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

Patrick plafratt at gmail.com
Mon Mar 7 18:29:59 EST 2016


On Fri, Mar 4, 2016 at 9:09 PM, 张云 <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


mkfs -t vfat /dev/loop0
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​
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160307/b3225a5d/attachment.html 


More information about the Kernelnewbies mailing list