summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta-netboot/README.renesas-gen364
1 files changed, 42 insertions, 22 deletions
diff --git a/meta-netboot/README.renesas-gen3 b/meta-netboot/README.renesas-gen3
index 225051af2..496141eef 100644
--- a/meta-netboot/README.renesas-gen3
+++ b/meta-netboot/README.renesas-gen3
@@ -8,17 +8,43 @@ Adjust board type with the following identifiers:
################## Common options #####################
# these options are common to all configurations:
+##### board info
+
# choose board
setenv board m3ulcb
+setenv soc r8a7796
# or
setenv board h3ulcb
+setenv soc r8a7795
+
+##### boot mode
+# choose bootmode:
+# netboot
+setenv bootmode net
+# or sdcard
+setenv bootmode sd
+# or sdcard with initrd
+setenv bootmode sdi
+
+##### sdcard options
+# which sdcard slot to use
+setenv bootmmc '0:1'
+
+##### netboot options
+# replace <IP> and <NUM> by appropriate addresses
+setenv ipaddr '<board_IP>'
+setenv serverip '<server_IP>'
+setenv ethact ravb
+setenv ethaddr DE:AD:C0:FF:EE:<NUM>
+
+################## Internal variables #####################
# kernel file
setenv set_bootkfile 'setenv bootkfile Image'
setenv bootkaddr 0x48080000
# dtb file
-setenv set_bootdfile 'setenv bootdfile Image-r8a7796-${board}.dtb'
+setenv set_bootdfile 'setenv bootdfile Image-${soc}-${board}.dtb'
setenv bootdaddr 0x48000000
# initrd
@@ -31,40 +57,34 @@ setenv bootargs_console 'console=ttySC0,115200 ignore_loglevel'
setenv bootargs_video 'vmalloc=384M video=HDMI-A-1:1920x1080-32@60'
setenv bootargs_extra 'rw rootfstype=ext4 rootwait rootdelay=2'
+# final boot command
+setenv bootcmd 'run bootcmd_${bootmode}'
+
################ Boot on MMC (SDcard) #################
-setenv bootargs_root 'root=/dev/mmcblk1p1'
-setenv bootmmc '0:1'
setenv bootkload_sd 'ext4load mmc ${bootmmc} ${bootkaddr} boot/${bootkfile}'
+setenv bootiload_sd 'ext4load mmc ${bootmmc} ${bootiaddr} boot/${bootifile}'
setenv bootdload_sd 'ext4load mmc ${bootmmc} ${bootdaddr} boot/${bootdfile}'
-setenv bootload_sd 'run set_bootkfile; run bootkload_sd; run set_bootdfile; run bootdload_sd'
-setenv bootcmd 'setenv bootargs ${bootargs_console} ${bootargs_video} ${bootargs_root} ${bootargs_extra}; run bootload_sd; booti ${bootkaddr} - ${bootdaddr}'
-################ Boot on MMC (SDcard) with initrd ######
-
-setenv bootargs_root 'root=/dev/ram0 ramdisk_size=16384'
-setenv bootmmc '0:1'
-setenv bootkload_sd 'ext4load mmc ${bootmmc} ${bootkaddr} boot/${bootkfile}'
-setenv bootdload_sd 'ext4load mmc ${bootmmc} ${bootdaddr} boot/${bootdfile}'
-setenv bootiload_sd 'ext4load mmc ${bootmmc} ${bootiaddr} boot/${bootifile}'
-setenv bootload_sd 'run set_bootkfile; run bootkload_sd; run set_bootdfile; run bootdload_sd; run set_bootifile; run bootiload_sd'
+# without initrd
+setenv bootargs_root_sd 'root=/dev/mmcblk1p1'
+setenv bootload_sd 'run set_bootkfile; run bootkload_sd; run set_bootdfile; run bootdload_sd'
+setenv bootcmd_sd 'setenv bootargs ${bootargs_console} ${bootargs_video} ${bootargs_root_sd} ${bootargs_extra}; run bootload_sd; booti ${bootkaddr} - ${bootdaddr}'
-setenv bootcmd 'setenv bootargs ${bootargs_console} ${bootargs_video} ${bootargs_root} ${bootargs_extra}; run bootload_sd; booti ${bootkaddr} ${bootiaddr}:${bootisize} ${bootdaddr}'
+# with initrd
+setenv bootargs_root_sdi 'root=/dev/ram0 ramdisk_size=16384'
+setenv bootload_sdi 'run set_bootkfile; run bootkload_sd; run set_bootdfile; run bootdload_sd; run set_bootifile; run bootiload_sd'
+setenv bootcmd_sdi 'setenv bootargs ${bootargs_console} ${bootargs_video} ${bootargs_root_sdi} ${bootargs_extra}; run bootload_sdi; booti ${bootkaddr} ${bootiaddr}:${bootisize} ${bootdaddr}'
################ Netboot through TFTP+NBD ##################
-# replace <IP> addresses by appropriate addresses
-setenv ipaddr '<board_IP>'
-setenv serverip '<server_IP>'
-setenv ethact ravb
-setenv ethaddr DE:AD:C0:FF:EE:01
-
-setenv bootargs_root 'root=/dev/ram0 ramdisk_size=16384 ip=dhcp'
setenv bootkload_net 'tftp ${bootkaddr} ${board}/${bootkfile}'
setenv bootdload_net 'tftp ${bootdaddr} ${board}/${bootdfile}'
setenv bootiload_net 'tftp ${bootiaddr} ${board}/${bootifile}'
+
+setenv bootargs_root_net 'root=/dev/ram0 ramdisk_size=16384 ip=dhcp'
setenv bootload_net 'run set_bootkfile; run bootkload_net; run set_bootdfile; run bootdload_net; run set_bootifile; run bootiload_net'
-setenv bootcmd 'setenv bootargs ${bootargs_console} ${bootargs_video} ${bootargs_root} ${bootargs_extra} nbd.server=${serverip}; run bootload_net; booti ${bootkaddr} ${bootiaddr}:${bootisize} ${bootdaddr}'
+setenv bootcmd_net 'setenv bootargs ${bootargs_console} ${bootargs_video} ${bootargs_root_net} ${bootargs_extra} nbd.server=${serverip}; run bootload_net; booti ${bootkaddr} ${bootiaddr}:${bootisize} ${bootdaddr}'
ht: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
/*
 * Copyright (C) 2015 "IoT.bzh"
 * Author "Fulup Ar Foll"
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */


