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

Commit

Permalink
Minor miscellaneous changes for NOOBS v1.3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
lurch committed Jun 20, 2014
1 parent 9216d6f commit 47fccbd
Show file tree
Hide file tree
Showing 9 changed files with 172 additions and 42 deletions.
2 changes: 1 addition & 1 deletion buildroot/.config
Original file line number Diff line number Diff line change
Expand Up @@ -1353,7 +1353,7 @@ BR2_LINUX_KERNEL_CUSTOM_GIT=y
BR2_LINUX_KERNEL_CUSTOM_GIT_REPO_URL="git://github.com/raspberrypi/linux.git"
BR2_LINUX_KERNEL_CUSTOM_GIT_VERSION="rpi-3.6.y"
BR2_LINUX_KERNEL_VERSION="rpi-3.6.y"
BR2_LINUX_KERNEL_PATCH=""
BR2_LINUX_KERNEL_PATCH="$(TOPDIR)/board/raspberrypi/kernel-patches/"
# BR2_LINUX_KERNEL_USE_DEFCONFIG is not set
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="kernelconfig-recovery"
Expand Down
38 changes: 38 additions & 0 deletions buildroot/board/raspberrypi/kernel-patches/linux-f2c2d2b.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
commit f2c2d2bfa1ef742584b2219eb34f90c284715dfb
Author: popcornmix <[email protected]>
Date: Tue Feb 11 17:03:51 2014 +0000

bcm2708: Allow disk activity led gpio to be specified

diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c
index 993379c..caa9f48 100644
--- a/arch/arm/mach-bcm2708/bcm2708.c
+++ b/arch/arm/mach-bcm2708/bcm2708.c
@@ -83,6 +83,8 @@
/* command line parameters */
static unsigned boardrev, serial;
static unsigned uart_clock;
+static unsigned disk_led_gpio = 16;
+static unsigned disk_led_active_low = 1;
static unsigned reboot_part = 0;
static unsigned w1_gpio_pin = W1_GPIO;

