Compare commits

...

4 Commits

Author SHA1 Message Date
Jeremy Soller
4898684e3c
Increase virt ram and image address 2021-01-19 12:29:55 -07:00
Jeremy Soller
85ce01c949
Decrease filesystem size to 48MB 2021-01-19 12:28:54 -07:00
Jeremy Soller
eb3b95460f
Do not copy bootloader, kernel, or relibc to filesystem 2021-01-19 12:28:46 -07:00
Jeremy Soller
e47ba0615d
Build kernel_live for aarch64 2021-01-19 12:13:02 -07:00
5 changed files with 37 additions and 19 deletions

View File

@ -5,15 +5,16 @@ set -ex
MACHINE=virt MACHINE=virt
U_BOOT="build/u-boot/${MACHINE}.bin" U_BOOT="build/u-boot/${MACHINE}.bin"
IMAGE="build/kernel_live.uimage"
case "${MACHINE}" in case "${MACHINE}" in
raspi3) raspi3)
U_BOOT_CONFIG=rpi_3_defconfig U_BOOT_CONFIG=rpi_3_defconfig
LOAD_ADDR=0x00000000 LOAD_ADDR=0x00000000
ENTRY_ADDR=0x00001000 ENTRY_ADDR=0x00001000
IMAGE_ADDR=0x01000000 IMAGE_ADDR=0x04000000
QEMU_ARGS=( QEMU_ARGS=(
-M raspi3 -M raspi3
-device "loader,file=build/kernel.uimage,addr=${IMAGE_ADDR},force-raw=on" -device "loader,file=${IMAGE},addr=${IMAGE_ADDR},force-raw=on"
-kernel "${U_BOOT}" -kernel "${U_BOOT}"
-nographic -nographic
-serial null -serial null
@ -25,12 +26,13 @@ case "${MACHINE}" in
U_BOOT_CONFIG=qemu_arm64_defconfig U_BOOT_CONFIG=qemu_arm64_defconfig
LOAD_ADDR=0x40000000 LOAD_ADDR=0x40000000
ENTRY_ADDR=0x40001000 ENTRY_ADDR=0x40001000
IMAGE_ADDR=0x41000000 IMAGE_ADDR=0x44000000
QEMU_ARGS=( QEMU_ARGS=(
-M virt -M virt
-m 1G
-cpu cortex-a57 -cpu cortex-a57
-bios "${U_BOOT}" -bios "${U_BOOT}"
-device "loader,file=build/kernel.uimage,addr=${IMAGE_ADDR},force-raw=on" -device "loader,file=${IMAGE},addr=${IMAGE_ADDR},force-raw=on"
-nographic -nographic
-serial mon:stdio -serial mon:stdio
-s -s
@ -67,6 +69,7 @@ touch kernel/src/arch/aarch64/init/pre_kstart/early_init.S
make build/kernel make build/kernel
make build/initfs.tag make build/initfs.tag
make build/filesystem.bin make build/filesystem.bin
make build/kernel_live
mkimage \ mkimage \
-A arm64 \ -A arm64 \
@ -76,8 +79,7 @@ mkimage \
-a "${LOAD_ADDR}" \ -a "${LOAD_ADDR}" \
-e "${ENTRY_ADDR}" \ -e "${ENTRY_ADDR}" \
-n "Redox kernel (qemu AArch64 ${MACHINE})" \ -n "Redox kernel (qemu AArch64 ${MACHINE})" \
-d build/kernel \ -d build/kernel_live \
build/kernel.uimage "${IMAGE}"
qemu-system-aarch64 "${QEMU_ARGS[@]}" "$@" qemu-system-aarch64 "${QEMU_ARGS[@]}" "$@"

View File

@ -7,7 +7,7 @@ prompt = false
# Package settings # Package settings
[packages] [packages]
drivers = {} #drivers = {}
init = {} init = {}
nulld = {} nulld = {}
#pciids = {} #pciids = {}
@ -21,15 +21,21 @@ path="/etc/init.rc"
data=""" data="""
export PATH /bin export PATH /bin
export TMPDIR /tmp export TMPDIR /tmp
stdio debug:
echo Post stdio!
nulld nulld
echo Post nulld!
zerod zerod
echo Post zerod!
randd randd
vesad T T G echo Post randd!
stdio display:1 # vesad T T G
ps2d us # ps2d us
ramfs logging ramfs logging
pcid /etc/pcid/initfs.toml echo Post ramfs!
# pcid /etc/pcid/initfs.toml
redoxfs disk/live: file redoxfs disk/live: file
echo Post redoxfs!
cd file: cd file:
export PATH file:/bin export PATH file:/bin
run.d /etc/init.d run.d /etc/init.d

View File

@ -8,7 +8,7 @@ INSTALLER_FLAGS?=--cookbook=cookbook
## Enabled to use binary prefix (much faster) ## Enabled to use binary prefix (much faster)
PREFIX_BINARY?=1 PREFIX_BINARY?=1
## Filesystem size in MB (256 is the default) ## Filesystem size in MB (256 is the default)
FILESYSTEM_SIZE?=256 FILESYSTEM_SIZE?=48
# Per host variables # Per host variables
UNAME := $(shell uname) UNAME := $(shell uname)

View File

@ -10,11 +10,11 @@ build/filesystem.bin: filesystem.toml build/bootloader build/kernel prefix
redoxfs/target/release/redoxfs $@.partial build/filesystem/ redoxfs/target/release/redoxfs $@.partial build/filesystem/
sleep 2 sleep 2
pgrep redoxfs pgrep redoxfs
cp $< build/filesystem/filesystem.toml # TODO aarch64: cp $< build/filesystem/filesystem.toml
cp build/bootloader build/filesystem/bootloader # TODO aarch64: cp build/bootloader build/filesystem/bootloader
cp build/kernel build/filesystem/kernel # TODO aarch64: cp build/kernel build/filesystem/kernel
cp -r $(ROOT)/$(PREFIX_INSTALL)/$(TARGET)/include build/filesystem/include # TODO aarch64: cp -r $(ROOT)/$(PREFIX_INSTALL)/$(TARGET)/include build/filesystem/include
cp -r $(ROOT)/$(PREFIX_INSTALL)/$(TARGET)/lib build/filesystem/lib # TODO aarch64: cp -r $(ROOT)/$(PREFIX_INSTALL)/$(TARGET)/lib build/filesystem/lib
$(INSTALLER) -c $< build/filesystem/ $(INSTALLER) -c $< build/filesystem/
sync sync
-$(FUMOUNT) build/filesystem/ || true -$(FUMOUNT) build/filesystem/ || true

View File

@ -34,10 +34,20 @@ build/kernel_live: kernel/linkers/$(ARCH).ld build/libkernel_live.a build/live.o
$(OBJCOPY) --only-keep-debug $@ $@.sym && \ $(OBJCOPY) --only-keep-debug $@ $@.sym && \
$(OBJCOPY) --strip-debug $@ $(OBJCOPY) --strip-debug $@
build/live.o: build/filesystem.bin
#TODO: More general use of $(ARCH) #TODO: More general use of $(ARCH)
ifeq ($(ARCH),aarch64)
build/live.o: build/filesystem.bin
export PATH="$(PREFIX_PATH):$$PATH" && \
$(OBJCOPY) -I binary -O elf64-littleaarch64 -B aarch64 $< $@ \
--redefine-sym _binary_build_filesystem_bin_start=__live_start \
--redefine-sym _binary_build_filesystem_bin_end=__live_end \
--redefine-sym _binary_build_filesystem_bin_size=__live_size
endif
ifeq ($(ARCH),x86_64)
build/live.o: build/filesystem.bin
export PATH="$(PREFIX_PATH):$$PATH" && \ export PATH="$(PREFIX_PATH):$$PATH" && \
$(OBJCOPY) -I binary -O elf64-x86-64 -B i386:x86-64 $< $@ \ $(OBJCOPY) -I binary -O elf64-x86-64 -B i386:x86-64 $< $@ \
--redefine-sym _binary_build_filesystem_bin_start=__live_start \ --redefine-sym _binary_build_filesystem_bin_start=__live_start \
--redefine-sym _binary_build_filesystem_bin_end=__live_end \ --redefine-sym _binary_build_filesystem_bin_end=__live_end \
--redefine-sym _binary_build_filesystem_bin_size=__live_size --redefine-sym _binary_build_filesystem_bin_size=__live_size
endif