1
0
Fork 0
mirror of https://github.com/hermitcore/libhermit.git synced 2025-03-09 00:00:03 +01:00

Replaced proxy-image.iso by host/VM shared mount

This commit moves most of the userspace initialization to
a new shell script in hermit/tools/init.sh

There, it also registers a new binary format for Hermit applications.
This commit is contained in:
Steffen Vogel 2016-03-30 16:07:23 +02:00
parent 4641a092d6
commit a9381b2896
5 changed files with 60 additions and 20 deletions

View file

@ -16,7 +16,13 @@ test:
@echo "Nothing to test"
qemu:
$(QEMU) -smp 10 -kernel linux/arch/x86/boot/bzImage -initrd config/initrd.cpio -append "root=/dev/ram0 rootfstype=ramfs init=init console=ttyS0" -net nic,model=rtl8139 -net user -net dump -nographic -monitor telnet:127.0.0.1:1234,server,nowait -m 8G -numa node,nodeid=0,cpus=0-4 -numa node,nodeid=1,cpus=5-9 -cdrom hermit/tools/proxy-image.iso
$(QEMU) -smp 10 -m 8G -numa node,nodeid=0,cpus=0-4 -numa node,nodeid=1,cpus=5-9 \
-kernel linux/arch/x86/boot/bzImage -initrd config/initrd.cpio \
-append "root=/dev/ram0 rootfstype=ramfs init=init console=ttyS0" \
-net nic,model=rtl8139 -net user -net dump \
-nographic -monitor telnet:127.0.0.1:1234,server,nowait \
-fsdev local,security_model=passthrough,id=fsdev0,path=$(shell realpath hermit) \
-device virtio-9p-pci,id=fs0,fsdev=fsdev0,mount_tag=hermit
clean:
make -C hermit clean

Binary file not shown.

View file

@ -643,7 +643,9 @@ CONFIG_NET_FLOW_LIMIT=y
# CONFIG_WIRELESS is not set
# CONFIG_WIMAX is not set
# CONFIG_RFKILL is not set
# CONFIG_NET_9P is not set
CONFIG_NET_9P=y
CONFIG_NET_9P_VIRTIO=y
# CONFIG_NET_9P_DEBUG is not set
# CONFIG_CAIF is not set
# CONFIG_CEPH_LIB is not set
# CONFIG_NFC is not set
@ -700,6 +702,7 @@ CONFIG_BLK_DEV=y
# CONFIG_BLK_DEV_RAM is not set
# CONFIG_CDROM_PKTCDVD is not set
# CONFIG_ATA_OVER_ETH is not set
# CONFIG_VIRTIO_BLK is not set
# CONFIG_BLK_DEV_HD is not set
# CONFIG_BLK_DEV_RBD is not set
# CONFIG_BLK_DEV_RSXX is not set
@ -843,6 +846,7 @@ CONFIG_SCSI_LOWLEVEL=y
# CONFIG_SCSI_DEBUG is not set
# CONFIG_SCSI_PMCRAID is not set
# CONFIG_SCSI_PM8001 is not set
# CONFIG_SCSI_VIRTIO is not set
# CONFIG_SCSI_DH is not set
# CONFIG_SCSI_OSD_INITIATOR is not set
CONFIG_ATA=y
@ -962,6 +966,7 @@ CONFIG_NET_CORE=y
# CONFIG_TUN is not set
# CONFIG_TUN_VNET_CROSS_LE is not set
# CONFIG_VETH is not set
# CONFIG_VIRTIO_NET is not set
# CONFIG_NLMON is not set
# CONFIG_ARCNET is not set
@ -1146,6 +1151,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y
# CONFIG_SERIAL_RP2 is not set
# CONFIG_SERIAL_FSL_LPUART is not set
CONFIG_TTY_PRINTK=y
# CONFIG_VIRTIO_CONSOLE is not set
# CONFIG_IPMI_HANDLER is not set
# CONFIG_HW_RANDOM is not set
# CONFIG_NVRAM is not set
@ -1361,11 +1367,15 @@ CONFIG_RTC_LIB=y
# CONFIG_AUXDISPLAY is not set
# CONFIG_UIO is not set
# CONFIG_VIRT_DRIVERS is not set
CONFIG_VIRTIO=y
#
# Virtio drivers
#
# CONFIG_VIRTIO_PCI is not set
CONFIG_VIRTIO_PCI=y
CONFIG_VIRTIO_PCI_LEGACY=y
# CONFIG_VIRTIO_BALLOON is not set
# CONFIG_VIRTIO_INPUT is not set
# CONFIG_VIRTIO_MMIO is not set
#
@ -1468,7 +1478,7 @@ CONFIG_EXT2_FS=y
# CONFIG_NILFS2_FS is not set
# CONFIG_F2FS_FS is not set
# CONFIG_FS_DAX is not set
# CONFIG_FS_POSIX_ACL is not set
CONFIG_FS_POSIX_ACL=y
# CONFIG_FILE_LOCKING is not set
# CONFIG_FSNOTIFY is not set
# CONFIG_DNOTIFY is not set
@ -1488,11 +1498,8 @@ CONFIG_EXT2_FS=y
#
# CD-ROM/DVD Filesystems
#
CONFIG_ISO9660_FS=y
CONFIG_JOLIET=y
# CONFIG_ZISOFS is not set
CONFIG_UDF_FS=y
CONFIG_UDF_NLS=y
# CONFIG_ISO9660_FS is not set
# CONFIG_UDF_FS is not set
#
# DOS/FAT/NT Filesystems
@ -1515,7 +1522,15 @@ CONFIG_HUGETLBFS=y
CONFIG_HUGETLB_PAGE=y
# CONFIG_CONFIGFS_FS is not set
# CONFIG_MISC_FILESYSTEMS is not set
# CONFIG_NETWORK_FILESYSTEMS is not set
CONFIG_NETWORK_FILESYSTEMS=y
# CONFIG_CEPH_FS is not set
# CONFIG_CIFS is not set
# CONFIG_NCP_FS is not set
# CONFIG_CODA_FS is not set
# CONFIG_AFS_FS is not set
CONFIG_9P_FS=y
CONFIG_9P_FS_POSIX_ACL=y
# CONFIG_9P_FS_SECURITY is not set
CONFIG_NLS=y
CONFIG_NLS_DEFAULT="iso8859-1"
# CONFIG_NLS_CODEPAGE_437 is not set

