Changeset fb48a0e in mainline for kernel/generic/src/main/kinit.c


Ignore:
Timestamp:
2011-11-30T13:36:49Z (12 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
317a463, c48f6ab
Parents:
83285fd
Message:

simplify RAM disk creation and usage
get rid of the useless HORD header

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/main/kinit.c

    r83285fd rfb48a0e  
    179179        for (i = 0; i < init.cnt; i++) {
    180180                if (init.tasks[i].addr % FRAME_SIZE) {
    181                         printf("init[%zu].addr is not frame aligned\n", i);
     181                        printf("init[%zu]: Address is not frame aligned\n", i);
    182182                        programs[i].task = NULL;
    183183                        continue;
     
    203203                    namebuf, &programs[i]);
    204204               
    205                 if ((rc == 0) && (programs[i].task != NULL)) {
     205                if (rc == 0) {
     206                        if (programs[i].task != NULL) {
     207                                /*
     208                                 * Set capabilities to init userspace tasks.
     209                                 */
     210                                cap_set(programs[i].task, CAP_CAP | CAP_MEM_MANAGER |
     211                                    CAP_IO_MANAGER | CAP_IRQ_REG);
     212                               
     213                                if (!ipc_phone_0)
     214                                        ipc_phone_0 = &programs[i].task->answerbox;
     215                        }
     216                       
    206217                        /*
    207                          * Set capabilities to init userspace tasks.
     218                         * If programs[i].task == NULL then it is
     219                         * the program loader and it was registered
     220                         * successfully.
    208221                         */
    209                         cap_set(programs[i].task, CAP_CAP | CAP_MEM_MANAGER |
    210                             CAP_IO_MANAGER | CAP_IRQ_REG);
    211                        
    212                         if (!ipc_phone_0)
    213                                 ipc_phone_0 = &programs[i].task->answerbox;
    214                 } else if (rc == 0) {
    215                         /* It was the program loader and was registered */
    216                 } else {
    217                         /* RAM disk image */
    218                         int rd = init_rd((rd_header_t *) init.tasks[i].addr, init.tasks[i].size);
    219                        
    220                         if (rd != RE_OK)
    221                                 printf("Init binary %zu not used (error %d)\n", i, rd);
    222                 }
     222                } else if (i == init.cnt - 1) {
     223                        /*
     224                         * Assume the last task is the RAM disk.
     225                         */
     226                        init_rd((void *) init.tasks[i].addr, init.tasks[i].size);
     227                } else
     228                        printf("init[%zu]: Init binary load failed (error %d)\n", i, rc);
    223229        }
    224230       
Note: See TracChangeset for help on using the changeset viewer.