forked from antmicro/renode-linux-runner-action
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Separates initramfs and rootfs (antmicro#26)
- adds two phases of compilation: first initramfs + kernel + bootloader, second: rootfs + tools (python, git, pip, ...) - speeds up Linux boot time to a few seconds - more flexible approach: adding new tools to rootfs will not significantly increase boot time
- Loading branch information
1 parent
7dd0d00
commit 8e2a17b
Showing
12 changed files
with
229 additions
and
50 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
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
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
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,48 @@ | ||
CONFIG_LINUXRC=n | ||
CONFIG_FEATURE_INIT_QUIET=n | ||
|
||
# disable unnecessary modules in initramfs environment | ||
|
||
# editors | ||
|
||
CONFIG_AWK=n | ||
CONFIG_CMP=n | ||
CONFIG_DIFF=n | ||
CONFIG_PATCH=n | ||
CONFIG_SED=n | ||
CONFIG_VI=n | ||
|
||
# finding utilities | ||
CONFIG_FIND=n | ||
CONFIG_GREP=n | ||
CONFIG_EGREP=n | ||
CONFIG_FGREP=n | ||
CONFIG_XARGS=n | ||
|
||
# user management | ||
|
||
CONFIG_ADDGROUP=n | ||
CONFIG_ADDUSER=n | ||
CONFIG_DELUSER=n | ||
CONFIG_DELGROUP=n | ||
|
||
# process management | ||
|
||
CONFIG_FREE=n | ||
CONFIG_FUSER=n | ||
CONFIG_KILL=n | ||
CONFIG_KILLALL=n | ||
CONFIG_KILLALL5=n | ||
CONFIG_LSOF=n | ||
CONFIG_PIDOF=n | ||
CONFIG_PS=n | ||
CONFIG_BB_SYSCTL=n | ||
CONFIG_TOP=n | ||
CONFIG_UPTIME=n | ||
CONFIG_WATCH=n | ||
|
||
# networking | ||
|
||
CONFIG_FEATURE_IPV6=n | ||
CONFIG_ARP=n | ||
CONFIG_IFCONFIG=n |
38 changes: 38 additions & 0 deletions
38
br2-external/patches/linux/0003-adds-second-virtio-device-for-user-data.patch
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,38 @@ | ||
From 502c5511e5f214da0d12862022f808929ca42a10 Mon Sep 17 00:00:00 2001 | ||
From: Wiktor Ogrodnik <wogrodnik@internships.antmicro.com> | ||
Date: Thu, 27 Apr 2023 14:54:46 +0200 | ||
Subject: [PATCH 3/3] adds second virtio device for user data | ||
|
||
--- | ||
arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts | 11 +++++++++-- | ||
1 file changed, 9 insertions(+), 2 deletions(-) | ||
|
||
diff --git a/arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts b/arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts | ||
index 15e528335102..295c70ba0296 100644 | ||
--- a/arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts | ||
+++ b/arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts | ||
@@ -29,12 +29,19 @@ memory@80000000 { | ||
}; | ||
|
||
soc { | ||
- virtio@100d0000 { | ||
+ virtio@100d0000 { | ||
compatible = "virtio,mmio"; | ||
reg = <0x00 0x100d0000 0x00 0x150>; | ||
interrupt-parent = <&plic0>; | ||
interrupts = <50>; | ||
- }; | ||
+ }; | ||
+ | ||
+ virtio@100d0200 { | ||
+ compatible = "virtio,mmio"; | ||
+ reg = <0x00 0x100d0200 0x00 0x150>; | ||
+ interrupt-parent = <&plic0>; | ||
+ interrupts = <49>; | ||
+ }; | ||
}; | ||
|
||
hfclk: hfclk { | ||
-- | ||
2.30.2 | ||
|
Empty file.
11 changes: 11 additions & 0 deletions
11
br2-external/rootfs/board/sifive/hifive-unleashed/genimage_sdcard.cfg
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,11 @@ | ||
image sdcard.img { | ||
hdimage { | ||
partition-table-type = "gpt" | ||
} | ||
|
||
partition rootfs { | ||
image = "rootfs.ext4" | ||
partition-type-uuid = 0fc63daf-8483-4772-8e79-3d69d8477de4 | ||
bootable = true | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
br2-external/rootfs/board/sifive/hifive-unleashed/post-image.sh
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,18 @@ | ||
#!/bin/sh | ||
|
||
# Repack rootfs to the ext4 image | ||
|
||
PATH=/usr/sbin:$PATH | ||
|
||
cd output/images | ||
|
||
# Clear previous images | ||
|
||
[ -f rootfs ] && rm -rf rootfs | ||
[ -e rootfs.img ] && rm -f rootfs.img | ||
|
||
mkdir -p rootfs | ||
tar -xf rootfs.tar --directory rootfs | ||
|
||
truncate rootfs.img -s 120M | ||
mkfs.ext4 -d rootfs rootfs.img |
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,58 @@ | ||
# CCACHE | ||
|
||
BR2_CCACHE=y | ||
|
||
# Architecture | ||
BR2_riscv=y | ||
BR2_riscv_custom=y | ||
BR2_RISCV_ISA_CUSTOM_RVM=y | ||
BR2_RISCV_ISA_CUSTOM_RVF=y | ||
BR2_RISCV_ISA_CUSTOM_RVD=y | ||
BR2_RISCV_ISA_CUSTOM_RVC=y | ||
BR2_RISCV_64=y | ||
BR2_RISCV_ABI_LP64D=y | ||
|
||
# System | ||
BR2_SYSTEM_DHCP="eth0" | ||
BR2_TARGET_GENERIC_GETTY=y | ||
BR2_TARGET_GENERIC_GETTY_PORT="ttySIF0" | ||
BR2_ROOTFS_POST_IMAGE_SCRIPT="${BR2_EXTERNAL_SIFIVE_RENODE_CI_ROOTFS_PATH}/board/sifive/hifive-unleashed/post-image.sh" | ||
|
||
# Linux headers same as kernel, a 5.10 series | ||
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_10=y | ||
|
||
# Kernel | ||
BR2_LINUX_KERNEL=n | ||
|
||
# Bootloader | ||
BR2_TARGET_OPENSBI=n | ||
BR2_TARGET_UBOOT=n | ||
|
||
# Host tools | ||
BR2_PACKAGE_HOST_GENIMAGE=n | ||
BR2_PACKAGE_HOST_UBOOT_TOOLS=n | ||
|
||
# Packages | ||
|
||
# video4linux packages | ||
BR2_PACKAGE_LIBV4L=y | ||
BR2_PACKAGE_LIBV4L_UTILS=y | ||
|
||
# python | ||
BR2_PACKAGE_PYTHON3=y | ||
BR2_PACKAGE_PYTHON_PIP=y | ||
|
||
# git | ||
BR2_PACKAGE_GIT=y | ||
BR2_PACKAGE_GIT_CRYPT=y | ||
BR2_PACKAGE_OPENSSL=y | ||
BR2_PACKAGE_LIBCURL=y | ||
BR2_PACKAGE_LIBCURL_CURL=y | ||
BR2_PACKAGE_CA_CERTIFICATES=y | ||
|
||
# gpio packages | ||
BR2_PACKAGE_LIBGPIOD=y | ||
BR2_PACKAGE_LIBGPIOD_TOOLS=y | ||
|
||
# i2c packages | ||
BR2_PACKAGE_I2C_TOOLS=y |
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,2 @@ | ||
name: SIFIVE_RENODE_CI_ROOTFS | ||
desc: Linux embedded instance for use in github actions |
Empty file.
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 |
---|---|---|
@@ -1,16 +1,39 @@ | ||
#!/bin/sh | ||
|
||
mkdir -p images | ||
git clone --branch 2022.11.3 https://github.com/buildroot/buildroot buildroot | ||
|
||
cd buildroot && \ | ||
make BR2_EXTERNAL=../br2-external hifive_unleashed_defconfig && \ | ||
cd buildroot | ||
|
||
# Set configuration for initramfs | ||
|
||
make BR2_EXTERNAL=../br2-external hifive_unleashed_defconfig | ||
make -j$(nproc) | ||
|
||
cd .. | ||
mkdir -p images | ||
|
||
for i in hifive-unleashed-a00.dtb fw_payload.elf Image rootfs.cpio; do | ||
cp buildroot/output/images/$i images; | ||
cp buildroot/output/images/$i images | ||
done | ||
|
||
# Clear only target binaries, do not delete host toolchain that will be used again | ||
# More info: https://stackoverflow.com/questions/47320800/how-to-clean-only-target-in-buildroot | ||
|
||
cd buildroot | ||
|
||
rm -rf output/target | ||
find output/ -name ".stamp_target_installed" -delete | ||
rm -f output/build/host-gcc-final-*/.stamp_host_installed | ||
|
||
|
||
# Set configuration for rootfs | ||
|
||
make BR2_EXTERNAL=../br2-external/rootfs hifive_unleashed_defconfig | ||
make -j$(nproc) | ||
|
||
cd .. | ||
|
||
cp buildroot/output/images/rootfs.img images | ||
rm -rf buildroot | ||
|
||
tar cJvf images.tar.xz images |