mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-30 00:23:24 +00:00
Add ldconfig to initramfs
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
86f09eef75
commit
d499c1592d
2
Makefile
2
Makefile
@ -46,7 +46,7 @@ endif
|
|||||||
|
|
||||||
# If the BENCHMARK is set, we will run the benchmark in the kernel mode.
|
# If the BENCHMARK is set, we will run the benchmark in the kernel mode.
|
||||||
ifneq ($(BENCHMARK), none)
|
ifneq ($(BENCHMARK), none)
|
||||||
CARGO_OSDK_ARGS += --init-args="/benchmark/$(BENCHMARK)/run.sh"
|
CARGO_OSDK_ARGS += --init-args="/benchmark/common/runner.sh $(BENCHMARK)"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(RELEASE_LTO), 1)
|
ifeq ($(RELEASE_LTO), 1)
|
||||||
|
@ -13,7 +13,6 @@ INITRAMFS_IMAGE := $(BUILD_DIR)/initramfs.cpio.gz
|
|||||||
EXT2_IMAGE := $(BUILD_DIR)/ext2.img
|
EXT2_IMAGE := $(BUILD_DIR)/ext2.img
|
||||||
EXFAT_IMAGE := $(BUILD_DIR)/exfat.img
|
EXFAT_IMAGE := $(BUILD_DIR)/exfat.img
|
||||||
INITRAMFS_EMPTY_DIRS := \
|
INITRAMFS_EMPTY_DIRS := \
|
||||||
$(INITRAMFS)/sbin \
|
|
||||||
$(INITRAMFS)/root \
|
$(INITRAMFS)/root \
|
||||||
$(INITRAMFS)/tmp \
|
$(INITRAMFS)/tmp \
|
||||||
$(INITRAMFS)/opt \
|
$(INITRAMFS)/opt \
|
||||||
@ -26,6 +25,7 @@ INITRAMFS_ALL_DIRS := \
|
|||||||
$(INITRAMFS)/lib/x86_64-linux-gnu \
|
$(INITRAMFS)/lib/x86_64-linux-gnu \
|
||||||
$(INITRAMFS)/lib64 \
|
$(INITRAMFS)/lib64 \
|
||||||
$(INITRAMFS)/bin \
|
$(INITRAMFS)/bin \
|
||||||
|
$(INITRAMFS)/sbin \
|
||||||
$(INITRAMFS)/usr/bin \
|
$(INITRAMFS)/usr/bin \
|
||||||
$(INITRAMFS)/test \
|
$(INITRAMFS)/test \
|
||||||
$(INITRAMFS)/benchmark \
|
$(INITRAMFS)/benchmark \
|
||||||
@ -82,6 +82,11 @@ $(INITRAMFS)/bin:
|
|||||||
@mkdir -p $@
|
@mkdir -p $@
|
||||||
@/bin/busybox --install -s $@
|
@/bin/busybox --install -s $@
|
||||||
|
|
||||||
|
$(INITRAMFS)/sbin:
|
||||||
|
@mkdir -p $@
|
||||||
|
@cp /sbin/ldconfig $@
|
||||||
|
@cp /sbin/ldconfig.real $@
|
||||||
|
|
||||||
$(INITRAMFS)/usr/bin: | $(INITRAMFS)/bin
|
$(INITRAMFS)/usr/bin: | $(INITRAMFS)/bin
|
||||||
@mkdir -p $@
|
@mkdir -p $@
|
||||||
@cp /usr/bin/busybox $@
|
@cp /usr/bin/busybox $@
|
||||||
|
45
test/benchmark/common/runner.sh
Executable file
45
test/benchmark/common/runner.sh
Executable file
@ -0,0 +1,45 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# SPDX-License-Identifier: MPL-2.0
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
print_help() {
|
||||||
|
echo "Usage: $0 bench_name"
|
||||||
|
echo ""
|
||||||
|
echo "The bench_name argument must be one of the directory under asterinas/test/benchmark/".
|
||||||
|
}
|
||||||
|
|
||||||
|
BENCH_NAME=$1
|
||||||
|
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
|
||||||
|
|
||||||
|
# Validate arguments
|
||||||
|
check_bench_name() {
|
||||||
|
if [ -z "${BENCH_NAME}" ]; then
|
||||||
|
echo "Error: No directory provided."
|
||||||
|
print_help
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local full_path="${SCRIPT_DIR}/../${BENCH_NAME}"
|
||||||
|
|
||||||
|
if ! [ -d "${full_path}" ]; then
|
||||||
|
echo "Directory '${BENCH_NAME}' does not exist in the script directory."
|
||||||
|
print_help
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
check_bench_name
|
||||||
|
|
||||||
|
BENCH_SCRIPT=${SCRIPT_DIR}/../${BENCH_NAME}/run.sh
|
||||||
|
|
||||||
|
# Prepare the environment
|
||||||
|
if [ ! -d /tmp ]; then
|
||||||
|
mkdir /tmp
|
||||||
|
fi
|
||||||
|
/sbin/ldconfig
|
||||||
|
chmod +x ${BENCH_SCRIPT}
|
||||||
|
|
||||||
|
# Run the benchmark
|
||||||
|
${BENCH_SCRIPT}
|
@ -6,8 +6,5 @@ set -e
|
|||||||
|
|
||||||
echo "*** Running the LMbench exec latency test ***"
|
echo "*** Running the LMbench exec latency test ***"
|
||||||
|
|
||||||
if [ ! -d /tmp ]; then
|
|
||||||
mkdir /tmp
|
|
||||||
fi
|
|
||||||
cp /benchmark/bin/lmbench/hello /tmp/
|
cp /benchmark/bin/lmbench/hello /tmp/
|
||||||
/benchmark/bin/lmbench/lat_proc -P 1 exec
|
/benchmark/bin/lmbench/lat_proc -P 1 exec
|
@ -6,8 +6,5 @@ set -e
|
|||||||
|
|
||||||
echo "*** Running the LMbench shell latency test ***"
|
echo "*** Running the LMbench shell latency test ***"
|
||||||
|
|
||||||
if [ ! -d /tmp ]; then
|
|
||||||
mkdir /tmp
|
|
||||||
fi
|
|
||||||
cp /benchmark/bin/lmbench/hello /tmp/
|
cp /benchmark/bin/lmbench/hello /tmp/
|
||||||
/benchmark/bin/lmbench/lat_proc -P 1 shell
|
/benchmark/bin/lmbench/lat_proc -P 1 shell
|
Reference in New Issue
Block a user