“What is the kernel die message”的版本间的差异

来自个人维基
跳转至: 导航搜索
 
(未显示1个用户的5个中间版本)
第34行: 第34行:
 
[  36.862337] -CJ do_mount_root (/dev/root, ext3)
 
[  36.862337] -CJ do_mount_root (/dev/root, ext3)
  
[  36.866925] VFS: Cannot open root device "sdd10" or unknown-block(0,0): error -6
+
[  36.866925] VFS: Cannot open root device "sdd10" or unknown-block(0,0): error -6 //ENXIO = /* No such device or address */
 
[  36.874332] Please append a correct "root=" boot option; here are the available partitions:
 
[  36.874332] Please append a correct "root=" boot option; here are the available partitions:
 
[  36.882734] --CJ printk_all_partitions:  
 
[  36.882734] --CJ printk_all_partitions:  
第65行: 第65行:
 
void __init prepare_namespace(void)
 
void __init prepare_namespace(void)
 
{
 
{
 +
        ROOT_DEV = name_to_dev_t(root_device_name);
 +
        root_device_name += 5; //remove /dev/
 
mount_root();
 
mount_root();
 
}
 
}
第70行: 第72行:
 
void __init mount_root(void)
 
void __init mount_root(void)
 
{
 
{
int err = create_dev("/dev/root", ROOT_DEV);
+
int err = create_dev("/dev/root", ROOT_DEV); (= mknod (/dev/root->ROOT_DEV)
 
mount_block_root("/dev/root", root_mountflags/=0x8000/);
 
mount_block_root("/dev/root", root_mountflags/=0x8000/);
 
}
 
}
第77行: 第79行:
 
for (p = fs_names; *p; p += strlen(p)+1) {
 
for (p = fs_names; *p; p += strlen(p)+1) {
 
int err = do_mount_root(name, p, flags, root_mount_data);
 
int err = do_mount_root(name, p, flags, root_mount_data);
                 //SYS_MOUNT("/dev/root", "/root","ext3") error
+
                 //SYS_MOUNT("/dev/root", "/root","ext3") error = -6
switch (err) {
+
case 0:
+
goto out;
+
}
+
 
__bdevname(ROOT_DEV, b); //ROOT_DEV=0
 
__bdevname(ROOT_DEV, b); //ROOT_DEV=0
 
printk("VFS: Cannot open root device \"%s\" or %s: error %d\n",
 
printk("VFS: Cannot open root device \"%s\" or %s: error %d\n",
 
root_device_name, b, err);
 
root_device_name, b, err);
 
//VFS: Cannot open root device "sdd10" or unknown-block(0,0): error -6
 
//VFS: Cannot open root device "sdd10" or unknown-block(0,0): error -6
 +
//root_device_name = sdd10 跟 /dev/root 有什麼關係?
 +
//why ROOT_DEV = 0,0: node created but not mount
  
 
printk("Please append a correct \"root=\" boot option; here are the available partitions:\n");
 
printk("Please append a correct \"root=\" boot option; here are the available partitions:\n");
                      //Please append a correct "root=" boot option; here are the available partitions:
 
 
 
printk_all_partitions();//NO OUTPUT
 
printk_all_partitions();//NO OUTPUT
#ifdef CONFIG_DEBUG_BLOCK_EXT_DEVT
 
printk("DEBUG_BLOCK_EXT_DEVT is enabled, you need to specify "
 
      "explicit textual name for \"root=\" boot option.\n");
 
#endif
 
 
panic("VFS: Unable to mount root fs on %s", b);
 
panic("VFS: Unable to mount root fs on %s", b);
 
                 // VFS: Unable to mount root fs on unknown-block(0,0)
 
                 // VFS: Unable to mount root fs on unknown-block(0,0)
}
 
if (!(flags & SB_RDONLY)) {
 
flags |= SB_RDONLY;
 
goto retry;
 
 
}
 
}
  
printk("List of all partitions:\n");
 
printk_all_partitions();
 
printk("No filesystem could mount root, tried: ");
 
for (p = fs_names; *p; p += strlen(p)+1)
 
printk(" %s", p);
 
printk("\n");
 
#ifdef CONFIG_BLOCK
 
__bdevname(ROOT_DEV, b);
 
#endif
 
panic("VFS: Unable to mount root fs on %s", b);
 
out:
 
put_page(page);
 
 
}
 
}
  
