Skip to content
This repository was archived by the owner on Feb 27, 2023. It is now read-only.

Commit 47fccbd

Browse files
committed
Minor miscellaneous changes for NOOBS v1.3.8
1 parent 9216d6f commit 47fccbd

File tree

9 files changed

+172
-42
lines changed

9 files changed

+172
-42
lines changed

buildroot/.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1353,7 +1353,7 @@ BR2_LINUX_KERNEL_CUSTOM_GIT=y
13531353
BR2_LINUX_KERNEL_CUSTOM_GIT_REPO_URL="git://github.com/raspberrypi/linux.git"
13541354
BR2_LINUX_KERNEL_CUSTOM_GIT_VERSION="rpi-3.6.y"
13551355
BR2_LINUX_KERNEL_VERSION="rpi-3.6.y"
1356-
BR2_LINUX_KERNEL_PATCH=""
1356+
BR2_LINUX_KERNEL_PATCH="$(TOPDIR)/board/raspberrypi/kernel-patches/"
13571357
# BR2_LINUX_KERNEL_USE_DEFCONFIG is not set
13581358
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
13591359
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="kernelconfig-recovery"
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
commit f2c2d2bfa1ef742584b2219eb34f90c284715dfb
2+
Author: popcornmix <[email protected]>
3+
Date: Tue Feb 11 17:03:51 2014 +0000
4+
5+
bcm2708: Allow disk activity led gpio to be specified
6+
7+
diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c
8+
index 993379c..caa9f48 100644
9+
--- a/arch/arm/mach-bcm2708/bcm2708.c
10+
+++ b/arch/arm/mach-bcm2708/bcm2708.c
11+
@@ -83,6 +83,8 @@
12+
/* command line parameters */
13+
static unsigned boardrev, serial;
14+
static unsigned uart_clock;
15+
+static unsigned disk_led_gpio = 16;
16+
+static unsigned disk_led_active_low = 1;
17+
static unsigned reboot_part = 0;
18+
static unsigned w1_gpio_pin = W1_GPIO;
19+
20+
@@ -965,7 +967,9 @@ static struct platform_device bcm2708_led_device = {
21+
22+
static void __init bcm2708_init_led(void)
23+
{
24+
- platform_device_register(&bcm2708_led_device);
25+
+ bcm2708_leds[0].gpio = disk_led_gpio;
26+
+ bcm2708_leds[0].active_low = disk_led_active_low;
27+
+ platform_device_register(&bcm2708_led_device);
28+
}
29+
#else
30+
static inline void bcm2708_init_led(void)
31+
@@ -1004,5 +1008,7 @@ MACHINE_END
32+
module_param(boardrev, uint, 0644);
33+
module_param(serial, uint, 0644);
34+
module_param(uart_clock, uint, 0644);
35+
+module_param(disk_led_gpio, uint, 0644);
36+
+module_param(disk_led_active_low, uint, 0644);
37+
module_param(reboot_part, uint, 0644);
38+
module_param(w1_gpio_pin, uint, 0644);

recovery/bootselectiondialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ BootSelectionDialog::BootSelectionDialog(const QString &defaultPartition, QWidge
8080
}
8181
}
8282
}
83-
if (m.value("name").toString()!="Data Partition")
83+
if (canBootOs(m.value("name").toString(), m))
8484
{
8585
QListWidgetItem *item = new QListWidgetItem(icon, m.value("name").toString()+"\n"+m.value("description").toString(), ui->list);
8686
item->setData(Qt::UserRole, m);

recovery/config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define CONFIG_H
33

44
/* Version number displayed in the title bar */
5-
#define VERSION_NUMBER "1.3.5"
5+
#define VERSION_NUMBER "1.3.8"
66

77
/* Color of the background */
88
// #define BACKGROUND_COLOR Qt::white

recovery/main.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,7 @@ int main(int argc, char *argv[])
6363
// Wait for keyboard to appear before displaying anything
6464
KeyDetection::waitForKeyboard();
6565

66-
QFile f("/sys/module/bcm2708/parameters/boardrev");
67-
f.open(f.ReadOnly);
68-
int rev = f.readAll().trimmed().toInt();
69-
f.close();
66+
int rev = readBoardRevision();
7067

7168
qDebug() << "Board revision is " << rev;
7269

recovery/mainwindow.cpp

Lines changed: 91 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ int MainWindow::_currentMode = 0;
5959
MainWindow::MainWindow(const QString &defaultDisplay, QSplashScreen *splash, QWidget *parent) :
6060
QMainWindow(parent),
6161
ui(new Ui::MainWindow),
62-
_qpd(NULL), _kcpos(0), _defaultDisplay(defaultDisplay), _splash(splash),
63-
_silent(false), _allowSilent(false), _settings(NULL),
62+
_qpd(NULL), _kcpos(0), _defaultDisplay(defaultDisplay),
63+
_silent(false), _allowSilent(false), _splash(splash), _settings(NULL),
6464
_activatedEth(false), _numInstalledOS(0), _netaccess(NULL), _displayModeBox(NULL)
6565
{
6666
ui->setupUi(this);
@@ -317,7 +317,13 @@ void MainWindow::repopulate()
317317
/* Whether this OS should be displayed in the list of installable OSes */
318318
bool canInstallOs(const QString& name, const QVariantMap& values)
319319
{
320-
/* Can't simply pull "name" from "values" because in some JSON files it's "os_name" and in others it's "name"
320+
/* Can't simply pull "name" from "values" because in some JSON files it's "os_name" and in others it's "name" */
321+
322+
/* If it's not bootable, is isn't really an OS, so is always installable */
323+
if (!canBootOs(name, values))
324+
{
325+
return true;
326+
}
321327

322328
/* RISC_OS needs a matching riscos_offset */
323329
if (nameMatchesRiscOS(name))
@@ -331,6 +337,27 @@ bool canInstallOs(const QString& name, const QVariantMap& values)
331337
return true;
332338
}
333339

340+
/* Whether this OS is supported */
341+
bool isSupportedOs(const QString& name, const QVariantMap& values)
342+
{
343+
/* Can't simply pull "name" from "values" because in some JSON files it's "os_name" and in others it's "name" */
344+
345+
/* If it's not bootable, is isn't really an OS, so is always supported */
346+
if (!canBootOs(name, values))
347+
{
348+
return true;
349+
}
350+
351+
/* Check the feature_level flag */
352+
quint64 featurelevel = values.value("feature_level", 58364).toULongLong();
353+
quint64 mask = (quint64)1 << readBoardRevision();
354+
if ((featurelevel & mask) != mask) {
355+
return false;
356+
}
357+
358+
return true;
359+
}
360+
334361
QMap<QString, QVariantMap> MainWindow::listImages()
335362
{
336363
QMap<QString,QVariantMap> images;
@@ -364,7 +391,8 @@ QMap<QString, QVariantMap> MainWindow::listImages()
364391
fm["recommended"] = true;
365392
fm["folder"] = imagefolder;
366393
fm["release_date"] = osv.value("release_date");
367-
images[imagefolder+"#"+name] = fm;
394+
QString imagekey = imagefolder+"#"+name;
395+
images[imagekey] = fm;
368396
}
369397
}
370398
}
@@ -374,7 +402,8 @@ QMap<QString, QVariantMap> MainWindow::listImages()
374402
if (name.contains(RECOMMENDED_IMAGE))
375403
osv["recommended"] = true;
376404
osv["folder"] = imagefolder;
377-
images[imagefolder+"#"+name] = osv;
405+
QString imagekey = imagefolder+"#"+name;
406+
images[imagekey] = osv;
378407
}
379408
}
380409
}
@@ -386,10 +415,18 @@ QMap<QString, QVariantMap> MainWindow::listImages()
386415
foreach (QVariant v, i)
387416
{
388417
QVariantMap m = v.toMap();
389-
m["installed"] = true;
390418
QString flavour = m.value("name").toString();
391419
QString imagefolder = m.value("folder").toString();
392-
images[imagefolder+"#"+flavour] = m;
420+
QString imageKey = imagefolder+"#"+flavour;
421+
if (images.contains(imageKey))
422+
{
423+
images[imageKey]["installed"] = true;
424+
}
425+
else
426+
{
427+
m["installed"] = true;
428+
images[imageKey] = m;
429+
}
393430
}
394431
}
395432

