|  | 
| 1 | 1 | /* Prepare SD card for first use thread | 
| 2 | 2 |  * | 
| 3 | 3 |  * Initial author: Floris Bos | 
| 4 |  | - *                                                                                                                                                                             | 
| 5 |  | - * Initial author: Floris Bos                                                                                                                                                  | 
| 6 |  | - * Maintained by Raspberry Pi                                                                                                                                                    | 
| 7 |  | - *                                                                                                                                                                             | 
| 8 |  | - * See LICENSE.txt for license details                                                                                                                                         | 
| 9 |  | - *                                                                                                                                                                            | 
|  | 4 | + * | 
|  | 5 | + * Initial author: Floris Bos | 
|  | 6 | + * Maintained by Raspberry Pi | 
|  | 7 | + * | 
|  | 8 | + * See LICENSE.txt for license details | 
|  | 9 | + * | 
| 10 | 10 |  */ | 
| 11 | 11 | 
 | 
| 12 | 12 | 
 | 
| @@ -183,7 +183,27 @@ bool InitDriveThread::method_resizePartitions() | 
| 183 | 183 | 
 | 
| 184 | 184 |     if (!QFile::exists("/dev/mmcblk0p1")) | 
| 185 | 185 |     { | 
| 186 |  | -        emit error(tr("SD card does not have a MBR. Cannot resize FAT partition.")); | 
|  | 186 | +        //emit error(tr("SD card does not have a MBR. Cannot resize FAT partition.")); | 
|  | 187 | +        // Warn user that their SD card does not have an MBR and ask | 
|  | 188 | +        // if they would like us to create one for them | 
|  | 189 | + | 
|  | 190 | +        // Create MBR containing single FAT partition | 
|  | 191 | +        QProcess proc; | 
|  | 192 | +        proc.setProcessChannelMode(proc.MergedChannels); | 
|  | 193 | +        proc.start("parted /dev/mmcblk0 --script -- mkpartfs primary fat32 0 -1"); | 
|  | 194 | +        proc.waitForFinished(-1); | 
|  | 195 | +        if (proc.exitCode() != 0) | 
|  | 196 | +        { | 
|  | 197 | +            // Warn user if we failed to create an MBR on their card | 
|  | 198 | +            emit error(tr("Error creating MBR")+"\n"+proc.readAll()); | 
|  | 199 | +            return false; | 
|  | 200 | +        } | 
|  | 201 | +        qDebug() << "Created missing MBR on SD card. parted output:" << proc.readAll(); | 
|  | 202 | + | 
|  | 203 | +        // Advise user that their SD card has now been formatted | 
|  | 204 | +        // suitably for installing NOOBS and that they will have to | 
|  | 205 | +        // re-copy the files before rebooting | 
|  | 206 | +        emit error(tr("SD card has now been formatted ready for NOOBS installation. Please re-copy the NOOBS files onto the card and reboot")); | 
| 187 | 207 |         return false; | 
| 188 | 208 |     } | 
| 189 | 209 | 
 | 
| @@ -271,7 +291,7 @@ bool InitDriveThread::method_resizePartitions() | 
| 271 | 291 |         QThread::msleep(1500); | 
| 272 | 292 |     } | 
| 273 | 293 | 
 | 
| 274 |  | -    QProcess::execute("/sbin/dosfslabel /dev/mmcblk0p1 RECOVERY"); | 
|  | 294 | +    //QProcess::execute("/sbin/dosfslabel /dev/mmcblk0p1 RECOVERY"); | 
| 275 | 295 | 
 | 
| 276 | 296 |     emit statusUpdate(tr("Mounting FAT partition")); | 
| 277 | 297 |     if (!mountSystemPartition()) | 
|  | 
0 commit comments