第134行: 第113行:
 
return 0;
 
return 0;
 
}
 
}
 +
 +
 +
 +
dev_t name_to_dev_t(const char *name)
 +
{
 +
char s[32];
 +
char *p;
 +
dev_t res = 0;
 +
int part;
 +
 +
strcpy(s, name);
 +
for (p = s; *p; p++)
 +
if (*p == '/')
 +
*p = '!';
 +
printk("--- blk_lookup_edvt(%s)\n", s);//s="sdd10"
 +
res = blk_lookup_devt(s, 0);
 +
if (res)
 +
goto done;
 +
 +
/*
 +
* try non-existent, but valid partition, which may only exist
 +
* after revalidating the disk, like partitioned md devices
 +
*/
 +
while (p > s && isdigit(p[-1]))
 +
p--;
 +
if (p == s || !*p || *p == '0')
 +
goto fail;
 +
 +
/* try disk name without <part number> */
 +
part = simple_strtoul(p, NULL, 10);
 +
*p = '\0';
 +
printk("--CJ 2nd blk_lookup_dvt(%s)\n", s);//s=sdd, part=10
 +
res = blk_lookup_devt(s, part);
 +
if (res)
 +
goto done;
 +
 +
/* try disk name without p<part number> */
 +
if (p < s + 2 || !isdigit(p[-2]) || p[-1] != 'p')
 +
goto fail;
 +
p[-1] = '\0';
 +
printk("--CJ 3rd bLk_lookup %s\n", s);
 +
res = blk_lookup_devt(s, part);
 +
if (res)
 +
goto done;
 +
 +
fail:
 +
return 0;
 +
done:
 +
return res;
 +
}
 +
 +
</source>
 +
./block/genhd.c
 +
<source lang="c">
 +
void __init printk_all_partitions(void)
 +
{
 +
struct class_dev_iter iter;
 +
struct device *dev;
 +
printk("--CJ printk_all_partitions: \n");
 +
class_dev_iter_init(&iter, &block_class, NULL, &disk_type);
 +
while ((dev = class_dev_iter_next(&iter))) {
 +
struct gendisk *disk = dev_to_disk(dev);
 +
struct disk_part_iter piter;
 +
struct hd_struct *part;
 +
char name_buf[BDEVNAME_SIZE];
 +
char devt_buf[BDEVT_SIZE];
 +
printk("-- -- CJ loop 1\n");
 +
/*
 +
* Don't show empty devices or things that have been
 +
* suppressed
 +
*/
 +
if (get_capacity(disk) == 0 ||
 +
    (disk->flags & GENHD_FL_SUPPRESS_PARTITION_INFO))
 +
continue;
 +
 +
/*
 +
* Note, unlike /proc/partitions, I am showing the
 +
* numbers in hex - the same format as the root=
 +
* option takes.
 +
*/
 +
disk_part_iter_init(&piter, disk, DISK_PITER_INCL_PART0);
 +
while ((part = disk_part_iter_next(&piter))) {
 +
bool is_part0 = part == &disk->part0;
 +
 +
printk("%s%s %10llu %s %s", is_part0 ? "" : "  ",
 +
      bdevt_str(part_devt(part), devt_buf),
 +
      (unsigned long long)part_nr_sects_read(part) >> 1
 +
      , disk_name(disk, part->partno, name_buf),
 +
      part->info ? part->info->uuid : "");
 +
if (is_part0) {
 +
if (dev->parent && dev->parent->driver)
 +
printk(" driver: %s\n",
 +
      dev->parent->driver->name);
 +
else
 +
printk(" (driver?)\n");
 +
} else
 +
printk("\n");
 +
}
 +
disk_part_iter_exit(&piter);
 +
}
 +
class_dev_iter_exit(&iter);
 +
}
 +
