diff --git a/default.nix b/default.nix index baee912b..1edc3fb0 100644 --- a/default.nix +++ b/default.nix @@ -88,13 +88,13 @@ let # FSBL startup fsbl-sd = pkgs.runCommand "zc706-${variant}-fsbl-sd" { - buildInputs = [ mkbootimage ]; + buildInputs = [ mkbootimage zc706-fsbl]; } '' # TODO: use self-built fsbl bifdir=`mktemp -d` cd $bifdir - ln -s ${./fsbl.elf} fsbl.elf + ln -s ${zc706-fsbl}/fsbl.elf fsbl.elf ln -s ${gateware}/top.bit top.bit ln -s ${firmware}/runtime.elf runtime.elf cat > boot.bif << EOF diff --git a/fsbl.elf b/fsbl.elf deleted file mode 100644 index e57257d6..00000000 Binary files a/fsbl.elf and /dev/null differ diff --git a/fsbl.nix b/fsbl.nix index 06397aff..2acd272d 100644 --- a/fsbl.nix +++ b/fsbl.nix @@ -10,6 +10,7 @@ pkgs.stdenv.mkDerivation { rev = "65c849ed46c88c67457e1fc742744f96db968ff1"; sha256 = "1rvl06ha40dzd6s9aa4sylmksh4xb9dqaxq462lffv1fdk342pda"; }; + patches = [ ./fsbl.patch ]; nativeBuildInputs = [ pkgs.gnumake gnutoolchain.binutils @@ -17,13 +18,14 @@ pkgs.stdenv.mkDerivation { ]; patchPhase = '' + patch -p1 -i ${./fsbl.patch} patchShebangs lib/sw_apps/zynq_fsbl/misc/copy_bsp.sh echo 'SEARCH_DIR("${gnutoolchain.newlib}/arm-none-eabi/lib");' >> lib/sw_apps/zynq_fsbl/src/lscript.ld ''; buildPhase = '' cd lib/sw_apps/zynq_fsbl/src - make BOARD=${board} + make BOARD=${board} "CFLAGS=-DFSBL_DEBUG_INFO -g" ''; installPhase = '' diff --git a/fsbl.patch b/fsbl.patch new file mode 100644 index 00000000..2537177c --- /dev/null +++ b/fsbl.patch @@ -0,0 +1,31 @@ +diff --git a/lib/sw_apps/zynq_fsbl/src/Makefile b/lib/sw_apps/zynq_fsbl/src/Makefile +index 0e3ccdf1c5..a5b02f386e 100644 +--- a/lib/sw_apps/zynq_fsbl/src/Makefile ++++ b/lib/sw_apps/zynq_fsbl/src/Makefile +@@ -71,11 +71,14 @@ endif + all: $(EXEC) + + $(EXEC): $(LIBS) $(OBJS) $(INCLUDES) +- cp $(BSP_DIR)/$(BOARD)/ps7_init.* . + $(LINKER) $(LD1FLAGS) -o $@ $(OBJS) $(LDFLAGS) + rm -rf $(OBJS) +- +- ++ ++.PHONY: ps7_init ++ ++ps7_init: ++ cp $(BSP_DIR)/$(BOARD)/ps7_init.* . ++ + $(LIBS): + echo "Copying BSP files" + $(BSP_DIR)/copy_bsp.sh $(BOARD) $(CC) +@@ -86,7 +89,7 @@ $(LIBS): + make -C $(BSP_DIR) -k all "CC=armcc" "AR=armar" "C_FLAGS= -O2 -c" "EC_FLAGS=--debug --wchar32"; \ + fi; + +-%.o:%.c ++%.o:%.c ps7_init + $(CC) $(CC_FLAGS) $(CFLAGS) $(ECFLAGS) -c $< -o $@ $(INCLUDEPATH) + + %.o:%.S