From f05aaa0561e071a54785ae7dfae3d8a34c9df06a Mon Sep 17 00:00:00 2001 From: Kimplul Date: Sat, 21 Aug 2021 23:23:30 +0300 Subject: Updated build system with run command --- arch/riscv/conf/apos.its | 31 +++++++++++++++++++++++++++++++ arch/riscv/conf/boot.cmd | 2 ++ arch/riscv/conf/kernel.its | 34 ---------------------------------- arch/riscv/conf/mkimage.sh | 28 ++++++++++++++++++++++++++++ arch/riscv/conf/rmimage.sh | 9 +++++++++ arch/riscv/conf/rootfs.fd | 9 +++++++++ arch/riscv/source.mk | 4 ++++ 7 files changed, 83 insertions(+), 34 deletions(-) create mode 100644 arch/riscv/conf/apos.its create mode 100644 arch/riscv/conf/boot.cmd delete mode 100644 arch/riscv/conf/kernel.its create mode 100755 arch/riscv/conf/mkimage.sh create mode 100755 arch/riscv/conf/rmimage.sh create mode 100644 arch/riscv/conf/rootfs.fd (limited to 'arch/riscv') diff --git a/arch/riscv/conf/apos.its b/arch/riscv/conf/apos.its new file mode 100644 index 0000000..c3611dd --- /dev/null +++ b/arch/riscv/conf/apos.its @@ -0,0 +1,31 @@ +/dts-v1/; + +/ { + description = "FUCK"; +#address-cells = <1>; + + images { + kernel { + description = "Garbaggio"; + data = /incbin/("../../../apos.bin"); + type = "kernel"; + arch = "riscv"; + os = "apos"; + compression = "none"; + load = <0x83800000>; + entry = <0x83800000>; + hash-1 { + algo = "sha1"; + }; + }; + }; + + configurations { + default = "config"; + + config { + description = "Default configuration"; + kernel = "kernel"; + }; + }; +}; diff --git a/arch/riscv/conf/boot.cmd b/arch/riscv/conf/boot.cmd new file mode 100644 index 0000000..ddbc319 --- /dev/null +++ b/arch/riscv/conf/boot.cmd @@ -0,0 +1,2 @@ +fatload ${devtype} ${devnum} ${kernel_addr_r} apos.itb +bootm ${kernel_addr_r} diff --git a/arch/riscv/conf/kernel.its b/arch/riscv/conf/kernel.its deleted file mode 100644 index f984d40..0000000 --- a/arch/riscv/conf/kernel.its +++ /dev/null @@ -1,34 +0,0 @@ -/dts-v1/; - -/ { - description = "FUCK"; -#address-cells = <1>; - - images { - kernel { - description = "My default kenel"; - data = /incbin/("kernel.bin"); - type = "kernel"; - arch = "riscv"; - os = "apos"; - compression = "none"; - load = <0x83800000>; - entry = <0x83800000>; - hash-1 { - algo = "md5"; - }; - }; - - }; - - configurations { - default = "config"; - - config { - description = "Default configuration"; - kernel = "kernel"; - }; - - - }; -}; diff --git a/arch/riscv/conf/mkimage.sh b/arch/riscv/conf/mkimage.sh new file mode 100755 index 0000000..31abb8e --- /dev/null +++ b/arch/riscv/conf/mkimage.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +if [ ! -e fs ]; then + mkdir fs +fi + +if [ ! -e rootfs.img ]; then + virt-make-fs --partition=mbr --type=vfat --size=10M fs rootfs.img +fi + + +SSIZE=$(fdisk -l rootfs.img | awk '$1=="Units:" {print $8}') +OFFSET=$(fdisk -l rootfs.img | awk '$1=="rootfs.img1" {print $2}') +mount -o loop,offset=$((${SSIZE}*${OFFSET})) rootfs.img fs + +../u-boot-apos/tools/mkimage -f arch/riscv/conf/apos.its fs/apos.itb +../u-boot-apos/tools/mkimage -A riscv -O apos -T script \ + -d arch/riscv/conf/boot.cmd fs/boot.scr + +umount -l fs + +qemu-system-riscv64 -machine virt \ + -kernel ../u-boot-apos/u-boot \ + -bios /usr/lib/riscv64-linux-gnu/opensbi/generic/fw_jump.elf \ + -device virtio-blk-device,drive=hd0 \ + -drive file=rootfs.img,format=raw,id=hd0 \ + -S -s -m 2G \ + -serial stdio diff --git a/arch/riscv/conf/rmimage.sh b/arch/riscv/conf/rmimage.sh new file mode 100755 index 0000000..8d6457f --- /dev/null +++ b/arch/riscv/conf/rmimage.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +if [ -e fs ]; then + rm -r fs +fi + +if [ -e rootfs.img ]; then + rm rootfs.img +fi diff --git a/arch/riscv/conf/rootfs.fd b/arch/riscv/conf/rootfs.fd new file mode 100644 index 0000000..59fb5f8 --- /dev/null +++ b/arch/riscv/conf/rootfs.fd @@ -0,0 +1,9 @@ +label: gpt +label-id: DBD1F99F-BFA3-D448-828F-0B505DF81F17 +device: rootfs.img +unit: sectors +first-lba: 2048 +last-lba: 20446 +sector-size: 512 + +rootfs.img1 : start= 2048, size= 18399, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=B129DB0D-F225-5C48-AA6D-DD8C049FA72C diff --git a/arch/riscv/source.mk b/arch/riscv/source.mk index 626ecd2..fb645f7 100644 --- a/arch/riscv/source.mk +++ b/arch/riscv/source.mk @@ -3,3 +3,7 @@ KERNEL_SOURCES += $(KERNEL_LOCAL) INIT_LOCAL != echo arch/riscv/init/*.[cS] INIT_SOURCES += $(INIT_LOCAL) + +CLEANUP_CMD := ./arch/riscv/conf/rmimage.sh +run: + ./arch/riscv/conf/mkimage.sh -- cgit v1.3