dev_t blk_lookup_devt(const char *name, int partno)
 +
{
 +
dev_t devt = MKDEV(0, 0);
 +
struct class_dev_iter iter;
 +
struct device *dev;
 +
 +
class_dev_iter_init(&iter, &block_class, NULL, &disk_type);
 +
while ((dev = class_dev_iter_next(&iter))) {
 +
struct gendisk *disk = dev_to_disk(dev);
 +
struct hd_struct *part;
 +
 +
if (strcmp(dev_name(dev), name))
 +
continue;
 +
 +
if (partno < disk->minors) {
 +
/* We need to return the right devno, even
 +
* if the partition doesn't exist yet.
 +
*/
 +
devt = MKDEV(MAJOR(dev->devt),
 +
    MINOR(dev->devt) + partno);
 +
break;
 +
}
 +
part = disk_get_part(disk, partno);
 +
if (part) {
 +
devt = part_devt(part);
 +
disk_put_part(part);
 +
break;
 +
}
 +
disk_put_part(part);
 +
}
 +
class_dev_iter_exit(&iter);
 +
return devt;
 +
}
 +
</source>

2019年11月21日 (四) 10:25的最后版本

error

(XEN) *** LOADING DOMAIN 0 ***
(XEN) Loading d0 kernel from boot module @ 00000000b936c000
(XEN) Allocating 1:1 mappings totalling 512MB for dom0:
(XEN) BANK[0] 0x000000c0000000-0x000000e0000000 (512MB)
(XEN) Grant table range: 0x000000b921c000-0x000000b925c000
(XEN) Allocating PPI 16 for event channel interrupt
(XEN) Loading zImage from 00000000b936c000 to 00000000c0080000-00000000c1187200
(XEN) Loading d0 DTB to 0x00000000c8000000-0x00000000c800a813
...
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Boot CPU: AArch64 Processor [410fd034]
[    0.000000] Machine model: HiKey960
[    0.000000] Xen 4.13 support found
[    0.000000] Kernel command line: console=tty0 console=hvc0 root=/dev/sdd10 rw efi=noruntime
[    0.000000] PID hash table entries: 2048 (order: 2, 16384 bytes)
[    0.000000] Memory: 456156K/525312K available (10364K kernel code, 1180K rwdata, 4664K rodata, 1152K init, 405K bss, 52772K reserved, 16384K cma-reserved)
...
[    7.067414] --CJ  enter prepare_namespace: root_delay=0
[    7.294633] ufshcd-hi3660 ff3b0000.ufs: ufshcd_query_flag: Sending flag query for idn 3 failed, err = -11
[    7.683146] xhci-hcd xhci-hcd.0.auto: USB bus 2 deregistered
[    7.688722] xhci-hcd xhci-hcd.0.auto: remove, state 1
...
[   14.998578] ufshcd-hi3660 ff3b0000.ufs: ufshcd_init_icc_levels: Failed reading power descriptor.len = 98 ret = -11
[   36.480083] ufshcd-hi3660 ff3b0000.ufs: ufshcd_print_pwr_info:[RX, TX]: gear=[1, 1], lane[1, 1], pwr[SLOWAUTO_MODE, SLOWAUTO_MODE], rate = 0
[   36.493073] ufshcd-hi3660 ff3b0000.ufs: UPIU[0] - issue time 14654573 us
...
[   36.755689] ufshcd-hi3660 ff3b0000.ufs: ufshcd_print_pwr_info:[RX, TX]: gear=[3, 3], lane[2, 2], pwr[FAST MODE, FAST MODE], rate = 2
[   36.767798] --CJ in mount_root: entering mount_block_root(/dev/root, 0x8000)
[   36.774793] --CJ mount_block_root: name=/dev/root, fs_names = 
[   36.862337] -CJ do_mount_root (/dev/root, ext3)
 
