Hi Guo Ren and C-SKY maintainers,

The generic early_param("initrd") handler in init/do_mounts_initrd.c
records physical initrd location in phys_initrd_start/phys_initrd_size.
On C-SKY, setup_initrd() only checked initrd_start/end, which are not
populated from the command line when initrd= is passed via bootargs.
As a result, initrd= was effectively ignored.

This patch converts phys_initrd_* to virtual addresses using __va(),
similar to ARC and reserve_initrd_mem().

Testing (kd5886 vendor platform, private, not for upstream):
- Kernel: Linux 4.9.56-based BSP with CONFIG_BLK_DEV_INITRD=y and
  CONFIG_CSKY_BUILTIN_DTB disabled; external DTB passed from U-Boot
- Boot method: U-Boot TFTP loads kd5886_evb_rgmii.dtb, uImage, and
  rootfs.squashfs into DDR
- /chosen/bootargs in DTB:
    console=ttyS0,115200 loglevel=8 root=/dev/ram0
    initrd=0x12000000,0x54000
- rootfs.squashfs (344064 bytes) loaded to physical address 0x12000000
  (virtual 0x92000000 via KSEG0 mapping)

Observed kernel log:
- Kernel command line: ... root=/dev/ram0 initrd=0x12000000,0x54000
- "Freeing initrd memory: 336k freed"
- "RAMDISK: squashfs filesystem found at block 0"
- "VFS: Mounted root (squashfs filesystem) readonly on device 1:0"
- Userspace application started successfully

Thanks,
gavin-Angry-Birds <[email protected]>

Attachment: 0001-csky-fix-initrd-setup-for-initrd-command-line-parame.patch
Description: Binary data

Reply via email to