ucb-bar / chipyard

An Agile RISC-V SoC Design Framework with in-order cores, out-of-order cores, accelerators, and more
https://chipyard.readthedocs.io/en/stable/
BSD 3-Clause "New" or "Revised" License
1.62k stars 638 forks source link

How to install Linux system on VCU118? #822

Closed xiaofeibao-xjtu closed 3 years ago

xiaofeibao-xjtu commented 3 years ago

How to install Linux system on vcu118 SD card? FireMarshal currently only supports the FireSim FPGA-accelerated simulation platform.

abejgonzalez commented 3 years ago

Right now that part of the documentation is missing since we want to have FireMarshal target the VCU118 (or similar prototype platforms). Once we get to that we will update the docs. Until then something like this probably works:

BIG NOTE: I haven't tested this flow since the internal Berkeley flow was done before FireMarshal existed... some of these steps might not work... so if you figure out the proper steps or can generalize them a bit please respond to this post with the changes.

Setup Linux to recognize the SDCard

Here was the Linux config that we used... might want to pick and choose stuff from it (I'm not sure what clashes with FireMarshal's Linux config)

CONFIG_DEFAULT_HOSTNAME="prototype"
CONFIG_SYSVIPC=y
# CONFIG_CROSS_MEMORY_ATTACH is not set
CONFIG_NAMESPACES=y
CONFIG_BLK_DEV_INITRD=y
# CONFIG_RD_BZIP2 is not set
# CONFIG_RD_LZMA is not set
# CONFIG_RD_XZ is not set
# CONFIG_RD_LZO is not set
# CONFIG_RD_LZ4 is not set
CONFIG_EMBEDDED=y
CONFIG_SOC_SIFIVE=y
CONFIG_HZ_100=y
CONFIG_CMDLINE="earlyprintk console=hvc0"
CONFIG_CMDLINE_FORCE=y
# CONFIG_BLK_DEV_BSG is not set
CONFIG_PARTITION_ADVANCED=y
# CONFIG_COMPACTION is not set
CONFIG_NET=y
CONFIG_PACKET=y
CONFIG_UNIX=y
CONFIG_INET=y
# CONFIG_INET_DIAG is not set
# CONFIG_IPV6 is not set
# CONFIG_WIRELESS is not set
CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y
CONFIG_BLK_DEV_LOOP=y
CONFIG_NETDEVICES=y
# CONFIG_ETHERNET is not set
# CONFIG_WLAN is not set
# CONFIG_INPUT_KEYBOARD is not set
# CONFIG_INPUT_MOUSE is not set
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_SERIAL_OF_PLATFORM=y
CONFIG_SERIAL_EARLYCON_RISCV_SBI=y
CONFIG_HVC_RISCV_SBI=y
# CONFIG_HW_RANDOM is not set
CONFIG_SPI=y
CONFIG_SPI_MEM=y
CONFIG_SPI_SIFIVE=y
CONFIG_SPI_SPIDEV=y
CONFIG_GPIOLIB=y
CONFIG_GPIO_SYSFS=y
CONFIG_GPIO_SIFIVE=y
# CONFIG_HWMON is not set
# CONFIG_LCD_CLASS_DEVICE is not set
# CONFIG_BACKLIGHT_CLASS_DEVICE is not set
# CONFIG_VGA_CONSOLE is not set
# CONFIG_USB_SUPPORT is not set
CONFIG_MMC=y
CONFIG_MMC_SPI=y
# CONFIG_VIRTIO_MENU is not set
# CONFIG_IOMMU_SUPPORT is not set
CONFIG_PWM=y
CONFIG_PWM_SIFIVE=y
CONFIG_EXT3_FS=y
CONFIG_EXPORTFS_BLOCK_OPS=y
CONFIG_VFAT_FS=y
CONFIG_PROC_CHILDREN=y
CONFIG_TMPFS=y
CONFIG_HFSPLUS_FS=y
# CONFIG_NETWORK_FILESYSTEMS is not set
CONFIG_NLS_CODEPAGE_437=y
CONFIG_NLS_ISO8859_1=y
# CONFIG_CRYPTO_HW is not set
# CONFIG_DIMLIB is not set
CONFIG_PRINTK_TIME=y
CONFIG_DEBUG_INFO=y
CONFIG_DEBUG_INFO_DWARF4=y
CONFIG_STRIP_ASM_SYMS=y
CONFIG_DEBUG_SECTION_MISMATCH=y
CONFIG_PANIC_ON_OOPS=y
CONFIG_STACKTRACE=y
CONFIG_RCU_TRACE=y
# CONFIG_FTRACE is not set
# CONFIG_RUNTIME_TESTING_MENU is not set

Use FireMarshal to create initramfs binary

./marshal -v --nodisk <YOUR-MARSHAL-WRKLD.json>

Modify the binary

riscv64-ucb-linux-gnu-objcopy -S -O binary --change-addresses=-0x80000000 <YOUR-MARSHAL-INITRAMFS-BIN> dummy-name.bin

Write SDCard with Binary - Linux Instructions

Use gdisk to put the binary on the SDCard (similar to gpt but with different commands). The following steps use /dev/sdc as the path to the SD card (replace with your own path).

First, wipe the GPT on the card.

sudo gdisk /dev/sdc

Use the z command to zap everything.

sudo gdisk /dev/sdc

Change the default partition alignment to 1 so you can write to sector 34. Do this with the l command.

Then create the new GPT with o. Click yes on all the prompts.

Create two partitions. First the 512MiB partition. Use n and select sector 34, with size +1048576. For the type search for the apfs type and use the hex number given.

