forked from starfive-tech/linux
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: MichaIng <[email protected]>
- Loading branch information
Showing
9 changed files
with
119 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/boot/extlinux/extlinux.conf | ||
/etc/fw_env.config | ||
/etc/u-boot-initial-env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Package: linux-image-star64 | ||
Version: VERSION | ||
Architecture: riscv64 | ||
Maintainer: MichaIng <[email protected]> | ||
Date: DATE | ||
Standards-Version: 4.6.2.0 | ||
Installed-Size: SIZE | ||
Section: kernel | ||
Priority: optional | ||
Homepage: https://github.com/MichaIng/linux | ||
Vcs-Git: https://github.com/MichaIng/linux.git | ||
Vcs-Browser: https://github.com/MichaIng/linux | ||
Description: Linux kernel for RISC-V PINE64 Star64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/dash | ||
set -e | ||
export DEB_MAINT_PARAMS=$* INITRD=Yes | ||
[ -d '/etc/kernel/postinst.d' ] && run-parts --arg='VERSION' --arg='VERSION' /etc/kernel/postinst.d | ||
sed -Ei '/^[[:blank:]]*(linux|kernel)/c\linux /boot/vmlinuz-VERSION' /boot/extlinux/extlinux.conf | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/dash | ||
set -e | ||
export DEB_MAINT_PARAMS=$* INITRD=Yes | ||
[ -d '/etc/kernel/postrm.d' ] && run-parts --arg='VERSION' --arg='VERSION' /etc/kernel/postrm.d | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/dash | ||
set -e | ||
export DEB_MAINT_PARAMS=$* INITRD=Yes | ||
[ -d '/etc/kernel/preinst.d' ] && run-parts --arg='VERSION' --arg='VERSION' /etc/kernel/preinst.d | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/dash | ||
set -e | ||
export DEB_MAINT_PARAMS=$* INITRD=Yes | ||
[ -d '/etc/kernel/prerm.d' ] && run-parts --arg='VERSION' --arg='VERSION' /etc/kernel/prerm.d | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
label DietPi | ||
linux /boot/vmlinuz-VERSION | ||
fdt /usr/lib/linux-image-visionfive2/starfive/jh7110-pine64-star64.dtb | ||
append root=/dev/mmcblk1p1 rootfstype=ext4 rootwait earlycon=sbi console=ttyS0,115200 console=tty1 consoleblank=0 net.ifnames=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/dev/mtd1 0x00000 0x10000 0x10000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
kernel_addr_r=0x40200000 | ||
scriptaddr=0x43900000 | ||
pxefile_addr_r=0x45900000 | ||
fdt_addr_r=0x46000000 | ||
ramdisk_addr_r=0x46100000 | ||
fdtoverlay_addr_r=0x4f000000 | ||
kernel_comp_addr_r=0x5a000000 | ||
kernel_comp_size=0x4000000 | ||
fdt_high=0xffffffffffffffff | ||
initrd_high=0xffffffffffffffff | ||
|
||
boot_prefixes=/ /boot/ | ||
bootenv=uEnv.txt | ||
boot_scripts=boot.scr.uimg boot.scr | ||
efi_dtb_prefixes=/ /dtb/ /dtb/current/ | ||
fdtfile=starfive/jh7110-pine64-star64.dtb | ||
ipaddr=192.168.120.230 | ||
|
||
preboot=run chipa_set_uboot | ||
chipa_set_uboot=fdt addr "${uboot_fdt_addr}"; run chipa_set | ||
chipa_set=if test "${chip_vision}" = 'A'; then echo 'VisionFive 2 revision A detected, updating device tree for Ethernet access ...'; run chipa_gmac_set; fi | ||
chipa_gmac_set=fdt set /soc/ethernet@16030000/ethernet-phy@0 tx_inverted_10 <0x0>; fdt set /soc/ethernet@16030000/ethernet-phy@0 tx_inverted_100 <0x0>; fdt set /soc/ethernet@16030000/ethernet-phy@0 tx_inverted_1000 <0x0>; fdt set /soc/ethernet@16030000/ethernet-phy@0 tx_delay_sel <0x9>; fdt set /soc/ethernet@16040000/ethernet-phy@1 tx_inverted_10 <0x0>; fdt set /soc/ethernet@16040000/ethernet-phy@1 tx_inverted_100 <0x0>; fdt set /soc/ethernet@16040000/ethernet-phy@1 tx_inverted_1000 <0x0>; fdt set /soc/ethernet@16040000/ethernet-phy@1 tx_delay_sel <0x9> | ||
|
||
bootcmd=setenv devnum; for target in "${boot_targets}"; do echo "Trying to boot from ${target} ..."; run "bootcmd_${target}"; done | ||
|
||
boot_targets=mmc1 usb0 nvme0 mmc0 dhcp | ||
bootcmd_mmc1=devnum=1; run mmc_boot | ||
bootcmd_usb0=devnum=0; run usb_boot | ||
bootcmd_nvme0=devnum=0; run nvme_boot | ||
bootcmd_mmc0=devnum=0; run mmc_boot | ||
bootcmd_dhcp=devtype=dhcp; pci enum; usb reset; if dhcp "${scriptaddr}" boot.scr.uimg; then source "${scriptaddr}"; fi; setenv efi_fdtfile "${fdtfile}"; setenv efi_old_vci "${bootp_vci}"; setenv efi_old_arch "${bootp_arch}"; setenv bootp_vci 'PXEClient:Arch:00027:UNDI:003000'; setenv bootp_arch '0x1b'; if dhcp "${kernel_addr_r}"; then tftpboot "${fdt_addr_r}" "dtb/${efi_fdtfile}"; if fdt addr "${fdt_addr_r}"; then bootefi "${kernel_addr_r}" "${fdt_addr_r}"; else bootefi "${kernel_addr_r}" "${fdtcontroladdr}"; fi; fi; setenv bootp_vci "${efi_old_vci}"; setenv bootp_arch "${efi_old_arch}"; setenv efi_fdtfile; setenv efi_old_arch; setenv efi_old_vci | ||
|
||
mmc_boot=if mmc dev "${devnum}"; then devtype=mmc; run scan_dev_for_boot_part; fi | ||
usb_boot=pci enum; usb reset; if usb dev "${devnum}"; then devtype=usb; run scan_dev_for_boot_part; fi | ||
nvme_boot=pci enum; nvme scan; if nvme dev "${devnum}"; then devtype=nvme; run scan_dev_for_boot_part; fi | ||
|
||
scan_dev_for_boot_part=part list "${devtype}" "${devnum}" -bootable devplist; env exists devplist || setenv devplist 1; for bootpart in ${devplist}; do if fstype "${devtype}" "${devnum}:${bootpart}" bootfstype; then run scan_dev_for_boot; fi; done; setenv devplist; run starfive_sdk_boot | ||
scan_dev_for_boot=echo "Scanning ${devtype} ${devnum}:${bootpart} ..."; for prefix in ${boot_prefixes}; do run scan_dev_for_uenv; run starfive_fdt_rewrite; run scan_dev_for_extlinux; run scan_dev_for_scripts; done; run scan_dev_for_efi | ||
scan_dev_for_uenv=if test -e "${devtype}" "${devnum}:${bootpart}" "${prefix}${bootenv}"; then echo "Found U-Boot environment file ${prefix}${bootenv}"; run load_uenv; fi | ||
scan_dev_for_extlinux=if test -e "${devtype}" "${devnum}:${bootpart}" "${prefix}extlinux/extlinux.conf"; then echo "Found ${prefix}extlinux/extlinux.conf"; run boot_extlinux; echo 'SCRIPT FAILED: continuing ...'; fi | ||
scan_dev_for_scripts=for script in ${boot_scripts}; do if test -e "${devtype}" "${devnum}:${bootpart}" "${prefix}${script}"; then echo "Found U-Boot script ${prefix}${script}"; run boot_a_script; echo 'SCRIPT FAILED: continuing ...'; fi; done | ||
scan_dev_for_efi=setenv efi_fdtfile "${fdtfile}"; for prefix in "${efi_dtb_prefixes}"; do if test -e "${devtype}" "${devnum}:${bootpart}" "${prefix}${efi_fdtfile}"; then run load_efi_dtb; fi; done; run boot_efi_bootmgr; if test -e "${devtype}" "${devnum}:${bootpart}" efi/boot/bootriscv64.efi; then echo 'Found EFI removable media binary efi/boot/bootriscv64.efi'; run boot_efi_binary; echo 'EFI LOAD FAILED: continuing ...'; fi; setenv efi_fdtfile | ||
|
||
load_uenv=if load "${devtype}" "${devnum}:${bootpart}" "${scriptaddr}" "${prefix}${bootenv}"; then env import -t "${scriptaddr}" "${filesize}" || echo "Importing U-Boot environment from RAM address ${scriptaddr} failed: continuing ..."; else echo "Loading U-Boot environment file ${prefix}${bootenv} into RAM failed: continuing ..."; fi | ||
boot_extlinux=sysboot "${devtype}" "${devnum}:${bootpart}" any "${scriptaddr}" "${prefix}extlinux/extlinux.conf" | ||
boot_a_script=load "${devtype}" "${devnum}:${bootpart}" "${scriptaddr}" "${prefix}${script}"; source "${scriptaddr}" | ||
load_efi_dtb=load "${devtype}" "${devnum}:${bootpart}" "${fdt_addr_r}" "${prefix}${efi_fdtfile}" | ||
boot_efi_bootmgr=if fdt addr "${fdt_addr_r}"; then bootefi bootmgr "${fdt_addr_r}"; else bootefi bootmgr; fi | ||
boot_efi_binary=load "${devtype}" "${devnum}:${bootpart}" "${kernel_addr_r}" efi/boot/bootriscv64.efi; if fdt addr "${fdt_addr_r}"; then bootefi "${kernel_addr_r}" "${fdt_addr_r}"; else bootefi "${kernel_addr_r}" "${fdtcontroladdr}"; fi | ||
|
||
starfive_fdt_rewrite=if test "${bootpart}" = 3 && test "${prefix}" = '/' && test -e "${devtype}" "${devnum}:${bootpart}" "${prefix}dtbs/${fdtfile}"; then run fdt_loaddtb; fi | ||
fdt_loaddtb=echo "Trying to load device tree from ${devtype}${devnum} partition ${bootpart} ..."; if fatload "${devtype}" "${devnum}:${bootpart}" "${fdt_addr_r}" "${prefix}dtbs/${fdtfile}"; then fdt addr "${fdt_addr_r}"; run fdt_sizecheck; run set_fdt_distro; fi | ||
fdt_sizecheck=fatsize "${devtype}" "${devnum}:${bootpart}" "${prefix}dtbs/${fdtfile}" | ||
set_fdt_distro=echo "Updating device tree ${prefix}dtbs/${fdtfile} on ${devtype}${devnum} partition ${bootpart} ..."; run chipa_set_linux; run cpu_vol_set; fatwrite "${devtype}" "${devnum}:${bootpart}" "${fdt_addr_r}" "${prefix}dtbs/${fdtfile}" "${filesize}" | ||
|
||
chipa_set_linux=run visionfive2_mem_set; run chipa_set | ||
visionfive2_mem_set=fdt memory "${memory_addr}" "${memory_size}"; run cma_resize | ||
cma_resize=if test "${memory_size}" -eq 40000000; then run cma_ddr1g_set; elif test "${memory_size}" -eq 80000000; then run cma_ddr2g_set; elif test "${memory_size}" -eq 100000000; then run cma_ddr4g_set; elif test "${memory_size}" -ge 200000000; then run cma_ddr8g_set; fi | ||
cma_ddr1g_set=echo 'Updating device tree for 1 GiB RAM size ...'; fdt set "${cma_node}" size "<0x0 0x${cma_1g}>"; fdt set "${cma_node}" alloc-ranges "<0x0 0x${cma_start} 0x0 0x${cma_1g}>" | ||
cma_ddr2g_set=echo 'Updating device tree for 2 GiB RAM size ...'; fdt set "${cma_node}" size "<0x0 0x${cma_2g}>"; fdt set "${cma_node}" alloc-ranges "<0x0 0x${cma_start} 0x0 0x${cma_2g}>" | ||
cma_ddr4g_set=echo 'Updating device tree for 4 GiB RAM size ...'; fdt set "${cma_node}" size "<0x0 0x${cma_4g}>"; fdt set "${cma_node}" alloc-ranges "<0x0 0x${cma_start} 0x0 0x${cma_4g}>" | ||
cma_ddr8g_set=echo 'Updating device tree for 8 GiB RAM size ...'; fdt set "${cma_node}" size "<0x0 0x${cma_8g}>"; fdt set "${cma_node}" alloc-ranges "<0x0 0x${cma_start} 0x0 0x${cma_8g}>" | ||
cma_node=/reserved-memory/linux,cma | ||
cma_1g=b000000 | ||
cma_2g=20000000 | ||
cma_4g=40000000 | ||
cma_8g=60000000 | ||
cma_start=70000000 | ||
|
||
cpu_vol_set=if test "${cpu_max_vol}" = 1000000; then run cpu_speed_1250_set; else run cpu_speed_1500_set; if test "${cpu_max_vol}" = 1060000; then run cpu_vol_1060_set; elif test "${cpu_max_vol}" = 1020000; then run cpu_vol_1020_set; else run cpu_vol_1040_set; fi; fi | ||
cpu_speed_1250_set=echo 'Updating device tree for 1250 MHz CPU speed ...'; fdt rm /opp-table-0/opp-375000000; fdt rm /opp-table-0/opp-500000000; fdt rm /opp-table-0/opp-750000000; fdt rm /opp-table-0/opp-1500000000 | ||
cpu_speed_1500_set=echo 'Updating device tree for 1500 MHz CPU speed ...'; fdt rm /opp-table-0/opp-312500000; fdt rm /opp-table-0/opp-417000000; fdt rm /opp-table-0/opp-625000000; fdt rm /opp-table-0/opp-1250000000 | ||
cpu_vol_1020_set=echo 'Updating device tree for 1.02V CPU voltage ...'; fdt set /opp-table-0/opp-1500000000 opp-microvolt <1020000> | ||
cpu_vol_1040_set=echo 'Updating device tree for 1.04V CPU voltage ...'; fdt set /opp-table-0/opp-1500000000 opp-microvolt <1040000> | ||
cpu_vol_1060_set=echo 'Updating device tree for 1.06V CPU voltage ...'; fdt set /opp-table-0/opp-1500000000 opp-microvolt <1060000> | ||
|
||
starfive_sdk_boot=if test -e "${devtype}" "${devnum}:3" /vf2_uEnv.txt && fatload "${devtype}" "${devnum}:3" "${scriptaddr}" /vf2_uEnv.txt; then setenv loadaddr 0x60000000; if "${devtype}" = 'nvme'; then setenv sdev_blk "nvme${devnum}n1p4"; elif "${devtype}" = 'usb'; then setenv sdev_blk sda4; else setenv sdev_blk "mmcblk${devnum}p4"; fi; setenv bootdelay 2; setenv bootdev "${devtype}"; setenv bootpart 3; env import -t "${scriptaddr}" "${filesize}"; run boot2; fi |