Package org.jnode.fs.fat

Examples of org.jnode.fs.fat.GrubBootSector


    public void initMbr() throws DeviceNotFoundException, ApiNotFoundException, IOException {
        out.println("Initialize MBR ...");

        BootSector oldMBR = bs;
        bs = new GrubBootSector(PLAIN_MASTER_BOOT_SECTOR);

        if (MBR.containsPartitionTable()) {
            out
                    .println("This device already contains a partition table. Copy the already existing partitions.");
View Full Code Here


     * @throws IOException
     */
    protected void formatDevice(Device device) throws IOException {

        /* Format the MBR & partitiontable */
        GrubBootSector mbr = (GrubBootSector) (createFormatter()
            .getBootSector());

        IBMPartitionTableEntry pte = mbr.initPartitions(geom, IBMPartitionTypes.PARTTYPE_DOS_FAT16_LT32M);

        /*
         * System.out.println("partition table:"); for (int i = 0; i < 4; i++) {
         * System.out.println("" + i + " " + mbr.getPartition(i)); }
         */

        /* Format partition 0 */
        part0 = new MappedFSBlockDeviceSupport(device, pte.getStartLba()
            * bytesPerSector, pte.getNrSectors() * bytesPerSector);
        GrubFatFormatter ff = createFormatter();
        ff.setInstallPartition(0x0000FFFF);
        ff.format(part0);
        GrubBootSector part0bs = (GrubBootSector) ff.getBootSector();

        /* Fixup stage2 sector in MBR */
        mbr.setStage2Sector(pte.getStartLba() + part0bs.getStage2Sector());
        try {
            mbr.write(device.getAPI(BlockDeviceAPI.class));
        } catch (ApiNotFoundException ex) {
            final IOException ioe = new IOException("BlockDeviceAPI not found on device");
            ioe.initCause(ex);
View Full Code Here

TOP

Related Classes of org.jnode.fs.fat.GrubBootSector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.