Skip to content

Commit

Permalink
Upgrade to include the xr829 driver (WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Molteno committed Jun 22, 2022
1 parent 9e1a147 commit 8417de7
Show file tree
Hide file tree
Showing 10 changed files with 94 additions and 30 deletions.
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
## Changelog

### Version 0.4

- Remove backticks in Dockerfile (thanks NexusXe)
- Add xradio driver code for the panel (work in progress - no firmware yet)


### Version 0.3

- Smaller builds by removing apt caches.
Expand Down
12 changes: 6 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ RUN if [ "$BOARD" = "lichee_rv_86" ] ; then \
echo "Building for the RV_86_Panel"; \
./update_uboot_config.sh lichee_rv_86_panel_defconfig; \
make $CROSS lichee_rv_86_panel_defconfig; \
elif [ "$BOARD" = "lichee_rv_dock" ] ; then \
elif [ "$BOARD" = "lichee_rv_dock" ] || [ "$BOARD" = "lichee_rv_lcd" ] ; then \
echo "Building for Lichee RV Dock"; \
./update_uboot_config.sh lichee_rv_defconfig; \
make $CROSS lichee_rv_defconfig; \
Expand All @@ -131,7 +131,7 @@ RUN make -j `nproc` $CROSS all V=1
RUN ls -l arch/riscv/dts/
# The binary is located here: u-boot/arch/riscv/dts/sun20i-d1-lichee-rv-dock.dtb
# The binary is located here: u-boot/arch/riscv/dts/sun20i-d1-lichee-rv-86-panel.dtb

# The binary is located here: u-boot/arch/riscv/dts/ov_lichee_rv_mini_lcd.dtb
#
# Generate u-boot TOC
#
Expand All @@ -144,8 +144,8 @@ RUN ./u-boot/tools/mkimage -A riscv -T sunxi_toc1 -d toc1_${BOARD}.cfg u-boot.to
#
# Create a boot script...
#
COPY config/bootscr.txt .
RUN ./u-boot/tools/mkimage -T script -C none -O linux -A riscv -d bootscr.txt boot.scr
COPY config/bootscr_${BOARD}.txt .
RUN ./u-boot/tools/mkimage -T script -C none -O linux -A riscv -d bootscr_${BOARD}.txt boot.scr
# The boot script is here: boot.scr

#
Expand All @@ -154,7 +154,7 @@ RUN ./u-boot/tools/mkimage -T script -C none -O linux -A riscv -d bootscr.txt bo
# RUN apt-get install -y device-tree-compiler
COPY --from=build_kernel /build/linux-build/ ./linux-build/
COPY config/${BOARD}_boot.its .
RUN PATH=/build/linux-build/scripts/dtc:$PATH ./u-boot/tools/mkimage -f ${BOARD}_boot.its boot.scr
RUN PATH=/build/linux-build/scripts/dtc:$PATH ./u-boot/tools/mkimage -f ${BOARD}_boot.its lichee_rv_boot.itb
# RUN ./u-boot/tools/mkimage -f lichee_rv_boot.itb boot.scr


Expand Down Expand Up @@ -182,7 +182,6 @@ COPY --from=build_kernel /build/linux-build/ ./linux-build/
COPY --from=build_kernel /build/linux/ ./linux/
COPY --from=build_kernel /build/rtl8723ds/8723ds.ko .
COPY --from=build_kernel /build/xradio/xradio_wlan.ko .

WORKDIR /build/linux-build
RUN make ARCH=riscv INSTALL_MOD_PATH=/port/rv64-port modules_install

Expand Down Expand Up @@ -235,6 +234,7 @@ COPY --from=build_kernel /build/linux/arch/riscv/configs/nezha_defconfig .
COPY --from=build_boot0 /build/sun20i_d1_spl/nboot/boot0_sdcard_sun20iw1p1.bin .
COPY --from=build_uboot /build/u-boot.toc1 .
COPY --from=build_uboot /build/boot.scr .
COPY --from=build_uboot /build/u-boot/arch/riscv/dts/ov_lichee_rv_mini_lcd.dtb .

RUN ls -l
RUN apt-get install -y kpartx openssl fdisk dosfstools e2fsprogs kmod parted
Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ dock:
docker-compose build dock
docker-compose up dock

lcd:
sudo rm -rf ./lichee_rv_lcd/*
docker-compose build lcd
docker-compose up lcd

clean:
sudo rm -rf ./lichee_rv_dock/*
sudo rm -rf ./lichee_rv_86/*
Expand Down
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,19 @@ And everything will be rebulid (new kernel download e.t.c.). This is very slow (
* https://github.com/sehraf/riscv-arch-image-builder/blob/main/1_compile.sh
* https://github.com/DongshanPI/NezhaSTU-ReleaseLinux/tree/master/.github/workflows

## Basic Flow
## How Booting Works

* Use a device tree which speficies the hardware
* Compile uboot & friends
* Then compile the kernel using the same device tree (kernel defconfig)
### First Boot Stage
* The first sun20i_d1_spl code is loaded. It looks for a u-boot toc1 file from the mmc drive (sd-card reader). This file is written directly onto the first part of the SDcard (not in a filesystem)
* The TOC file contains a list of parts of the system. These are (in order) opensbi, dtb, u-boot.
These parts are loaded into memory.

The device tree is first found in the U-boot compile, and the Kernel compile should use this same device tree. In our case there are two of interest. These are found in uboot/configs/xxx
### Second Boot stage

lichee_rv_86_panel_defconfig
lichee_rv_defconfig
* The OpenSBI runs as the second boot stage. It is responsible for loading U-Boot

### Third boot stage

This is U-Boot. It mounts the boot partition on the mmc drive. Reads a file called 'boot.scr' and executes this script. This loads the kernel (Image.gz), uncompresses it and starts things running.

These are for the RV 86 Panel (with built-in screen) and the dock/board respectively.

4 changes: 4 additions & 0 deletions config/bootscr_lichee_rv_lcd.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@ load mmc 0:1 ${kernel_addr_r} Image.gz
setenv bootargs "earlycon=sbi console=ttyS0,115200n8 root=/dev/mmcblk0p2 cma=96M"
setenv kernel_comp_addr_r 0x44000000
setenv kernel_comp_size 0xb000000
setenv fdtovaddr 0x87fc0000
load mmc 0:1 ${fdtovaddr} ov_lichee_rv_mini_lcd.dtb
fdt resize 8192
fdt apply $fdtovaddr
echo "Booting kernel with bootargs as $bootargs; and fdtcontroladdr is $fdtcontroladdr"
booti ${kernel_addr_r} - ${fdtcontroladdr}
45 changes: 45 additions & 0 deletions config/lichee_rv_lcd_boot.its
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/dts-v1/;

/ {
description = "Lichee RV FIT Image";

images {
uboot {
description = "U-Boot";
data = /incbin/("u-boot/u-boot-nodtb.bin");
type = "standalone";
os = "U-Boot";
arch = "riscv";
compression = "none";
load = <0x4a000000>;
};
opensbi {
description = "RISC-V OpenSBI";
data = /incbin/("fw_dynamic.bin");
type = "firmware";
os = "opensbi";
arch = "riscv";
compression = "none";
load = <0x40000000>;
entry = <0x40000000>;
};
fdt-1 {
description = "DTB";
data = /incbin/("u-boot/arch/riscv/dts/sun20i-d1-lichee-rv-86-panel.dtb");
type = "flat_dt";
arch = "riscv";
compression = "none";
load = <0x44000000>;
entry = <0x44000000>;
};
};

configurations {
default = "standard";
standard {
description = "Standard Boot";
firmware = "opensbi";
loadables = "uboot";
};
};
};
28 changes: 14 additions & 14 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@ services:
volumes:
- './lichee_rv_86:/outport'

#lcd: # Build the Dock with LCD display enabled
#privileged: true
#build:
#context: .
#dockerfile: Dockerfile
#args:
#BOARD: lichee_rv_lcd
#DISK_MB: 8000
#GNU_TOOLS_TAG: 10.2.1
#OPENSBI_TAG: d1-wip
#UBOOT_TAG: d1-wip
#KERNEL_TAG: d1-wip-v5.18-rc1
#volumes:
#- './lichee_rv_lcd:/outport'
lcd: # Build the Dock with LCD display enabled
privileged: true
build:
context: .
dockerfile: Dockerfile
args:
BOARD: lichee_rv_lcd
DISK_MB: 8000
GNU_TOOLS_TAG: 10.2.1
OPENSBI_TAG: d1-wip
UBOOT_TAG: d1-wip
KERNEL_TAG: d1-wip-v5.18-rc1
volumes:
- './lichee_rv_lcd:/outport'
2 changes: 1 addition & 1 deletion kernel/xradio/modules.order
Original file line number Diff line number Diff line change
@@ -1 +1 @@
/home/tim/git/xradio/xradio_wlan.ko
/home/tim/git/d1_build/kernel/xradio/xradio_wlan.ko
2 changes: 1 addition & 1 deletion kernel/xradio/xradio_wlan.mod
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/home/tim/git/xradio/fwio.o /home/tim/git/xradio/tx.o /home/tim/git/xradio/rx.o /home/tim/git/xradio/main.o /home/tim/git/xradio/queue.o /home/tim/git/xradio/hwio.o /home/tim/git/xradio/bh.o /home/tim/git/xradio/wsm.o /home/tim/git/xradio/sta.o /home/tim/git/xradio/ap.o /home/tim/git/xradio/keys.o /home/tim/git/xradio/scan.o /home/tim/git/xradio/module.o /home/tim/git/xradio/sdio.o /home/tim/git/xradio/pm.o /home/tim/git/xradio/ht.o /home/tim/git/xradio/p2p.o
/home/tim/git/d1_build/kernel/xradio/fwio.o /home/tim/git/d1_build/kernel/xradio/tx.o /home/tim/git/d1_build/kernel/xradio/rx.o /home/tim/git/d1_build/kernel/xradio/main.o /home/tim/git/d1_build/kernel/xradio/queue.o /home/tim/git/d1_build/kernel/xradio/hwio.o /home/tim/git/d1_build/kernel/xradio/bh.o /home/tim/git/d1_build/kernel/xradio/wsm.o /home/tim/git/d1_build/kernel/xradio/sta.o /home/tim/git/d1_build/kernel/xradio/ap.o /home/tim/git/d1_build/kernel/xradio/keys.o /home/tim/git/d1_build/kernel/xradio/scan.o /home/tim/git/d1_build/kernel/xradio/module.o /home/tim/git/d1_build/kernel/xradio/sdio.o /home/tim/git/d1_build/kernel/xradio/pm.o /home/tim/git/d1_build/kernel/xradio/ht.o /home/tim/git/d1_build/kernel/xradio/p2p.o

1 change: 1 addition & 0 deletions scripts/create_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ cp /builder/Image.gz "${BOOTPOINT}/"

# install U-Boot
cp /builder/boot.scr "${BOOTPOINT}/"
cp /builder/ov_lichee_rv_mini_lcd.dtb "${BOOTPOINT}/"

umount ${BOOTPOINT}
rm -rf ${BOOTPOINT}
Expand Down

0 comments on commit 8417de7

Please sign in to comment.