@@ -425,46 +462,65 @@ void MainWindow::on_actionWrite_image_to_disk_triggered()
425462
tr("Warning: this will install the selected Operating System(s). All existing data on the SD card will be overwritten, including any OSes that are already installed."),
426463
QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes)
427464
{
428-
setEnabled(false);
429-
_numMetaFilesToDownload = 0;
430-
465+
/* See if any of the OSes are unsupported */
466+
bool allSupported = true;
467+
QString unsupportedOses;
431468
QList<QListWidgetItem *> selected = selectedItems();
432469
foreach (QListWidgetItem *item, selected)
433470
{
434471
QVariantMap entry = item->data(Qt::UserRole).toMap();
472+
QString name = entry.value("name").toString();
473+
if (!isSupportedOs(name, entry)) {
474+
allSupported = false;
475+
unsupportedOses += "\n" + name;
476+
}
477+
}
478+
if (_silent || allSupported || QMessageBox::warning(this,
479+
tr("Confirm"),
480+
tr("Warning: incompatible Operating System(s) detected. The following OSes aren't supported on this revision of Raspberry Pi and may fail to boot or function correctly:") + unsupportedOses,
481+
QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes)
482+
{
483+
setEnabled(false);
484+
_numMetaFilesToDownload = 0;
435485

436-
if (!entry.contains("folder"))
486+
QList<QListWidgetItem *> selected = selectedItems();
487+
foreach (QListWidgetItem *item, selected)
437488
{
438-
QDir d;
439-
QString folder = "/settings/os/"+entry.value("name").toString();
440-
folder.replace(' ', '_');
441-
if (!d.exists(folder))
442-
d.mkpath(folder);
489+
QVariantMap entry = item->data(Qt::UserRole).toMap();
490+
491+
if (!entry.contains("folder"))
492+
{
493+
QDir d;
494+
QString folder = "/settings/os/"+entry.value("name").toString();
495+
folder.replace(' ', '_');
496+
if (!d.exists(folder))
497+
d.mkpath(folder);
443498

444-
downloadMetaFile(entry.value("os_info").toString(), folder+"/os.json");
445-
downloadMetaFile(entry.value("partitions_info").toString(), folder+"/partitions.json");
499+
downloadMetaFile(entry.value("os_info").toString(), folder+"/os.json");
500+
downloadMetaFile(entry.value("partitions_info").toString(), folder+"/partitions.json");
446501

447-
if (entry.contains("marketing_info"))
448-
downloadMetaFile(entry.value("marketing_info").toString(), folder+"/marketing.tar");
502+
if (entry.contains("marketing_info"))
503+
downloadMetaFile(entry.value("marketing_info").toString(), folder+"/marketing.tar");
449504

450-
if (entry.contains("partition_setup"))
451-
downloadMetaFile(entry.value("partition_setup").toString(), folder+"/partition_setup.sh");
505+
if (entry.contains("partition_setup"))
506+
downloadMetaFile(entry.value("partition_setup").toString(), folder+"/partition_setup.sh");
452507

453-
if (entry.contains("icon"))
454-
downloadMetaFile(entry.value("icon").toString(), folder+"/icon.png");
508+
if (entry.contains("icon"))
509+
downloadMetaFile(entry.value("icon").toString(), folder+"/icon.png");
510+
}
455511
}
456-
}
457512

458-
if (_numMetaFilesToDownload == 0)
459-
{
460-
/* All OSes selected are local */
461-
startImageWrite();
462-
}
463-
else if (!_silent)
464-
{
465-
_qpd = new QProgressDialog(tr("The install process will begin shortly."), QString(), 0, 0, this);
466-
_qpd->setWindowFlags(Qt::Window | Qt::CustomizeWindowHint | Qt::WindowTitleHint);
467-
_qpd->show();
513+
if (_numMetaFilesToDownload == 0)
514+
{
515+
/* All OSes selected are local */
516+
startImageWrite();
517+
}
518+
else if (!_silent)
519+
{
520+
_qpd = new QProgressDialog(tr("The install process will begin shortly."), QString(), 0, 0, this);
521+
_qpd->setWindowFlags(Qt::Window | Qt::CustomizeWindowHint | Qt::WindowTitleHint);
522+
_qpd->show();
523+
}
468524
}
469525
}
470526
}

