#1662 PR merged: Initial Arm Support

Labels: enhancement, cleanup, fixed / solved / done

Lukey3332 opened issue at 2017-12-25 12:32:

#1197
This PR adds support for Arm Devices (and improves compatibility for all Architectures). It should work with Raspberry Pis, most TI and Allwinner Devices.
Currently only OUTPUT=PXE is supported and you'll need to manually craft an bootable Disk with the Kernel and Initrd. Also Automatic Bootloader detection is not implemented and you'll need to set BOOTLOADER to either "ARM", which is just an Dummy and does nothing, or "ARM-ALLWINNER" which will backup and restore the Allwinner Bootloader. For Raspberry and most TI Devices it should be enough to include the first fat partition (containing the MLO or bootcode.bin) in the Backup to Backup the Bootloader.
This has been tested on an Allwinner pcduino. Testing for other Devices welcome!

schlomo commented at 2017-12-31 13:56:

Thanks a lot @Lukey3332 for starting to work on ARM support. It seems to me that there are actually 3 topics included in your PR:

  1. add support for MMCBLK (great idea!)
  2. clean up and consolidate the kernel guessing code (another great idea!)
  3. add support for ARM ALLWINNER (nice!)

IMHO 1) and 3) look fine, 2) looks to me like it could benefit from a little bit more work, as now the kernel guessing happens twice: once in one of the 300_copy_kernel.sh scripts and then once more in 400_guess_kernel.sh I am wondering if you can simplify the code even more and if those 300_copy_kernel.sh scripts are actually still necessary, especially since none of them actually *copies * the kernel. @rear/contributors what do you think?

About 3) the allwinner scripts, could you kindly move them to a suitable architecture dependant sub-folder? rear dump will show you which ones you can use.

Finally, could you kindly provide us a rear dump here for reference so that we can see how ReaR reads your system? Thanks a lot!

Lukey3332 commented at 2018-01-08 18:56:

Hi,
The 400_guess_kernel.sh was intended as fallback, if the current Architecture has no Kernel selection/guessing Code. I already thought about moving the Allwinner Bootloader Code to an architecture folder, but on arm the output of uname -m is inconsistent, so far I've seen armv[45678][lb], aarch64 and aarch64_be.
The output of rear dump is below.

Relax-and-Recover 2.3 / Git
Using log file: /var/log/rear/rear-lukasduino.log.lockless
Dumping out configuration and system information
System definition:
                                    ARCH = Linux-armv7l
                                      OS = GNU/Linux
                        OS_MASTER_VENDOR = 
                       OS_MASTER_VERSION = 9
                   OS_MASTER_VENDOR_ARCH = armv7l
                OS_MASTER_VENDOR_VERSION = 9
           OS_MASTER_VENDOR_VERSION_ARCH = 9/armv7l
                               OS_VENDOR = Debian
                              OS_VERSION = 9
                          OS_VENDOR_ARCH = Debian/armv7l
                       OS_VENDOR_VERSION = Debian/9
                  OS_VENDOR_VERSION_ARCH = Debian/9/armv7l
Configuration tree:
                       Linux-armv7l.conf : missing/empty
                          GNU/Linux.conf : OK
                             armv7l.conf : missing/empty
                                  9.conf : missing/empty
                           9/armv7l.conf : missing/empty
                             Debian.conf : missing/empty
                      Debian/armv7l.conf : missing/empty
                           Debian/9.conf : missing/empty
                    Debian/9/armv7l.conf : missing/empty
                               site.conf : missing/empty
                              local.conf : OK
Backup with NETFS
              NETFS_KEEP_OLD_BACKUP_COPY = 1
                            NETFS_PREFIX = lukasduino
              NETFS_RESTORE_CAPABILITIES = No
                  BACKUP_INTEGRITY_CHECK = 
                         BACKUP_MOUNTCMD = 
                     BACKUP_ONLY_EXCLUDE = no
                     BACKUP_ONLY_INCLUDE = no
                          BACKUP_OPTIONS = user=xxx,cache=strict,password=xxx,noperm
      BACKUP_RESTORE_MOVE_AWAY_DIRECTORY = /var/lib/rear/moved_away_after_backup_restore/
          BACKUP_RESTORE_MOVE_AWAY_FILES = 
                    BACKUP_RSYNC_OPTIONS = --sparse --archive --hard-links --numeric-ids --stats
                  BACKUP_SELINUX_DISABLE = 1
                             BACKUP_TYPE = 
                        BACKUP_UMOUNTCMD = 
                              BACKUP_URL = cifs://xxx/pcduino/