@@ -965,7 +967,9 @@ static struct platform_device bcm2708_led_device = {

static void __init bcm2708_init_led(void)
{
- platform_device_register(&bcm2708_led_device);
+ bcm2708_leds[0].gpio = disk_led_gpio;
+ bcm2708_leds[0].active_low = disk_led_active_low;
+ platform_device_register(&bcm2708_led_device);
}
#else
static inline void bcm2708_init_led(void)
@@ -1004,5 +1008,7 @@ MACHINE_END
module_param(boardrev, uint, 0644);
module_param(serial, uint, 0644);
module_param(uart_clock, uint, 0644);
+module_param(disk_led_gpio, uint, 0644);
+module_param(disk_led_active_low, uint, 0644);
module_param(reboot_part, uint, 0644);
module_param(w1_gpio_pin, uint, 0644);
2 changes: 1 addition & 1 deletion recovery/bootselectiondialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ BootSelectionDialog::BootSelectionDialog(const QString &defaultPartition, QWidge
}
}
}
if (m.value("name").toString()!="Data Partition")
if (canBootOs(m.value("name").toString(), m))
{
QListWidgetItem *item = new QListWidgetItem(icon, m.value("name").toString()+"\n"+m.value("description").toString(), ui->list);
item->setData(Qt::UserRole, m);
Expand Down
2 changes: 1 addition & 1 deletion recovery/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define CONFIG_H

/* Version number displayed in the title bar */
#define VERSION_NUMBER "1.3.5"
#define VERSION_NUMBER "1.3.8"

/* Color of the background */
// #define BACKGROUND_COLOR Qt::white
Expand Down
5 changes: 1 addition & 4 deletions recovery/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,7 @@ int main(int argc, char *argv[])
// Wait for keyboard to appear before displaying anything
KeyDetection::waitForKeyboard();

QFile f("/sys/module/bcm2708/parameters/boardrev");
f.open(f.ReadOnly);
int rev = f.readAll().trimmed().toInt();
f.close();
int rev = readBoardRevision();

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

Expand Down
126 changes: 91 additions & 35 deletions recovery/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ int MainWindow::_currentMode = 0;
MainWindow::MainWindow(const QString &defaultDisplay, QSplashScreen *splash, QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow),
_qpd(NULL), _kcpos(0), _defaultDisplay(defaultDisplay), _splash(splash),
_silent(false), _allowSilent(false), _settings(NULL),
_qpd(NULL), _kcpos(0), _defaultDisplay(defaultDisplay),
_silent(false), _allowSilent(false), _splash(splash), _settings(NULL),
_activatedEth(false), _numInstalledOS(0), _netaccess(NULL), _displayModeBox(NULL)
{
ui->setupUi(this);
Expand Down Expand Up @@ -317,7 +317,13 @@ void MainWindow::repopulate()
/* Whether this OS should be displayed in the list of installable OSes */
bool canInstallOs(const QString& name, const QVariantMap& values)
{
/* Can't simply pull "name" from "values" because in some JSON files it's "os_name" and in others it's "name"
/* Can't simply pull "name" from "values" because in some JSON files it's "os_name" and in others it's "name" */

/* If it's not bootable, is isn't really an OS, so is always installable */
if (!canBootOs(name, values))
{
return true;
}

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

/* Whether this OS is supported */
bool isSupportedOs(const QString& name, const QVariantMap& values)
{
/* Can't simply pull "name" from "values" because in some JSON files it's "os_name" and in others it's "name" */

/* If it's not bootable, is isn't really an OS, so is always supported */
if (!canBootOs(name, values))
{
return true;
}

/* Check the feature_level flag */
quint64 featurelevel = values.value("feature_level", 58364).toULongLong();
quint64 mask = (quint64)1 << readBoardRevision();
if ((featurelevel & mask) != mask) {
return false;
}

return true;
}

QMap<QString, QVariantMap> MainWindow::listImages()
{
QMap<QString,QVariantMap> images;
Expand Down Expand Up @@ -364,7 +391,8 @@ QMap<QString, QVariantMap> MainWindow::listImages()
fm["recommended"] = true;
fm["folder"] = imagefolder;
fm["release_date"] = osv.value("release_date");
images[imagefolder+"#"+name] = fm;
QString imagekey = imagefolder+"#"+name;
images[imagekey] = fm;
}
}
}
Expand All @@ -374,7 +402,8 @@ QMap<QString, QVariantMap> MainWindow::listImages()
if (name.contains(RECOMMENDED_IMAGE))
osv["recommended"] = true;
osv["folder"] = imagefolder;
images[imagefolder+"#"+name] = osv;
QString imagekey = imagefolder+"#"+name;
images[imagekey] = osv;
}
}
}
Expand All @@ -386,10 +415,18 @@ QMap<QString, QVariantMap> MainWindow::listImages()
foreach (QVariant v, i)
{
QVariantMap m = v.toMap();
m["installed"] = true;
QString flavour = m.value("name").toString();
QString imagefolder = m.value("folder").toString();
images[imagefolder+"#"+flavour] = m;
QString imageKey = imagefolder+"#"+flavour;
if (images.contains(imageKey))
{
images[imageKey]["installed"] = true;
}
else
{
m["installed"] = true;
images[imageKey] = m;
}
}
}