[   36.866925] VFS: Cannot open root device "sdd10" or unknown-block(0,0): error -6 //ENXIO = /* No such device or address */
[   36.874332] Please append a correct "root=" boot option; here are the available partitions:
[   36.882734] --CJ printk_all_partitions: 
[   36.886730] -- -- CJ loop 1
[   36.889578] -- -- CJ loop 1
[   36.892442] -- -- CJ loop 1
[   36.895304] -- -- CJ loop 1
[   36.898157] -- -- CJ loop 1
[   36.901025] -- -- CJ loop 1
[   36.903889] -- -- CJ loop 1
[   36.906751] -- -- CJ loop 1
[   36.909613] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[   36.930939] Call trace:
[   36.933464] [<ffff000008088be0>] dump_backtrace+0x0/0x370
[   36.938925] [<ffff000008088f64>] show_stack+0x14/0x20
[   36.944037] [<ffff000008a71200>] dump_stack+0x9c/0xbc
[   36.949159] [<ffff0000080c78d8>] panic+0x11c/0x28c
[   36.954011] [<ffff000008f41184>] mount_block_root+0x1bc/0x290
[   36.959817] [<ffff000008f41384>] mount_root+0x12c/0x144
[   36.965107] [<ffff000008f414e4>] prepare_namespace+0x148/0x190
[   36.971005] [<ffff000008f40d8c>] kernel_init_freeable+0x208/0x22c
[   36.977163] [<ffff000008a836e8>] kernel_init+0x10/0x100
[   36.982451] [<ffff000008084b58>] ret_from_fork+0x10/0x18
[   36.987832] SMP: stopping secondary CPUs

init\do_mount.c

void __init prepare_namespace(void)
{
        ROOT_DEV = name_to_dev_t(root_device_name);
        root_device_name += 5; //remove /dev/
	mount_root();
}
 
void __init mount_root(void)
{
		int err = create_dev("/dev/root", ROOT_DEV); (= mknod (/dev/root->ROOT_DEV)
		mount_block_root("/dev/root", root_mountflags/=0x8000/);
}
 
void __init mount_block_root(char *name, int flags) //name shouldn't be sdd10
	for (p = fs_names; *p; p += strlen(p)+1) {
		int err = do_mount_root(name, p, flags, root_mount_data);
                //SYS_MOUNT("/dev/root", "/root","ext3") error = -6
 
		__bdevname(ROOT_DEV, b); //ROOT_DEV=0
		printk("VFS: Cannot open root device \"%s\" or %s: error %d\n",
				root_device_name, b, err);
//VFS: Cannot open root device "sdd10" or unknown-block(0,0): error -6
//root_device_name = sdd10 跟 /dev/root 有什麼關係?
//why ROOT_DEV = 0,0: node created but not mount 
 
		printk("Please append a correct \"root=\" boot option; here are the available partitions:\n");
		printk_all_partitions();//NO OUTPUT
		panic("VFS: Unable to mount root fs on %s", b);
                // VFS: Unable to mount root fs on unknown-block(0,0)
	}
 
}
 
static int __init do_mount_root(char *name, char *fs, int flags, void *data)
{
	struct super_block *s;
	int err = sys_mount(name, "/root", fs, flags, data);
	if (err)
		return err;
 
	sys_chdir("/root");
	s = current->fs->pwd.dentry->d_sb;
	ROOT_DEV = s->s_dev;
	printk(KERN_INFO
	       "VFS: Mounted root (%s filesystem)%s on device %u:%u.\n",
	       s->s_type->name,
	       sb_rdonly(s) ? " readonly" : "",
	       MAJOR(ROOT_DEV), MINOR(ROOT_DEV));
	return 0;
}
 
 
 