Backup program is 'tar':
                             BACKUP_PROG = tar
                     BACKUP_PROG_ARCHIVE = backup
            BACKUP_PROG_COMPRESS_OPTIONS = -I lzop
             BACKUP_PROG_COMPRESS_SUFFIX = .lzop
               BACKUP_PROG_CRYPT_ENABLED = 0
                   BACKUP_PROG_CRYPT_KEY = 
               BACKUP_PROG_CRYPT_OPTIONS = /usr/bin/openssl des3 -salt -k 
             BACKUP_PROG_DECRYPT_OPTIONS = /usr/bin/openssl des3 -d -k 
                     BACKUP_PROG_EXCLUDE = /tmp/* /dev/shm/* /var/lib/rear/output/*
                     BACKUP_PROG_INCLUDE = 
                     BACKUP_PROG_OPTIONS = --anchored
      BACKUP_PROG_OPTIONS_CREATE_ARCHIVE = 
     BACKUP_PROG_OPTIONS_RESTORE_ARCHIVE = 
                      BACKUP_PROG_SUFFIX = .tar
       BACKUP_PROG_WARN_PARTIAL_TRANSFER = 1
Output to PXE
                   PXE_CONFIG_GRUB_STYLE = 
                         PXE_CONFIG_PATH = /var/lib/rear/output
                       PXE_CONFIG_PREFIX = rear-
                          PXE_CONFIG_URL = 
                        PXE_CREATE_LINKS = MAC
                        PXE_RECOVER_MODE = 
                    PXE_REMOVE_OLD_LINKS = 
                             PXE_TFTP_IP = 
                           PXE_TFTP_PATH = /var/lib/rear/output
                         PXE_TFTP_PREFIX = lukasduino.
                            PXE_TFTP_URL = 
                         OUTPUT_MOUNTCMD = 
                          OUTPUT_OPTIONS = 
                           OUTPUT_PREFIX = lukasduino
                       OUTPUT_PREFIX_PXE = 
                        OUTPUT_UMOUNTCMD = 
                              OUTPUT_URL = file:///root
                           RESULT_MAILTO =

/usr/share/rear/lib/validated/Debian/9/armv7l.txt
Your system is not yet validated. Please carefully check all functions
and create a validation record with 'rear validate'. This will help others
to know about the validation status of Relax-and-Recover on this system.
Saving /var/log/rear/rear-lukasduino.log.lockless as /var/log/rear/rear-lukasduino.log

Lukey3332 commented at 2018-01-14 19:19:

@ArnoutVerbeken
Did you see this already? It would be cool to have this Tested on an Raspberry Pi.

gdha commented at 2018-01-27 12:03:

@schlomo @jsmeix @gozora @schabrolles Please have a look at this PR. Would be nice to merge.

Lukey3332 commented at 2018-02-06 18:59:

From a quick look, the separate Kernel-Selection Scripts seem to have their purpose. I think cleaning them up should be done by someone who can test it on all Architectures.

gdha commented at 2018-02-09 07:42:

@schlomo @jsmeix @schabrolles If you could have a peek at the code and approve or give comments for improvements that would be fine.

jsmeix commented at 2018-02-09 09:14:

@gdha
I know - I know ... it is on my todo list,
but I know nothing about ARM architecture
so that I could at most have a basically
blind look (oxymoron intended ;-)
at the plain code...

jsmeix commented at 2018-02-09 09:58:

@Lukey3332
FYI in general regarding Schlomo's finding

LogPrint "Warning: BOOTLOADER = ARM is just an Dummy!"

see
http://blog.schlomo.schapiro.org/2015/04/warning-is-waste-of-my-time.html

I fully agree with Schlomo and furthermore I even recommend to never shout
at the (poor) user i.e. neither use ALL-CAPS nor exclamation marks.

As far as I understand your description about BOOTLOADER="ARM" in default.conf
it is perfectly valid when the user specifies BOOTLOADER="ARM" in his local.conf
and the user must manually explicity specify BOOTLOADER for ARM
which means the user knows about what BOOTLOADER="ARM" means
so that there is no need to warn the user about his setting.

Strictly speaking there is no need to tell the user anything about settings
that he must do manually and explicitly so that at most there could be
a plain information message, e.g. something like

LogPrint "Skipping bootloader setup (BOOTLOADER=ARM)"

jsmeix commented at 2018-02-09 13:48:

@Lukey3332
in your initial
https://github.com/rear/rear/pull/1662#issue-160052060
you wrote that "Currently only OUTPUT=PXE is supported"
but I fail to find "PXE" in your code - perhaps I overlooked something?
I wonder if there should be a test somewhere
that lets "rear mkrescue/mkbackup" error out
when not OUTPUT=PXE is used?
For my general reasoning behind such tests have a look at
https://github.com/rear/rear/issues/1718#issuecomment-361871332

jsmeix commented at 2018-02-12 10:47:

@Lukey3332
many thanks for your latest adaptions.

If there are no further objections I would like to merge it today afternoon.

jsmeix commented at 2018-02-13 08:43:

@Lukey3332
many thanks for your valuable contribution to ReaR!

Now since you implemented the basics for ARM support
it should be relatively easy for other ARM users to
enhance and adapt that to support more ARM devices.


[Export of Github issue for rear/rear.]