Expand Down Expand Up @@ -425,46 +462,65 @@ void MainWindow::on_actionWrite_image_to_disk_triggered()
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."),
QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes)
{
setEnabled(false);
_numMetaFilesToDownload = 0;

/* See if any of the OSes are unsupported */
bool allSupported = true;
QString unsupportedOses;
QList<QListWidgetItem *> selected = selectedItems();
foreach (QListWidgetItem *item, selected)
{
QVariantMap entry = item->data(Qt::UserRole).toMap();
QString name = entry.value("name").toString();
if (!isSupportedOs(name, entry)) {
allSupported = false;
unsupportedOses += "\n" + name;
}
}
if (_silent || allSupported || QMessageBox::warning(this,
tr("Confirm"),
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,
QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes)
{
setEnabled(false);
_numMetaFilesToDownload = 0;

if (!entry.contains("folder"))
QList<QListWidgetItem *> selected = selectedItems();
foreach (QListWidgetItem *item, selected)
{
QDir d;
QString folder = "/settings/os/"+entry.value("name").toString();
folder.replace(' ', '_');
if (!d.exists(folder))
d.mkpath(folder);
QVariantMap entry = item->data(Qt::UserRole).toMap();

if (!entry.contains("folder"))
{
QDir d;
QString folder = "/settings/os/"+entry.value("name").toString();
folder.replace(' ', '_');
if (!d.exists(folder))
d.mkpath(folder);

downloadMetaFile(entry.value("os_info").toString(), folder+"/os.json");
downloadMetaFile(entry.value("partitions_info").toString(), folder+"/partitions.json");
downloadMetaFile(entry.value("os_info").toString(), folder+"/os.json");
downloadMetaFile(entry.value("partitions_info").toString(), folder+"/partitions.json");

if (entry.contains("marketing_info"))
downloadMetaFile(entry.value("marketing_info").toString(), folder+"/marketing.tar");
if (entry.contains("marketing_info"))
downloadMetaFile(entry.value("marketing_info").toString(), folder+"/marketing.tar");

if (entry.contains("partition_setup"))
downloadMetaFile(entry.value("partition_setup").toString(), folder+"/partition_setup.sh");
if (entry.contains("partition_setup"))
downloadMetaFile(entry.value("partition_setup").toString(), folder+"/partition_setup.sh");

if (entry.contains("icon"))
downloadMetaFile(entry.value("icon").toString(), folder+"/icon.png");
if (entry.contains("icon"))
downloadMetaFile(entry.value("icon").toString(), folder+"/icon.png");
}
}
}

if (_numMetaFilesToDownload == 0)
{
/* All OSes selected are local */
startImageWrite();
}
else if (!_silent)
{
_qpd = new QProgressDialog(tr("The install process will begin shortly."), QString(), 0, 0, this);
_qpd->setWindowFlags(Qt::Window | Qt::CustomizeWindowHint | Qt::WindowTitleHint);
_qpd->show();
if (_numMetaFilesToDownload == 0)
{
/* All OSes selected are local */
startImageWrite();
}
else if (!_silent)
{
_qpd = new QProgressDialog(tr("The install process will begin shortly."), QString(), 0, 0, this);
_qpd->setWindowFlags(Qt::Window | Qt::CustomizeWindowHint | Qt::WindowTitleHint);
_qpd->show();
}
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions recovery/multiimagewritethread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,8 @@ emit statusUpdate(tr("%1: Unmounting FAT partition").arg(os_name));
ventry["folder"] = folder;
ventry["release_date"]= releasedate;
ventry["partitions"] = vpartitions;
if (vos.contains("bootable"))
ventry["bootable"] = vos.value("bootable").toBool();
QString iconfilename = folder+"/"+flavour+".png";
iconfilename.replace(" ", "_");
if (QFile::exists(iconfilename))
Expand Down
34 changes: 34 additions & 0 deletions recovery/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,37 @@ bool nameMatchesRiscOS(const QString &name)
{
return name.contains("risc", Qt::CaseInsensitive);
}

static uint revision = 0;
uint readBoardRevision()
{
if (revision == 0)
{
QFile f("/sys/module/bcm2708/parameters/boardrev");
f.open(f.ReadOnly);
revision = f.readAll().trimmed().toUInt();
f.close();
}
return revision;
}

/* Whether this OS should be displayed in the list of bootable OSes */
bool canBootOs(const QString& name, const QVariantMap& values)
{
/* Can't simply pull "name" from "values" because in some JSON files it's "os_name" and in others it's "name" */

/* Check if it's explicitly not bootable */
bool bootable = values.value("bootable", true).toBool();
if (!bootable)
{
return false;
}

/* Data Partition isn't bootable */
if (name == "Data Partition")
{
return false;
}

return true;
}
3 changes: 3 additions & 0 deletions recovery/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include <QString>
#include <QByteArray>
#include <QVariant>

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

0 comments on commit 47fccbd

Please sign in to comment.