#include "local-def.h"

// Dummy sample of Client Application Context
typedef struct {
  int  something;       
  void *whateveryouwant;
} MyClientApplicationHandle;


// Request Creation of new context if it does not exist
STATIC json_object* clientContextCreate (AFB_request *request) {
    json_object *jresp;

    // add an application specific client context to session
    request->context = malloc (sizeof (MyClientApplicationHandle));
    
    // Send response to UI
    jresp = json_object_new_object();               
    json_object_object_add(jresp, "token", json_object_new_string ("A New Token and Session Context Was Created"));

    return (jresp);
}

// Before entering here token will be check and renew
STATIC json_object* clientContextRefresh (AFB_request *request) {
    json_object *jresp;

  
    jresp = json_object_new_object();
    json_object_object_add(jresp, "token", json_object_new_string ("Token was refreshed"));              
    
    return (jresp);
}


// Session token will we verified before entering here
STATIC json_object* clientContextCheck (AFB_request *request) {
    
    json_object *jresp = json_object_new_object();    
    json_object_object_add(jresp, "isvalid", json_object_new_boolean (TRUE));       
        
    return (jresp); 
}


// Close and Free context
STATIC json_object* clientContextReset (AFB_request *request) {
    json_object *jresp;
   
    /* after this call token will be reset
     *  - no further access to API will be possible 
     *  - every context from any used plugin will be freed
     */
    
    jresp = json_object_new_object();
    json_object_object_add(jresp, "info", json_object_new_string ("Token and all resources are released"));
    
    // WARNING: if you free context resource manually here do not forget to set request->context=NULL; 
    return (jresp); 
}


// This function is call when Client Session Context is removed
// Note: when freeCtxCB==NULL standard free/malloc is called
STATIC void clientContextFree(void *context, char* uuid) {
    fprintf (stderr,"Plugin[token] Closing Session uuid=[%s]\n", uuid);
    free (context);
}

STATIC  AFB_restapi pluginApis[]= {
  {"ping"    , AFB_SESSION_NONE  , (AFB_apiCB)getPingTest         ,"Ping Rest Test Service"},
  {"create"  , AFB_SESSION_CREATE, (AFB_apiCB)clientContextCreate ,"Request Client Context Creation"},
  {"refresh" , AFB_SESSION_RENEW , (AFB_apiCB)clientContextRefresh,"Refresh Client Context Token"},
  {"check"   , AFB_SESSION_CHECK , (AFB_apiCB)clientContextCheck  ,"Check Client Context Token"},
  {"reset"   , AFB_SESSION_CLOSE , (AFB_apiCB)clientContextReset  ,"Close Client Context and Free resources"},
  {NULL}
};

PUBLIC AFB_plugin *pluginRegister () {
    AFB_plugin *plugin = malloc (sizeof (AFB_plugin));
    plugin->type  = AFB_PLUGIN_JSON; 
    plugin->info  = "Application Framework Binder Service";
    plugin->prefix= "token";  // url base
    plugin->apis  = pluginApis;
    plugin->handle= (void*) "What ever you want";
    plugin->freeCtxCB= (void*) clientContextFree;
    
    return (plugin);
};