20170418_jeffrey - silenceuncrio/diary GitHub Wiki

0835

review

參考日記 20170411_jeffrey

先把 upgrade uboot 以及加密 rootfs 的部分做一下

參考日記 20161222_jeffrey#1435

準備一個 firmware_patch.sh

#!/bin/bash
# Additional patch for firmware upgrade shell script



echo "Burn the uboot to NAND..."

echo "Erasing Boot partition"
flash_erase /dev/mtd0 0 0

echo "Erasing Boot env partition"
flash_erase /dev/mtd1 0 0

echo "Flashing Bootloader"
kobs-ng init -x -v --chip_0_device_path=/dev/mtd0 /tmp/firmware/u-boot-m300.imx-nand

0925

些改 firmware upgrade WEB UI 上的 Select the firmware to upgrade(*.tar)

改成 Select the firmware to upgrade

build image 來試試

0955

打完收工上 code

git log 如下

commit 4b3c3c4f0d081ba4f4c5b93086c665f0c19c06e9
Author: jeffrey <[email protected]>
Date:   Tue Apr 18 09:52:51 2017 +0800

    change the firmware format and secure the rootfs
    - add "firmware_patch.sh" to do additional patch for firmware upgrade shell script
      - at this version, we burn the uboot to NAND
    - secure "firmware_patch.sh"
    - secure rootfs
    - change filename extension of the firmware from ".tar" to ".img"

1000

回到昨天的 Step 2: Derive unary and binary relationships

而且保留 GroupBuyingProducts

Owners GroupBuyings Buyers GroupBuyingProducts Products ProductSuppliers GroupBuyingOrders
Owners
GroupBuyings create
Buyers
GroupBuyingProducts contain
Products own change
ProductSuppliers supply
GroupBuyingOrders place fill

不過把 ProductsGroupBuyingProducts 之間的 relationship 從 join 改成 change

因為 join 這個字眼會讓 GroupBuyingProducts 的性質偏向一個 group

所以我把它改成 change 這個字眼, 比較 common 一些

1030

Step 4: List assertions for all relationships

  • A Owner can create many GroupBuyings
  • A Owner can own many Products
  • A GroupBuying must contain at least one GroupBuyingProduct
  • A Buyer can place many GroupBuyingOrders
  • A GroupBuyingProduct must be changed from only one Product
  • A GroupBuyingProduct can fill in only one GroupBuyingOrder
  • A Product must be supply from only one ProductSupplier

反過來

  • A GroupBuying must be created by only one Owner
  • A Product must be owned by only one Owner
  • A GroupBuyingProduct must be contained in only one GroupBuying
  • A GroupBuyingOrder must be placed by only one Buyer
  • A Product can change to only one GroupBuyingProduct
  • A GroupBuyingOrder must be filled at least one GroupBuyingProduct
  • A ProductSupplier can supply many Product

仔細推敲一下合不合理

1100


Step 1-2: Assign attributes to each entity discovered

Step 1-3: Select identifiers, keys and primary keys from attributes for each entity

  • Owners
    • (PK) OwnerId
    • Name
    • Email
  • GroupBuyings
    • (PK) GroupBuyingId
    • Name
    • Description
    • DateStarted
    • DateEnded
  • Buyers
    • (PK) BuyerId
    • Name
    • Email
    • FBAccount
  • GroupBuyingProducts
    • (PK) GroupBuyingProductId
    • Name
    • price
  • Products
    • (PK) ProductId
    • Name
    • Cost
  • ProductSuppliers
    • (PK) ProductSupplierId
    • Name
    • URL
  • GroupBuyingOrders
    • (PK) GroupBuyingOrderId
    • DatePlaces
    • TotalPrice

Step 3: Create simplified Entity-Relationship diagram

畫圖的時候發現有些 entity 的名字太長了

適當的修一下

GroupBuyingProducts 改成 GBuyProducts

GroupBuyingOrders 改成 GBuyOrders

重新整理一下

step 1

  • Owners
    • (PK) OwnerId
    • Name
    • Email
  • GroupBuyings
    • (PK) GroupBuyingId
    • Name
    • Description
    • DateStarted
    • DateEnded
  • Buyers
    • (PK) BuyerId
    • Name
    • Email
    • FBAccount
  • GBuyProducts
    • (PK) GBuyProductId
    • Name
    • price
  • Products
    • (PK) ProductId
    • Name
    • Cost
  • ProductSuppliers
    • (PK) ProductSupplierId
    • Name
    • URL
  • GBuyOrders
    • (PK) GBuyOrderId
    • DatePlaces
    • TotalPrice

step 2

Owners GroupBuyings Buyers GBuyProducts Products ProductSuppliers GBuyOrders
Owners
GroupBuyings create
Buyers
GBuyProducts contain
Products own change
ProductSuppliers supply
GpBuyOrders place fill

step 3

image

1120

Step 4: List assertions for all relationships

First

  • A Owner can create many GroupBuyings
  • A Owner can own many Products
  • A GroupBuying must contain at least one GBuyProduct
  • A Buyer can place many GBuyOrders
  • A GBuyProduct must be changed from only one Product
  • A GBuyProduct can fill in only one GBuyOrder
  • A Product must be supply from only one ProductSupplier