Second the other partition. Use n and use the defaults for starting sector and overall size. For the type search for the hfs and use the hex number given.

Write the changes using w.

Finally, setup the filesystem on the 2nd partition using the following command:

sudo mkfs.hfs -v "Prototype Data" /dev/sdc2

Note that sdc2 is used since it points to the 2nd partition.

Finally transfer the dummy-name.bin to the sdcard:

sudo dd if=<pathto>/dummy-name.bin of=/dev/sdc1

Note that sdc1 points to the 1st partition.

abejgonzalez commented 3 years ago

I would look at #849 now for adapted steps on how to run Linux on the VCU118 (note that requires you to be on the dev branch)

xiaofeibao-xjtu commented 3 years ago

I would look at #849 now for adapted steps on how to run Linux on the VCU118 (note that requires you to be on the dev branch) Thank you very much for your reply. I used fedora-base.json previously and it didn't work. I will try the br-chip-base.json.

pengwubj commented 3 years ago

Thanks very much for this enhencement. It works with rocket-core to boot linux . But when I switch to boom-core, the kernel stuck at init process as below: Could you help on this issue. Thank you very much. Platform Name : freechips,rocketchip-unknown Platform Features : timer,mfdeleg Platform HART Count : 1 Boot HART ID : 0 Boot HART ISA : rv64imafdcsux BOOT HART Features : pmp,scounteren,mcounteren BOOT HART PMP Count : 16 Firmware Base : 0x80000000 Firmware Size : 92 KB Runtime SBI Version : 0.2

MIDELEG : 0x0000000000000222 MEDELEG : 0x000000000000b109 PMP0 : 0x0000000080000000-0x000000008001ffff (A) PMP1 : 0x0000000000000000-0x00000001ffffffff (A,R,W,X) [ 0.000000] OF: fdt: No chosen node found, continuing without [ 0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80200000 [ 0.000000] Forcing kernel command line to: console=hvc0 earlycon=sbi [ 0.000000] Linux version 5.7.0-rc3-58539-g5f5fd87 (gcc version 9.2.0 (GCC), GNU ld (GNU Binutils) 2.32) #1 SMP Fri Apr 9 17:29:05 CST 2021 [ 0.000000] earlycon: sbi0 at I/O port 0x0 (options '') [ 0.000000] printk: bootconsole [sbi0] enabled [ 0.000000] initrd not found or empty - disabling initrd

xiaofeibao-xjtu commented 3 years ago

I use boom-core(DualSmallBoomVCU118Config). I don't know if it works, should I send it any commands? The init process as below: OpenSBI v0.8


/ \ / __ _ _ __ (___ _) ' \ / \ '_ \ ___ \ _ < __ _) __/ ____) _) _ ____/ ./ _ _ _ _____/ __/___
_

Platform Name : freechips,rocketchip-unknown Platform Features : timer,mfdeleg Platform HART Count : 2 Boot HART ID : 0 Boot HART ISA : rv64imafdcsux BOOT HART Features : pmp,scounteren,mcounteren BOOT HART PMP Count : 16 Firmware Base : 0x80000000 Firmware Size : 100 KB Runtime SBI Version : 0.2

MIDELEG : 0x0000000000000222 MEDELEG : 0x000000000000b109 PMP0 : 0x0000000080000000-0x000000008001ffff (A) PMP1 : 0x0000000000000000-0x00000001ffffffff (A,R,W,X)

