summaryrefslogtreecommitdiffstats
path: root/resources/utilities/ich9deblob/src/common
diff options
context:
space:
mode:
authorFrancis Rowe <info@gluglug.org.uk>2015-05-03 11:48:20 (EDT)
committer Francis Rowe <info@gluglug.org.uk>2015-05-03 11:48:20 (EDT)
commit438cc1fe58f4b65099d778596b93e8094594cb69 (patch)
tree64f15e7b5e970341799fae6f3de103301dfde452 /resources/utilities/ich9deblob/src/common
parent2350f55533902f9f67b50a920fad2044daec03ac (diff)
downloadlibreboot-438cc1fe58f4b65099d778596b93e8094594cb69.zip
libreboot-438cc1fe58f4b65099d778596b93e8094594cb69.tar.gz
libreboot-438cc1fe58f4b65099d778596b93e8094594cb69.tar.bz2
demefactory (new utility): create GM45 factory.rom without the ME
Diffstat (limited to 'resources/utilities/ich9deblob/src/common')
-rw-r--r--resources/utilities/ich9deblob/src/common/descriptor_gbe.c30
-rw-r--r--resources/utilities/ich9deblob/src/common/descriptor_gbe.h1
2 files changed, 31 insertions, 0 deletions
diff --git a/resources/utilities/ich9deblob/src/common/descriptor_gbe.c b/resources/utilities/ich9deblob/src/common/descriptor_gbe.c
index 6a87452..31cca1b 100644
--- a/resources/utilities/ich9deblob/src/common/descriptor_gbe.c
+++ b/resources/utilities/ich9deblob/src/common/descriptor_gbe.c
@@ -58,3 +58,33 @@ int notCreatedDescriptorGbeFile(struct DESCRIPTORREGIONRECORD descriptorStruct,
return 0;
}
+
+/*
+ * create 4KiB file with descriptor
+ */
+int notCreated4kDescriptorFile(struct DESCRIPTORREGIONRECORD descriptorStruct, char* fileName)
+{
+ FILE* fileStream = NULL;
+
+ /* delete old file before continuing */
+ remove(fileName);
+
+ /* open new file for writing the descriptor+gbe */
+ fileStream = fopen(fileName, "ab");
+
+ /* write the descriptor region into the first part */
+ if (DESCRIPTORREGIONSIZE != fwrite((uint8_t*)&descriptorStruct, 1, sizeof(descriptorStruct), fileStream))
+ {
+ printf("\nerror: writing descriptor region failed\n");
+ return 1;
+ }
+
+
+ fclose(fileStream);
+
+ printf("descriptor successfully written to the file: %s\n", fileName);
+ printf("Now do: dd if=%s of=yourrom.rom bs=1 count=4k conv=notrunc\n", fileName);
+ printf("(in other words, add the modified descriptor to your ROM image)\n\n");
+
+ return 0;
+}
diff --git a/resources/utilities/ich9deblob/src/common/descriptor_gbe.h b/resources/utilities/ich9deblob/src/common/descriptor_gbe.h
index d3e8977..94d4a24 100644
--- a/resources/utilities/ich9deblob/src/common/descriptor_gbe.h
+++ b/resources/utilities/ich9deblob/src/common/descriptor_gbe.h
@@ -32,5 +32,6 @@
#include "../gbe/gbe.h" /* structs describing what's in the gbe region */
int notCreatedDescriptorGbeFile(struct DESCRIPTORREGIONRECORD descriptorStruct, struct GBEREGIONRECORD_8K gbeStruct8k, char* fileName);
+int notCreated4kDescriptorFile(struct DESCRIPTORREGIONRECORD descriptorStruct, char* fileName);
#endif