Second

  • A GroupBuying must be created by only one Owner
  • A Product must be owned by only one Owner
  • A GBuyProduct must be contained in only one GroupBuying
  • A GBuyOrder must be placed by only one Buyer
  • A Product can change to only one GBuyProduct
  • A GBuyOrder must be filled at least one GBuyProduct
  • A ProductSupplier can supply many Product

1140

可以進行 Step 5: Create detailed E-R diagram using assertions

Step 5-1: Using assertions and the simplified E-R diagram to create the detailed E-R diagram

這個步驟跟 Step 3: Create simplified Entity-Relationship diagram 的差別在於多了 assertion

The assertions are placed on the detailed E-R diagram between the entity and the relation shop using the following convention:

1310

繼續 Step 5-1: Using assertions and the simplified E-R diagram to create the detailed E-R diagram

The assertions are placed on the detailed E-R diagram between the entity and the relation shop using the following convention:

optionality:cardinality

  • Optionality 0 - Can(optional)
  • Optionality 1 - Must(obligatory)
  • Cardinality 1 - Only one
  • Cardinality N - Many or At least one

Here is a list of all the possible combination of optionality:cardinality that can apper on the detailed E-R diagram:

  • 0:1 - [Entity] can [relationship] only one [Entity]
  • 0:N - [Entity] can [relationship] many [Entity]; or [Entity] can [relationship] at least one [Entity]
  • 1:1 - [Entity] must [relationship] only one [Entity]
  • 1:N - [Entity] must [relationship] many [Entity]; or [Entity] must [relationship] at least one [Entity]

進行 Step 5-1: Use assertions and the simplified E-R diagram to create the detailed E-R diagram

First: List the generated assertions and include (optionality:cardinality) at the end of the assertion

  • A Owner can create many GroupBuyings (0:N)
  • A Owner can own many Products (0:N)
  • A GroupBuying must contain at least one GBuyProduct (1:N)
  • A Buyer can place many GBuyOrders (0:N)
  • A GBuyProduct must be changed from only one Product (1:1)
  • A GBuyProduct can fill in only one GBuyOrder (0:1)
  • A Product must be supply from only one ProductSupplier (1:1)
  • A GroupBuying must be created by only one Owner (1:1)
  • A Product must be owned by only one Owner (1:1)
  • A GBuyProduct must be contained in only one GroupBuying (1:1)
  • A GBuyOrder must be placed by only one Buyer (1:1)
  • A Product can change to only one GBuyProduct (0:1)
  • A GBuyOrder must be filled at least one GBuyProduct (1:N)
  • A ProductSupplier can supply many Product (0:N)

Second: Insert the generated assertions as optionality:cardinality one at a time on the simplified E-R diagram

image

1335

Step 6: Transform the detailed E-R diagram into an implementable R-M diagram

Step 6-1: Many-to-many relationships

我們在這步驟沒有需要修改的部分

Step 6-2: One-to-many relationships

稍微 study 一下

1500

Step 6-2: One-to-many relationships

image

1520

Step 6-3: One-to-one relationships

image

1530

要進入 Implementing the design 的階段了

1615

ariel 希望我針對 OSPF 和 VRRP 給個 schedule

關於 OSPF 可以參考 20170216_jeffrey

Quagga Routing Suite

Quagga is a routing software suite, providing implementations of OSPFv2, OSPFv3, RIP v1 and v2, RIPng and BGP-4 for Unix platforms, particularly FreeBSD, Linux, Solaris and NetBSD. Quagga is a fork of GNU Zebra which was developed by Kunihiro Ishiguro. The Quagga tree aims to build a more involved community around Quagga than the current centralised model of GNU Zebra.

YOCTO 裡也有 quagga 這個 recipe

參考 VRRP-虛擬路由器備援協定

有現成的 vrrpd 透過 apt-get install vrrpd 就可以安裝了

How to run redundant BGP via Quagga on /30 netblock? 提到

Quagga itself doesn't support VRRP but you can use Quagga in conjunction with any of these without any issues:

  • keepalived (as you've already mentioned)
  • uCARP - A Linux port of OpenBSD's CARP (Common Address Redundancy Protocol)
  • vrrpd - A sparsely documented and largely untested VRRP daemon, but an option nonetheless

YOCTO 裡找不到 keepalived 相關的 recipe

YOCTO 裡也找不到 uCARPvrrpd 相關的 recipe

先粗估一下囉

  • VRRP: 22 working days
    • Start: 5/2
    • End: 6/2
  • OSPF: 20 working days
    • Start: 6/5
    • End: 6/30

1705

回到 monkeyjj 資料庫的 design

參考書上的 Chapter 9 Implementing the designImplementation Considerations

先拿 Owners 這個 table 來開刀

  • Table - Owners
    • Column - (PK) OwnerId
      • Recommend Data Type - Number
      • Comments
    • Column - Name
      • Recommend Data Type -
      • Comments
    • Column - Email
      • Recommend Data Type -
      • Comments