Compare commits
10 Commits
452aaa2f60
...
3e19f1b927
Author | SHA1 | Date | |
---|---|---|---|
3e19f1b927 | |||
3f6e9b6384 | |||
294492a176 | |||
67a1cd3718 | |||
|
f8a275d1a3 | ||
0ee9c76c33 | |||
bc20f4c6b7 | |||
848214d104 | |||
ede8f12d2b | |||
6cd5b90678 |
@ -4,7 +4,8 @@
|
|||||||
******************************
|
******************************
|
||||||
|
|
||||||
This device is based on a 64 bit Mediatek MT7622 ARM platform,
|
This device is based on a 64 bit Mediatek MT7622 ARM platform,
|
||||||
and is "work in progress" in Liminix.
|
and is mostly feature-complete in Liminix but as of Dec 2024
|
||||||
|
has seen very little actual use.
|
||||||
|
|
||||||
.. note:: The factory flash image contains ECC errors that make it
|
.. note:: The factory flash image contains ECC errors that make it
|
||||||
incompatible with Liminix: use the `OpenWrt
|
incompatible with Liminix: use the `OpenWrt
|
||||||
@ -25,7 +26,11 @@
|
|||||||
Installation
|
Installation
|
||||||
============
|
============
|
||||||
|
|
||||||
Installation is currently a manual process.
|
Liminix on this device uses the UBI volume management system to
|
||||||
|
perform wear leveling on the flash. This is not set up from the
|
||||||
|
factory, so a one-time step is needed to prepare it before Liminix
|
||||||
|
can be installed.
|
||||||
|
|
||||||
|
|
||||||
Preparation
|
Preparation
|
||||||
-----------
|
-----------
|
||||||
@ -33,7 +38,7 @@
|
|||||||
To prepare the device for Liminix you first need to use the
|
To prepare the device for Liminix you first need to use the
|
||||||
`OpenWrt UBI Installer
|
`OpenWrt UBI Installer
|
||||||
<https://github.com/dangowrt/owrt-ubi-installer>`_ image to
|
<https://github.com/dangowrt/owrt-ubi-installer>`_ image to
|
||||||
rewrite the flash layout. You can do this in onw of two ways:
|
rewrite the flash layout. You can do this in one of two ways:
|
||||||
either follow the instructions to do it through the vendor web
|
either follow the instructions to do it through the vendor web
|
||||||
interface, or you can drop to U-boot and use TFTP
|
interface, or you can drop to U-boot and use TFTP
|
||||||
|
|
||||||
@ -44,14 +49,50 @@
|
|||||||
MT7622> tftpboot 0x42000000 openwrt-mediatek-mt7622-linksys_e8450-ubi-initramfs-recovery-installer.itb
|
MT7622> tftpboot 0x42000000 openwrt-mediatek-mt7622-linksys_e8450-ubi-initramfs-recovery-installer.itb
|
||||||
MT7622> bootm 0x42000000
|
MT7622> bootm 0x42000000
|
||||||
|
|
||||||
Once it's finished booted into Linux you can safely reboot
|
This will write the new flash layout and then boot into a
|
||||||
|
"recovery" OpenWrt installation.
|
||||||
|
|
||||||
Installing Liminix
|
Building/installing Liminix
|
||||||
------------------
|
----------------
|
||||||
|
|
||||||
This is a manual process: you need a :ref:`serial <serial>` conection and TFTP : follow the instructions at :ref:`system-outputs-ubimage`
|
The default target for this device is ``outputs.ubimage`` which
|
||||||
|
makes a ubifs image suitable for use with :command:`ubiupdatevol`.
|
||||||
|
For a first-time installation the simplest way to achieve this is
|
||||||
|
using the OpenWrt recovery system that you installed in the
|
||||||
|
previous step. In this configuration the device assigns itself the
|
||||||
|
IP address 192.168.1.1/24 on its LAN ports and expects the
|
||||||
|
connected computer to have 192.168.1.254
|
||||||
|
|
||||||
'';
|
The `ubi0_7` device in these instructions is correct as of Dec
|
||||||
|
2024 (dangowrt/owrt-ubi-installer commit d79e7928). If you are
|
||||||
|
installing some time later, it is important to check the output
|
||||||
|
from :command:`ubinfo -a` and make sure you are updating the
|
||||||
|
"liminix" volume and not some other one which had been introduced
|
||||||
|
since I wrote this.
|
||||||
|
|
||||||
|
.. code-block:: console
|
||||||
|
|
||||||
|
$ nix-build -I liminix-config=./my-configuration.nix --arg device "import ./devices/belkin-rt3200" -A outputs.default
|
||||||
|
$ cat result/rootfs | ssh root@192.168.1.1 "cat > /tmp/rootfs"
|
||||||
|
$ ssh root@192.168.1.1
|
||||||
|
root@OpenWrt:~# ubimkvol /dev/ubi0 --name=liminix --maxavsize
|
||||||
|
root@OpenWrt:~# ubinfo -a
|
||||||
|
[...]
|
||||||
|
Volume ID: 7 (on ubi0)
|
||||||
|
Type: dynamic
|
||||||
|
Alignment: 1
|
||||||
|
Size: 851 LEBs (108056576 bytes, 103.0 MiB)
|
||||||
|
State: OK
|
||||||
|
Name: liminix
|
||||||
|
Character device major/minor: 250:8
|
||||||
|
root@OpenWrt:~# ubiupdatevol /dev/ubi0_7 /tmp/rootfs
|
||||||
|
|
||||||
|
For subsequent Liminix reinstalls, you don't need to repeat the
|
||||||
|
"Preparation" step and in fact should seek to avoid it if
|
||||||
|
possible. Updating volumes with :command:`ubiupdatevol` will
|
||||||
|
preserve the erase counters used for write levelling, so is
|
||||||
|
preferred over any kind of "factory" wipe which will reset them.
|
||||||
|
'';
|
||||||
|
|
||||||
system = {
|
system = {
|
||||||
crossSystem = {
|
crossSystem = {
|
||||||
@ -177,6 +218,7 @@
|
|||||||
tftp.loadAddress = lim.parseInt "0x4007ff28";
|
tftp.loadAddress = lim.parseInt "0x4007ff28";
|
||||||
imageFormat = "fit";
|
imageFormat = "fit";
|
||||||
};
|
};
|
||||||
|
rootfsType = lib.mkDefault "ubifs";
|
||||||
filesystem =
|
filesystem =
|
||||||
let inherit (pkgs.pseudofile) dir symlink;
|
let inherit (pkgs.pseudofile) dir symlink;
|
||||||
in
|
in
|
||||||
@ -198,7 +240,8 @@
|
|||||||
in {
|
in {
|
||||||
ubi = {
|
ubi = {
|
||||||
minIOSize = "2048";
|
minIOSize = "2048";
|
||||||
eraseBlockSize = "126976";
|
logicalEraseBlockSize = "126976";
|
||||||
|
physicalEraseBlockSize = "131072";
|
||||||
maxLEBcount = "1024"; # guessing
|
maxLEBcount = "1024"; # guessing
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -13,6 +13,12 @@ in
|
|||||||
options = {
|
options = {
|
||||||
boot = { };
|
boot = { };
|
||||||
hardware = {
|
hardware = {
|
||||||
|
ubi = {
|
||||||
|
minIOSize = mkOption { type = types.str; };
|
||||||
|
logicalEraseBlockSize = mkOption { type = types.str; }; # LEB
|
||||||
|
physicalEraseBlockSize = mkOption { type = types.str; }; # PEB
|
||||||
|
maxLEBcount = mkOption { type = types.str; }; # LEB
|
||||||
|
};
|
||||||
dts = {
|
dts = {
|
||||||
src = mkOption {
|
src = mkOption {
|
||||||
type = types.nullOr types.path;
|
type = types.nullOr types.path;
|
||||||
|
@ -17,6 +17,7 @@ in
|
|||||||
./outputs/boot-fit.nix
|
./outputs/boot-fit.nix
|
||||||
./outputs/uimage.nix
|
./outputs/uimage.nix
|
||||||
./outputs/updater
|
./outputs/updater
|
||||||
|
./outputs/ubimage.nix
|
||||||
];
|
];
|
||||||
options = {
|
options = {
|
||||||
system.outputs = {
|
system.outputs = {
|
||||||
|
@ -13,18 +13,6 @@ in
|
|||||||
./initramfs.nix
|
./initramfs.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
options.system.outputs.rootubifs = mkOption {
|
|
||||||
type = types.package;
|
|
||||||
internal = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
options.hardware.ubi = {
|
|
||||||
minIOSize = mkOption { type = types.str; };
|
|
||||||
logicalEraseBlockSize = mkOption { type = types.str; }; # LEB
|
|
||||||
physicalEraseBlockSize = mkOption { type = types.str; }; # PEB
|
|
||||||
maxLEBcount = mkOption { type = types.str; }; # LEB
|
|
||||||
};
|
|
||||||
|
|
||||||
config = mkIf (config.rootfsType == "ubifs") {
|
config = mkIf (config.rootfsType == "ubifs") {
|
||||||
kernel.config = {
|
kernel.config = {
|
||||||
MTD_UBI="y";
|
MTD_UBI="y";
|
||||||
@ -33,7 +21,7 @@ in
|
|||||||
};
|
};
|
||||||
boot.initramfs.enable = true;
|
boot.initramfs.enable = true;
|
||||||
system.outputs = {
|
system.outputs = {
|
||||||
rootubifs =
|
rootfs =
|
||||||
let
|
let
|
||||||
inherit (pkgs.pkgsBuildBuild) runCommand mtdutils;
|
inherit (pkgs.pkgsBuildBuild) runCommand mtdutils;
|
||||||
cfg = config.hardware.ubi;
|
cfg = config.hardware.ubi;
|
||||||
|
@ -82,12 +82,11 @@ automatically, you can try booting it by hand to see if it works:
|
|||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
|
|
||||||
uboot> ubifsmount ubi0:liminix
|
uboot> ubifsmount ubi0:liminix
|
||||||
uboot> ubifsload ''${loadaddr} boot/uimage
|
uboot> ubifsload ''${loadaddr} boot/fit
|
||||||
uboot> bootm ''${loadaddr}
|
uboot> bootm ''${loadaddr}
|
||||||
|
|
||||||
Once you've done this and you're happy with it, reset the device to
|
Once you've done this and you're happy with it, reset the device to
|
||||||
U-Boot. You don't need to recreate the volume but you do need to
|
return to U-Boot.
|
||||||
repeat step 3.
|
|
||||||
|
|
||||||
5) Instructions for configuring autoboot are likely to be very
|
5) Instructions for configuring autoboot are likely to be very
|
||||||
device-dependent. On the Linksys E8450/Belkin RT3200, the environment
|
device-dependent. On the Linksys E8450/Belkin RT3200, the environment
|
||||||
@ -96,7 +95,10 @@ you could do
|
|||||||
|
|
||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
|
|
||||||
uboot> setenv boot_production 'led $bootled_pwr on ; ubifsmount ubi0:liminix; ubifsload ''${loadaddr} boot/uimage; bootm ''${loadaddr}'
|
uboot> setenv orig_boot_production $boot_production
|
||||||
|
uboot> setenv boot_production 'led $bootled_pwr on ; ubifsmount ubi0:liminix && ubifsload ''${loadaddr} boot/fit && bootm ''${loadaddr}'
|
||||||
|
uboot> saveenv
|
||||||
|
uboot> reset
|
||||||
|
|
||||||
On other devices, some detective work may be needed. Try running
|
On other devices, some detective work may be needed. Try running
|
||||||
`printenv` and look for likely commands, try looking at the existing
|
`printenv` and look for likely commands, try looking at the existing
|
||||||
@ -111,16 +113,13 @@ boot process, maybe even try looking for documentation for that device.
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf (config.rootfsType == "ubifs") {
|
config.system.outputs.ubimage =
|
||||||
system.outputs = {
|
assert config.rootfsType == "ubifs";
|
||||||
ubimage =
|
let o = config.system.outputs; in
|
||||||
let o = config.system.outputs; in
|
pkgs.runCommand "ubimage" {} ''
|
||||||
pkgs.runCommand "ubimage" {} ''
|
mkdir $out
|
||||||
mkdir $out
|
cd $out
|
||||||
cd $out
|
ln -s ${o.rootfs} rootfs
|
||||||
ln -s ${o.rootfs} rootfs
|
ln -s ${instructions} env.scr
|
||||||
ln -s ${instructions} env.scr
|
'';
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,9 @@ in
|
|||||||
eraseBlockSize = mkOption { type = types.str; }; # LEB
|
eraseBlockSize = mkOption { type = types.str; }; # LEB
|
||||||
maxLEBcount = mkOption { type = types.str; }; # LEB
|
maxLEBcount = mkOption { type = types.str; }; # LEB
|
||||||
};
|
};
|
||||||
|
options.system.outputs.ubivolume = mkOption {
|
||||||
|
type = types.package;
|
||||||
|
};
|
||||||
|
|
||||||
config = mkIf (config.rootfsType == "ubifs") {
|
config = mkIf (config.rootfsType == "ubifs") {
|
||||||
kernel.config = {
|
kernel.config = {
|
||||||
@ -28,7 +31,7 @@ in
|
|||||||
};
|
};
|
||||||
boot.initramfs.enable = true;
|
boot.initramfs.enable = true;
|
||||||
|
|
||||||
system.outputs.rootfs =
|
system.outputs.ubivolume =
|
||||||
let
|
let
|
||||||
inherit (pkgs.pkgsBuildBuild) runCommand;
|
inherit (pkgs.pkgsBuildBuild) runCommand;
|
||||||
ubiVolume = ({ name, volumeId, image, flags ? [] }:
|
ubiVolume = ({ name, volumeId, image, flags ? [] }:
|
||||||
@ -81,7 +84,7 @@ in
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
disk = ubiDisk {
|
disk = ubiDisk {
|
||||||
initramfs = config.system.outputs.rootubifs; # liminix.builders.squashfs config.filesystem.contents; # # assert this is a proper FIT.
|
initramfs = config.system.outputs.rootfs; # ???
|
||||||
};
|
};
|
||||||
|
|
||||||
in
|
in
|
||||||
|
@ -39,7 +39,7 @@ on a system with pre-existing firmware and OS.
|
|||||||
dd if=/dev/zero of=$out bs=1 count=1 seek=8388607
|
dd if=/dev/zero of=$out bs=1 count=1 seek=8388607
|
||||||
'';
|
'';
|
||||||
firmwareImage = pkgs.runCommand "firmware-image" {} ''
|
firmwareImage = pkgs.runCommand "firmware-image" {} ''
|
||||||
cat ${paddedKernel} ${o.rootfs} > $out
|
cat ${paddedKernel} ${o.ubivolume} > $out
|
||||||
'';
|
'';
|
||||||
dts = pkgs.writeText "image.its" ''
|
dts = pkgs.writeText "image.its" ''
|
||||||
/dts-v1/;
|
/dts-v1/;
|
||||||
|
Loading…
Reference in New Issue
Block a user