Changeset 67445 in vbox for trunk/src/VBox/Runtime/common/fs/isomakercmd.cpp
- Timestamp:
- Jun 16, 2017 2:31:28 PM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 116176
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/fs/isomakercmd.cpp
r67437 r67445 285 285 } u; 286 286 } RTFSISOMKCMDELTORITOENTRY; 287 /** Pointer to an el torito boot entry. */ 288 typedef RTFSISOMKCMDELTORITOENTRY *PRTFSISOMKCMDELTORITOENTRY; 287 289 288 290 /** … … 1335 1337 if (idxObj != UINT32_MAX) 1336 1338 { 1337 intrc = RTFsIsoMakerObjRemove(pOpts->hIsoMaker, idxObj);1339 rc = RTFsIsoMakerObjRemove(pOpts->hIsoMaker, idxObj); 1338 1340 if (RT_FAILURE(rc)) 1339 1341 return rtFsIsoMakerCmdErrorRc(pOpts, rc, "Failed to remove '%s': %Rrc", pszSpec, rc); … … 1354 1356 uint32_t offError; 1355 1357 RTERRINFOSTATIC ErrInfo; 1356 intrc = RTVfsChainQueryInfo(pszSrc, &ObjInfo, RTFSOBJATTRADD_UNIX,1357 1358 rc = RTVfsChainQueryInfo(pszSrc, &ObjInfo, RTFSOBJATTRADD_UNIX, 1359 RTPATH_F_FOLLOW_LINK, &offError, RTErrInfoInitStatic(&ErrInfo)); 1358 1360 if (RT_FAILURE(rc)) 1359 1361 return rtFsIsoMakerCmdChainError(pOpts, "RTVfsChainQueryInfo", pszSrc, rc, offError, &ErrInfo.Core); … … 1747 1749 * Locate and configure the boot images first. 1748 1750 */ 1749 for (uint32_t idxBootCat = 1; idxBootCat < pOpts->cBootCatEntries; idxBootCat++) 1750 if ( pOpts->aBootCatEntries[idxBootCat].enmType == RTFSISOMKCMDELTORITOENTRY::kEntryType_Default 1751 || pOpts->aBootCatEntries[idxBootCat].enmType == RTFSISOMKCMDELTORITOENTRY::kEntryType_Section) 1751 int rc; 1752 PRTFSISOMKCMDELTORITOENTRY pBootCatEntry = &pOpts->aBootCatEntries[1]; 1753 for (uint32_t idxBootCat = 1; idxBootCat < pOpts->cBootCatEntries; idxBootCat++, pBootCatEntry++) 1754 if ( pBootCatEntry->enmType == RTFSISOMKCMDELTORITOENTRY::kEntryType_Default 1755 || pBootCatEntry->enmType == RTFSISOMKCMDELTORITOENTRY::kEntryType_Section) 1752 1756 { 1753 1757 /* Make sure we've got a boot image. */ 1754 uint32_t idxImageObj = p Opts->aBootCatEntries[idxBootCat].u.Section.idxImageObj;1758 uint32_t idxImageObj = pBootCatEntry->u.Section.idxImageObj; 1755 1759 if (idxImageObj == UINT32_MAX) 1756 1760 { 1757 const char *pszBootImage = p Opts->aBootCatEntries[idxBootCat].u.Section.pszImageNameInIso;1761 const char *pszBootImage = pBootCatEntry->u.Section.pszImageNameInIso; 1758 1762 if (pszBootImage == NULL) 1759 1763 return rtFsIsoMakerCmdSyntaxError(pOpts, "No image name given for boot catalog entry #%u", idxBootCat); … … 1763 1767 return rtFsIsoMakerCmdSyntaxError(pOpts, "Unable to locate image for boot catalog entry #%u: %s", 1764 1768 idxBootCat, pszBootImage); 1765 p Opts->aBootCatEntries[idxBootCat].u.Section.idxImageObj = idxImageObj;1769 pBootCatEntry->u.Section.idxImageObj = idxImageObj; 1766 1770 } 1767 1771 1768 1772 /* Enable patching it? */ 1769 if (p Opts->aBootCatEntries[idxBootCat].u.Section.fInsertBootInfoTable)1773 if (pBootCatEntry->u.Section.fInsertBootInfoTable) 1770 1774 { 1771 intrc = RTFsIsoMakerObjEnableBootInfoTablePatching(pOpts->hIsoMaker, idxImageObj, true);1775 rc = RTFsIsoMakerObjEnableBootInfoTablePatching(pOpts->hIsoMaker, idxImageObj, true); 1772 1776 if (RT_FAILURE(rc)) 1773 1777 return rtFsIsoMakerCmdErrorRc(pOpts, rc, … … 1777 1781 1778 1782 /* Figure out the floppy type given the object size. */ 1779 if (p Opts->aBootCatEntries[idxBootCat].u.Section.bBootMediaType == ISO9660_ELTORITO_BOOT_MEDIA_TYPE_MASK)1783 if (pBootCatEntry->u.Section.bBootMediaType == ISO9660_ELTORITO_BOOT_MEDIA_TYPE_MASK) 1780 1784 { 1781 1785 uint64_t cbImage; 1782 intrc = RTFsIsoMakerObjQueryDataSize(pOpts->hIsoMaker, idxImageObj, &cbImage);1786 rc = RTFsIsoMakerObjQueryDataSize(pOpts->hIsoMaker, idxImageObj, &cbImage); 1783 1787 if (RT_FAILURE(rc)) 1784 1788 return rtFsIsoMakerCmdErrorRc(pOpts, rc, "RTFsIsoMakerObjGetDataSize failed on entry #%u: %Rrc\n", 1785 1789 idxBootCat, rc); 1786 1790 if (cbImage == 1228800) 1787 p Opts->aBootCatEntries[idxBootCat].u.Section.bBootMediaType = ISO9660_ELTORITO_BOOT_MEDIA_TYPE_FLOPPY_1_2_MB;1791 pBootCatEntry->u.Section.bBootMediaType = ISO9660_ELTORITO_BOOT_MEDIA_TYPE_FLOPPY_1_2_MB; 1788 1792 else if (cbImage <= 1474560) 1789 p Opts->aBootCatEntries[idxBootCat].u.Section.bBootMediaType = ISO9660_ELTORITO_BOOT_MEDIA_TYPE_FLOPPY_1_44_MB;1793 pBootCatEntry->u.Section.bBootMediaType = ISO9660_ELTORITO_BOOT_MEDIA_TYPE_FLOPPY_1_44_MB; 1790 1794 else if (cbImage <= 2949120) 1791 p Opts->aBootCatEntries[idxBootCat].u.Section.bBootMediaType = ISO9660_ELTORITO_BOOT_MEDIA_TYPE_FLOPPY_2_88_MB;1795 pBootCatEntry->u.Section.bBootMediaType = ISO9660_ELTORITO_BOOT_MEDIA_TYPE_FLOPPY_2_88_MB; 1792 1796 else 1793 p Opts->aBootCatEntries[idxBootCat].u.Section.bBootMediaType = ISO9660_ELTORITO_BOOT_MEDIA_TYPE_HARD_DISK;1797 pBootCatEntry->u.Section.bBootMediaType = ISO9660_ELTORITO_BOOT_MEDIA_TYPE_HARD_DISK; 1794 1798 } 1795 1799 } … … 1798 1802 * Add the boot catalog entries. 1799 1803 */ 1800 1804 pBootCatEntry = &pOpts->aBootCatEntries[0]; 1805 for (uint32_t idxBootCat = 0; idxBootCat < pOpts->cBootCatEntries; idxBootCat++, pBootCatEntry++) 1806 switch (pBootCatEntry->enmType) 1807 { 1808 case RTFSISOMKCMDELTORITOENTRY::kEntryType_Validation: 1809 Assert(idxBootCat == 0); 1810 rc = RTFsIsoMakerBootCatSetValidationEntry(pOpts->hIsoMaker, pBootCatEntry->u.Validation.idPlatform, 1811 pBootCatEntry->u.Validation.pszString); 1812 if (RT_FAILURE(rc)) 1813 return rtFsIsoMakerCmdErrorRc(pOpts, rc, "RTFsIsoMakerBootCatSetValidationEntry failed: %Rrc\n", rc); 1814 break; 1815 1816 case RTFSISOMKCMDELTORITOENTRY::kEntryType_Default: 1817 case RTFSISOMKCMDELTORITOENTRY::kEntryType_Section: 1818 Assert(pBootCatEntry->enmType == RTFSISOMKCMDELTORITOENTRY::kEntryType_Default ? idxBootCat == 1 : idxBootCat > 2); 1819 rc = RTFsIsoMakerBootCatSetSectionEntry(pOpts->hIsoMaker, idxBootCat, 1820 pBootCatEntry->u.Section.idxImageObj, 1821 pBootCatEntry->u.Section.bBootMediaType, 1822 pBootCatEntry->u.Section.bSystemType, 1823 pBootCatEntry->u.Section.fBootable, 1824 pBootCatEntry->u.Section.uLoadSeg, 1825 pBootCatEntry->u.Section.cSectorsToLoad); 1826 if (RT_FAILURE(rc)) 1827 return rtFsIsoMakerCmdErrorRc(pOpts, rc, "RTFsIsoMakerBootCatSetSectionEntry failed on entry #%u: %Rrc\n", 1828 idxBootCat, rc); 1829 break; 1830 1831 case RTFSISOMKCMDELTORITOENTRY::kEntryType_SectionHeader: 1832 { 1833 uint32_t cEntries = 1; 1834 while ( idxBootCat + cEntries < pOpts->cBootCatEntries 1835 && pBootCatEntry[cEntries].enmType != RTFSISOMKCMDELTORITOENTRY::kEntryType_SectionHeader) 1836 cEntries++; 1837 cEntries--; 1838 1839 Assert(idxBootCat > 1); 1840 rc = RTFsIsoMakerBootCatSetSectionHeaderEntry(pOpts->hIsoMaker, idxBootCat, cEntries, 1841 pBootCatEntry->u.SectionHeader.idPlatform, 1842 pBootCatEntry->u.SectionHeader.pszString); 1843 if (RT_FAILURE(rc)) 1844 return rtFsIsoMakerCmdErrorRc(pOpts, rc, 1845 "RTFsIsoMakerBootCatSetSectionHeaderEntry failed on entry #%u: %Rrc\n", 1846 idxBootCat, rc); 1847 break; 1848 } 1849 1850 default: 1851 AssertFailedReturn(VERR_INTERNAL_ERROR_3); 1852 } 1801 1853 1802 1854 return VINF_SUCCESS; … … 2002 2054 rc = rtFsIsoMakerCmdErrorRc(&Opts, VERR_INVALID_PARAMETER, "No output file specified (--output <file>)"); 2003 2055 } 2056 2057 /* 2058 * Final actions. 2059 */ 2060 if (RT_SUCCESS(rc)) 2061 rc = rtFsIsoMakerCmdOptEltoritoCommitBootCatalog(&Opts); 2004 2062 if (RT_SUCCESS(rc)) 2005 2063 {
Note:
See TracChangeset
for help on using the changeset viewer.