Skip to content

Commit 4604859

Browse files
committed
[NOT-FOR-UPSTREAM] Add build instructions
For convenience this also adds a small visionfive_defconfig and the firmware needed for the brcmfmac driver along with the signed regulatory database. The firmware is from the linux-firmware repo and the regulatory database from the wireless-regdb Fedora package. Signed-off-by: Emil Renner Berthing <kernel@esmil.dk> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Drew Fustini <drew@beagleboard.org>
1 parent c0168cc commit 4604859

10 files changed

+483
-0
lines changed

README.md

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
# Linux kernel for StarFive's JH7100 RISC-V SoC
2+
3+
## What is this?
4+
5+
The [JH7100][soc] is a Linux-capable dual-core 64bit RISC-V SoC and this tree
6+
is meant to collect all the in-development patches for running Linux on boards
7+
using this. So far there are two such boards and both are supported by this tree:
8+
9+
1) [StarFive VisionFive][visionfive]
10+
2) [BeagleV Starlight Beta][starlight]
11+
12+
The VisionFive boards aren't quite shipping yet, but you can already
13+
[register interest][interest] and ask questions on the [forum][].
14+
15+
About 300 BeagleV Starlight Beta boards were sent out to developers in
16+
April 2021 in preparation for an eventual BeagleV branded board using the
17+
updated JH7110 chip. The BeagleBoard organization has since [cancelled that
18+
project][beaglev] though.
19+
20+
21+
[visionfive]: https://github.com/starfive-tech/VisionFive
22+
[interest]: http://starfive.mikecrm.com/doQXj99
23+
[forum]: https://forum.rvspace.org/c/visionfive/6
24+
[starlight]: https://github.com/beagleboard/beaglev-starlight
25+
[soc]: https://github.com/starfive-tech/JH7100_Docs
26+
[beaglev]: https://beaglev.org/blog/2021-07-30-the-future-of-beaglev-community
27+
28+
## Cross-compiling
29+
30+
Cross-compiling the Linux kernel is surprisingly easy since it doesn't depend
31+
on any (target) libraries and most distributions already have packages with a
32+
working cross-compiler. We'll also need a few other tools to build everything:
33+
```shell
34+
# Debian/Ubuntu
35+
sudo apt-get install libncurses-dev libssl-dev bc flex bison make gcc gcc-riscv64-linux-gnu
36+
# Fedora
37+
sudo dnf install ncurses-devel openssl openssl-devel bc flex bison make gcc gcc-riscv64-linux-gnu
38+
# Archlinux
39+
sudo pacman -S --needed ncurses openssl bc flex bison make gcc riscv64-linux-gnu-gcc
40+
```
41+
42+
The build system needs to know that we want to cross-compile a kernel for
43+
RISC-V by setting `ARCH=riscv`. It also needs to know the prefix of our
44+
cross-compiler using `CROSS_COMPILE=riscv64-linux-gnu-`. Also let's assume
45+
we're building on an 8-core machine so compilation can be greatly sped up by
46+
telling make to use all 8 cores with `-j8`.
47+
48+
First we need to configure the kernel though. Linux has a *very* extensive
49+
configuration system, but you can get a good baseline configuration for the
50+
boards using:
51+
```shell
52+
make -j8 ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- visionfive_defconfig
53+
```
54+
55+
There is nothing magic about this configuration other than it has all the
56+
drivers enabled that are working for the hardware on the boards. In fact it has
57+
very little extra features enabled which is great for compile times, but you
58+
are very much encouraged to add additional drivers and configure your kernel
59+
further using
60+
```shell
61+
make -j8 ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- nconfig
62+
```
63+
64+
Now compile the whole thing with
65+
```
66+
make -j8 ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu-
67+
```
68+
69+
70+
## Installing
71+
72+
Once the build has finished the resulting kernel can be found at
73+
```shell
74+
arch/riscv/boot/Image
75+
```
76+
You'll also need the matching device tree at
77+
```shell
78+
arch/riscv/boot/dts/starfive/jh7100-starfive-visionfive-v1.dtb
79+
```
80+
(If you have a Starlight board you should instead be using `jh7100-beaglev-starlight.dtb`.)
81+
82+
These two files should be copied to the boot partition on the SD card. In the
83+
default [Fedora image][fedora] this is `/dev/mmcblk0p3` and is mounted at `/boot`.
84+
85+
Now add the following entry to the `grub.cfg` file:
86+
```
87+
menuentry 'My New Kernel' {
88+
linux /Image earlycon console=ttyS0,115200n8 stmmac.chain_mode=1 root=/dev/mmcblk0p4 rootwait
89+
devicetree /jh7100-starfive-visionfive-v1.dtb
90+
}
91+
```
92+
93+
This assumes your root file system is at `/dev/mmcblk0p4` which it is in the
94+
default [Fedora image][fedora].
95+
96+
The `visionfive_defconfig` doesn't enable modules, but if you enabled them in
97+
your build you'll also need to install them in `/lib/modules/` on the root file
98+
system. How to do that best is out of scope for this README though.
99+
100+
[fedora]: https://github.com/starfive-tech/Fedora_on_StarFive/
101+
102+
## Status
103+
104+
#### SoC
105+
106+
- [x] Clock tree
107+
- [x] Resets
108+
- [x] Pinctrl/Pinmux
109+
- [x] GPIO
110+
- [x] Serial port
111+
- [x] I2C
112+
- [x] SPI
113+
- [x] MMC / SDIO / SD card
114+
- [x] Random number generator
115+
- [x] Temperature sensor
116+
- [x] Ethernet, though `stmmac.chain_mode=1` needed on the cmdline
117+
- [x] USB, USB 3.0 is broken with `CONFIG_PM=y`
118+
- [x] DRM driver
119+
- [x] NVDLA
120+
- [x] Watchdog
121+
- [ ] PWM DAC for sound through the minijack [WIP]
122+
- [ ] I2S [WIP]
123+
- [ ] TDM [WIP]
124+
- [ ] MIPI-DSI [WIP]
125+
- [ ] MIPI-CSI [WIP]
126+
- [ ] ISP [WIP]
127+
- [ ] Video Decode [WIP]
128+
- [ ] Video Encode [WIP]
129+
- [ ] QSPI
130+
- [ ] Security Engine
131+
- [ ] NNE50
132+
- [ ] Vision DSP
133+
134+
#### Board
135+
136+
- [x] LED
137+
- [x] PMIC / Reboot
138+
- [x] Ethernet PHY
139+
- [x] HDMI
140+
- [x] AP6236 Wifi
141+
- [x] AP6236 Bluetooth, with a [userspace tool][patchram]
142+
- [x] I2C EEPROM (VisionFive only)
143+
- [ ] GD25LQ128DWIG (VisionFive) / GD25LQ256D (Starlight) flash
144+
145+
[patchram]: https://github.com/AsteroidOS/brcm-patchram-plus
146+
147+
## Contributing
148+
149+
If you're working on cleaning up or upstreaming some of this or adding support
150+
for more of the SoC I'd very much like to incorporate it into this tree. Either
151+
send a pull request, mail or contact Esmil on IRC/Slack.
152+
153+
Also think of this tree mostly as a collection of patches that will hopefully
154+
mature enough to be submitted upstream eventually. So expect regular rebases.
Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
CONFIG_LOCALVERSION="-visionfive"
2+
CONFIG_SYSVIPC=y
3+
CONFIG_POSIX_MQUEUE=y
4+
# CONFIG_CROSS_MEMORY_ATTACH is not set
5+
CONFIG_NO_HZ_IDLE=y
6+
CONFIG_HIGH_RES_TIMERS=y
7+
CONFIG_BPF_SYSCALL=y
8+
CONFIG_PSI=y
9+
# CONFIG_CPU_ISOLATION is not set
10+
CONFIG_IKCONFIG=y
11+
CONFIG_IKCONFIG_PROC=y
12+
CONFIG_CGROUPS=y
13+
CONFIG_CGROUP_SCHED=y
14+
CONFIG_CFS_BANDWIDTH=y
15+
CONFIG_CGROUP_PIDS=y
16+
CONFIG_CGROUP_CPUACCT=y
17+
CONFIG_NAMESPACES=y
18+
CONFIG_BLK_DEV_INITRD=y
19+
# CONFIG_RD_BZIP2 is not set
20+
# CONFIG_RD_LZMA is not set
21+
# CONFIG_RD_XZ is not set
22+
# CONFIG_RD_LZO is not set
23+
# CONFIG_RD_LZ4 is not set
24+
CONFIG_EXPERT=y
25+
# CONFIG_SYSFS_SYSCALL is not set
26+
CONFIG_PERF_EVENTS=y
27+
# CONFIG_VM_EVENT_COUNTERS is not set
28+
# CONFIG_SLUB_DEBUG is not set
29+
CONFIG_SHUFFLE_PAGE_ALLOCATOR=y
30+
CONFIG_SOC_STARFIVE=y
31+
# CONFIG_RISCV_ERRATA_ALTERNATIVE is not set
32+
CONFIG_SMP=y
33+
CONFIG_NR_CPUS=4
34+
# CONFIG_RISCV_SBI_V01 is not set
35+
CONFIG_JUMP_LABEL=y
36+
# CONFIG_STACKPROTECTOR is not set
37+
# CONFIG_GCC_PLUGINS is not set
38+
CONFIG_BLK_WBT=y
39+
# CONFIG_BLK_DEBUG_FS is not set
40+
CONFIG_PARTITION_ADVANCED=y
41+
# CONFIG_MQ_IOSCHED_DEADLINE is not set
42+
# CONFIG_MQ_IOSCHED_KYBER is not set
43+
CONFIG_IOSCHED_BFQ=y
44+
CONFIG_KSM=y
45+
CONFIG_CMA=y
46+
CONFIG_ZSMALLOC=y
47+
CONFIG_NET=y
48+
CONFIG_PACKET=y
49+
CONFIG_UNIX=y
50+
CONFIG_INET=y
51+
CONFIG_IP_ADVANCED_ROUTER=y
52+
CONFIG_IP_MULTIPLE_TABLES=y
53+
CONFIG_IP_PNP=y
54+
CONFIG_IP_PNP_DHCP=y
55+
# CONFIG_INET_DIAG is not set
56+
# CONFIG_IPV6_SIT is not set
57+
CONFIG_IPV6_MULTIPLE_TABLES=y
58+
CONFIG_NET_SCHED=y
59+
CONFIG_NET_SCH_FQ_CODEL=y
60+
CONFIG_BT=y
61+
CONFIG_BT_RFCOMM=y
62+
CONFIG_BT_RFCOMM_TTY=y
63+
CONFIG_BT_BNEP=y
64+
CONFIG_BT_HIDP=y
65+
CONFIG_BT_HS=y
66+
CONFIG_BT_HCIUART=y
67+
CONFIG_BT_HCIUART_H4=y
68+
CONFIG_CFG80211=y
69+
# CONFIG_CFG80211_DEFAULT_PS is not set
70+
CONFIG_RFKILL=y
71+
CONFIG_DEVTMPFS=y
72+
CONFIG_DEVTMPFS_MOUNT=y
73+
# CONFIG_STANDALONE is not set
74+
# CONFIG_PREVENT_FIRMWARE_BUILD is not set
75+
CONFIG_EXTRA_FIRMWARE="regulatory.db regulatory.db.p7s brcm/brcmfmac43430-sdio.bin brcm/brcmfmac43430-sdio.clm_blob brcm/brcmfmac43430-sdio.beagle,beaglev-starlight-jh7100-r0.txt brcm/brcmfmac43430-sdio.starfive,visionfive-v1.txt"
76+
CONFIG_EXTRA_FIRMWARE_DIR="firmware"
77+
CONFIG_MTD=y
78+
CONFIG_MTD_BLOCK=y
79+
CONFIG_MTD_PARTITIONED_MASTER=y
80+
CONFIG_MTD_SPI_NOR=y
81+
# CONFIG_MTD_SPI_NOR_USE_4K_SECTORS is not set
82+
CONFIG_ZRAM=y
83+
CONFIG_ZRAM_MEMORY_TRACKING=y
84+
CONFIG_BLK_DEV_LOOP=y
85+
CONFIG_BLK_DEV_LOOP_MIN_COUNT=1
86+
CONFIG_BLK_DEV_NBD=y
87+
CONFIG_EEPROM_AT24=y
88+
CONFIG_SCSI=y
89+
# CONFIG_SCSI_PROC_FS is not set
90+
CONFIG_BLK_DEV_SD=y
91+
CONFIG_CHR_DEV_SG=y
92+
CONFIG_SCSI_CONSTANTS=y
93+
CONFIG_SCSI_SCAN_ASYNC=y
94+
# CONFIG_SCSI_LOWLEVEL is not set
95+
CONFIG_NETDEVICES=y
96+
CONFIG_WIREGUARD=y
97+
CONFIG_TUN=y
98+
CONFIG_STMMAC_ETH=y
99+
CONFIG_MICREL_PHY=y
100+
CONFIG_MOTORCOMM_PHY=y
101+
CONFIG_BRCMFMAC=y
102+
CONFIG_INPUT_EVDEV=y
103+
# CONFIG_INPUT_KEYBOARD is not set
104+
# CONFIG_INPUT_MOUSE is not set
105+
# CONFIG_SERIO is not set
106+
# CONFIG_LEGACY_PTYS is not set
107+
# CONFIG_LDISC_AUTOLOAD is not set
108+
CONFIG_SERIAL_8250=y
109+
# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set
110+
# CONFIG_SERIAL_8250_16550A_VARIANTS is not set
111+
CONFIG_SERIAL_8250_CONSOLE=y
112+
CONFIG_SERIAL_8250_DW=y
113+
# CONFIG_DEVMEM is not set
114+
# CONFIG_I2C_COMPAT is not set
115+
CONFIG_I2C_CHARDEV=y
116+
# CONFIG_I2C_HELPER_AUTO is not set
117+
CONFIG_I2C_DESIGNWARE_PLATFORM=y
118+
CONFIG_SPI=y
119+
CONFIG_SPI_CADENCE_QUADSPI=y
120+
CONFIG_SPI_DESIGNWARE=y
121+
CONFIG_SPI_DW_DMA=y
122+
CONFIG_SPI_DW_MMIO=y
123+
CONFIG_SPI_SPIDEV=y
124+
# CONFIG_PTP_1588_CLOCK is not set
125+
CONFIG_GPIOLIB_FASTPATH_LIMIT=256
126+
CONFIG_GPIO_SYSFS=y
127+
CONFIG_GPIO_TPS65086=y
128+
CONFIG_POWER_RESET=y
129+
CONFIG_POWER_RESET_GPIO_RESTART=y
130+
CONFIG_POWER_RESET_TPS65086=y
131+
CONFIG_SENSORS_SFCTEMP=y
132+
CONFIG_THERMAL=y
133+
CONFIG_THERMAL_NETLINK=y
134+
CONFIG_THERMAL_STATISTICS=y
135+
CONFIG_THERMAL_WRITABLE_TRIPS=y
136+
CONFIG_CPU_THERMAL=y
137+
CONFIG_WATCHDOG=y
138+
CONFIG_STARFIVE_WATCHDOG=y
139+
CONFIG_MFD_TPS65086=y
140+
CONFIG_DRM=y
141+
CONFIG_DRM_I2C_NXP_TDA998X=y
142+
CONFIG_DRM_STARFIVE=y
143+
CONFIG_FB=y
144+
# CONFIG_VGA_CONSOLE is not set
145+
CONFIG_FRAMEBUFFER_CONSOLE=y
146+
CONFIG_USB=y
147+
CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
148+
CONFIG_USB_MON=y
149+
CONFIG_USB_XHCI_HCD=y
150+
CONFIG_USB_XHCI_DBGCAP=y
151+
CONFIG_USB_STORAGE=y
152+
CONFIG_USB_UAS=y
153+
CONFIG_USB_CDNS_SUPPORT=y
154+
CONFIG_USB_CDNS3=y
155+
CONFIG_USB_CDNS3_HOST=y
156+
CONFIG_MMC=y
157+
# CONFIG_PWRSEQ_EMMC is not set
158+
CONFIG_MMC_DW=y
159+
CONFIG_NEW_LEDS=y
160+
CONFIG_LEDS_CLASS=y
161+
CONFIG_LEDS_GPIO=y
162+
CONFIG_LEDS_TRIGGERS=y
163+
CONFIG_LEDS_TRIGGER_HEARTBEAT=y
164+
CONFIG_DMADEVICES=y
165+
CONFIG_DW_AXI_DMAC=y
166+
CONFIG_DMABUF_HEAPS=y
167+
CONFIG_DMABUF_HEAPS_SYSTEM=y
168+
# CONFIG_VIRTIO_MENU is not set
169+
# CONFIG_VHOST_MENU is not set
170+
# CONFIG_IOMMU_SUPPORT is not set
171+
CONFIG_PWM=y
172+
CONFIG_PWM_SIFIVE_PTC=y
173+
CONFIG_EXT4_FS=y
174+
CONFIG_EXT4_FS_POSIX_ACL=y
175+
CONFIG_EXT4_FS_SECURITY=y
176+
CONFIG_BTRFS_FS=y
177+
CONFIG_BTRFS_FS_POSIX_ACL=y
178+
# CONFIG_MANDATORY_FILE_LOCKING is not set
179+
# CONFIG_DNOTIFY is not set
180+
CONFIG_FANOTIFY=y
181+
CONFIG_AUTOFS_FS=y
182+
CONFIG_VFAT_FS=y
183+
CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-15"
184+
CONFIG_FAT_DEFAULT_UTF8=y
185+
CONFIG_EXFAT_FS=y
186+
CONFIG_PROC_KCORE=y
187+
CONFIG_TMPFS=y
188+
CONFIG_TMPFS_POSIX_ACL=y
189+
# CONFIG_MISC_FILESYSTEMS is not set
190+
CONFIG_NFS_FS=y
191+
CONFIG_ROOT_NFS=y
192+
CONFIG_NLS_DEFAULT="utf8"
193+
CONFIG_NLS_CODEPAGE_437=y
194+
CONFIG_NLS_ISO8859_15=y
195+
CONFIG_NLS_UTF8=y
196+
CONFIG_LSM=""
197+
CONFIG_CRYPTO_ZSTD=y
198+
# CONFIG_CRYPTO_HW is not set
199+
# CONFIG_RAID6_PQ_BENCHMARK is not set
200+
CONFIG_DMA_CMA=y
201+
# CONFIG_SYMBOLIC_ERRNAME is not set
202+
CONFIG_STRIP_ASM_SYMS=y
203+
CONFIG_DEBUG_SECTION_MISMATCH=y
204+
# CONFIG_SECTION_MISMATCH_WARN_ONLY is not set
205+
CONFIG_DEBUG_FS=y
206+
# CONFIG_DEBUG_MISC is not set
207+
CONFIG_DEBUG_RODATA_TEST=y
208+
CONFIG_DEBUG_WX=y
209+
CONFIG_SOFTLOCKUP_DETECTOR=y
210+
CONFIG_WQ_WATCHDOG=y
211+
# CONFIG_SCHED_DEBUG is not set
212+
CONFIG_STACKTRACE=y
213+
CONFIG_RCU_CPU_STALL_TIMEOUT=60
214+
# CONFIG_RCU_TRACE is not set
215+
# CONFIG_FTRACE is not set
216+
# CONFIG_RUNTIME_TESTING_MENU is not set

0 commit comments

Comments
 (0)