View file

@ -5,7 +5,7 @@ CC = gcc
CFLAGS = -O2 -Wall
HEXDUMP = hexdump
LDFLAGS = -lelf
PROXYFILES = proxy $(shell find ../usr/tests ../usr/benchmarks ../usr/openmpbench -type f -executable)
PROXYFILES = proxy init.sh $(shell find ../usr/tests ../usr/benchmarks ../usr/openmpbench -type f -executable)
# Prettify output
V = 0
@ -19,7 +19,7 @@ endif
@echo [CC] $@
$Q$(CC) -c $(CFLAGS) -o $@ $<
all: proxy-image.iso init.h
all: init.h proxy
init.bin: init.asm
@echo [NASM] $@
@ -31,16 +31,9 @@ init.h: init.bin
$Q$(HEXDUMP) -v -e '"0x" 1/1 "%02X" ", "' $< >> $@
$Q@echo "};" >> $@
iso:
mkdir -p iso
proxy-image.iso: iso $(PROXYFILES)
$Qcp $(PROXYFILES) iso
$Qgenisoimage -R -J -input-charset utf8 -o proxy-image.iso iso
clean:
@echo Cleaning tools
$Q$(RM) -rf *.o *~ *.bin *.obj *.h *.iso iso
$Q$(RM) -rf *.o *~ *.bin *.obj *.h
veryclean: clean
$Q$(RM) -rf iso

26
hermit/tools/init.sh Executable file
View file

@ -0,0 +1,26 @@
#!/bin/sh
PROXY=/hermit/tools/proxy
ELF_OSABI_OFFSET=7
ELF_OSABI="\\x42"
# Network
/sbin/ifconfig lo 127.0.0.1 netmask 255.0.0.0 up
/sbin/ifconfig eth0 up 10.0.2.15 netmask 255.255.255.0 up
/sbin/ifconfig mmnif up 192.168.28.1 netmask 255.255.255.0 up
/sbin/route add default gw 10.0.2.2
/bin/hostname -F /etc/hostname
echo "Network setup completed"
# Load binfmt_misc kernel module and mount pseudo FS
test -d /lib/modules && modprobe binfmt_misc
grep binfmt_misc /proc/mounts || mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc
# Register new format
echo ":hermit:M:$ELF_OSABI_OFFSET:$ELF_OSABI::$PROXY:" > /proc/sys/fs/binfmt_misc/register
# Startup completed
sleep 1 && echo -e '\n\nWelcome to HermitCore (http://www.hermitcore.org/)!'
/bin/sh