[ 0.000000] OF: fdt: No chosen node found, continuing without [ 0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80200000 [ 0.000000] Forcing kernel command line to: console=hvc0 earlycon=sbi [ 0.000000] Linux version 5.7.0-rc3-58539-g5f5fd87-dirty (xfb@localhost.localdomain) (gcc version 9.2.0 (GCC), GNU ld (GNU Binutils) 2.32) #3 SMP Wed Apr 7 19:52:29 CST 2021 [ 0.000000] earlycon: sbi0 at I/O port 0x0 (options '') [ 0.000000] printk: bootconsole [sbi0] enabled [ 0.000000] initrd not found or empty - disabling initrd [ 0.000000] Zone ranges: [ 0.000000] DMA32 [mem 0x0000000080200000-0x00000000ffffffff] [ 0.000000] Normal empty [ 0.000000] Movable zone start for each node [ 0.000000] Early memory node ranges [ 0.000000] node 0: [mem 0x0000000080200000-0x00000000ffffffff] [ 0.000000] Initmem setup node 0 [mem 0x0000000080200000-0x00000000ffffffff] [ 0.000000] software IO TLB: mapped [mem 0xfa3f9000-0xfe3f9000] (64MB) [ 0.000000] SBI specification v0.2 detected [ 0.000000] SBI implementation ID=0x1 Version=0x8 [ 0.000000] SBI v0.2 TIME extension detected [ 0.000000] SBI v0.2 IPI extension detected [ 0.000000] SBI v0.2 RFENCE extension detected [ 0.000000] SBI v0.2 HSM extension detected [ 0.000000] elf_hwcap is 0x112d [ 0.000000] percpu: Embedded 17 pages/cpu s31976 r8192 d29464 u69632 [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 516615 [ 0.000000] Kernel command line: console=hvc0 earlycon=sbi [ 0.000000] Dentry cache hash table entries: 262144 (order: 9, 2097152 bytes, linear) [ 0.000000] Inode-cache hash table entries: 131072 (order: 8, 1048576 bytes, linear) [ 0.000000] Sorting __ex_table... [ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off

[ 0.000000] Memory: 1973960K/2095104K available (6544K kernel code, 4152K rwdata, 4096K rodata, 6331K init, 318K bss, 121144K reserved, 0K cma-reserved) [ 0.000000] Virtual kernel memory layout: [ 0.000000] fixmap : 0xffffffcefee00000 - 0xffffffceff000000 (2048 kB) [ 0.000000] pci io : 0xffffffceff000000 - 0xffffffcf00000000 ( 16 MB) [ 0.000000] vmemmap : 0xffffffcf00000000 - 0xffffffcfffffffff (4095 MB) [ 0.000000] vmalloc : 0xffffffd000000000 - 0xffffffdfffffffff (65535 MB) [ 0.000000] lowmem : 0xffffffe000000000 - 0xffffffe07fe00000 (2046 MB) [ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1 [ 0.000000] rcu: Hierarchical RCU implementation. [ 0.000000] rcu: RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=2. [ 0.000000] rcu: RCU debug extended QS entry/exit. [ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies. [ 0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2 [ 0.000000] NR_IRQS: 0, nr_irqs: 0, preallocated irqs: 0 [ 0.000000] plic: mapped 2 interrupts with 2 handlers for 4 contexts. [ 0.000000] riscv_timer_init_dt: Registering clocksource cpuid [0] hartid [0] [ 0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x1d854df40, max_idle_ns: 3526361616960 ns [ 0.000133] sched_clock: 64 bits at 1000kHz, resolution 1000ns, wraps every 2199023255500ns [ 0.010167] Console: colour dummy device 80x25 [ 0.014602] printk: console [hvc0] enabled [ 0.014602] printk: console [hvc0] enabled [ 0.022745] printk: bootconsole [sbi0] disabled [ 0.022745] printk: bootconsole [sbi0] disabled [ 0.032265] Calibrating delay loop (skipped), value calculated using timer frequency.. 2.00 BogoMIPS (lpj=4000) [ 0.042260] pid_max: default: 32768 minimum: 301 [ 0.050456] Mount-cache hash table entries: 4096 (order: 3, 32768 bytes, linear) [ 0.058281] Mountpoint-cache hash table entries: 4096 (order: 3, 32768 bytes, linear)

[ 0.098417] rcu: Hierarchical SRCU implementation. [ 0.113314] smp: Bringing up secondary CPUs ... [ 0.131464] smp: Brought up 1 node, 2 CPUs [ 0.145743] devtmpfs: initialized

[ 0.172143] random: get_random_u32 called from bucket_table_alloc.isra.0+0x4a/0xbe with crng_init=0 [ 0.187432] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns [ 0.197200] futex hash table entries: 512 (order: 3, 32768 bytes, linear) [ 0.214167] NET: Registered protocol family 16

[ 0.563637] vgaarb: loaded [ 0.573110] SCSI subsystem initialized [ 0.585559] usbcore: registered new interface driver usbfs [ 0.591823] usbcore: registered new interface driver hub [ 0.598038] usbcore: registered new device driver usb

[ 0.620990] clocksource: Switched to clocksource riscv_clocksource

[ 0.834060] NET: Registered protocol family 2

[ 0.850356] tcp_listen_portaddr_hash hash table entries: 1024 (order: 3, 40960 bytes, linear) [ 0.859976] TCP established hash table entries: 16384 (order: 5, 131072 bytes, linear) [ 0.872827] TCP bind hash table entries: 16384 (order: 7, 524288 bytes, linear) [ 0.891767] TCP: Hash tables configured (established 16384 bind 16384) [ 0.902188] UDP hash table entries: 1024 (order: 4, 98304 bytes, linear) [ 0.910751] UDP-Lite hash table entries: 1024 (order: 4, 98304 bytes, linear) [ 0.923008] NET: Registered protocol family 1 [ 0.938996] RPC: Registered named UNIX socket transport module. [ 0.945152] RPC: Registered udp transport module. [ 0.949867] RPC: Registered tcp transport module. [ 0.954638] RPC: Registered tcp NFSv4.1 backchannel transport module. [ 0.961313] PCI: CLS 0 bytes, default 64

[ 6.083325] workingset: timestamp_bits=62 max_order=19 bucket_order=0

[ 6.316136] NFS: Registering the id_resolver key type [ 6.321888] Key type id_resolver registered [ 6.326022] Key type id_legacy registered [ 6.330273] nfs4filelayout_init: NFSv4 File Layout Driver Registering... [ 6.339449] 9p: Installing v9fs 9p2000 file system support [ 6.352812] NET: Registered protocol family 38 [ 6.357808] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251) [ 6.365183] io scheduler mq-deadline registered [ 6.369752] io scheduler kyber registered

[ 7.551833] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled

[ 7.580163] 64000000.serial: ttySIF0 at MMIO 0x64000000 (irq = 1, base_baud = 0) is a SiFive UART v0 [ 7.599809] [drm] radeon kernel modesetting enabled.

[ 7.820752] loop: module loaded

[ 7.835506] sifive_spi 64001000.spi: mapped; irq=2, cs=1 [ 7.863417] libphy: Fixed MDIO Bus: probed

[ 7.885178] e1000e: Intel(R) PRO/1000 Network Driver - 3.2.6-k [ 7.890979] e1000e: Copyright(c) 1999 - 2015 Intel Corporation. [ 7.898859] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver [ 7.905531] ehci-pci: EHCI PCI platform driver [ 7.910851] ehci-platform: EHCI generic platform driver [ 7.917667] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver [ 7.925181] ohci-pci: OHCI PCI platform driver [ 7.930506] ohci-platform: OHCI generic platform driver [ 7.943651] usbcore: registered new interface driver uas [ 7.950167] usbcore: registered new interface driver usb-storage [ 7.959302] mousedev: PS/2 mouse device common for all mice

[ 8.015630] mmc_spi spi0.0: SD/MMC host mmc0, no DMA, no WP, no poweroff, cd polling [ 8.028210] usbcore: registered new interface driver usbhid [ 8.034280] usbhid: USB HID core driver

[ 8.057069] NET: Registered protocol family 10 [ 8.081800] Segment Routing with IPv6 [ 8.086804] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver [ 8.105413] NET: Registered protocol family 17 [ 8.114436] 9pnet: Installing 9P2000 support [ 8.119682] Key type dns_resolver registered

[ 8.297362] Freeing unused kernel memory: 6328K [ 8.303864] Run /init as init process

Running FireMarshal nodisk init

[ 8.485205] mmc0: host does not support reading read-only switch, assuming write-enable [ 8.493937] mmc0: new SDHC card on SPI [ 8.517148] mmcblk0: mmc0:0000 5B1Q5 29.8 GiB

Loading FireMarshal platform drivers

[ 8.765978] random: fast init done

Calling distro init

Starting syslogd: OK

Starting klogd: OK

Running sysctl: OK

Starting mdev: OK

xiaofeibao-xjtu commented 3 years ago

Thanks very much for this enhencement. It works with rocket-core to boot linux . But when I switch to boom-core, the kernel stuck at init process as below: Could you help on this issue. Thank you very much. Platform Name : freechips,rocketchip-unknown Platform Features : timer,mfdeleg Platform HART Count : 1 Boot HART ID : 0 Boot HART ISA : rv64imafdcsux BOOT HART Features : pmp,scounteren,mcounteren BOOT HART PMP Count : 16 Firmware Base : 0x80000000 Firmware Size : 92 KB Runtime SBI Version : 0.2

MIDELEG : 0x0000000000000222 MEDELEG : 0x000000000000b109 PMP0 : 0x0000000080000000-0x000000008001ffff (A) PMP1 : 0x0000000000000000-0x00000001ffffffff (A,R,W,X) [ 0.000000] OF: fdt: No chosen node found, continuing without [ 0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80200000 [ 0.000000] Forcing kernel command line to: console=hvc0 earlycon=sbi [ 0.000000] Linux version 5.7.0-rc3-58539-g5f5fd87 (gcc version 9.2.0 (GCC), GNU ld (GNU Binutils) 2.32) #1 SMP Fri Apr 9 17:29:05 CST 2021 [ 0.000000] earlycon: sbi0 at I/O port 0x0 (options '') [ 0.000000] printk: bootconsole [sbi0] enabled [ 0.000000] initrd not found or empty - disabling initrd

Can I see the successful process of rocket-core to boot linux?

pengwubj commented 3 years ago

Thanks very much for this enhencement. It works with rocket-core to boot linux . But when I switch to boom-core, the kernel stuck at init process as below: Could you help on this issue. Thank you very much. Platform Name : freechips,rocketchip-unknown Platform Features : timer,mfdeleg Platform HART Count : 1 Boot HART ID : 0 Boot HART ISA : rv64imafdcsux BOOT HART Features : pmp,scounteren,mcounteren BOOT HART PMP Count : 16 Firmware Base : 0x80000000 Firmware Size : 92 KB Runtime SBI Version : 0.2 MIDELEG : 0x0000000000000222 MEDELEG : 0x000000000000b109 PMP0 : 0x0000000080000000-0x000000008001ffff (A) PMP1 : 0x0000000000000000-0x00000001ffffffff (A,R,W,X) [ 0.000000] OF: fdt: No chosen node found, continuing without [ 0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80200000 [ 0.000000] Forcing kernel command line to: console=hvc0 earlycon=sbi [ 0.000000] Linux version 5.7.0-rc3-58539-g5f5fd87 (gcc version 9.2.0 (GCC), GNU ld (GNU Binutils) 2.32) #1 SMP Fri Apr 9 17:29:05 CST 2021 [ 0.000000] earlycon: sbi0 at I/O port 0x0 (options '') [ 0.000000] printk: bootconsole [sbi0] enabled [ 0.000000] initrd not found or empty - disabling initrd

Can I see the successful process of rocket-core to boot linux? sure, I post the log as below; INIT CMD0 CMD8 ACMD41 CMD58 CMD16 CMD18 LOADING BOOT

OpenSBI v0.8


/ \ / __ _ _ __ (___ _) ' \ / \ '_ \ ___ \ _ < __ _) __/ ____) _) _ ____/ ./ _ _ _ _____/ __/___
_

Platform Name : freechips,rocketchip-unknown Platform Features : timer,mfdeleg Platform HART Count : 2 Boot HART ID : 1 Boot HART ISA : rv64imafdcsux BOOT HART Features : pmp,scounteren,mcounteren BOOT HART PMP Count : 16 Firmware Base : 0x80000000 Firmware Size : 100 KB Runtime SBI Version : 0.2

MIDELEG : 0x0000000000000222 MEDELEG : 0x000000000000b109 PMP0 : 0x0000000080000000-0x000000008001ffff (A) PMP1 : 0x0000000000000000-0x00000001ffffffff (A,R,W,X) [ 0.000000] OF: fdt: No chosen node found, continuing without [ 0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80200000 [ 0.000000] Forcing kernel command line to: console=hvc0 earlycon=sbi [ 0.000000] Linux version 5.7.0-rc3-58539-g5f5fd87 () (gcc version 9.2.0 (GCC), GNU ld (GNU Binutils) 2.32) #1 SMP Fri Apr 9 17:29:05 CST 2021 [ 0.000000] earlycon: sbi0 at I/O port 0x0 (options '') [ 0.000000] printk: bootconsole [sbi0] enabled [ 0.000000] initrd not found or empty - disabling initrd [ 0.000000] Zone ranges: [ 0.000000] DMA32 [mem 0x0000000080200000-0x00000000ffffffff] [ 0.000000] Normal empty [ 0.000000] Movable zone start for each node [ 0.000000] Early memory node ranges [ 0.000000] node 0: [mem 0x0000000080200000-0x00000000ffffffff] [ 0.000000] Initmem setup node 0 [mem 0x0000000080200000-0x00000000ffffffff] [ 0.000000] software IO TLB: mapped [mem 0xfa3f9000-0xfe3f9000] (64MB) [ 0.000000] SBI specification v0.2 detected [ 0.000000] SBI implementation ID=0x1 Version=0x8 [ 0.000000] SBI v0.2 TIME extension detected [ 0.000000] SBI v0.2 IPI extension detected [ 0.000000] SBI v0.2 RFENCE extension detected [ 0.000000] SBI v0.2 HSM extension detected [ 0.000000] elf_hwcap is 0x112d [ 0.000000] percpu: Embedded 17 pages/cpu s31976 r8192 d29464 u69632 [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 516615 [ 0.000000] Kernel command line: console=hvc0 earlycon=sbi [ 0.000000] Dentry cache hash table entries: 262144 (order: 9, 2097152 bytes, linear) [ 0.000000] Inode-cache hash table entries: 131072 (order: 8, 1048576 bytes, linear) [ 0.000000] Sorting __ex_table... [ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off [ 0.000000] Memory: 1973960K/2095104K available (6544K kernel code, 4152K rwdata, 4096K rodata, 6367K init, 318K bss, 121144K reserved, 0K cma-reserved) [ 0.000000] Virtual kernel memory layout: [ 0.000000] fixmap : 0xffffffcefee00000 - 0xffffffceff000000 (2048 kB) [ 0.000000] pci io : 0xffffffceff000000 - 0xffffffcf00000000 ( 16 MB) [ 0.000000] vmemmap : 0xffffffcf00000000 - 0xffffffcfffffffff (4095 MB) [ 0.000000] vmalloc : 0xffffffd000000000 - 0xffffffdfffffffff (65535 MB) [ 0.000000] lowmem : 0xffffffe000000000 - 0xffffffe07fe00000 (2046 MB) [ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1 [ 0.000000] rcu: Hierarchical RCU implementation. [ 0.000000] rcu: RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=2. [ 0.000000] rcu: RCU debug extended QS entry/exit. [ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies. [ 0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2 [ 0.000000] NR_IRQS: 0, nr_irqs: 0, preallocated irqs: 0 [ 0.000000] plic: mapped 2 interrupts with 2 handlers for 4 contexts. [ 0.000000] riscv_timer_init_dt: Registering clocksource cpuid [0] hartid [1] [ 0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x1d854df40, max_idle_ns: 3526361616960 ns [ 0.000071] sched_clock: 64 bits at 1000kHz, resolution 1000ns, wraps every 2199023255500ns [ 0.009425] Console: colour dummy device 80x25 [ 0.013533] printk: console [hvc0] enabled [ 0.013533] printk: console [hvc0] enabled [ 0.021743] printk: bootconsole [sbi0] disabled [ 0.021743] printk: bootconsole [sbi0] disabled [ 0.031130] Calibrating delay loop (skipped), value calculated using timer frequency.. 2.00 BogoMIPS (lpj=4000) [ 0.041143] pid_max: default: 32768 minimum: 301 [ 0.048017] Mount-cache hash table entries: 4096 (order: 3, 32768 bytes, linear) [ 0.055494] Mountpoint-cache hash table entries: 4096 (order: 3, 32768 bytes, linear) [ 0.081487] rcu: Hierarchical SRCU implementation. [ 0.091592] smp: Bringing up secondary CPUs ... [ 0.103133] smp: Brought up 1 node, 2 CPUs [ 0.112972] devtmpfs: initialized [ 0.127557] random: get_random_u32 called from bucket_table_alloc.isra.0+0x4a/0xbe with crng_init=0 [ 0.139662] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns [ 0.149158] futex hash table entries: 512 (order: 3, 32768 bytes, linear) [ 0.162013] NET: Registered protocol family 16 [ 0.333726] vgaarb: loaded [ 0.339608] SCSI subsystem initialized [ 0.347596] usbcore: registered new interface driver usbfs [ 0.353317] usbcore: registered new interface driver hub [ 0.358729] usbcore: registered new device driver usb [ 0.372814] clocksource: Switched to clocksource riscv_clocksource [ 0.482486] NET: Registered protocol family 2 [ 0.492889] tcp_listen_portaddr_hash hash table entries: 1024 (order: 3, 40960 bytes, linear) [ 0.502145] TCP established hash table entries: 16384 (order: 5, 131072 bytes, linear) [ 0.513497] TCP bind hash table entries: 16384 (order: 7, 524288 bytes, linear) [ 0.532867] TCP: Hash tables configured (established 16384 bind 16384) [ 0.541943] UDP hash table entries: 1024 (order: 4, 98304 bytes, linear) [ 0.550782] UDP-Lite hash table entries: 1024 (order: 4, 98304 bytes, linear) [ 0.561749] NET: Registered protocol family 1 [ 0.571765] RPC: Registered named UNIX socket transport module. [ 0.577423] RPC: Registered udp transport module. [ 0.582137] RPC: Registered tcp transport module. [ 0.586870] RPC: Registered tcp NFSv4.1 backchannel transport module. [ 0.593425] PCI: CLS 0 bytes, default 64 [ 3.199163] workingset: timestamp_bits=62 max_order=19 bucket_order=0 [ 3.312505] NFS: Registering the id_resolver key type [ 3.317571] Key type id_resolver registered [ 3.321723] Key type id_legacy registered [ 3.325866] nfs4filelayout_init: NFSv4 File Layout Driver Registering... [ 3.334533] 9p: Installing v9fs 9p2000 file system support [ 3.343539] NET: Registered protocol family 38 [ 3.348084] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251) [ 3.355132] io scheduler mq-deadline registered [ 3.359702] io scheduler kyber registered [ 4.081780] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled [ 4.100286] 64000000.serial: ttySIF0 at MMIO 0x64000000 (irq = 1, base_baud = 0) is a SiFive UART v0 [ 4.115272] [drm] radeon kernel modesetting enabled. [ 4.241030] loop: module loaded [ 4.249949] sifive_spi 64001000.spi: mapped; irq=2, cs=1 [ 4.265692] libphy: Fixed MDIO Bus: probed [ 4.278106] e1000e: Intel(R) PRO/1000 Network Driver - 3.2.6-k [ 4.283560] e1000e: Copyright(c) 1999 - 2015 Intel Corporation. [ 4.290660] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver [ 4.296870] ehci-pci: EHCI PCI platform driver [ 4.301727] ehci-platform: EHCI generic platform driver [ 4.307231] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver [ 4.313181] ohci-pci: OHCI PCI platform driver [ 4.318139] ohci-platform: OHCI generic platform driver [ 4.327404] usbcore: registered new interface driver uas [ 4.333195] usbcore: registered new interface driver usb-storage [ 4.340934] mousedev: PS/2 mouse device common for all mice [ 4.381029] mmc_spi spi0.0: SD/MMC host mmc0, no DMA, no WP, no poweroff, cd polling [ 4.390908] usbcore: registered new interface driver usbhid [ 4.396149] usbhid: USB HID core driver [ 4.409265] NET: Registered protocol family 10 [ 4.425831] Segment Routing with IPv6 [ 4.429866] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver [ 4.441870] NET: Registered protocol family 17 [ 4.448149] 9pnet: Installing 9P2000 support [ 4.452868] Key type dns_resolver registered [ 4.478958] mmc0: host does not support reading read-only switch, assuming write-enable [ 4.486989] mmc0: new SDXC card on SPI [ 4.504878] mmcblk0: mmc0:0000 ED4QT 119 GiB [ 4.555010] random: fast init done [ 4.574994] Freeing unused kernel memory: 6364K [ 4.586237] Run /init as init process Running FireMarshal nodisk init Loading FireMarshal platform drivers Calling distro init Starting syslogd: OK Starting klogd: OK Running sysctl: [ 5.798099] mmcblk0: p1 p2 OK Starting mdev... OK Initializing random number generator... [ 12.467585] random: dd: uninitialized urandom read (512 bytes read) done. Starting network: OK launching firesim workload run/command firesim workload run/command done

Welcome to Buildroot buildroot login: root Password:

cat /proc/cpuinfo

processor : 0 hart : 1 isa : rv64imafdc mmu : sv39 uarch : sifive,rocket0

processor : 1 hart : 0 isa : rv64imafdc mmu : sv39 uarch : sifive,rocket0

pengwubj commented 3 years ago

Thanks very much for this enhencement. It works with rocket-core to boot linux . But when I switch to boom-core, the kernel stuck at init process as below: Could you help on this issue. Thank you very much. Platform Name : freechips,rocketchip-unknown Platform Features : timer,mfdeleg Platform HART Count : 1 Boot HART ID : 0 Boot HART ISA : rv64imafdcsux BOOT HART Features : pmp,scounteren,mcounteren BOOT HART PMP Count : 16 Firmware Base : 0x80000000 Firmware Size : 92 KB Runtime SBI Version : 0.2 MIDELEG : 0x0000000000000222 MEDELEG : 0x000000000000b109 PMP0 : 0x0000000080000000-0x000000008001ffff (A) PMP1 : 0x0000000000000000-0x00000001ffffffff (A,R,W,X) [ 0.000000] OF: fdt: No chosen node found, continuing without [ 0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80200000 [ 0.000000] Forcing kernel command line to: console=hvc0 earlycon=sbi [ 0.000000] Linux version 5.7.0-rc3-58539-g5f5fd87 (gcc version 9.2.0 (GCC), GNU ld (GNU Binutils) 2.32) #1 SMP Fri Apr 9 17:29:05 CST 2021 [ 0.000000] earlycon: sbi0 at I/O port 0x0 (options '') [ 0.000000] printk: bootconsole [sbi0] enabled [ 0.000000] initrd not found or empty - disabling initrd

Can I see the successful process of rocket-core to boot linux? sure, I post the log as below; INIT CMD0 CMD8 ACMD41 CMD58 CMD16 CMD18 LOADING BOOT

OpenSBI v0.8


/ \ / __ _ _ __ (___ _) ' \ / \ '_ \ ___ \ _ < __ _) __/ ____) _) _ ____/ ./ _ _ _ _____/ __/___
_

Platform Name : freechips,rocketchip-unknown Platform Features : timer,mfdeleg Platform HART Count : 2 Boot HART ID : 1 Boot HART ISA : rv64imafdcsux BOOT HART Features : pmp,scounteren,mcounteren BOOT HART PMP Count : 16 Firmware Base : 0x80000000 Firmware Size : 100 KB Runtime SBI Version : 0.2

MIDELEG : 0x0000000000000222 MEDELEG : 0x000000000000b109 PMP0 : 0x0000000080000000-0x000000008001ffff (A) PMP1 : 0x0000000000000000-0x00000001ffffffff (A,R,W,X) [ 0.000000] OF: fdt: No chosen node found, continuing without [ 0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80200000 [ 0.000000] Forcing kernel command line to: console=hvc0 earlycon=sbi [ 0.000000] Linux version 5.7.0-rc3-58539-g5f5fd87 (wupeng09@gzbh-isa-silicon19.gzbh.baidu.com) (gcc version 9.2.0 (GCC), GNU ld (GNU Binutils) 2.32) #1 SMP Fri Apr 9 17:29:05 CST 2021 [ 0.000000] earlycon: sbi0 at I/O port 0x0 (options '') [ 0.000000] printk: bootconsole [sbi0] enabled [ 0.000000] initrd not found or empty - disabling initrd [ 0.000000] Zone ranges: [ 0.000000] DMA32 [mem 0x0000000080200000-0x00000000ffffffff] [ 0.000000] Normal empty [ 0.000000] Movable zone start for each node [ 0.000000] Early memory node ranges [ 0.000000] node 0: [mem 0x0000000080200000-0x00000000ffffffff] [ 0.000000] Initmem setup node 0 [mem 0x0000000080200000-0x00000000ffffffff] [ 0.000000] software IO TLB: mapped [mem 0xfa3f9000-0xfe3f9000] (64MB) [ 0.000000] SBI specification v0.2 detected [ 0.000000] SBI implementation ID=0x1 Version=0x8 [ 0.000000] SBI v0.2 TIME extension detected [ 0.000000] SBI v0.2 IPI extension detected [ 0.000000] SBI v0.2 RFENCE extension detected [ 0.000000] SBI v0.2 HSM extension detected [ 0.000000] elf_hwcap is 0x112d [ 0.000000] percpu: Embedded 17 pages/cpu s31976 r8192 d29464 u69632 [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 516615 [ 0.000000] Kernel command line: console=hvc0 earlycon=sbi [ 0.000000] Dentry cache hash table entries: 262144 (order: 9, 2097152 bytes, linear) [ 0.000000] Inode-cache hash table entries: 131072 (order: 8, 1048576 bytes, linear) [ 0.000000] Sorting __ex_table... [ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off [ 0.000000] Memory: 1973960K/2095104K available (6544K kernel code, 4152K rwdata, 4096K rodata, 6367K init, 318K bss, 121144K reserved, 0K cma-reserved) [ 0.000000] Virtual kernel memory layout: [ 0.000000] fixmap : 0xffffffcefee00000 - 0xffffffceff000000 (2048 kB) [ 0.000000] pci io : 0xffffffceff000000 - 0xffffffcf00000000 ( 16 MB) [ 0.000000] vmemmap : 0xffffffcf00000000 - 0xffffffcfffffffff (4095 MB) [ 0.000000] vmalloc : 0xffffffd000000000 - 0xffffffdfffffffff (65535 MB) [ 0.000000] lowmem : 0xffffffe000000000 - 0xffffffe07fe00000 (2046 MB) [ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1 [ 0.000000] rcu: Hierarchical RCU implementation. [ 0.000000] rcu: RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=2. [ 0.000000] rcu: RCU debug extended QS entry/exit. [ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies. [ 0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2 [ 0.000000] NR_IRQS: 0, nr_irqs: 0, preallocated irqs: 0 [ 0.000000] plic: mapped 2 interrupts with 2 handlers for 4 contexts. [ 0.000000] riscv_timer_init_dt: Registering clocksource cpuid [0] hartid [1] [ 0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x1d854df40, max_idle_ns: 3526361616960 ns [ 0.000071] sched_clock: 64 bits at 1000kHz, resolution 1000ns, wraps every 2199023255500ns [ 0.009425] Console: colour dummy device 80x25 [ 0.013533] printk: console [hvc0] enabled [ 0.013533] printk: console [hvc0] enabled [ 0.021743] printk: bootconsole [sbi0] disabled [ 0.021743] printk: bootconsole [sbi0] disabled [ 0.031130] Calibrating delay loop (skipped), value calculated using timer frequency.. 2.00 BogoMIPS (lpj=4000) [ 0.041143] pid_max: default: 32768 minimum: 301 [ 0.048017] Mount-cache hash table entries: 4096 (order: 3, 32768 bytes, linear) [ 0.055494] Mountpoint-cache hash table entries: 4096 (order: 3, 32768 bytes, linear) [ 0.081487] rcu: Hierarchical SRCU implementation. [ 0.091592] smp: Bringing up secondary CPUs ... [ 0.103133] smp: Brought up 1 node, 2 CPUs [ 0.112972] devtmpfs: initialized [ 0.127557] random: get_random_u32 called from bucket_table_alloc.isra.0+0x4a/0xbe with crng_init=0 [ 0.139662] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns [ 0.149158] futex hash table entries: 512 (order: 3, 32768 bytes, linear) [ 0.162013] NET: Registered protocol family 16 [ 0.333726] vgaarb: loaded [ 0.339608] SCSI subsystem initialized [ 0.347596] usbcore: registered new interface driver usbfs [ 0.353317] usbcore: registered new interface driver hub [ 0.358729] usbcore: registered new device driver usb [ 0.372814] clocksource: Switched to clocksource riscv_clocksource [ 0.482486] NET: Registered protocol family 2 [ 0.492889] tcp_listen_portaddr_hash hash table entries: 1024 (order: 3, 40960 bytes, linear) [ 0.502145] TCP established hash table entries: 16384 (order: 5, 131072 bytes, linear) [ 0.513497] TCP bind hash table entries: 16384 (order: 7, 524288 bytes, linear) [ 0.532867] TCP: Hash tables configured (established 16384 bind 16384) [ 0.541943] UDP hash table entries: 1024 (order: 4, 98304 bytes, linear) [ 0.550782] UDP-Lite hash table entries: 1024 (order: 4, 98304 bytes, linear) [ 0.561749] NET: Registered protocol family 1 [ 0.571765] RPC: Registered named UNIX socket transport module. [ 0.577423] RPC: Registered udp transport module. [ 0.582137] RPC: Registered tcp transport module. [ 0.586870] RPC: Registered tcp NFSv4.1 backchannel transport module. [ 0.593425] PCI: CLS 0 bytes, default 64 [ 3.199163] workingset: timestamp_bits=62 max_order=19 bucket_order=0 [ 3.312505] NFS: Registering the id_resolver key type [ 3.317571] Key type id_resolver registered [ 3.321723] Key type id_legacy registered [ 3.325866] nfs4filelayout_init: NFSv4 File Layout Driver Registering... [ 3.334533] 9p: Installing v9fs 9p2000 file system support [ 3.343539] NET: Registered protocol family 38 [ 3.348084] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251) [ 3.355132] io scheduler mq-deadline registered [ 3.359702] io scheduler kyber registered [ 4.081780] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled [ 4.100286] 64000000.serial: ttySIF0 at MMIO 0x64000000 (irq = 1, base_baud = 0) is a SiFive UART v0 [ 4.115272] [drm] radeon kernel modesetting enabled. [ 4.241030] loop: module loaded [ 4.249949] sifive_spi 64001000.spi: mapped; irq=2, cs=1 [ 4.265692] libphy: Fixed MDIO Bus: probed [ 4.278106] e1000e: Intel(R) PRO/1000 Network Driver - 3.2.6-k [ 4.283560] e1000e: Copyright(c) 1999 - 2015 Intel Corporation. [ 4.290660] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver [ 4.296870] ehci-pci: EHCI PCI platform driver [ 4.301727] ehci-platform: EHCI generic platform driver [ 4.307231] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver [ 4.313181] ohci-pci: OHCI PCI platform driver [ 4.318139] ohci-platform: OHCI generic platform driver [ 4.327404] usbcore: registered new interface driver uas [ 4.333195] usbcore: registered new interface driver usb-storage [ 4.340934] mousedev: PS/2 mouse device common for all mice [ 4.381029] mmc_spi spi0.0: SD/MMC host mmc0, no DMA, no WP, no poweroff, cd polling [ 4.390908] usbcore: registered new interface driver usbhid [ 4.396149] usbhid: USB HID core driver [ 4.409265] NET: Registered protocol family 10 [ 4.425831] Segment Routing with IPv6 [ 4.429866] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver [ 4.441870] NET: Registered protocol family 17 [ 4.448149] 9pnet: Installing 9P2000 support [ 4.452868] Key type dns_resolver registered [ 4.478958] mmc0: host does not support reading read-only switch, assuming write-enable [ 4.486989] mmc0: new SDXC card on SPI [ 4.504878] mmcblk0: mmc0:0000 ED4QT 119 GiB [ 4.555010] random: fast init done [ 4.574994] Freeing unused kernel memory: 6364K [ 4.586237] Run /init as init process Running FireMarshal nodisk init Loading FireMarshal platform drivers Calling distro init Starting syslogd: OK Starting klogd: OK Running sysctl: [ 5.798099] mmcblk0: p1 p2 OK Starting mdev... OK Initializing random number generator... [ 12.467585] random: dd: uninitialized urandom read (512 bytes read) done. Starting network: OK launching firesim workload run/command firesim workload run/command done

Welcome to Buildroot buildroot login: root Password:

cat /proc/cpuinfo

processor : 0 hart : 1 isa : rv64imafdc mmu : sv39 uarch : sifive,rocket0

processor : 1 hart : 0 isa : rv64imafdc mmu : sv39 uarch : sifive,rocket0

Thanks very much for this enhencement. It works with rocket-core to boot linux . But when I switch to boom-core, the kernel stuck at init process as below: Could you help on this issue. Thank you very much. Platform Name : freechips,rocketchip-unknown Platform Features : timer,mfdeleg Platform HART Count : 1 Boot HART ID : 0 Boot HART ISA : rv64imafdcsux BOOT HART Features : pmp,scounteren,mcounteren BOOT HART PMP Count : 16 Firmware Base : 0x80000000 Firmware Size : 92 KB Runtime SBI Version : 0.2 MIDELEG : 0x0000000000000222 MEDELEG : 0x000000000000b109 PMP0 : 0x0000000080000000-0x000000008001ffff (A) PMP1 : 0x0000000000000000-0x00000001ffffffff (A,R,W,X) [ 0.000000] OF: fdt: No chosen node found, continuing without [ 0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80200000 [ 0.000000] Forcing kernel command line to: console=hvc0 earlycon=sbi [ 0.000000] Linux version 5.7.0-rc3-58539-g5f5fd87 (gcc version 9.2.0 (GCC), GNU ld (GNU Binutils) 2.32) #1 SMP Fri Apr 9 17:29:05 CST 2021 [ 0.000000] earlycon: sbi0 at I/O port 0x0 (options '') [ 0.000000] printk: bootconsole [sbi0] enabled [ 0.000000] initrd not found or empty - disabling initrd

Can I see the successful process of rocket-core to boot linux?

1441675923 , May I have your personal contact, email or wechat, anyway convenient for you ?

abejgonzalez commented 3 years ago

Closing since the base question has been addressed (and further conversation has moved offline).

xiaoQ77 commented 3 years ago

@pengwubj Have you solved the problem? Thanks.