From 438cc1fe58f4b65099d778596b93e8094594cb69 Mon Sep 17 00:00:00 2001 From: Francis Rowe Date: Sun, 03 May 2015 11:48:20 -0400 Subject: demefactory (new utility): create GM45 factory.rom without the ME --- (limited to 'resources/utilities/ich9deblob/src/common') 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 -- cgit v0.9.1