Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c2b60b98 authored by Bill Yi's avatar Bill Yi
Browse files

Merge commit 'f8dd04e1' into HEAD

parents 4eb6c71e f8dd04e1
Loading
Loading
Loading
Loading
+36 −8
Original line number Diff line number Diff line
@@ -309,7 +309,7 @@ static int LoadPartitionContents(const char* filename, FileContents* file) {
// Save the contents of the given FileContents object under the given
// filename.  Return 0 on success.
int SaveFileContents(const char* filename, const FileContents* file) {
    int fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
    int fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_SYNC, S_IRUSR | S_IWUSR);
    if (fd < 0) {
        printf("failed to open \"%s\" for write: %s\n",
               filename, strerror(errno));
@@ -324,8 +324,14 @@ int SaveFileContents(const char* filename, const FileContents* file) {
        close(fd);
        return -1;
    }
    fsync(fd);
    close(fd);
    if (fsync(fd) != 0) {
        printf("fsync of \"%s\" failed: %s\n", filename, strerror(errno));
        return -1;
    }
    if (close(fd) != 0) {
        printf("close of \"%s\" failed: %s\n", filename, strerror(errno));
        return -1;
    }

    if (chmod(filename, file->st.st_mode) != 0) {
        printf("chmod of \"%s\" failed: %s\n", filename, strerror(errno));
@@ -408,7 +414,7 @@ int WriteToPartition(unsigned char* data, size_t len,
        {
            size_t start = 0;
            int success = 0;
            int fd = open(partition, O_RDWR);
            int fd = open(partition, O_RDWR | O_SYNC);
            if (fd < 0) {
                printf("failed to open %s: %s\n", partition, strerror(errno));
                return -1;
@@ -433,7 +439,22 @@ int WriteToPartition(unsigned char* data, size_t len,
                    }
                    start += written;
                }
                fsync(fd);
                if (fsync(fd) != 0) {
                   printf("failed to sync to %s (%s)\n",
                          partition, strerror(errno));
                   return -1;
                }
                if (close(fd) != 0) {
                   printf("failed to close %s (%s)\n",
                          partition, strerror(errno));
                   return -1;
                }
                fd = open(partition, O_RDONLY);
                if (fd < 0) {
                   printf("failed to reopen %s for verify (%s)\n",
                          partition, strerror(errno));
                   return -1;
                }

                // drop caches so our subsequent verification read
                // won't just be reading the cache.
@@ -919,7 +940,8 @@ static int GenerateTarget(FileContents* source_file,
            strcpy(outname, target_filename);
            strcat(outname, ".patch");

            output = open(outname, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
            output = open(outname, O_WRONLY | O_CREAT | O_TRUNC | O_SYNC,
                S_IRUSR | S_IWUSR);
            if (output < 0) {
                printf("failed to open output file %s: %s\n",
                       outname, strerror(errno));
@@ -950,8 +972,14 @@ static int GenerateTarget(FileContents* source_file,
        }

        if (output >= 0) {
            fsync(output);
            close(output);
            if (fsync(output) != 0) {
                printf("failed to fsync file \"%s\" (%s)\n", outname, strerror(errno));
                result = 1;
            }
            if (close(output) != 0) {
                printf("failed to close file \"%s\" (%s)\n", outname, strerror(errno));
                result = 1;
            }
        }

        if (result != 0) {
+2 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ static const char* ITEMS[] = {"reboot system now",
                               "wipe cache partition",
                               "reboot to bootloader",
                               "power down",
                               "view recovery logs",
                               NULL };

class DefaultDevice : public Device {
@@ -69,6 +70,7 @@ class DefaultDevice : public Device {
          case 3: return WIPE_CACHE;
          case 4: return REBOOT_BOOTLOADER;
          case 5: return SHUTDOWN;
          case 6: return READ_RECOVERY_LASTLOG;
          default: return NO_ACTION;
        }
    }
+1 −1
Original line number Diff line number Diff line
@@ -68,7 +68,7 @@ class Device {
    enum BuiltinAction { NO_ACTION, REBOOT, APPLY_EXT,
                         APPLY_CACHE,   // APPLY_CACHE is deprecated; has no effect
                         APPLY_ADB_SIDELOAD, WIPE_DATA, WIPE_CACHE,
                         REBOOT_BOOTLOADER, SHUTDOWN };
                         REBOOT_BOOTLOADER, SHUTDOWN, READ_RECOVERY_LASTLOG };

    // Perform a recovery action selected from the menu.
    // 'menu_position' will be the item number of the selected menu
+7 −1
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ on init
    chmod 0775 /tmp

    write /proc/sys/kernel/panic_on_oops 1
    write /proc/sys/vm/max_map_count 1000000

on fs
    mkdir /dev/usb-ffs 0770 shell shell
@@ -45,7 +46,6 @@ on fs
    write /sys/class/android_usb/android0/iProduct ${ro.product.model}
    write /sys/class/android_usb/android0/iSerial ${ro.serialno}


on boot
    ifup lo
    hostname localhost
@@ -57,6 +57,9 @@ on boot
on load_all_props_action
    load_all_props

on firmware_mounts_complete
   rm /dev/.booting

# Mount filesystems and start core system services.
on late-init
    trigger early-fs
@@ -69,6 +72,9 @@ on late-init
    # issued fs triggers have completed.
    trigger load_all_props_action

    # Remove a file to wake up anything waiting for firmware
    trigger firmware_mounts_complete

    trigger early-boot
    trigger boot

+12 −0
Original line number Diff line number Diff line
@@ -180,6 +180,18 @@ static gr_surface fbdev_init(minui_backend* backend) {

static gr_surface fbdev_flip(minui_backend* backend __unused) {
    if (double_buffered) {
#if defined(RECOVERY_BGRA)
        // In case of BGRA, do some byte swapping
        unsigned int idx;
        unsigned char tmp;
        unsigned char* ucfb_vaddr = (unsigned char*)gr_draw->data;
        for (idx = 0 ; idx < (gr_draw->height * gr_draw->row_bytes);
                idx += 4) {
            tmp = ucfb_vaddr[idx];
            ucfb_vaddr[idx    ] = ucfb_vaddr[idx + 2];
            ucfb_vaddr[idx + 2] = tmp;
        }
#endif
        // Change gr_draw to point to the buffer currently displayed,
        // then flip the driver so we're displaying the other buffer
        // instead.
Loading