mirror of
https://github.com/tailix/mrubyvisor.git
synced 2024-11-11 13:50:47 -05:00
Build drivers
This commit is contained in:
parent
9feb7c884d
commit
42c7bbbbcf
2 changed files with 32 additions and 9 deletions
25
Makefile
25
Makefile
|
@ -33,12 +33,16 @@ DEST_DIR = dest
|
|||
IMAGE = image.iso
|
||||
ROOTFS_DIR = rootfs
|
||||
SRC_DIR = src
|
||||
|
||||
# Basic paths (dependencies)
|
||||
LIBKERNAUX_DIR = vendor/libkernaux
|
||||
DRIVERS_DIR = vendor/drivers
|
||||
MRUBY_DIR = vendor/mruby
|
||||
|
||||
# Deeper paths
|
||||
INCLUDE_DIR = $(DEST_DIR)/include
|
||||
LIB_DIR = $(DEST_DIR)/lib
|
||||
LIBDRIVERS = $(LIB_DIR)/libdrivers.a
|
||||
LIBKERNAUX = $(LIB_DIR)/libkernaux.a
|
||||
LIBMRUBY = $(LIB_DIR)/libmruby.a
|
||||
GRUBCFG = $(ROOTFS_DIR)/boot/grub/grub.cfg
|
||||
|
@ -56,6 +60,16 @@ LIBKERNAUX_ARGS = \
|
|||
--with-drivers \
|
||||
--with-libc
|
||||
|
||||
###########
|
||||
# drivers #
|
||||
###########
|
||||
|
||||
DRIVERS_CFLAGS = \
|
||||
-nostdlib \
|
||||
-ffreestanding \
|
||||
-fno-pic \
|
||||
-fno-stack-protector
|
||||
|
||||
#########
|
||||
# mruby #
|
||||
#########
|
||||
|
@ -91,6 +105,9 @@ clean-dest:
|
|||
clean-mruby:
|
||||
cd $(MRUBY_DIR) && $(RAKE) clean
|
||||
|
||||
clean-drivers:
|
||||
$(MAKE) -C $(DRIVERS_DIR) distclean || true
|
||||
|
||||
clean-libkernaux:
|
||||
$(MAKE) -C $(LIBKERNAUX_DIR) distclean || true
|
||||
|
||||
|
@ -101,7 +118,7 @@ clean-libkernaux:
|
|||
$(IMAGE): $(GRUBCFG) $(MRUBYVISOR)
|
||||
$(GRUB_MKRESCUE) $(ROOTFS_DIR) -o $@
|
||||
|
||||
$(MRUBYVISOR): $(LIBKERNAUX) $(LIBMRUBY)
|
||||
$(MRUBYVISOR): $(LIBKERNAUX) $(LIBDRIVERS) $(LIBMRUBY)
|
||||
$(MAKE) -C $(SRC_DIR) mrubyvisor.multiboot2 CCPREFIX='$(CCPREFIX)' DEST='$(ABS_REPO)/$(DEST_DIR)' MRUBY_FLAGS='$(MRUBY_FLAGS)'
|
||||
$(CP) $(SRC_DIR)/mrubyvisor.multiboot2 $@
|
||||
|
||||
|
@ -111,6 +128,12 @@ $(LIBKERNAUX):
|
|||
cd $(LIBKERNAUX_DIR) && $(MAKE)
|
||||
cd $(LIBKERNAUX_DIR) && $(MAKE) install
|
||||
|
||||
$(LIBDRIVERS):
|
||||
cd $(DRIVERS_DIR) && ./autogen.sh
|
||||
cd $(DRIVERS_DIR) && ./configure --host='i386-elf' --prefix='$(ABS_REPO)/$(DEST_DIR)' CFLAGS='$(DRIVERS_CFLAGS)' AR='$(AR)' AS='$(AS)' CC='$(CC)' LD='$(LD)' RANLIB='$(RANLIB)'
|
||||
cd $(DRIVERS_DIR) && $(MAKE)
|
||||
cd $(DRIVERS_DIR) && $(MAKE) install
|
||||
|
||||
$(LIBMRUBY): $(LIBKERNAUX) $(MRUBY_CONF)
|
||||
$(MAKE) clean-mruby
|
||||
$(MKDIR) -p $(INCLUDE_DIR) $(LIB_DIR)
|
||||
|
|
|
@ -35,7 +35,7 @@ clean:
|
|||
rm -f $(MRUBYVISOR) $(OBJS)
|
||||
|
||||
$(MRUBYVISOR): $(OBJS)
|
||||
$(CC) -T linker.ld -o $@ $^ -ffreestanding -nostdlib -lmruby -lkernaux -lc -lgcc -Wl,-L$(DEST)/lib
|
||||
$(CC) -T linker.ld -o $@ $^ -ffreestanding -nostdlib -lmruby -ldrivers -lkernaux -lc -lgcc -Wl,-L$(DEST)/lib
|
||||
grub-file --is-x86-multiboot2 $@
|
||||
|
||||
%.c.o: %.c
|
||||
|
|
Loading…
Reference in a new issue