[coreboot-gerrit] Change in coreboot[master]: util/qualcomm: Add updated qgpt.py script.

Evan Green (Code Review) gerrit at coreboot.org
Thu Apr 12 19:41:53 CEST 2018


Evan Green has uploaded this change for review. ( https://review.coreboot.org/25640


Change subject: util/qualcomm: Add updated qgpt.py script.
......................................................................

util/qualcomm: Add updated qgpt.py script.

I'm not sure exactly which pieces of this changed script are truly
needed, but this script works for booting from SPI on Cheza.

BUG=b:74020650
TEST=Booting Cheza from SPI flash now works.

Change-Id: I1d5fd7aaa667d3fc9f10974f704c37ad38911a61
---
M util/qualcomm/qgpt.py
1 file changed, 2 insertions(+), 61 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/40/25640/1

diff --git a/util/qualcomm/qgpt.py b/util/qualcomm/qgpt.py
index 0f79290..f561eee 100755
--- a/util/qualcomm/qgpt.py
+++ b/util/qualcomm/qgpt.py
@@ -1,40 +1,4 @@
 #!/usr/bin/python
-#============================================================================
-#
-#/** @file qgpt.py
-#
-# GENERAL DESCRIPTION
-#   Generates QCom GPT header/tail for wrapping Bootblock
-#
-# Copyright (c) 2018, The Linux Foundation. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#     * Redistributions of source code must retain the above copyright
-#       notice, this list of conditions and the following disclaimer.
-#     * Redistributions in binary form must reproduce the above
-#       copyright notice, this list of conditions and the following
-#       disclaimer in the documentation and/or other materials provided
-#       with the distribution.
-#     * Neither the name of The Linux Foundation nor the names of its
-#       contributors may be used to endorse or promote products derived
-#       from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
-# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
-# ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-#**/
-#
 
 import os
 import math
@@ -42,7 +6,6 @@
 import re
 import struct
 import sys
-import tempfile
 
 from optparse import OptionParser
 from types import *
@@ -237,7 +200,7 @@
     PrimaryGPT[i + 6] = 0xFF                  # sector
     PrimaryGPT[i + 7] = 0xFF                  # cylinder
     PrimaryGPT[i + 8:i + 8 + 4] = [0x01, 0x00, 0x00, 0x00]  # starting sector
-    PrimaryGPT[i + 12:i + 12 + 4] = [0xFF, 0xFF, 0xFF, 0xFF]  # starting sector
+    PrimaryGPT[i + 12:i + 12 + 4] = [0xFF, 0x0F, 0x00, 0x00]  # starting sector
 
     # magic byte for MBR partitioning - always at this location regardless of
     # options.sector
@@ -406,7 +369,7 @@
         parser.print_help()
         sys.exit(1)
 
-    options.inputfile = args[0]
+    options.image = args[0]
 
     if options.advance_format is True:
         options.sector = 4096
@@ -419,15 +382,6 @@
     if options.type is None:
         options.type = 'DEA0BA2C-CBDD-4805-B4F9-F428251C3E98'
 
-    #create temp file, this will be deleted later
-    fout_fill = tempfile.NamedTemporaryFile()
-    options.image = fout_fill.name
-    fout_fill.close()
-    fout_fill = openfile(options.image, 'wb')
-    #96768 is for SD boot, this value will differ for SPI-NOR
-    fout_fill.write('\0' * 96768)
-    fout_fill.close()
-
     if os.path.isfile(options.image) == False:
         print("Invalid file name. Exiting...\n")
         parser.print_help()
@@ -445,16 +399,3 @@
     createGPTPartionTable(options)
 
     createOut(options)
-
-    bb_statinfo = os.stat(options.image)
-    file_bb= openfile(options.inputfile, 'r+')
-    bb_buffer = file_bb.read(statinfo.st_size)
-    file_gpt= open(options.out, 'rb+')
-    #17408 is for SD boot, this value will differ for SPI-NOR
-    file_gpt.seek(17408)
-    file_gpt.write(bb_buffer)
-    file_gpt.close()
-    file_bb.close()
-
-    # Delete Temp File
-    os.unlink(fout_fill.name)

-- 
To view, visit https://review.coreboot.org/25640
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1d5fd7aaa667d3fc9f10974f704c37ad38911a61
Gerrit-Change-Number: 25640
Gerrit-PatchSet: 1
Gerrit-Owner: Evan Green <evgreen at chromium.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180412/81e38926/attachment-0001.html>


More information about the coreboot-gerrit mailing list