dev_t name_to_dev_t(const char *name)
{
	char s[32];
	char *p;
	dev_t res = 0;
	int part;
 
	strcpy(s, name);
	for (p = s; *p; p++)
		if (*p == '/')
			*p = '!';
printk("--- blk_lookup_edvt(%s)\n", s);//s="sdd10"
	res = blk_lookup_devt(s, 0);
	if (res)
		goto done;
 
	/*
	 * try non-existent, but valid partition, which may only exist
	 * after revalidating the disk, like partitioned md devices
	 */
	while (p > s && isdigit(p[-1]))
		p--;
	if (p == s || !*p || *p == '0')
		goto fail;
 
	/* try disk name without <part number> */
	part = simple_strtoul(p, NULL, 10);
	*p = '\0';
printk("--CJ 2nd blk_lookup_dvt(%s)\n", s);//s=sdd, part=10
	res = blk_lookup_devt(s, part);
	if (res)
		goto done;
 
	/* try disk name without p<part number> */
	if (p < s + 2 || !isdigit(p[-2]) || p[-1] != 'p')
		goto fail;
	p[-1] = '\0';
printk("--CJ 3rd bLk_lookup %s\n", s);
	res = blk_lookup_devt(s, part);
	if (res)
		goto done;
 
fail:
	return 0;
done:
	return res;
}

./block/genhd.c

void __init printk_all_partitions(void)
{
	struct class_dev_iter iter;
	struct device *dev;
printk("--CJ printk_all_partitions: \n");
	class_dev_iter_init(&iter, &block_class, NULL, &disk_type);
	while ((dev = class_dev_iter_next(&iter))) {
		struct gendisk *disk = dev_to_disk(dev);
		struct disk_part_iter piter;
		struct hd_struct *part;
		char name_buf[BDEVNAME_SIZE];
		char devt_buf[BDEVT_SIZE];
printk("-- -- CJ loop 1\n");
		/*
		 * Don't show empty devices or things that have been
		 * suppressed
		 */
		if (get_capacity(disk) == 0 ||
		    (disk->flags & GENHD_FL_SUPPRESS_PARTITION_INFO))
			continue;
 
		/*
		 * Note, unlike /proc/partitions, I am showing the
		 * numbers in hex - the same format as the root=
		 * option takes.
		 */
		disk_part_iter_init(&piter, disk, DISK_PITER_INCL_PART0);
		while ((part = disk_part_iter_next(&piter))) {
			bool is_part0 = part == &disk->part0;
 
			printk("%s%s %10llu %s %s", is_part0 ? "" : "  ",
			       bdevt_str(part_devt(part), devt_buf),
			       (unsigned long long)part_nr_sects_read(part) >> 1
			       , disk_name(disk, part->partno, name_buf),
			       part->info ? part->info->uuid : "");
			if (is_part0) {
				if (dev->parent && dev->parent->driver)
					printk(" driver: %s\n",
					      dev->parent->driver->name);
				else
					printk(" (driver?)\n");
			} else
				printk("\n");
		}
		disk_part_iter_exit(&piter);
	}
	class_dev_iter_exit(&iter);
}
dev_t blk_lookup_devt(const char *name, int partno)
{
	dev_t devt = MKDEV(0, 0);
	struct class_dev_iter iter;
	struct device *dev;
 
	class_dev_iter_init(&iter, &block_class, NULL, &disk_type);
	while ((dev = class_dev_iter_next(&iter))) {
		struct gendisk *disk = dev_to_disk(dev);
		struct hd_struct *part;
 
		if (strcmp(dev_name(dev), name))
			continue;
 
		if (partno < disk->minors) {
			/* We need to return the right devno, even
			 * if the partition doesn't exist yet.
			 */
			devt = MKDEV(MAJOR(dev->devt),
				     MINOR(dev->devt) + partno);
			break;
		}
		part = disk_get_part(disk, partno);
		if (part) {
			devt = part_devt(part);
			disk_put_part(part);
			break;
		}
		disk_put_part(part);
	}
	class_dev_iter_exit(&iter);
	return devt;
}