Skip to contentSkip to conversation

write option roms in pc-bios/

PATCH Paolo Bonzini 2 participants 2 messages Jan 8, 2010 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

This will wreak havoc on the tree since these are built by default and they are replacing files in revision control.

... the next question is why are they (linuxboot.bin and multiboot.bin) in revision control since they do not require any strange tool to be built.

They require an i386 cross compiler, which is not available on all installations.

Quoted 7 lines
Quoted 3 lines

They are being built always anyway now, since their target pc-bios/optionrom/linuxboot.bin does not exist on a checked out tree or even a release tree. But no one has complained.

They are only built on i386 and x86_64 hosts, look at the configure script. We should continue providing all the ROM binaries, even the x86 ones.

Oops, my bad. :-( The only reason I see against my patch is that the option ROMS do not change that often; maybe I felt that it should be done different only because I screwed up and I'm blaming the code instead of myself. There is also the problem that they are not built on Darwin and Solaris, which is possibly even worse.

What about adding to version control a stamp file and using it to avoid useless changes to pc-bios/*.bin? Such as overwriting the .bin files only when the .S file changes. Something like the attached patch.

Paolo

Quoted 1 line

From 4c76452f62099f5b003a4e4416523ef6c0b141ed Mon Sep 17 00:00:00 2001

From: Paolo Bonzini <[email protected]>
Date: Fri, 8 Jan 2010 11:04:23 +0100
Subject: [PATCH] update option rom files in pc-bios/ when they change

Some care has to be taken to avoid spurious updates. So, the source code's SHA1 checksum is stored in a file and this file is used to drive the automatic update of pc-bios/{linuxboot,multiboot}.bin.

---

 create mode 100644 pc-bios/optionrom/.gitattributes
 create mode 100644 pc-bios/optionrom/linuxboot.stamp
 create mode 100644 pc-bios/optionrom/multiboot.stamp
.gitignore +3 -0
index d7d2146..6860122 100644
@@ -47,6 +47,9 @@ patches
 pc-bios/bios-pq/status
 pc-bios/vgabios-pq/status
 pc-bios/optionrom/linuxboot.bin
+pc-bios/optionrom/linuxboot.img
+pc-bios/optionrom/linuxboot.raw
 pc-bios/optionrom/multiboot.bin
+pc-bios/optionrom/multiboot.img
 pc-bios/optionrom/multiboot.raw
 .stgit-*
pc-bios/optionrom/Makefile +13 -1
index 54db882..16a291a 100644
@@ -13,7 +13,8 @@ CFLAGS += -I$(SRC_PATH)
 CFLAGS += $(call cc-option, $(CFLAGS), -fno-stack-protector)
 QEMU_CFLAGS = $(CFLAGS)
 
-build-all: multiboot.bin linuxboot.bin
+build-all: multiboot.stamp linuxboot.stamp
+.SECONDARY:
 
 %.img: %.o
 	$(call quiet-command,$(LD) -Ttext 0 -e _start -s -o $@ $<,"  Building $(TARGET_DIR)$@")
@@ -24,5 +25,16 @@ build-all: multiboot.bin linuxboot.bin
 %.bin: %.raw
 	$(call quiet-command,$(SHELL) $(SRC_PATH)/pc-bios/optionrom/signrom.sh $< $@,"  Signing $(TARGET_DIR)$@")
 
+%.stamp: %.S %.bin
+	$(call quiet-command,:,"  GEN   $@")
+	@sha1=`sha1sum < $< | awk '{print $$1}'`; \
+	if test -f "$@" && test "`cat $@`" = "$$sha1"; then \
+	  echo '$@ is unchanged'; \
+	else \
+	  echo 'Updating $(TARGETDIR)../$*.bin'; \
+	  cp $*.bin ..; \
+	fi; \
+	echo $$sha1 > $@
+
 clean:
 	rm -f *.o *.d *.raw *.img *.bin *~
pc-bios/optionrom/linuxboot.stamp new file +1 -0
new file mode 100644
index 0000000..8bfa45d
@@ -0,0 +1 @@
+2871c1f6faabe518d8187c127d56bb8b8ba1ea3d
pc-bios/optionrom/multiboot.stamp new file +1 -0
new file mode 100644
index 0000000..9c7de51
@@ -0,0 +1 @@
+04a71e8e3cfc29160b49c9e5eae859c7cebbf5f2
#2 lore raw
Quoted 21 lines · Paolo Bonzini
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

This will wreak havoc on the tree since these are built by default and they are replacing files in revision control.

... the next question is why are they (linuxboot.bin and multiboot.bin) in revision control since they do not require any strange tool to be built.

They require an i386 cross compiler, which is not available on all installations.

Quoted 7 lines
Quoted 3 lines

They are being built always anyway now, since their target pc-bios/optionrom/linuxboot.bin does not exist on a checked out tree or even a release tree.  But no one has complained.

They are only built on i386 and x86_64 hosts, look at the configure script. We should continue providing all the ROM binaries, even the x86 ones.

Oops, my bad. :-(  The only reason I see against my patch is that the option ROMS do not change that often; maybe I felt that it should be done different only because I screwed up and I'm blaming the code instead of myself. There is also the problem that they are not built on Darwin and Solaris, which is possibly even worse.

Quoted 3 lines

What about adding to version control a stamp file and using it to avoid useless changes to pc-bios/*.bin?  Such as overwriting the .bin files only when the .S file changes.  Something like the attached patch.

configure could also detect that we are building inside the source tree (not in an object tree outside of the source directory) and not compile the roms in that case. Or we could make object tree use mandatory, it's a good practice anyway.