recovery/multiimagewritethread.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,8 @@ emit statusUpdate(tr("%1: Unmounting FAT partition").arg(os_name));
373373
ventry["folder"] = folder;
374374
ventry["release_date"]= releasedate;
375375
ventry["partitions"] = vpartitions;
376+
if (vos.contains("bootable"))
377+
ventry["bootable"] = vos.value("bootable").toBool();
376378
QString iconfilename = folder+"/"+flavour+".png";
377379
iconfilename.replace(" ", "_");
378380
if (QFile::exists(iconfilename))

recovery/util.cpp

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,37 @@ bool nameMatchesRiscOS(const QString &name)
9494
{
9595
return name.contains("risc", Qt::CaseInsensitive);
9696
}
97+
98+
static uint revision = 0;
99+
uint readBoardRevision()
100+
{
101+
if (revision == 0)
102+
{
103+
QFile f("/sys/module/bcm2708/parameters/boardrev");
104+
f.open(f.ReadOnly);
105+
revision = f.readAll().trimmed().toUInt();
106+
f.close();
107+
}
108+
return revision;
109+
}
110+
111+
/* Whether this OS should be displayed in the list of bootable OSes */
112+
bool canBootOs(const QString& name, const QVariantMap& values)
113+
{
114+
/* Can't simply pull "name" from "values" because in some JSON files it's "os_name" and in others it's "name" */
115+
116+
/* Check if it's explicitly not bootable */
117+
bool bootable = values.value("bootable", true).toBool();
118+
if (!bootable)
119+
{
120+
return false;
121+
}
122+
123+
/* Data Partition isn't bootable */
124+
if (name == "Data Partition")
125+
{
126+
return false;
127+
}
128+
129+
return true;
130+
}

recovery/util.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include <QString>
55
#include <QByteArray>
6+
#include <QVariant>
67

78
/*
89
* Convenience functions
@@ -17,4 +18,6 @@ QByteArray getFileContents(const QString &filename);
1718
void putFileContents(const QString &filename, const QByteArray &data);
1819
void getOverscan(int &top, int &bottom, int &left, int &right);
1920
bool nameMatchesRiscOS(const QString &name);
21+
uint readBoardRevision();
22+
bool canBootOs(const QString& name, const QVariantMap& values);
2023
#endif // UTIL_H

0 commit comments

Comments
 (0)